rnmapbox / rnmapbox/maps

[Bug]: Custom Styles on iOS

Open
#3,434 3 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug 🪲
Dominant language
Kotlin
Stars
2.9k
Forks
947
Avg merge
6d 37m
Merged PRs (30d)
1

Description

Mapbox Implementation

Mapbox

Mapbox Version

11

React Native Version

0.71.8

Platform

iOS

@rnmapbox/maps version

10.1.19

Standalone component to reproduce
import React from 'react'
import { Camera, MapView } from '@rnmapbox/maps'

  const MapCameraProps = {
        // styleJSON: '',  {/**anything other than the default styleJSON, ie an exported style json file from mapbox... I think it needs to have some v11 styling to be black */}
}

export default function App() {
  return (
    <MapView {...MapCameraProps} style={{ flex: 1 }} 
>
      <Camera
        zoomLevel={8}
      />
    </MapView>
  )
}




Observed behavior and steps to reproduce

When I comment out the styleJSON around line 25 the default style loads. If I uncomment it, and fresh restart, the style loads completely black with no map. I know the style works because if I change the style file and save it, uncomment the line, the hot reloading will allow the map to load.

Expected behavior

Map loads with expected styleJSON

Notes / preliminary analysis

Seems like something about how the style is getting loaded isn't allowing the custom style to load on iOS. Android works fine.

The style I'm loading is v11 and I believe I have all the things set up based on this guide: here

Additional links and references

Are other people running into this issue?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the standalone App reproduction and the linked ios/install.md guide, focusing on the MapView styleJSON entry point. Compare a fresh restart with hot reload on iOS and the working Android behavior. Done means the supplied v11 styleJSON renders normally on a fresh iOS launch without regressing the default style.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, react-native, typescript
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.