美文网首页
React Native 填坑大全(持续更新)

React Native 填坑大全(持续更新)

作者: Angrybaby | 来源:发表于2019-02-25 10:46 被阅读0次

    1、引入mobx,支持ES7 decorator的报错问题

    安装以下包(yarn or npm)
    yarn add module:metro-react-native-babel-preset @babel/preset-flow @babel/plugin-proposal-decorators --dev
    
    创建 .babelrc文件
    {
      "presets": [
        "module:metro-react-native-babel-preset",
        "@babel/preset-flow"
      ],
      "plugins": [
        ["@babel/plugin-proposal-decorators", { "legacy" : true }]
      ]
    }
    
    

    2、使用导航栏组件react-navigationstackNavigator报错

    stackNavigator 因为涉及到客户端手势操作,
    需导入react-native-gesture-handler
    
    1. yarn add react-native-gesture-handler
    2. react-native link react-native-gesture-handler
    3. 查看iOS工程的Podfile文件是否引入
    pod 'React', :path => '../node_modules/react-native', :subspecs => [
        . . . // other subspecs
        'RCTLinkingIOS',
        . . .
      ]
    pod 'RNGestureHandler', :path => '../node_modules/react-native-gesture-handler'
    4. 进行pod install
    

    相关文章

      网友评论

          本文标题:React Native 填坑大全(持续更新)

          本文链接:https://www.haomeiwen.com/subject/dvdwyqtx.html