Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: resolves react snapshot undefined warning #2903

Merged
merged 1 commit into from
Jun 13, 2019

Conversation

jxeeno
Copy link
Contributor

@jxeeno jxeeno commented Jun 9, 2019

Does any other open PR do the same thing?

No

What issue is this PR fixing?

Resolves React warning being displayed when the region prop in MapView is undefined. React requires a snapshot value (or null) to be provided (see warning message below). This PR modifies getSnapshotBeforeUpdate in MapView to return null if props.region is undefined.

How did you test this PR?

Change is JS only and only affects library's interaction with React. However, the change was also tested on Android (on device) and iOS (device and simulator) to confirm warning is no longer triggered.

Steps to recreate and test for change:

  1. Create MapView without region prop defined, e.g.:
<MapView style={{flex: 1, width: '100%'}} />
  1. Run react native app and observe React warning in debug mode.
    image

  2. Now test with changes in this PR, warning should disappear.

@rborn rborn merged commit 99492e9 into react-native-maps:master Jun 13, 2019
@jxeeno jxeeno deleted the fix/shapshot-warning branch June 13, 2019 15:32
pohnean pushed a commit to pohnean/react-native-maps that referenced this pull request Jul 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants