react-navigation v2 問題javascript
問題:html
static navigationOptions = ({navigation, navigationOptions}) => ({
headerTitle: (
<Text style={{color:"#fff"}}>個人</Text>
),
headerRight: (
<View></View>
),
headerLeft: (
<View></View>
)
})java
無論頁面如何設置,都不能影響header, 查看文檔 大概的意思是 v2 tab 不報錯header了連接:https://github.com/react-navigation/react-navigation-tabs/issues/19node
高德插件問題react
經過使用 https://github.com/react-native-component/react-native-smart-amap/issues 插件,須要生成key,而高德的key須要經過keytool生成(生成key教程地址:https://lbs.amap.com/faq/top/hot-questions/249),在 Android Studio的Terminal 輸入命令:keytool -v -list -keystore keystore文件路徑報錯:android
keytool 錯誤: java.lang.Exception: 密鑰庫文件不存在: keystore
解決辦法:具體查看:https://blog.csdn.net/Cocoa_M/article/details/66968545ios
keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android 別名: androiddebugkey 建立日期: May 31, 2018 條目類型: PrivateKeyEntry 證書鏈長度: 1 證書[1]: 全部者: C=US, O=Android, CN=Android Debug 發佈者: C=US, O=Android, CN=Android Debug 序列號: 1 有效期爲 Thu May 31 22:45:53 CST 2018 至 Sat May 23 22:45:53 CST 2048 證書指紋: MD5: AC:7E:98:73:B6:85:22:2A:14:27:94:50:A5:71:7E:02 SHA1: EE:D0:46:8C:3D:C4:CB:28:CE:69:8D:13:71:47:8C:D2:3F:84:83:B2 SHA256: 18:4B:28:F3:B0:1B:1C:8E:8E:03:9C:99:7D:B4:65:F1:57:E2:6D:5E:54:B9:4E:18:ED:F2:53:FC:1B:A7:4F:A0 簽名算法名稱: SHA1withRSA 主體公共密鑰算法: 1024 位 RSA 密鑰 版本: 1 Warning: JKS 密鑰庫使用專用格式。建議使用 "keytool -importkeystore -srckeystore /Users/lph/.android/debug.keystore -destkeystore /Users/lph/.android/debug.keystore -deststorety行業標準格式 PKCS12。
按照教程繼續添加代碼 android\app\src\main\AndroidManifest.xml運行報錯git
Starting: Intent { cmp=com.deraceurapp/.MainActivity } Error type 3 Error: Activity class {com.deraceurapp/com.deraceurapp.MainActivity} does not exist. lphdeMacBook-Pro:DeraceurApp lph$ react-native run-android Scanning folders for symlinks in /Users/lph/react_native/DeraceurApp/node_modules (40ms) JS server already running.
是包名問題?解決:github
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.deraceurapp"> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/> <application android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:allowBackup="false" android:theme="@style/AppTheme"> ...... <meta-data android:name="com.amap.api.v1.deraceurapp.sdk" android:value="EE:D0:46:8C:3D:C4:CB:28:CE:69:8D:13:71:47:8C:D2:3F:84:83:B2" /> ...... </application> </manifest>
須要寫在一個 application裏面算法
這個問題產生緣由:
/Users/你的用戶名/.rncache中boost_1_63_0.tar.gz,double-conversion-1.1.5.tar.gz,folly-2016.09.26.00.tar.gz,glog-0.3.4.tar.gz文件不完整。或者node_modules/react-native/third-party 文件不完整。
解決方法2種:
打開命令行工具,在項目目錄下輸入rm -rf node_modules && rm -rf ~/.rncache && yarn
npm install
react-native upgrade
2.方法2
報錯問題:Native module VectorIconsPackage tired to override modulename for module name VectorIconsPackage.If this was your intention,setcanOverrideExistingModule=true
緣由:這個是Project\android\app\src\main\java\com\project\MainApplication.java裏面 重複引用了包
protected List<ReactPackage> getPackages() { return Arrays.<ReactPackage>asList( new MainReactPackage(), new ReactVideoPackage(), new VectorIconsPackage(), new RNSoundPackage(), new ImagePickerPackage(), new ReactNativeAudioPackage(), new AMap3DPackage() ); }
刪除該函數裏面的重複引用
解決方法: 根目錄index.js添加代碼
/** * @format */ .... import { YellowBox } from 'react-native'; YellowBox.ignoreWarnings(['Remote debugger']); ....