基于react-native编写的图书APP,接口来自豆瓣
git clone https://github.com/lypeng29/react-native-book.git
cd react-native-book
yarn install
react-native run-android
- header导航条:目前影藏了,设置了header高度为0
解决方案:https://blog.csdn.net/ancientear/article/details/81091342
因版本问题找不到编译后的入口文件,新版都是index.js为入口文件,执行:react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/
真机测试需要摇动手机,模拟器的话是menu键(windows: ctrl + M ,macOS: command + M)
设置host:port(例如我的是192.168.1.129:8081)
设置:headerTitleStyle:{flex:1,textAlign:'center'}
先使用createBottomTabNavigator创建底部导航,后使用createStackNavigator创建全局导航,把底部导航放进去 具体见main.js文件
传递值:this.props.navigation.push('Details', { 'bookID': item.id })
获取值:this.props.navigation.getParam('bookID', 26378583);
查看了之前的项目,需要新建local.properties文件,里面写上:sdk.dir=D\:\\Android\\SDK
缺少模块,需要安装下:
yarn add react-native-gesture-handler
react-native link
yarn add react-native-webview
react-native link react-native-webview #安装完成,需要关联下
关联成功后,需要修改settings.gradle文件中的“\”为“/”,否则路径错误。react-native 0.59已修复



