import React, {Component} from 'react'; import { StyleSheet, SafeAreaView, Text, TouchableOpacity, View, Keyboard, Button, Platform, } from 'react-native'; import Alerts from './examples/Alerts'; import Scrolling from './examples/Scrolling'; import Background from './examples/Background'; import Downloads from './examples/Downloads'; import Uploads from './examples/Uploads'; import Injection from './examples/Injection'; import LocalPageLoad from './examples/LocalPageLoad'; import Messaging from './examples/Messaging'; import NativeWebpage from './examples/NativeWebpage'; const TESTS = { Messaging: { title: 'Messaging', testId: 'messaging', description: 'js-webview postMessage messaging test', render() { return ; }, }, Alerts: { title: 'Alerts', testId: 'alerts', description: 'Alerts tests', render() { return ; }, }, Scrolling: { title: 'Scrolling', testId: 'scrolling', description: 'Scrolling event test', render() { return ; }, }, Background: { title: 'Background', testId: 'background', description: 'Background color test', render() { return ; }, }, Downloads: { title: 'Downloads', testId: 'downloads', description: 'File downloads test', render() { return ; }, }, Uploads: { title: 'Uploads', testId: 'uploads', description: 'Upload test', render() { return ; }, }, Injection: { title: 'Injection', testId: 'injection', description: 'Injection test', render() { return ; }, }, PageLoad: { title: 'LocalPageLoad', testId: 'LocalPageLoad', description: 'Local Page load test', render() { return ; }, }, NativeWebpage: { title: 'NativeWebpage', testId: 'NativeWebpage', description: 'Test to open a new webview with a link', render() { return ; }, }, }; type Props = {}; type State = {restarting: boolean; currentTest: Object}; export default class App extends Component { state = { restarting: false, currentTest: TESTS.Alerts, }; _simulateRestart = () => { this.setState({restarting: true}, () => this.setState({restarting: false})); }; _changeTest = (testName) => { this.setState({currentTest: TESTS[testName]}); }; render() { const {restarting, currentTest} = this.state; return ( Keyboard.dismiss()} testID="closeKeyboard" /> Simulate Restart