Skip to content

Instantly share code, notes, and snippets.

@heytulsiprasad
Created June 11, 2021 15:58
Show Gist options
  • Select an option

  • Save heytulsiprasad/32dc2ccc4607212c5e07a58b5aab497b to your computer and use it in GitHub Desktop.

Select an option

Save heytulsiprasad/32dc2ccc4607212c5e07a58b5aab497b to your computer and use it in GitHub Desktop.
Basic usage of React Native Webview
// 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