react-native引用antd-mobile报错。低级配置问题没有解决

我是新手。刚刚接触react-native,在成功的跑出hello world之后。尝试引入antd-mobile,出现报错。我按照官网的配置,没有能够解决。麻烦大家帮忙看看!
.babelrc配置文件

{
  "plugins": [["import", { "libraryName": "antd-mobile" }]],
  "presets": ["react-native"]
}

index.js文件

import React, { Component } from 'react';
import {
  AppRegistry,
  StyleSheet,
  View
} from 'react-native';
import { Button } from 'antd-mobile';
export default class smartphone extends Component {
  render() {
    return (
      <View style={styles.container}>
        <Button>Start</Button>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
  },
  welcome: {
    fontSize: 20,
    textAlign: 'center',
    margin: 10,
  },
  instructions: {
    textAlign: 'center',
    color: '#333333',
    marginBottom: 5,
  },
});

AppRegistry.registerComponent('smartphone', () => smartphone);

报错如下:

clipboard.png
,辛苦大家!

阅读 3.7k
1 个回答

删除node_modules,重新npm install
npm start -resert-cache
react-native run-iso

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题