gia*_*ipz 6 android-studio react-native
我正在尝试使用 Expo 创建我的第一个 React Native 应用程序,并且我正在尝试通过单击按钮来 console.log 一个随机文本。
当按下按钮时,我收到两个错误(这是通过 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.
有时我有时也会收到此错误
Animated node tag 3 does not exist
Run Code Online (Sandbox Code Playgroud)
下面是我试图执行的简单代码
<View>
<TouchableOpacity
onPress={() => console.log('test')}
>
<Text>Log In</Text>
</TouchableOpacity>
</View>
Run Code Online (Sandbox Code Playgroud)
我在网上看了一下,我真的没有看到关于这两个错误的任何信息。这是我设置代码的方式吗?我可能缺少包裹吗?
我暂时安装了这些 react-native 包
"react-native": "^0.64.0",
"react-native-gesture-handler": "^1.10.3",
"react-native-reanimated": "^2.0.0",
Run Code Online (Sandbox Code Playgroud)
提前致谢
小智 6
我可以按照https://github.com/facebook/react-native/issues/29999中提供的解决方案来解决这个问题
这似乎是新版本的React Native中的一个错误,要解决它,请转到react-native/Libraries/Animated/NativeAnimatedHelper.js,然后将第71行更改为:
if (Platform.OS === 'android') {
NativeAnimatedModule.startOperationBatch();
}
Run Code Online (Sandbox Code Playgroud)
到
if (Platform.OS === 'android' && NativeAnimatedModule.startOperationBatch) {
NativeAnimatedModule.startOperationBatch();
}
Run Code Online (Sandbox Code Playgroud)
第 78 行:
if (Platform.OS === 'android') {
NativeAnimatedModule.finishOperationBatch();
}
Run Code Online (Sandbox Code Playgroud)
到
if (Platform.OS === 'android' && NativeAnimatedModule.finishOperationBatch) {
NativeAnimatedModule.finishOperationBatch();
}
Run Code Online (Sandbox Code Playgroud)
希望它会起作用。
| 归档时间: |
|
| 查看次数: |
1229 次 |
| 最近记录: |