728x90
1. 라이브러리
https://github.com/react-native-community/react-native-webview
react-native-community/react-native-webview
React Native Cross-Platform WebView. Contribute to react-native-community/react-native-webview development by creating an account on GitHub.
github.com
2. 설치
https://github.com/react-native-community/react-native-webview/blob/master/docs/Getting-Started.md
react-native-community/react-native-webview
React Native Cross-Platform WebView. Contribute to react-native-community/react-native-webview development by creating an account on GitHub.
github.com
yarn add react-native-webview
rn 0.60 이상이므로 pod install만! (android는 할 필요 x)
pod install
3. Usage
import React, {useState} from 'react';
import {ActivityIndicator} from 'react-native';
import {WebView} from 'react-native-webview';
export default ({route}) => {
const {uri, title} = route.params;
const [loading, setLoading] = useState(true);
return (
<>
{loading && (
<ActivityIndicator color={theme.mint} style={{marginTop: 20}} />
)}
<WebView
source={{uri}}
onLoadEnd={() => setLoading(false)}
renderLoading={() => <ActivityIndicator color="blue" />}
/>
</>
);
};
'Solve Problem > React Native' 카테고리의 다른 글
[React Native] Splash Screen 사용법 / 스플래시 LaunchImage (0) | 2020.05.11 |
---|---|
[React Native] GraphQL & Apollo & Code Generator 사용법 (0) | 2020.05.11 |
[React Native] Gif 파일 표시하기 (4) | 2020.05.05 |
Parent View의 Height를 알고싶다면? (0) | 2020.05.04 |
[React Native] library not found for -lAppAuth / Build input file cannot be found:에러 (0) | 2020.05.04 |