Skip to content

Commit

Permalink
feat(MapView): remove redundant onMarkerPress interception
Browse files Browse the repository at this point in the history
See react-native-maps#1741. I'm not really sure if it fixed
anything back then, or just helped making it easier to access the data
of the nativeEvent.

Either way, this will never be called today, as the consumer-provided
prop will override this, as the consumer props are spread AFTER
this is passed, as opposed to back when the fix was introduced.
  • Loading branch information
monholm committed Oct 4, 2021
1 parent c718c99 commit 7489f21
Showing 1 changed file with 0 additions and 9 deletions.
9 changes: 0 additions & 9 deletions src/MapView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ class MapView extends React.Component<Props, State, SnapShot> {
};

this._onMapReady = this._onMapReady.bind(this);
this._onMarkerPress = this._onMarkerPress.bind(this);
this._onChange = this._onChange.bind(this);
this._onLayout = this._onLayout.bind(this);
}
Expand Down Expand Up @@ -259,12 +258,6 @@ class MapView extends React.Component<Props, State, SnapShot> {
}
}

_onMarkerPress(event) {
if (this.props.onMarkerPress) {
this.props.onMarkerPress(event.nativeEvent);
}
}

private _onChange({ nativeEvent }: ChangeEvent) {
this.__lastRegion = nativeEvent.region;
const isGesture = nativeEvent.isGesture;
Expand Down Expand Up @@ -587,7 +580,6 @@ class MapView extends React.Component<Props, State, SnapShot> {
props = {
region: null,
initialRegion: null,
onMarkerPress: this._onMarkerPress,
onChange: this._onChange,
onMapReady: this._onMapReady,
onLayout: this._onLayout,
Expand All @@ -606,7 +598,6 @@ class MapView extends React.Component<Props, State, SnapShot> {
style: this.props.style,
region: null,
initialRegion: null,
onMarkerPress: this._onMarkerPress,
onChange: this._onChange,
onMapReady: this._onMapReady,
onLayout: this._onLayout,
Expand Down

0 comments on commit 7489f21

Please sign in to comment.