Hi, I'm not sure if you are accepting issues at this time, but I was messing around trying to implement an example project by wcandillon and got this crash in native code:
libc++abi.dylib: terminating with uncaught exception of type facebook::jsi::JSError: undefined is not an object (evaluating 'Object.keys(oldStyle)')
keys@[native code]
[native code]
[native code]
[native code]
Which I could trace to this location on the JS side https://github.com/software-mansion/react-native-reanimated/blob/master/src/reanimated2/Hooks.js#L139
oldStyle seems to originate from what I initially return from useAnimatedStyle, but as you can see it's not undefined in my code: https://github.com/lindskogen/reanimated-2-playground/blob/master/SnapchatDiscovery.js#L122
I am running against latest master of reanimated-2 by using yalc.
Image will close by animating away
Crash in native code (if app is being debugged by xcode it will break and show a stacktrace)
My code example is based on the reanimated-2-playground:
https://github.com/lindskogen/reanimated-2-playground/blob/master/SnapchatDiscovery.js#L122
I can reproduce the same bug by running the reanimated-2-playground.
I had a similar issue in my own app (using react-native-reanimated v2 alpha), it crashes after using it and interacting with it for about 10-20 seconds
I don't know if it the same error or a different one, or even an error because of a different library.
I posted this here because of the render thread error at the end of the logs.
Can someone check this and point me in the right direction?
Error log: https://pastebin.com/WBeExG5v
@lindskogen, could you please check if this error still occurs on the latest alpha?
No crash anymore!
I'm still seeing this error in the latest alpha (2.0.0-alpha.5) using the example code shown the documentation:
function Box() {
const offset = useSharedValue(0);
const animatedStyles = useAnimatedStyle(() => {
return {
transform: [{ translateX: offset.value * 255 }],
};
});
return (
<>
<Animated.View style={[styles.box, animatedStyles]} />
<Button onPress={() => (offset.value = Math.random())} title="Move" />
</>
);
}
After more digging, I found this error is caused only with react-native 0.63.2 onwards, and you can easily reproduce this by updating the react native version in the V2 playground repo and running the app on a simulator or device.
I temporarily fixed this by reverting back react-native to version 0.63.1:
npm i [email protected] -S && npx pod-install && react-native run-ios --device
However since this error breaks V2 alpha in the latest react-native versions, this issue should ideally be re-opened.
Thanks for looking into this, will try to repro it tomorrow.
@davidfarinha I've checked and it's working fine with RN 0.63.2
However, we have recently discovered that there are some problems with reanimated when someone uses npm instead of yarn. Closing, this for now as I wasn't able to reproduce the error.
Thanks, I've just checked and it's still broken installing with npm, but does work using yarn with all the react-native versions I tested (0.63.0 - 0.63.2).
Running in the same problem here as well with npm install:
"react-native-reanimated": "~1.9.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-38.0.2.tar.gz",
same issue with
[email protected]
react-native": "https://github.com/expo/react-native/archive/sdk-39.0.2.tar.gz"
solution:
downgrade reanimated to [email protected] and it works
in my case an error occurred inside the useAnimatedStyle callback. I wrapped the code in a try-catch, fixed the error and the hook worked again
Most helpful comment
I can reproduce the same bug by running the reanimated-2-playground.