Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Very slowly perfermance when there is some ListItem in one page. #759

Closed
Symous opened this issue Apr 20, 2017 · 22 comments
Closed

Very slowly perfermance when there is some ListItem in one page. #759

Symous opened this issue Apr 20, 2017 · 22 comments

Comments

@Symous
Copy link

Symous commented Apr 20, 2017

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!

@cyclops24
Copy link

+1 I have performance issue too. 😞

@SupriyaKalghatgi
Copy link
Contributor

#625

@Jasbir23
Copy link
Contributor

Jasbir23 commented Jun 8, 2017

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.

@Symous
Copy link
Author

Symous commented Jun 8, 2017

@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. :-)

@Jasbir23
Copy link
Contributor

Jasbir23 commented Jun 9, 2017

@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 :-)

@mnlbox
Copy link

mnlbox commented Jul 16, 2017

@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?

@Symous
Copy link
Author

Symous commented Jul 21, 2017

@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,,,

@Symous
Copy link
Author

Symous commented Jul 21, 2017

@mnlbox Hi,I guess the best way for now is that create a similar custom component to replace ListItem....

@sebasgarcep
Copy link

@Symous I used to have perf issues with react-native-router-flux. Could you try using react-navigation instead?

@Symous
Copy link
Author

Symous commented Aug 15, 2017

@sebasgarcep actually, I have test it with react-navigation when I found the issue ,but the result is still not
smooth enough... :(

@sebasgarcep
Copy link

@Symous Are you running production builds? The difference in performance is huge.

@Akshg
Copy link

Akshg commented Sep 11, 2017

@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.

@Symous
Copy link
Author

Symous commented Sep 13, 2017

@sebasgarcep not yet, I just running in the develop mode, will try that later, thanks.

@sebasgarcep
Copy link

@Akshg What about using InteractionManager instead of setTimeout? Have you tried that?

@Akshg
Copy link

Akshg commented Sep 13, 2017

@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

@ksrawat
Copy link

ksrawat commented Sep 21, 2017

@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} />}
/>

@Symous
Copy link
Author

Symous commented Sep 21, 2017

@ksrawat so,we need to download 'react-native-elements' to our app?

@ksrawat
Copy link

ksrawat commented Sep 21, 2017

@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.

@sebasgarcep
Copy link

@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?

@SupriyaKalghatgi
Copy link
Contributor

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

@akhil-ga
Copy link
Contributor

akhil-ga commented Nov 8, 2017

FlatList with ListItem

listitem

@SupriyaKalghatgi
Copy link
Contributor

I have opened this issue on the docs repo here: #65
Since we split the docs and the source into separate repos.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants