react-native-reanimated: [iOS] ScrollView event fatal crash
Description
REANodeManager try to handle events from ScrollView but it causes a fatal crash. Mouting block is expected to not be set
Actual behavior & steps to reproduce
Run code from PR: https://github.com/software-mansion/react-native-reanimated/pull/2122 try to move the content ScrollView.
Package versions
- React Native Reanimated: 2.3.0.alpha.2
Affected platforms
- Android
- iOS
- Web
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 1
- Comments: 22 (7 by maintainers)
Hey @piaskowyk, can we please also backport this to 2.x, since the diff that causes this issue is in that branch as well? 🙂
Fixed by: https://github.com/software-mansion/react-native-reanimated/pull/4403 The fix will be available since 3.2.0
Still happening in v3.0.2. This is happening to me on a FlatList. It wasn’t happening in version v2.14.4
Same here, tried to use
withTiming
but it still crashes. The list has only 1 item in it. If there are multiple items it doesn’t crash, I’m using FlashList and reanimated3.0.1
@bnovarini I’ve also encountered this filckering, 100% it’s a math issue, try playing around with the
[0, 64], [100, 41]
values and the initial absolute position of the TabBar. This flickering was happening to me only on Android though, iOS was fine.After updating to version
3.0.0
found the same problem. AddingwithTiming
and/orinterpolate
doesn’t solve the problem. In my case, the application crashes when the height of the component inside theAnimated.ScrollView
is animated to decrease.@sunnylqm you’re right, me bad 🙏 that’s mean I need to make a release as soon as possible
heyy, i still have this issue on 2.15 and 2.17 on 2.14.4 works fine can anyone help me?
Still happening in
v3.1.0
. In addition, thewithTiming
+duration
fix no longer seems to work (whereas it did work onv2.14.4
).Still happening on v2.14.4. Unfortunately, the withTiming workaround has some flickering.
Can confirm https://github.com/software-mansion/react-native-reanimated/pull/4403 fixes our crash.
After some few iterations, below is the solution I’ve come up with to fix the flicker/crash bug.
First, you need to determine the static height of the scrollview minus the height of the header, insets, tab bar, etc.
Second, on the
useAnimatedScrollHandler
, you only want to update thescrollY.value
if the scrolled height is smaller than the “actual” scrollview height. e.g.Now you can interpolate the scroll value e.g.
The reason this works (at least on my case) is that the reanimated bug happens only if the actual content height of the scrollview is smaller than the static height when
overScrollMode
is enabled (default). The only drawback on this is that the header animated height is ignored during over scroll if there’s less content 🤷‍♂️I hope this helps on someway while debugging the root cause, but for now this works as expected without the flicker/crash
Hey! I used the solution proposed by @valentinoConti as a quick fix to avoid crashing the app, however the scroll keeps flickering/bouncing with this approach. I’ve tried several durations and also tried both inside useAnimatedScrollHandler and wrapping the interpolate function. Both avoid crashing, but result in the flickering behavior.
Using v2.13.0
Attached is a video showing the behavior
https://user-images.githubusercontent.com/49925472/204670604-130cdc08-4713-4482-aced-bc1e20c580ae.mp4