react-native - React Native Webview 将参数添加到本地 URI
问题描述
我正在使用带有本机反应的本地 SPA,webview
并且我正在尝试向它发送一个参数,以便它可以使用该参数加载。
我已将源添加如下
let source = (Platform.OS === 'android' ? 'file:///android_asset/' : '') + 'SPA/index.html';
这是处理 android 和 iOS 但每当我添加?例如,如果我添加一个参数,我会在此服务器上找不到 URI
let source = (Platform.OS === 'android' ? 'file:///android_asset/' : '') + 'SPA/index.html?parameter=foo';
或者如果我添加
let source = (Platform.OS === 'android' ? 'file:///android_asset/' : '') + 'SPA/index.html/parameter=foo';
编辑:
我正在使用来源
<WebView
originWhitelist={["file://"]}
useWebKit={true}
onMessage={this.invoke.listener}
source={{
uri: source
}}
style={{ marginTop: 20, flex: 1, backgroundColor: 'transparent' }}
bounces={false}
scrollEnabled={false}
overScrollMode={'never'}
/>
解决方案
推荐阅读
- reactjs - 如何使用 Typescript react-native 样式做宽度:null?
- python-3.x - Dropbox 和 Mega Python 图像下载像素减少
- javascript - 如何在单击时添加/删除数组中的元素?
- android - 在 android studio 中创建 CSV,以便从项目中获取
- c - 调用以结构为参数的 C 函数
- java - 用java存储聊天消息对象的最佳集合是什么?
- x86 - 将 16 位值的 __m256i 打包(饱和)到 8 位值的 __m128i?
- c++ - while(t-- >0) 是什么意思
- microcontroller - 为什么8051中的程序地址寄存器连接到8位总线?
- mysql - 带有乱码值的mysql表