Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

120
Views
Flatlist Scrolling to initalScrollIndex after rendering

For some reason my Flatlist first renders and then Scrolls to the initalScrollIndex
I recorded it and it looks like this and if you watch it carefully

Frame 1
enter image description here

Frame 2
enter image description here

Code:

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>
</>);

how do I make the flatlist render already at the initalScrollIndex position ?
I tried this but it doesn't seem to help

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!