웹페이지를 앱으로 표현하는 WebView이다.
1. #react-native init demo
2. #cd demo
3. #npm install --save react-native-webview
4. #react-native link react-native-webview
5. npm run android
*** App.js
/uri사용
import React from 'react';
import { View, Text, Image, ScrollView, TextInput } from 'react-native';
import { WebView } from 'react-native-webview';
const App = () => {
}
export default App;
/inline HTML 사용
import React from 'react';
import { View, Text, Image, ScrollView, TextInput } from 'react-native';
import { WebView } from 'react-native-webview';
const App = () => {
return (
<WebView
originWhitelist={['*']}
source={{ html: '<h1>안녕하세요?</h1>' }}
/>
);
}
export default App;