美文网首页
react-native echarts|Ant Design

react-native echarts|Ant Design

作者: 黎峰麟 | 来源:发表于2018-06-28 17:52 被阅读113次

    一: react-native-image-picker

    npm install react-native-image-picker
    react-native link
    
    //iOS 添加权限
    <key>NSPhotoLibraryUsageDescription</key>
        <string>$(PRODUCT_NAME) would like access to your photo gallery</string>
        <key>NSCameraUsageDescription</key>
        <string>$(PRODUCT_NAME) would like to use your camera</string>
        <key>NSPhotoLibraryAddUsageDescription</key>
        <string>$(PRODUCT_NAME) would like to save photos to your photo gallery</string>
        <key>NSMicrophoneUsageDescription</key>
        <string>$(PRODUCT_NAME) would like to your microphone (for videos)</string>
    
    //安卓 
    1 设置编译工具版本
    buildscript {
        ...
        dependencies {
            classpath 'com.android.tools.build:gradle:2.2.+' // <- USE 2.2.+ version
        }
        ...
    }
    ...
    2 添加权限
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    
    
    最后链接
    react-native link react-native-image-picker
    

    二 Ant Design Mobile RN of React

    npm install antd-mobile-rn --save
    npm install babel-plugin-import
    
    在自己的工程项目下.babelrc
    // .babelrc or babel-loader option
    {
      "plugins": [
        // 与 Web 平台的区别是不需要设置 style
        ["import", { libraryName: "antd-mobile-rn" }] 
      ]
    }
    
    然后改变从 antd-mobile-rn 引入模块方式即可。
    import { Button } from 'antd-mobile-rn';
    
    

    native-echarts

    npm install native-echarts --save
    
    1 安卓无法设置宽度的问题
    
    修改echarts包目录下index.js文件
    scalesPageToFit =  {Platform.OS == 'ios' ? false : true}
    
    2 安卓打包后路径显示不正确的问题
    
    复制 tpl.html 到安卓工程asset文件夹下
    WebView的source 改为 source = {{‘uri’:’file:///android_asset/echarts/tpl.html’}}
    
    
    屏幕快照 2018-06-28 下午5.50.30.png

    相关文章

      网友评论

          本文标题:react-native echarts|Ant Design

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