我尝试过使用这样的元素:
<WebView
source={{ uri: contentURL }}
startInLoadingState={true}
style={styles.articleOnWeb.webView}>
onLoadStart={function () {
ToastAndroid.show("onLoadStart", ToastAndroid.SHORT)
console.log("onLoadStart")
const nextState = Immutable.Map(thisComponent.state).toJS()
nextState.articleOnWebLoadingProgress = 0.5
thisComponent.setState(nextState)
}}
onLoadEnd={function () {
ToastAndroid.show("onLoadEnd", ToastAndroid.SHORT)
console.log("onLoadEnd")
const nextState = Immutable.Map(thisComponent.state).toJS()
nextState.articleOnWebLoadingProgress = 1
thisComponent.setState(nextState)
setTimeout(()=> {
const nextState = Immutable.Map(thisComponent.state).toJS()
nextState.articleOnWebIsLoaded = true
thisComponent.setState(nextState)
}, 1000)
}}
</WebView>