react-native-syan-image-picker的使用


傳送門

第一種方式:link

  第一步:安裝

  1.  npm install react-native-syan-image-picker --save

  2.  react-native link react-native-syan-image-picker

  第二步:原生配置

  1. ios
    1.  TARGETS -> Build Phases -> Copy Bundle Resources 點擊"+"按鈕,在彈出的窗口中點擊“Add Other”按鈕,選擇
      node_modules/react-native-syan-image-picker/ios/TZImagePickerController/TZImagePickerController.bundle
    2. 相冊相關權限 
    3. 中文適配

       

  2. android

    1. 在 build.gradle 中添加 maven { url "https://jitpack.io" } 和Google 配置:

      

buildscript {
    repositories {
        jcenter()
        maven { // 添加這條 url 'https://maven.google.com/' name 'Google' } google() } dependencies { classpath 'com.android.tools.build:gradle:3.1.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { mavenLocal() jcenter() maven { url "https://jitpack.io" } // 添加這條 maven { // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm url "$rootDir/../node_modules/react-native/android" } } }
  

  2.
在 AndroidManifest.xml 中添加權限:
    
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.CAMERA" />
第二種方式就是link不成功的,這里就不寫了,傳送門里有答案:
  

 





免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM