-
Notifications
You must be signed in to change notification settings - Fork 113
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
Optimize slow performance #4
Comments
Hi @ZeroCool00 I noticed the performance issues on Android as well. I've done some research into optimizing performance for Android but haven't had any luck so far.
Right now it's meant to embed wherever you'd like, so you would need to design your own dialog. This feature is on the roadmap though so I will keep you posted when it becomes available |
@arronhunt I am looking forward to it.. |
@arronhunt regarding the performance issue, a quick look at your code shows that you are not using PureComponent with your flatlist (EmojiCell should be a class that extends PureComponent ). now even if you use PureComponent, your flat list data should not be generated every time you render, i.e. <FlatList data={list.map(emoji => ({ key: emoji.unified, emoji }))} /> This means you are generating a new list every time a render function called and each object in that list will have a new reference in every single render. The proper way to do this is by converting the EmojiSection and EmojiSelector components to class. After that you generate your FlatList data once in the constructor and you use that reference in Flatlist data in the render function additional optimisation can be achieved by using StyleSheet.create for your EmojiCell as now you are sending theStyle for each item over the bridge in each render while StyleSheet.create will cache it for you One more optimisation can also be achieved by NOT defining functions inside the render function i.e const EmojiSection = () => (
<FlatList
renderItem={({item}) => (
<EmojiCell key={item.key} emoji={item.emoji} />
)}
/>
); should be like this instead class EmojiSection extends Compnent
renderItem = ({item})=>(<EmojiCell key={item.key} emoji={item.emoji} />)
render() (
return <FlatList
renderItem={this.renderItem}
/>
); I hope this help, it's a good start but not everything, |
Awesome @hareeqi this is very insightful feedback! If I can find time I can try these updates. Otherwise if someone wanted to submit a PR it would be appreciated :) |
Unfortunately this one is hard since width/height refer to colSize which gets passed from its parent |
Latest merge included some performance updates, looking for someone to test for me :) |
The rerendering still plays in there, I just simply add the following piece and become much better except the rendering of the very beginning still a little slow though.
|
I have added this to fix the performance issue
|
For the best performance in Modal (mainly for android performance issues), do not forget these props: <Modal |
In ios its working fine but in android this is too slow to open and after we click on icon, it too slow to close.
sometime its just hang my device. is there any scope for android?
Q. 2
how can i open as a popup., right now i am using react-native modal to open in dialog, i hope you can add this feature as props.
I am using Moto g4 plus (nougat).
The text was updated successfully, but these errors were encountered: