Skip to content

fix(android): add RNMBXMapViewFactory.register - #4369

Merged
mfazekas merged 1 commit into
mainfrom
fix/android-mapview-factory-register
Oct 18, 2026
Merged

mfazekas merged 1 commit into
mainfrom
fix/android-mapview-factory-register

Conversation

@mfazekas

Copy link
Copy Markdown
Contributor

Description

On Android, RNMBXMapViewFactory.regiser(...) threw IndexOutOfBoundsException: Index: 1, Size: 1 for any id without a : (e.g. "custom"), because it destructured the result of split(":", limit = 2). This adds a correctly spelled register (matching iOS RNMBXMapViewFactory.register) that uses substringBefore(":"), and keeps regiser as a @Deprecated alias that delegates to it.

Reproduced on unfixed main with a JVM unit test calling RNMBXMapViewFactory.regiser("custom") { _, _ -> null } via ./gradlew :rnmapbox_maps:testDebugUnitTest; it fails at RNMBXMapView.kt:118 with the exception above and passes with this change. RNMBXMapViewFactoryTest covers register with and without options and the deprecated alias.

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

N/A

Component to reproduce the issue you're fixing

Native-only API; reproduced with a Kotlin unit test instead of a component:

@Test
fun `regiser without colon`() {
    RNMBXMapViewFactory.regiser("custom") { _, _ -> null }
}
// main: java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
//   at RNMBXMapViewFactory$Companion.regiser(RNMBXMapView.kt:118)

regiser threw for ids without ':'. Add register and keep regiser as a deprecated alias.
@mfazekas
mfazekas merged commit f6ea7de into main Oct 18, 2026
9 checks passed
@mfazekas
mfazekas deleted the fix/android-mapview-factory-register branch October 18, 2026 16:54

This branch was previously deployed

1 inactive deployment
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.

1 participant