react native-使用WebView注入javascript不起作用
我正在尝试在react native WebView中注入javascriptreact native-使用WebView注入javascript不起作用,javascript,reactjs,react-native,Javascript,Reactjs,React Native,我正在尝试在react native WebView中注入javascript window.isRNWebView=true 因此,在我的网页上,我将能够确定用户是在使用该应用程序还是在使用手机上的浏览器 但在尝试访问客户端中的window.isRNWebView时,我没有定义 这是我的密码 <View style={{ flex: 1 }}> <StatusBar barStyle="dark-content" /> <WebV
window.isRNWebView=true
因此,在我的网页上,我将能够确定用户是在使用该应用程序还是在使用手机上的浏览器
但在尝试访问客户端中的window.isRNWebView时,我没有定义
这是我的密码
<View style={{ flex: 1 }}>
<StatusBar barStyle="dark-content" />
<WebView
style={{ marginTop: StatusBarHeight, flex: 1 }}
source={{ uri: "http://192.168.1.11:3000" }}
renderLoading={() => (
<View
style={{
position: "absolute",
top: 0,
left: 0,
right: 0,
bottom: 0,
justifyContent: "center",
alignItems: "center",
}}
>
<ActivityIndicator size="large" color="#005790" />
</View>
)}
startInLoadingState={true}
javaScriptEnabled={true}
injectedJavaScriptBeforeContentLoaded="window.isRNWebView=true"
injectedJavaScript="window.isRNWebView=true"
allowsBackForwardNavigationGestures={true}
/>
</View>
(
)}
startInLoadingState={true}
javaScriptEnabled={true}
injectedJavaScriptBeforeContentLoaded=“window.isRNWebView=true”
injectedJavaScript=“window.isRNWebView=true”
AllowsBackForwardNavigationPigests={true}
/>