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

Method render

example/src/examples/CachedMap.tsx:37–80  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

35 }
36
37 render() {
38 const {width} = Dimensions.get('window');
39 const mapSize = width - HORIZONTAL_PADDING * 2;
40 return (
41 <View style={styles.container}>
42 <View style={styles.buttonContainer}>
43 <TouchableOpacity
44 onPress={() => this.toggleCache()}
45 style={[styles.bubble, styles.button]}>
46 <Text style={styles.buttonText}>
47 {this.state.cache ? 'Cached' : 'Not cached'}
48 </Text>
49 </TouchableOpacity>
50 </View>
51 <FlatList
52 data={this.state.data}
53 renderItem={({item: region}) => (
54 <View style={styles.item}>
55 <Text>{region.name}</Text>
56 <MapView
57 provider={this.props.provider}
58 style={{
59 width: mapSize,
60 height: mapSize,
61 }}
62 initialRegion={region}
63 cacheEnabled={this.state.cache}
64 zoomEnabled
65 loadingIndicatorColor="#666666"
66 loadingBackgroundColor="#eeeeee">
67 <Marker
68 coordinate={region}
69 centerOffset={{x: -18, y: -60}}
70 anchor={{x: 0.69, y: 1}}
71 image={flagImg}
72 />
73 </MapView>
74 </View>
75 )}
76 keyExtractor={(item, index) => index.toString()}
77 />
78 </View>
79 );
80 }
81}
82
83const styles = StyleSheet.create({

Callers

nothing calls this directly

Calls 1

toggleCacheMethod · 0.95

Tested by

no test coverage detected