首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法使用本机库解析模块

无法使用本机库解析模块
EN

Stack Overflow用户
提问于 2017-07-12 17:15:30
回答 1查看 7.9K关注 0票数 2

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

我的环境是:

代码语言:javascript
复制
"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:

代码语言:javascript
复制
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';

请告诉我我错过了哪一步。提前谢谢。

EN

回答 1

Stack Overflow用户

发布于 2017-07-12 21:12:51

我想您已经忘记了首先安装native-base组件,如果没有,那么在项目中使用以下命令

代码语言:javascript
复制
npm install native-base --save
票数 8
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/45053454

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档