import React, {Component} from 'react';
import {
StyleSheet,
SafeAreaView,
Text,
TouchableOpacity,
View,
Keyboard,
Button,
} from 'react-native';
import Alerts from './examples/Alerts';
import Scrolling from './examples/Scrolling';
import Background from './examples/Background';
const TESTS = {
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 ;
},
},
};
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
{restarting ? null : (
{currentTest.title}
{currentTest.description}
{currentTest.render()}
)}
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#F5FCFF',
padding: 8,
},
exampleContainer: {
padding: 16,
backgroundColor: '#FFF',
borderColor: '#EEE',
borderTopWidth: 1,
borderBottomWidth: 1,
flex: 1,
},
exampleTitle: {
fontSize: 18,
},
exampleDescription: {
color: '#333333',
marginBottom: 16,
},
exampleInnerContainer: {
borderColor: '#EEE',
borderTopWidth: 1,
paddingTop: 10,
flex: 1,
},
restartButton: {
padding: 6,
fontSize: 16,
borderRadius: 5,
backgroundColor: '#F3F3F3',
alignItems: 'center',
justifyContent: 'center',
alignSelf: 'flex-end',
},
closeKeyboardView: {
width: 5,
height: 5,
},
testPickerContainer: {
flexDirection: 'row',
flexWrap: 'wrap',
},
});