Perform function on press showUserLocation button in MapView of react-native-maps

Viewed 14

I want to perform a function whenever a user press current location button given by the react-native-maps

        <MapView 
          style={styles.map} 
          initialRegion={{
            latitude: pin.latitude || 31.497955,
            longitude: pin.longitude || 74.328312,
            latitudeDelta: 0.0922,
            longitudeDelta: 0.0421,
          }} 
          showsUserLocation={true} //here I want to perform a function when user click on the current location button
        >
          {pin.latitude && 
            <Marker
              coordinate={{latitude: pin.latitude, longitude: pin.longitude}}
              title={pin.title}
              description={pin.description}
              draggable
              onDragEnd={(e) => setPin({latitude: e.nativeEvent.coordinate.latitude, longitude: e.nativeEvent.coordinate.longitude})
            }
            />
          }
        </MapView>

Here is the visual (the button in top right corner), also can we change the position of the button?

enter image description here

0 Answers
Related