我是在react原生中新开发的。
首先,我使用npx react-native init hello_world --template react-native-template-typescript
创建基本代码,然后将app.tsx替换为以下代码:
import React from 'react';
import {StyleSheet, Text, View} from 'react-native';
const App = () => {
return (
<View style={styles.helloWorldContainer}>
<Text style={{fontSize: 18}}>Hello, world!</Text>
</View>
);
};
const styles = StyleSheet.create({
helloWorldContainer: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
});
export default App;
这些是我在调试模式下得到的错误:Error picture 1 Error picture 2
如果我删除组件文本的样式,错误就会消失。我的问题是,如何在保留组件文本中的样式的同时修复错误。我看到chrome有很多错误,有没有更好的调试器?
发布于 2021-09-27 05:55:02
正如Lucas Azambuja Santos提到的,这是react-native 0.65.*
中的一个错误查看新一期的https://github.com/facebook/react-native/issues/32197
它应该修复为0.66,以解决降级到0.64.x并重新构建的问题:
cd android && ./gradlew clean cleanBuildCache
发布于 2021-10-15 08:43:27
升级到0.66.x -这很容易。这样问题就会消失。
https://stackoverflow.com/questions/68940923
复制相似问题