-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[iOS] ScrollView event fatal crash #2285
Comments
Fixed! I'm almost sure that at the time I created that PR that wasn't happening, the first thing I did was going to the code were that crash happens (on ios/REANodesManager.m) and commented it, and it started working fine without crashing:
But, because I know nothing about native code I did a research to see if I found something else to do, I found this open issue #1947 with same problem and used the same fix that they say on the comments, wrap the interpolate on a withTiming with only 10 of duration, works perfectly fine now, but I don't really know if that is the way to go or if there is some issue on the native code used on the reanimated repo Cheers! |
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 Simulator.Screen.Recording.-.iPhone.14.-.2022-11-29.at.18.24.53.mp4 |
@piaskowyk is there any development on this? there's all kind of issues/pr closed about this but no clear answer thanks. |
After updating to version |
We also have the same problem on our application but we need the "hard stress" the screen. The workaround seems to work.
|
Same here, tried to use @bnovarini I've also encountered this filckering, 100% it's a math issue, try playing around with the |
Still happening on v2.14.4. Unfortunately, the withTiming workaround has some flickering. |
Still happening in v3.0.2. This is happening to me on a FlatList. It wasn't happening in version v2.14.4 |
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. const insets = useSafeAreaInsets()
const dimentions = useWindowDimensions()
// The static height of the content within the screen
const contentHeight = useMemo(
() =>
dimentions.height -
(insets.top + insets.bottom + HEADER_HEIGHT + SEARCH_BAR_HEIGHT + TAB_BAR_HEIGHT /* etc */),
[insets.top, insets.bottom, dimentions.height],
) Second, on the const SCROLL_DRAG_AREA = 200
const scrollY = useSharedValue(0)
const scrollHandler = useAnimatedScrollHandler(
{
onScroll: (e) => {
// If the "static" height is greater than the actual height
// DO NOT update scroll value
if (e.contentOffset.y + contentHeight + SCROLL_DRAG_AREA > e.contentSize.height) {
return
}
// Safe
scrollY.value = e.contentOffset.y
},
},
[contentHeight],
) Now you can interpolate the scroll value e.g. const $animatedHeader = useAnimatedStyle(
() => ({
height: interpolate(
scrollY.value,
[0, SCROLL_DRAG_AREA],
[HEADER_HEIGHT, 0],
Extrapolation.CLAMP,
),
opacity: interpolate(
scrollY.value,
[0, SCROLL_DRAG_AREA],
[1, 0],
Extrapolation.CLAMP,
),
}),
) 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 I hope this helps on someway while debugging the root cause, but for now this works as expected without the flicker/crash |
Still happening in |
Has anybody been able to get around this in v3? Unfortunately is very easy for me to reproduce (#4394) and I have not been able to find a fix. |
In our case, changing zIndex during the animation caused the crash on 3.1.0: |
Is this pr meant to fix this? #4403 |
Can confirm #4403 fixes our crash. |
heyy, i still have this issue on 2.15 and 2.17 |
This is still happening on 2.x for me. Upgrading to 3.x doesn't seem to be an option as that causes even more crashes. I just migrated everything out of rage to Animated from RN and probably won't ever use Reanimated again. |
This is randomly happening on IOS could not found the source of issue and neither reproduced it. |
Hey. Can you try it? #4221 |
Fixed by: #4403 The fix will be available since 3.2.0 |
@piaskowyk I think the fix is only landed to main branch but not released to any version yet. |
@sunnylqm you're right, me bad 🙏 that's mean I need to make a release as soon as possible |
Hey @piaskowyk, can we please also backport this to 2.x, since the diff that causes this issue is in that branch as well? 🙂 |
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: #2122 try to move the content ScrollView.
Screen.Recording.2021-08-13.at.21.33.32.mov
Package versions
Affected platforms
The text was updated successfully, but these errors were encountered: