Por alguna razón, mi Flatlist primero se procesa y luego se desplaza al initalScrollIndex
lo grabe y se ve asi y si lo miras con atencion
Código:
const Am_pm_DATA=[{ key: 0, title: '' }, { key: 1, title: 'am' }, { key: 2, title: 'pm' }, { key: 3, title: '' }]; const [FromAmPm, setFromAmPm] = useState(() => 1); const ItemComp = ({ item }) => ( <View style={...}> <Text style={...}>{item.title}</Text> </View> ) return(<> <FlatList initialScrollIndex={FromAmPm} data={Am_pm_DATA} renderItem={ItemComp} keyExtractor={(_, index) => index.toString()} getItemLayout={(_, index) => { return { length: CustomStyle.height, offset: CustomStyle.height * index, index }; }} showsVerticalScrollIndicator={false} snapToOffsets={Am_pm_DATA.map((x, i) => (i * CustomStyle.height))} /> <View style={...} pointerEvents="none"></View> </>); ¿Cómo hago que la lista plana ya se muestre en la posición initalScrollIndex ?
Intenté esto pero no parece ayudar