- 用法一
import Loading from 'react-native-loading-w';
//view
render() {
return (
<View>
<Text>test loading</Text>
<Loading ref={'loading'} text={'Loading...'} />
</View>
);
}
getLoading() {
return this.refs['loading'];
}
//usage
this.getLoading().show();
//or
this.getLoading().show('uploading...');
//or
this.getLoading().show('uploading...', true);
this.getLoading().dismiss();
- 用法二
- 创建
<WebView
ref = {(webview) => this.webview = webview}
source={{ uri: this.state.url }}
style = {styles.webView_style}
startInLoadingState={true}
onNavigationStateChange={(e) => this.onNavChange(e)}
/>
2.全局引用
goBack() {
if (this.state.canGoBack)
{
this.webview.goBack();
}
else
{
NavigationUtil.goBack(this.props.navigation);
}
}
网友评论