我正在用 React Native 进行新开发。
首先,我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;
Run Code Online (Sandbox Code Playgroud)
如果我删除组件文本的样式,错误就会消失。我的问题是如何修复错误,同时保留组件文本中的样式。我看到chrome有很多错误,是否有另一个更好的调试器?
react-native ×1