Skip to content

fix: issue with maxPitch MapView config setting not propagating to native components#4191

Open
KijongHan wants to merge 2 commits intornmapbox:mainfrom
KijongHan:fix/issue-with-max-pitch-config-not-propagating-to-native
Open

fix: issue with maxPitch MapView config setting not propagating to native components#4191
KijongHan wants to merge 2 commits intornmapbox:mainfrom
KijongHan:fix/issue-with-max-pitch-config-not-propagating-to-native

Conversation

@KijongHan
Copy link
Copy Markdown
Contributor

@KijongHan KijongHan commented Apr 3, 2026

Description

Fixes #4138

  • iOS fix: maxPitch prop in iOS Fabric component view not getting propagated from javascript in the remap logic
  • Android/iOS fix: issue with min/max pitch config settings getting disposed when camera bounds are changed and updateMaxBounds handler is called

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

Android:

Screen_Recording_20260403_165006_RNMapboxExample.mp4

iOS:

Screen.Recording.2026-04-03.at.8.29.36.PM.mov

Component to reproduce the issue you're fixing

Use the following code to replace BugReportExample.js

import React from 'react';
import {View, TouchableOpacity, Text, StyleSheet} from 'react-native';
import {
  Images,
  MapView,
  ShapeSource,
  SymbolLayer,
  CircleLayer,
  Camera,
  VectorSource,
  LineLayer,
  RasterArraySource,
  RasterParticleLayer,
} from '@rnmapbox/maps';

const features = {
  type: 'FeatureCollection',
  features: [
    {
      type: 'Feature',
      id: 'a-feature',
      properties: {
        icon: 'example',
        text: 'example-icon-and-label',
      },
      geometry: {
        type: 'Point',
        coordinates: [-74.00597, 40.71427],
      },
    },
    {
      type: 'Feature',
      id: 'b-feature',
      properties: {
        text: 'just-label',
      },
      geometry: {
        type: 'Point',
        coordinates: [-74.001097, 40.71527],
      },
    },
    {
      type: 'Feature',
      id: 'c-feature',
      properties: {
        icon: 'example',
      },
      geometry: {
        type: 'Point',
        coordinates: [-74.00697, 40.72427],
      },
    },
  ],
};

const aLine = {
  type: 'LineString',
  coordinates: [
    [-74.00597, 40.71427],
    [-74.00697, 40.71527],
  ],
};


class BugReportExample extends React.Component {
  state = {
    pitch: 0,
  };

  changePitch(delta) {
    this.setState((prev) => ({
      pitch: prev.pitch + delta,
    }));
  }

  render() {
    const { pitch } = this.state;
    return (
      <View style={{flex: 1}}>
        <MapView pitchEnabled maxPitch={45.5} style={{flex: 1}}>
          <Camera
            centerCoordinate={[-74.00597, 40.71427]}
            zoomLevel={14}
            pitch={pitch}
          />
          <ShapeSource id="idStreetLayer" shape={aLine}>
            <LineLayer id="idStreetLayer" />
          </ShapeSource>
        </MapView>
        <View style={pitchStyles.controls}>
          <TouchableOpacity
            style={pitchStyles.button}
            onPress={() => this.changePitch(-5)}>
            <Text style={pitchStyles.buttonText}>- Pitch</Text>
          </TouchableOpacity>
          <Text style={pitchStyles.label}>{pitch}°</Text>
          <TouchableOpacity
            style={pitchStyles.button}
            onPress={() => this.changePitch(5)}>
            <Text style={pitchStyles.buttonText}>+ Pitch</Text>
          </TouchableOpacity>
        </View>
      </View>
    );
  }
}

const pitchStyles = StyleSheet.create({
  controls: {
    flexDirection: 'row',
    justifyContent: 'center',
    alignItems: 'center',
    padding: 50,
  },
  button: {
    backgroundColor: '#4A90D9',
    paddingHorizontal: 16,
    paddingVertical: 10,
    borderRadius: 6,
    marginHorizontal: 8,
  },
  buttonText: {
    color: '#fff',
    fontWeight: 'bold',
  },
  label: {
    fontSize: 16,
    fontWeight: 'bold',
    minWidth: 40,
    textAlign: 'center',
  },
});

export default BugReportExample;

- fix: maxPitch prop in iOS Fabric component view not getting propagated from javascript
@KijongHan KijongHan requested a deployment to CI with Mapbox Tokens April 3, 2026 07:28 — with GitHub Actions Waiting
@KijongHan KijongHan requested a deployment to CI with Mapbox Tokens April 3, 2026 07:28 — with GitHub Actions Waiting
@KijongHan KijongHan requested a deployment to CI with Mapbox Tokens April 3, 2026 07:28 — with GitHub Actions Waiting
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.

[Bug]: maxPitch not working

1 participant