6

I'm attempting to create my first React Native application with Expo, and I'm trying to console.log a random text upon the click of a button.

When the button is pressed, I get two errors (this is via Android Studio):

1 - NativeAnimatedModule.startOperationBatch is not a function

2 - There was a problem sending log messages to your development environment TypeError: stackString.split is not a function.

Occasionally I sometimes get this error as well

Animated node tag 3 does not exist

Below is the simple code I'm trying to execute

<View>
  <TouchableOpacity
    onPress={() => console.log('test')}
  >
  <Text>Log In</Text>
  </TouchableOpacity>
</View>

I looked online and I don't really see anything on these 2 errors. Is it the way I have the code setup? Could I be missing packages?

I have these react-native packages installed for the time being

"react-native": "^0.64.0",
"react-native-gesture-handler": "^1.10.3",
"react-native-reanimated": "^2.0.0",

Thanks in advance

1 Answers1

6

I could solve this by following the solution provided in https://github.com/facebook/react-native/issues/29999

This seems to be a bug in the new versions of react native, to solve it, go to react-native/Libraries/Animated/NativeAnimatedHelper.js, then change lines 71 with:

if (Platform.OS === 'android') {
      NativeAnimatedModule.startOperationBatch();
   }

to

if (Platform.OS === 'android' && NativeAnimatedModule.startOperationBatch) {
      NativeAnimatedModule.startOperationBatch();
   }

and in line 78:

if (Platform.OS === 'android') {
  NativeAnimatedModule.finishOperationBatch();
}

to

   if (Platform.OS === 'android' && NativeAnimatedModule.finishOperationBatch) {
         NativeAnimatedModule.finishOperationBatch();
   }

Hopefully it will work.

leodsc
  • 111
  • 4