Very slowly perfermance when there is some ListItem in one page.
Hi ,there are some ListItem(about 6-7) in one page of my program(Android Platform),And I found that when I click a button to enter this page(with some ListItem),it will have a 1-3 scends delay before I totally enter the page, And the switch animation is not smooth enough too.
And after that I have made a custom ListItem component of myself and replace the ListItem of nativebase,when I test to press a button to enter this page again.it work much better,but the switch animation is still not smooth.
So,it prove that the ListItem component of nativebase is not "perfect" enougn.and I aslo have run the demo app of native base, it also slowly when we open a page when there is ListItem exist.
Do you have any idea about that and how to solve this.It's an urgency for me. Thank you!
+1 I have performance issue too. 😞
#625
Hi @Symous @cyclops24 , We tried replicating what you suggested but did not encounter any problems. Some more information might help like are you using images in your ListItems. Also, attach some code snippets or GIF's to make this clearer.
@Jasbir23 Hi, in my app I have about 7 - 8 of the below ListItem in one page.
<ListItem icon>
<Left>
<Button style={{ backgroundColor: '#FD3C2D' }} onPress={()=>{alert(oo.id);}}>
<Icon active name="notifications" />
</Button>
</Left>
<Body>
<Text>Notifications</Text>
</Body>
<Right>
{(Platform.OS === 'ios') && <Icon active name="arrow-forward" />}
</Right>
</ListItem>
// some similar ListItem here...
and everytime I enter this page, the perfermance is just so bad. :-)
@Symous I need a little more than that. Like, versions of RN and NB. What navigation are you using. Also a GIF showing the performance problem will help us solve this quicker. Thanks :-)
@Jasbir23 please see #1024 for see more detail about this bug. @Symous Are you find any working solution about this or stop using NativeBase List component?
@Jasbir23 Hi,sorry for the delay.
this is the version information React-Native : 0.45.1, Native-Base:2.1.2 navaigation: react-native-router-flux : 3.38.0 (Also test with react-navigation,and turned out same result)
In fact I have replace the ListItem with a custom component just like it. what I can say is that ListItem works not fluently enough, the animation when we enter a page with some ListItem perform so slowly,,,
@mnlbox Hi,I guess the best way for now is that create a similar custom component to replace ListItem....
@Symous I used to have perf issues with react-native-router-flux. Could you try using react-navigation instead?
@sebasgarcep actually, I have test it with react-navigation when I found the issue ,but the result is still not smooth enough... :(
@Symous Are you running production builds? The difference in performance is huge.
@Symous I have a work around for this problem. Check out this blog post https://medium.com/@akash_gupta/react-native-how-settimout-saved-my-life-803346bf18a5 if this helps. You can use the deferred rendering of the component in which you are using ListItem as suggested on the blog.
@sebasgarcep not yet, I just running in the develop mode, will try that later, thanks.
@Akshg What about using InteractionManager instead of setTimeout? Have you tried that?
@sebasgarcep yes i tried InteractionManager but it didn't help. I used like it is shown here https://github.com/brentvatne/run-after-interactions-exp/blob/master/main.js
@Akshg @sebasgarcep @Symous
I tried using native ListView alongwith 'ListItem' from 'react-native-elements'. And this fixed my lagging and it works pretty awsm. Following is the working code snippet.
<ListView
style={styles.container}
dataSource={this.state.dataSource}
renderRow={(rowdata) =>
<ListItem
roundAvatar
title={`${rowdata.name.first} ${rowdata.name.last}`}
subtitle={rowdata.email}
avatar={{ uri: rowdata.picture.thumbnail }}
containerStyle={{ borderBottomWidth: 0 }}
rightIcon={{ name: 'phone', type: 'font-awesome', color: '#f50', raised: true}}
onPressRightIcon={this.callfunction}
/>
}
renderSeparator={(sectionId, rowId) => <View key={rowId} style={styles.separator} />}
renderHeader={() => <Header />}
renderFooter={() => <Footer />}
renderSectionHeader={(sectionData) => <SectionHeader {...sectionData} />}
/>
@ksrawat so,we need to download 'react-native-elements' to our app?
@Symous yes u need to install 'react-native-elements' https://react-native-training.github.io/react-native-elements/
try to use it with native Listview.
@ksrawat If things work flawlessly in react-native-elements, then there is a performance issue in this library that is worth investigating. I hope I had the time. Maybe someone else?
NativeBase List will be deprecated, very soon this will be documented So please use React Native's FlatList in place of it You can use ListItem for the necessary styling