Skip to content

feat: Feature state - #3741

Closed
davor-bauk-sh wants to merge 1 commit into
rnmapbox:mainfrom
davor-bauk-sh:feature-state
Closed

davor-bauk-sh wants to merge 1 commit into
rnmapbox:mainfrom
davor-bauk-sh:feature-state

Conversation

@davor-bauk-sh

@davor-bauk-sh davor-bauk-sh commented Jan 16, 2025

Copy link
Copy Markdown
Contributor

Description

Adds support for setting, getting, and removing feature state (issue #1807).

await this._map.setFeatureState('my-feature-id', { 'my-state-key': true }, 'my-source-id', 'my-source-layer-id');
await this._map.getFeatureState('my-feature-id', 'my-source-id', 'my-source-layer-id');
await this._map.removeFeatureState('my-feature-id', 'my-state-key', 'my-source-id', 'my-source-layer-id');

Notes

I had trouble building the Android example project, which I solved by adding this to /example/android/settings.gradle:

includeBuild('../android')

Checklist

  • I've read CONTRIBUTING.md
  • I updated the doc/other generated code with running yarn generate in the root folder
  • I have tested the new feature on /example app.
    • In V11 mode/ios
    • In New Architecture mode/ios
    • In V11 mode/android
    • In New Architecture mode/android
  • I added/updated a sample - if a new feature was implemented (/example)

Screenshot OR Video

iOS:

feature-state-ios-oldarch-scaled.mp4

iOS (v11):

feature-state-ios-oldarch-v11-scaled.mp4

iOS (New Architecture):

feature-state-ios-newarch-scaled.mp4

iOS (v11, New Architecture):

feature-state-ios-newarch-v11-scaled.mp4

Android:

feature-state-oldarch-scaled.mp4

Android (v11):

feature-state-oldarch-v11-scaled.mp4

Android (New Architecture):

feature-state-newarch-scaled.mp4

Android (v11, New Architecture):

feature-state-newarch-v11-scaled.mp4

Comment thread android/src/main/java/com/rnmapbox/rnmbx/components/mapview/RNMBXMapView.kt Outdated
Comment thread android/src/main/java/com/rnmapbox/rnmbx/components/mapview/RNMBXMapView.kt Outdated
Comment thread android/src/main/java/com/rnmapbox/rnmbx/utils/ViewTagResolver.kt Outdated
@DavidAmyot

Copy link
Copy Markdown

@mfazekas Is there a reason why this feature is not moved forward? It would be quite convenient in many different cases. Thank you :)

@mfazekas

mfazekas commented Aug 12, 2025

Copy link
Copy Markdown
Contributor

@davor-bauk-sh thanks much for looking into it, amazing work! Looks great for the first glance will be looking into it in details later this week. Sorry for the long turnaround

@mfazekas

Copy link
Copy Markdown
Contributor

@davor-bauk-sh there are some android ci failures, you might need to rebase to/merge current main

@davor-bauk-sh

Copy link
Copy Markdown
Contributor Author

@mfazekas Rebased my branch on main. Hopefully CI will pass, otherwise I might need some help looking into the CI failures.

@mfazekas mfazekas mentioned this pull request Sep 5, 2025
8 tasks
@mfazekas

mfazekas commented Sep 7, 2025

Copy link
Copy Markdown
Contributor

@davor-bauk-sh for some reason I wasn't able to get this working on this branch. I've needed to add v11 callback support, but otherwise it was working nice. It's merged now, thanks again!

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.

4 participants