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

147
Views
Change from ScrollView to FlatList in react native

I'm going to make a todolist app. On the main page, to show the task of todolist, I used scrollview, but I want to change it to FlatList.

<ScrollView width = {width-20}>
            {Object.values(tasks).map(item => (
               <Task key = {item.id} item={item} deleteTask={_deleteTask} 
               toggleTask={_toggleTask} updateTask={_updateTask}/>
           ))} 
         </ScrollView>

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

To Flatlist
More info here

<FlatList
     data={Object.values(tasks)}
     keyExtractor={(item)=>item?.id}
     renderItem={({item})=><Task key = {item.id} item={item} deleteTask={_deleteTask} toggleTask={_toggleTask} updateTask={_updateTask}/>}
     />
about 4 years ago · Juan Pablo Isaza Report

0

Because of performance, I recommend using the variation when we avoid inline functions. If you want to know more how to optimize React native FlatList performance: https://codingislove.com/optimize-react-native-flatlist-performance/

const renderItem = ({item})=><Task item={item} deleteTask={_deleteTask} toggleTask={_toggleTask} updateTask={_updateTask}/>;
const keyExtractor = (item) => item.id;

return (
  <Flatlist
   data={Object.values(tasks)}
   renderItem={renderItem}
   keyExtractor={keyExtractor}
  />
);
about 4 years ago · Juan Pablo Isaza Report
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!