【发布时间】:2021-05-09 05:40:28
【问题描述】:
我有以下:
import React from 'react';
import { View, ActivityIndicator } from 'react-native';
import { WebView } from 'react-native-webview';
export default function Links() {
function LoadingIndicatorView() {
return (
<View style={styles.hubLoading}>
<ActivityIndicator color='#009b88' size='large' />
</View>
)
}
const runFirst = 'window.alert("You will see this just before the webpage loads"); true;';
const runAfterTenSecs = 'window.alert("You have been on this page for 10 seconds"); true;';
return <WebView
source={{ uri: https://google.com }}
renderLoading={LoadingIndicatorView}
startInLoadingState={true}
originWhitelist={['*']}
javaScriptEnabled={true}
onMessage={() => {}}
injectedJavaScript={runFirst}
/>;
}
runAfterTenSecs 当前未使用。我可以对其或runFirst 进行哪些更改,以在 Web 视图加载十秒后产生警报“您已在此页面上停留 10 秒”的预期结果?
【问题讨论】:
标签: javascript react-native react-native-webview