Closed pkt-dev closed 5 years ago
+1
+1
Any help on this would be greatly appreciated. It doesn't matter the content. Android is pretty consistently extremely slow. I animate to 150 when I click on a map marker, and then have another button to make it animate to the top of the screen to show more details. Even without all of the data its still very slow.
Have you been testing with the debugger on? RN with js-debugger on will generally slow down any type of animation from my experience.
Yes, I have debugging on. I turned it off, and the animation is much smoother. However, it doesn't really help when we are developing to have an animation going unbearably slow.
That is true, but i haven't find a way to have smooth animation while debugger on since RN came out. What I usually do is test for all the data process before applying any animation to the component or using Alert to display certain data if needed with debugger off(ex, Alert.alert(some data to display)). Another solution may be using real device, it's still slow but much smoother ans faster than when testing on virtual device in my opinion.
for this package, Im not sure if it has animation off option, but if it doesn't i'm sure you can fork the repo and make an animation off functionality yourself for test purposes.
Thanks @vgb0332. I will attempt to do that.
I am also facing this issue, When calling the show or close the animation is extremely slow.
@pkt-dev have you any idea about this problem ?
I think that solution is to rewrite animation with react-native-reanimated ;(
the problem is with when we use setstate or redux dispatch before show or close
@saiyam-sage Thank you for your help, when I use panel.show() after setState it is too slow, but ı use before setState it is good working
yes need to use react-native-reanimated
I resolved this by making hide a callback in setState:
this.setState( { sortsMenu: newSort }, this.slideUpPanel.hide )
I would recommend you schedule your works to run after the animation has finished using InteractionManager.
InteractionManager.runAfterInteractions(() => {
// ...long-running synchronous task...
});
this.panelRef.show() // Or hide(). panelRef holding the reference the SlidingUpPanel component.
Since the entire animation is running in Javascript thread. Other scripts might occupy the thread and make the animation doesn't look smooth.
@octopitus but runAfterInteractions() is not fired sometime
@octopitus runAfterInteractions()
is not always calling.
@saiyam-sage this might be related https://github.com/facebook/react-native/issues/8624
Couldn't solve it in any way. Seems like something in the background (requests, maybe) block the main thread and slows this animation. Other SlidingMenu packages worked well, seems related to how the animations are initialized.
I managed to get it working by running the show/hide in a javaScript setTimeout like this:
setTimeout(() => {
panelRef?.hide();
});
I was having the same issue while running on Expo Client while remote debugging. Disabling it solved the problem for me.
i ended up using 'reanimated-bottom-sheet' as none of these attempts fixed preformance issues on Androi.
@29er Thanks so much for pointing me towards this library. I've spent more time than I care to admit trying to get rn-sliding-up-panel
to work properly and it just consistently causes so many issues. For instance if you have multiple panels, calling .show()
on one of them will show every panel. Like, why? reanimated-bottom-sheet
works much better.
@29er Thanks, I guess I have to migrate to reanimated-bottom-sheet as well.. pretty painful since my entire app is relying on this library :(
Issue Description
When calling show or close some times the animation is extremely slow.
Steps to Reproduce / Code Snippets / Screenshots
Environment