Problems reloading Android app while using Reanimated v2
See original GitHub issueDescription
When I reload Android using R + R
, everything’s okay.
When I reload Android using Cmd + M -> Reload
, the app crashes.
When I reload Android using the key R
in metro console, the app crashes.
Screenshots
https://user-images.githubusercontent.com/8364345/110551740-ff335e00-812d-11eb-9f87-c9ffee59e2ab.mov
Steps To Reproduce
- Clone this repo: https://github.com/nelsonprsousa/rnn-testing/tree/test-rea-v2
- Use
test-rea-v2
branch - yarn android
Expected behavior
The app should reload with Cmd + M -> Reload and when we send the “R” key signal in metro console. iOS works as expected on all the scenarios.
Actual behavior
Android app crashes on reload.
Snack or minimal code example
I’ve made a new react-native application, added react-native-navigation and reanimated v2. Then I added the following code:
import React from 'react';
import {SafeAreaView, StyleSheet, View, Text} from 'react-native';
import Animated, {useAnimatedStyle} from 'react-native-reanimated';
const App: () => React$Node = () => {
const animated = useAnimatedStyle(() => {
return {
transform: [{scale: 1}],
};
});
return (
<SafeAreaView>
<Animated.ScrollView
contentInsetAdjustmentBehavior="automatic"
style={{backgroundColor: 'gray'}}>
<View>
<Text style={styles.footer}>Hello Reanimated v2!</Text>
</View>
</Animated.ScrollView>
</SafeAreaView>
);
};
const styles = StyleSheet.create({
scrollView: {
backgroundColor: 'white',
},
footer: {
color: 'black',
fontSize: 12,
fontWeight: '600',
padding: 4,
paddingRight: 12,
height: 1500,
},
});
export default App;
Please note that animated
const isn’t used. If we comment that const (that’s not being used), everything works as expected. Also tried to really use it and got the same problem, so I am publishing this way for simplicity.
Package versions
- React: 16.13.1
- React Native: 0.63.4
- React Native Reanimated: 2.0.0
- React Native Navigation: 7.11.3
- NodeJS: 14.6.0
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:32 (11 by maintainers)
Same issue here. Even after clearing derived data, removing and reinstalling node_modules, clearing metro cache…
Upon further inspection looks like NativeReanimated.useOnlyV1 is always returning true, hence the isConfiguredCheck error, which indicates that somehow InnerNativeModule is null.
@jakub-gonet any ideas on a fix?
I am facing the same problem as you @teuscm. I think
NativeReanimated.useOnlyV1
is always returning true too. Did you manage to fix that?