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

add reuseIdentifier usage for custom iOS annotations to fix scroll away disappearing #426

Merged
merged 5 commits into from
Sep 30, 2016

Conversation

aksonov
Copy link
Contributor

@aksonov aksonov commented Sep 27, 2016

It appears that reuseIdentifier is mandatory to use custom views (i thought it is optional, just for performance improvements).
mapbox/mapbox-gl-native#6458 (comment)

@1ec5
Copy link
Contributor

1ec5 commented Sep 27, 2016

@bsudekum for review.

@1ec5 1ec5 added the ios label Sep 27, 2016
@1ec5
Copy link
Contributor

1ec5 commented Sep 29, 2016

Hi @aksonov, thanks for this PR. It looks like this PR does more than provide the reuse identifier. Can you describe what else has changed?

@1ec5
Copy link
Contributor

1ec5 commented Sep 29, 2016

Ah, I see that these changes were made in response to mapbox/mapbox-gl-native#6474.


-(void)layoutSubviews {
[super layoutSubviews];
[self.map restoreAnnotationPosition:self.id];
Copy link
Contributor

Choose a reason for hiding this comment

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

If the intent is to maintain the view’s center after changing its size, you can instead:

  1. Store the current center in a local variable.
  2. Call [super layoutSubviews].
  3. Set the center back to the value stored in (1).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@1ec5 Unfortunately it is not possible. When layoutSubviews is called, position is already changed by internal react native stuff (when JS changes size of that react view, for example).

@mrooding
Copy link
Contributor

It seems that this PR will need to be merged to fix the broken state of master due to #421. It's trying to import from ./Annotation which was not included in that PR

@1ec5
Copy link
Contributor

1ec5 commented Sep 30, 2016

Since this PR fixes a broken build, I'm going to go ahead and merge it. The manual annotation repositioning is probably unperformant and sort of defeats the purpose of using the SDK's view-backed annotation functionality, but that can be addressed in future PRs.

@1ec5 1ec5 merged commit a77830d into nitaliano:master Sep 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants