-
Notifications
You must be signed in to change notification settings - Fork 694
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
Conversation
@bsudekum for review. |
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? |
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]; |
There was a problem hiding this comment.
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:
- Store the current
center
in a local variable. - Call
[super layoutSubviews]
. - Set the
center
back to the value stored in (1).
There was a problem hiding this comment.
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).
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 |
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. |
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)