MCPcopy Create free account
hub / github.com/react-native-maps/react-native-maps / App

Class App

example/src/App.tsx:71–197  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69}
70
71export 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}>&larr;</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}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected