728x90
1. 라이브러리
https://github.com/react-native-community/react-native-webview
2. 설치
https://github.com/react-native-community/react-native-webview/blob/master/docs/Getting-Started.md
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" />}
/>
</>
);
};
Buy Me A Coffee!
https://www.buymeacoffee.com/daheeahn
'Develop > React Native' 카테고리의 다른 글
[React Native] react-native-svg ProgressCircle로 시계 나타내는 법 / startAngle, endAngle (0) | 2020.05.24 |
---|---|
[React Native] GraphQL & Apollo & Code Generator 사용법 (0) | 2020.05.11 |
[React Native] build가 영원히 되지 않을 때 (2) | 2020.05.10 |
Parent View의 Height를 알고싶다면? (0) | 2020.05.04 |
[React Native] library not found for -lAppAuth / Build input file cannot be found:에러 (0) | 2020.05.04 |