Created
June 11, 2021 15:58
-
-
Save heytulsiprasad/32dc2ccc4607212c5e07a58b5aab497b to your computer and use it in GitHub Desktop.
Basic usage of React Native Webview
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Mobile: React Native | |
| import React, {useState, useEffect} from 'react'; | |
| import { View } from 'react-native'; | |
| import {Button} from 'react-native-paper'; | |
| import { WebView } from 'react-native-webview'; | |
| const App = () => { | |
| const [show, setShow] = useState({isOpen: false, url: null}); | |
| return ( | |
| <View> | |
| <View> | |
| <Button | |
| onPress={() => | |
| setShow({ | |
| isOpen: true, | |
| url: 'webview.com/login', | |
| }) | |
| }> | |
| Login | |
| </Button> | |
| </View> | |
| {show.isOpen && ( | |
| <WebView source={{uri: show.url}} /> | |
| )} | |
| </ImageBackground> | |
| </View> | |
| ); | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment