Mobile

[React-Native] WebView 환경 설정

J1Eun 2024. 2. 20. 15:02

react-native-webview 설치

npm install --save react-native-webview

 

const windowWidth = Dimensions.get('window').width;

const windowHeight = Dimensions.get('window').height;

 

 

<SafeAreaView style={styles.container}>

      <WebView

        style={styles.webview}

        source={{uri: 'https://naver.com'}}

      />

    </SafeAreaView>

 

 

container: {

    flex: 1,

    alignItems: 'center',

    justifyContent: 'space-between',

  },

  webview: {

    flex: 1,

    width: windowWidth,

    height: windowHeight,

  },

 

 

https://velog.io/@chloedev/React-native-%EB%A6%AC%EC%95%A1%ED%8A%B8-%EB%84%A4%EC%9D%B4%ED%8B%B0%EB%B8%8C%EC%97%90%EC%84%9C-%EC%9B%B9%EB%B7%B0-%EB%A7%8C%EB%93%A4%EA%B8%B0