question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

app crashes with reanimated 2

See original GitHub issue

Description

Hey guys! I installed the last version of reanimated v2, and when i’m trying to use some hooks, like: withSpring, withTiming, useAnimatedScrollHandler , useAnimatedStyle etc… app crashes. useSharedValue works fine. I also tried to downgrade react-native to 0.63.1 and react-native-reanimated to 2.0.0-alpha.5 and received the same errors on Android and iOS

Screenshots

Снимок экрана 2020-09-16 в 22 23 17 Снимок экрана 2020-09-16 в 22 23 01

Steps To Reproduce

I created a snack with minimal code to reproduce errors

Expected behavior

all reanimated hooks works and the app doesn’t crash

Actual behavior

app crash

Snack or minimal code example

https://snack.expo.io/@pavel.s/reanimated-2

Package versions

  • React: ^16.13.1
  • React Native: ^0.63.2
  • React Native Reanimated: 2.0.0-alpha.6

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
jakub-gonetcommented, Sep 17, 2020

Leave Animated import in place and use createAnimatedComponent() from it:

import Animated, {useSharedValue, useAnimatedScrollHandler} from 'react-native-reanimated';
const AnimatedSectionList = Animated.createAnimatedComponent(SectionList);
  const transY = useSharedValue(0);

  const scrollHandler = useAnimatedScrollHandler({
    onScroll: (event) => {
      transY.value = event.contentOffset.y;
    }
  });

return (
  <AnimatedSectionList onScroll={scrollHandler}>
    ....
  </AnimatedSectionList>
)
1reaction
terrysahaidakcommented, Sep 17, 2020

Could you please make sure you used Reanimated’s babel plugin which is required to make everything work? Also, make sure you run packager with --reset-cache.

Read more comments on GitHub >

github_iconTop Results From Across the Web

React Native Reanimated 2 Easing Crash
When I use easing:Easing.ease etc. in reanimated keyframe, app crashes. Imported exactly how it needs to be, checked it.
Read more >
Topics tagged Reanimated
App does not build, react-native-reanimated gradle error ... Canpt find variable: Extrapolation in Reanimated v2 ... App Crash on Production (SDK 44).
Read more >
Troubleshooting | React Native Gesture Handler - Open Source
It is the best to provide an example app that reproduces the issue you are having. Put it up on gist, snack or...
Read more >
App is crashing one time before the realm data loads
... related here i have decided to remake my app from scratch without using reanimated 2. But the app now is crashing once,...
Read more >
react native reanimated not working
Opacity fading animation not working with react-native-reanimated 2 ... don't show errors due to this check, but the app just crashes with these...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found