250x250
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Tags
- IOS
- jQuery
- iOS 개발자
- javascript
- hover
- CSS
- Animation
- HTML
- keyframes
- html5
- effect
- react
- 백엔드
- 비전공자
- front-end
- 프론트엔드
- button
- php
- xcode
- SWIFT
- MAC
- 애니메이션
- 풀스택
- css3
- iPhone
- 자바스크립트
- 비전공 개발자
- ipad
- 개발자
- image
Archives
- Today
- Total
비전공자 개발일기
React Native Webview2 본문
728x90
SMALL
import React, { useEffect } from "react";
import { StatusBar } from "expo-status-bar";
import { Text, View, StyleSheet, BackHandler, Alert } from "react-native";
import { WebView } from "react-native-webview";
import Constants from "expo-constants";
const MYLINK = "https://relaxed-turing-e7ea57.netlify.app";
// android 뒤로가기 버튼 클릭 시, 종료 확인 안내 문구 표시
const App = () => {
useEffect(() => {
const backAction = () => {
Alert.alert("Hold on!", "앱을 종료하시겠습니까?", [
{
text: "취소",
onPress: () => null,
},
{ text: "확인", onPress: () => BackHandler.exitApp() },
]);
return true;
};
const backHandler = BackHandler.addEventListener(
"hardwareBackPress",
backAction
);
return () => backHandler.remove();
}, []);
return (
<View style={{ width: "100%", height: "100%" }}>
<Text style={styles.text}>WEBVIEW</Text>
<View style={styles.container}>
<WebView
style={styles.test}
onLoad={console.log("Looooood!")}
source={{ uri: MYLINK }}
></WebView>
</View>
<StatusBar style="auto"></StatusBar>
</View>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
marginTop: Constants.statusBarHeight,
justifyContent: "center",
},
text: {
fontSize: 30,
fontWeight: "bold",
marginTop: Constants.statusBarHeight,
fontWeight: "700",
textAlign: "center",
color: "#2598eb",
},
test: {
flex: 1,
marginTop: Constants.statusBarHeight,
},
});
export default App;
728x90
LIST
'React & React Native' 카테고리의 다른 글
three.js (0) | 2022.04.11 |
---|---|
React Native Login & Basic Page (0) | 2022.02.27 |
React Native Webview (0) | 2022.02.13 |
React Native Pressable (0) | 2022.02.06 |
React & React Native Props (0) | 2022.01.13 |