Skip to content

[RN][iOS][google] Set region only when view has width&height#785

Merged
spikebrehm merged 1 commit intomasterfrom
gil/set-region-after-layout
Nov 10, 2016
Merged

[RN][iOS][google] Set region only when view has width&height#785
spikebrehm merged 1 commit intomasterfrom
gil/set-region-after-layout

Conversation

@gilbox
Copy link
Copy Markdown
Contributor

@gilbox gilbox commented Nov 10, 2016

  • Fix type issue in AIRMapManager
  • Setup Gemfile in example/ios dir to avoid problems with different versions of cocoapods
  • Update examples-setup.md to use bundler
  • Change MapView so that we only set the native region prop when there is a width and height. GoogleMaps iOS requires the width and height to properly calculate the map zoom level.

@spikebrehm @lelandrichardson

- Fix type issue in AIRMapManager
- Setup Gemfile in example/ios dir to avoid problems with different versions of cocoapods
- Update examples-setup.md to use bundler
- Change MapView so that we only set the native region prop when there is a width and height. GoogleMaps iOS requires the width and height to properly calculate the map zoom level.
Copy link
Copy Markdown

@spikebrehm spikebrehm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks

const { region, initialRegion } = this.props;
if (region && this.state.isReady) {
this.map.setNativeProps({ region });
} else if (initialRegion && this.state.isReady) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this no longer needed?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because of the change to _onLayout()?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For google+ios, this will cause a region calculation that is incorrect. For mapkit+ios it will cause the map to redundantly set the region because it will happen in _onLayout anyway.

cd ios
pod install
bundle install
bundle exec pod install
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need both? Can it just be the second?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@spikebrehm unless there is a way to add a command to run pod install from the Gemfile I think we need both.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh are you saying that bundle exec runs bundle install automatically? I don't know much about bundler tbh

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh no nevermind brainfart

@spikebrehm spikebrehm merged commit 498896f into master Nov 10, 2016
@spikebrehm spikebrehm deleted the gil/set-region-after-layout branch November 10, 2016 20:46
pinpong pushed a commit to pinpong/react-native-maps that referenced this pull request Feb 28, 2025
…fter-layout

[RN][iOS][google] Set region only when view has width&height
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