import React, { useState, useEffect } from "react";
import { FlatList, View, StyleSheet } from "react-native";
import firestore from "@react-native-firebase/firestore";
import { useSelector, shallowEqual, useDispatch } from "react-redux";
import { theme, deviceWidth, deviceHeight } from "../../utils/theme";
import {
emailValidator,
passwordValidator,
firstNameValidator,
lastNameValidator,
} from "../../utils/utils";
import styles from "../../utils/styles";
import {
Surface,
Text,
TextInput,
ActivityIndicator,
Button,
} from "react-native-paper";
import AlphabetSectionList from 'react-native-alphabet-sectionlist';
const menu = {
'A': [{ name: 'A1' }, { name: 'A2' }, { name: 'A3' }],
"E": [{ name: 'E1' }, { name: 'E2' }, { name: 'E3' }, { name: 'E4' }],
'F': [{ name: 'F1' }, { name: 'F2' }, { name: 'F3' }],
'H': [{ name: 'H1' }, { name: 'H2' }, { name: 'H3' }, { name: 'H5' }],
'J': [{ name: 'J1' }, { name: 'J2' }, { name: 'J3' }, { name: 'J5' }],
'K': [{ name: 'K1' }, { name: 'K2' }, { name: 'K3' }, { name: 'K5' }],
'N': [{ name: 'N1' }, { name: 'N2' }, { name: 'N3' }, { name: 'N5' }],
'Y': [{ name: 'Y1' }, { name: 'Y2' }, { name: 'Y3' }, { name: 'Y5' }, { name: 'Y6' }],
}
export default function OfficeScreen() {
const [images, setImages] = useState([]);
useEffect(() => {
setImages(
);
}, []);
function renderItem({ }) {
return (
<View style={{
marginLeft: 10,
paddingVertical: 10,
borderBottomColor: 'lightgray',
borderBottomWidth: 0.5
}}>
<Text>{'item.name'}</Text>
</View>
)
}
function renderHeader() {
return (
<View>
<Text>header1</Text>
<Text>header2</Text>
</View>
)
}
function renderSectionHeader({ section: { title } }) {
return (
<View style={{
paddingLeft: 10,
backgroundColor: '#f1f2f3',
paddingVertical: 5,
}}>
<Text style={{ color: 'blue' }}>{'title'}</Text>
</View>
)
}
return (
<Surface style={theme.mainContainer}>
<View>
<Text style={styles.DayNameText}>{"Directory"}</Text>
<AlphabetSectionList
data={menu}
renderItem={renderItem()}
renderHeader={renderHeader()}
// custom section header
renderSectionHeader={renderSectionHeader()}
// default section header styles
// sectionHeaderStyle={{ paddingVertical: 5 }}
// sectionHeaderTextStyle={{ fontSize: 16, color: 'blue' }}
/>
</View>
</Surface>
);
}
Below is my code:
Could anyone please help me run this example ?
my react-native version is "0.61.5"