Skip to content

[Bug]: <Mapbox.Light> properties are ignored or cause errors (especially color and position array) #4091

@yuriiburov

Description

@yuriiburov

Mapbox Implementation

Mapbox

Mapbox Version

11.15.2

React Native Version

0.82.1

React Native Architecture

New Architecture (Fabric/TurboModules)

Platform

iOS, Android

@rnmapbox/maps version

10.2.7

Standalone component to reproduce

import React from 'react';
import {
  MapView,
  Light,
  Camera,
} from '@rnmapbox/maps';

class BugReportExample extends React.Component {
  render() {
    return (
      <MapView style={{flex: 1}} styleURL="mapbox://styles/mapbox/standard">
        <Camera
          centerCoordinate={[-122.39704267804365, 37.79723788407266]}
          pitch={80}
          heading={152.2}
          zoomLevel={16.7}
          animationMode={'flyTo'}
          animationDuration={1500}
        />
        <Light
          style={{
            anchor: 'viewport', // or 'map',
            color: '#0000ff', // doesn't work
            intensity: 0.85, // doesn't work
            position: [171, 60, 20], // doesn't work
          }}
        />
      </MapView>
    );
  }
}

Observed behavior and steps to reproduce

Issue with the color property:
Setting the color property to a direct HEX string, such as color: #0000ff, fails to change the scene's lighting color to yellow.
IOS error: Mapbox [error] Unexpeted value for color: 4278190335, retuning red

Expected behavior

The color property should correctly accept a HEX/RGB/HSL string, as described in the documentation.

The intensity and position properties should take precedence over the built-in lighting settings within the styleURL. This is necessary to allow for dynamic creation of custom lighting effects (e.g., long sunset shadows) without having to manually modify and strip the base style of its default lighting layers in Mapbox Studio.

Notes / preliminary analysis

No response

Additional links and references

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🪲Something isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions