WebView 从 ReactNative 中移除
- 解决方案:使用 react-native-webview 第三方库
yarn add react-native-webview 后直接启动失败
yarn link react-native-webview
- 解决方案:找到 ${workspace}/android/build.gradle,将 compileSdkVersion 改为 29.
- 参考资料:https://github.com/react-native-community/react-native-webview/blob/master/docs/Getting-Started.md
编译时出现:Error:Execution failed for task ‘:app:processDebugResources’.
- 原因:builToolsVersion、compileSDKVersion、targetSDKVersion不一致
- 解决方案,同2里的,将 targetSdkVersion 也改为29.
onNavigationStateChange 方法不响应
- 原因:该方法不支持SPA应用
- 解决思路:重写 webviewClient 中跳转的方法,使其产生响应
- 参考资料:https://blog.csdn.net/hxl517116279/article/details/105244511
- 参考资料2:https://medium.com/@tanjohnny/webview-of-your-spa-in-react-native-a06b0aa2e85d