처음 호출한 URL에서 다시 Redirect하는 경우에, 사용하면 navState를 정확히 파악할 수 있다.
=> BackHandler 사용 시, canGoBack의 결과에 따라 앱을 종료하는 로직을 사용할 수 있음.
onShouldStartLoadWithRequest
Function that allows custom handling of any web view requests. Return true from the function to continue loading the request and false to stop loading.
On Android, is not called on the first load.
TypeRequired
function | No |
Example:
<WebView source={{ uri: 'https://facebook.github.io/react-native' }} onShouldStartLoadWithRequest={request => { // Only allow navigating within this website return request.url.startsWith('https://facebook.github.io/react-native'); }} />
The request object includes these properties:
title url loading target canGoBack canGoForward lockIdentifier navigationType
반응형
'Mobile > ReactNative' 카테고리의 다른 글
[RN] React Native WebView Debugging (0) | 2019.05.28 |
---|---|
[RN] react-native-docview 적용하기 (0) | 2019.05.23 |
[RN] react native webview cache clear (0) | 2019.05.22 |
[RN] Could not resolve project :react-native-gesture-handler. (0) | 2019.05.22 |
[RN] Invariant Violation: requireNativeComponents: (0) | 2019.05.22 |