This is what I am trying to do:
I'm trying to put a transparent circle on the map view (like a magnifying glass) with a dark blue overlay on the sides. This is what I have so far (it's purposely black):
import React from 'react';
import {
StyleSheet,
Text,
View,
} from 'react-native';
import MapView from 'react-native-maps';
const GEOFENCE_RANGE = 0.01;
const OrderMap = props => {
return (
<View style={[props.style, styles.container]} >
<MapView style={styles.map}
scrollEnabled={false}
initialRegion={{
latitude: 37.78825,
longitude: -122.4324,
}}
/>
<View style={styles.overlay}>
<View style={styles.circle}/>
</View>
</View>
)
};
const styles = StyleSheet.create({
container: {
position: 'relative',
},
map: {
flex: 1,
},
overlay: {
backgroundColor: 'rgba(21,31,53, 0.5)',
position: 'absolute',
top: 0,
right: 0,
bottom: 0,
left: 0,
alignItems: 'center',
justifyContent: 'center',
},
circle: {
backgroundColor: 'black', // <---------------------------
borderRadius: 100,
alignSelf: 'stretch',
flex: 1,
margin: 50,
}
});
export default OrderMap;
When I try to change styles.overlay
to use backgroundColor: 'transparent'
, it just makes the whole thing dark blue.
Is there a way to do this?
P.S. I'm using react native maps https://github.com/airbnb/react-native-maps