[Bug]: Unexpectedly found nil while implicitly unwrapping an Optional value
Nobody has claimed this yet.
- Dominant language
- Kotlin
- Stars
- 2.9k
- Forks
- 947
- Avg merge
- 6d 37m
- Merged PRs (30d)
- 1
Description
Mapbox Version
default
React Native Version
0.84.1
Platform
iOS
@rnmapbox/maps version
10.3.0
Standalone component to reproduce
import React from 'react';
import {
Images,
MapView,
ShapeSource,
LineLayer,
Camera,
} from '@rnmapbox/maps';
const aLine = {
type: 'LineString',
coordinates: [
[-74.00597, 40.71427],
[-74.00697, 40.71527],
],
};
class BugReportExample extends React.Component {
render(props) {
return (
<MapView style={{flex: 1}}>
{/* real images object should be passed with at least one png */}
<Images images={{}} />
<Camera centerCoordinate={[-74.00597, 40.71427]} zoomLevel={14} />
<ShapeSource id="idStreetLayer" shape={aLine}>
<LineLayer id="idStreetLayer" />
</ShapeSource>
</MapView>
);
}
}
Observed behavior and steps to reproduce
After upgrading to RN 0.84.1, app on iOS started crashing immediately due to usage of the <Images images={images} /> component with a native error saying Unexpectedly found nil while implicitly unwrapping an Optional value. Images object can be as simple as {icon: importedPngIcon}
Does not crash if no images are passed into component
Tried using both images/nativeAssetImages
Happens in both debug and release modes
Xcode 26.4, but happened on 26.3 version as well
import React from 'react';
import {
Images,
MapView,
ShapeSource,
LineLayer,
Camera,
} from '@rnmapbox/maps';
const aLine = {
type: 'LineString',
coordinates: [
[-74.00597, 40.71427],
[-74.00697, 40.71527],
],
};
class BugReportExample extends React.Component {
render(props) {
return (
<MapView style={{flex: 1}}>
{/* real images object should be passed with at least one png */}
<Images images={{}} />
<Camera centerCoordinate={[-74.00597, 40.71427]} zoomLevel={14} />
<ShapeSource id="idStreetLayer" shape={aLine}>
<LineLayer id="idStreetLayer" />
</ShapeSource>
</MapView>
);
}
}
Expected behavior
App should not crash
Notes / preliminary analysis
No response
Additional links and references
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the standalone reproduction, especially the Images component using images={{}} and the alternative nativeAssetImages path. Trace the Images component's iOS native handling and reproduce the crash in both debug and release modes; done means the example no longer crashes when images are supplied or omitted.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ios, javascript, react-native
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100