基於react-native,百度地圖開發的記錄運動軌跡的appnode
在根目錄執行npm installreact
"react": "16.0.0-alpha.6", "react-native": "0.43.3", "react-native-wechat": "^1.9.2", "react-navigation": "^1.0.0-beta.7"
因爲我在寫的時候,0.43剛出來,本着嚐鮮的衝動,用了它,致使react-navigation不兼容,會報錯。這裏的解決辦法就是註釋掉android
node_modules\react-navigation\src\views\Header.js
裏面的第12行, 以下git
// import ReactComponentWithPureRenderMixin from 'react/lib/ReactComponentWithPureRenderMixin';
因爲我所使用的百度地圖功能,包括定位,地圖,鷹眼,因此申請百度key的時候須要選擇這三個,通常默認是包涵的。github
百度地圖的key修改位置:npm
android\app\src\main\AndroidManifest.xml
裏面的:react-native
<meta-data android:name="com.baidu.lbsapi.API_KEY" android:value="你的百度密鑰" />
使用的是react-native-wechat,它的註冊是在componentDidMount生命週期方法裏面註冊,例如:api
componentDidMount() { WeChat.registerApp('你的微信key'); }
react-native run-android
這裏說明, 使用android模擬器運行,會閃退,因此建議在真機上運行。微信
github地址app