react-native-paper
react-native-paper copied to clipboard
fix(snackbar): fix show animation on new architecture
Motivation
This bug is only available on android with new architecture enabled and is well described (with and example) in the related issue #4445
From what I've been able to find, the problem occurs when the animation is started before the component is rendered.
In our scenario, the component returns null as long as the hidden state is set to true. In the handleOnVisible function we have the main steps setHidden(false) and Animation start. To fix the bug, I moved the start of the animation to a useEffect that depends on the hidden value, so that the animation will start after the state is changed (and component re-rendered).
btw, since this bug only occurs with the new architecture, it is either also a react-native bug or an expected change. I have not found an answer yet.
Related issue
#4445
Test plan
Run android app with New Architecture enabled and try to show/hide snackbar.
| Before | After |
|---|---|
Hey @seb-zabielski, thank you for your pull request 🤗. The documentation from this branch can be viewed here.
@seb-zabielski @gedu Is there a tentative timeline for 5.12.4. Also, random question, but is @lukewalczak no longer maintaining this?