我参考了https://docs.nativebase.io/,当我尝试使用示例代码时,它显示了错误Unable to resolve module,就像照片一样

我的环境是:
"expo": "^18.0.4",
"native-base": "^2.2.1",
"react": "16.0.0-alpha.12",
"react-native": "https://github.com/expo/react-native/archive/sdk-18.0.1.tar.gz",这是我的App.js:
import React from 'react';
// import { StyleSheet, View, Text } from 'react-native';
import { Container, Button, Text } from 'native-base';
export default class App extends React.Component {
render() {
return (
<Container>
<Button>
<Text>
Button
</Text>
</Button>
</Container>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
});我发现我只是导入了'native-base‘,因为错误import { Container, Button, Text } from 'native-base';
请告诉我我错过了哪一步。提前谢谢。
发布于 2017-07-12 21:12:51
我想您已经忘记了首先安装native-base组件,如果没有,那么在项目中使用以下命令
npm install native-base --savehttps://stackoverflow.com/questions/45053454
复制相似问题