| 69 | } |
| 70 | |
| 71 | export default class App extends React.Component<any, any> { |
| 72 | constructor(props: any) { |
| 73 | super(props); |
| 74 | |
| 75 | this.state = { |
| 76 | Component: null, |
| 77 | useGoogleMaps: ANDROID, |
| 78 | }; |
| 79 | } |
| 80 | |
| 81 | renderExample([Component, title]: any) { |
| 82 | return ( |
| 83 | <TouchableOpacity |
| 84 | key={title} |
| 85 | style={styles.button} |
| 86 | onPress={() => this.setState({Component})}> |
| 87 | <Text>{title}</Text> |
| 88 | </TouchableOpacity> |
| 89 | ); |
| 90 | } |
| 91 | |
| 92 | renderBackButton() { |
| 93 | return ( |
| 94 | <TouchableOpacity |
| 95 | style={styles.back} |
| 96 | onPress={() => this.setState({Component: null})}> |
| 97 | <Text style={styles.backButton}>←</Text> |
| 98 | </TouchableOpacity> |
| 99 | ); |
| 100 | } |
| 101 | |
| 102 | renderGoogleSwitch() { |
| 103 | return ( |
| 104 | <View> |
| 105 | <Text>Use GoogleMaps?</Text> |
| 106 | <Switch |
| 107 | onValueChange={value => this.setState({useGoogleMaps: value})} |
| 108 | style={styles.googleSwitch} |
| 109 | value={this.state.useGoogleMaps} |
| 110 | /> |
| 111 | </View> |
| 112 | ); |
| 113 | } |
| 114 | |
| 115 | renderExamples(examples: any) { |
| 116 | const {Component, useGoogleMaps} = this.state; |
| 117 | |
| 118 | return ( |
| 119 | <View style={styles.container}> |
| 120 | {Component && ( |
| 121 | <Component |
| 122 | provider={useGoogleMaps ? PROVIDER_GOOGLE : PROVIDER_DEFAULT} |
| 123 | /> |
| 124 | )} |
| 125 | {Component && this.renderBackButton()} |
| 126 | {!Component && ( |
| 127 | <ScrollView |
| 128 | style={StyleSheet.absoluteFill} |
nothing calls this directly
no outgoing calls
no test coverage detected