[iOS] [Apple Maps] [New Architecture] Custom markers intermittently disappear after zoom/pan
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 48/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 技术栈
- ios, react-native, typescript
- 领域
- mobile
调研方向
Start by running the provided TSX reproduction with New Architecture enabled on iOS, focusing on MapView, Marker, and the onRegionChangeComplete update. Compare marker behavior during pan and zoom with New Architecture disabled, then trace the Apple Maps native reconciliation path. Done means all visible custom image markers remain present after gestures without changing the underlying data.
由索引模型根据 Issue 内容生成。
描述
Summary
Custom components with image children intermittently disappear from MKMapView after zoom or pan gestures when New Architecture is enabled on Expo SDK 54 (RN 0.81). Markers are still present in React state — a bottom sheet showing the same data array remains complete — and sometimes reappear on subsequent renders. This does not occur with New Architecture disabled.
This is distinct from #5877 (Android) and #5908 (iOS Google Maps) — this affects Apple Maps on iOS specifically, where markers render initially but are silently dropped by the native layer during reconciliation triggered by map gestures.
Reproducible sample code
import React, { useState, useRef, useCallback, useEffect } from 'react';
import { View, Image, StyleSheet, Animated } from 'react-native';
import MapView, { Marker } from 'react-native-maps';
const INITIAL_MARKERS = [
{ id: '1', lat: 37.7882, long: -122.4324 },
{ id: '2', lat: 37.7902, long: -122.4344 },
{ id: '3', lat: 37.7862, long: -122.4304 },
{ id: '4', lat: 37.7842, long: -122.4354 },
{ id: '5', lat: 37.7922, long: -122.4314 },
];
function MarkerComponent({ marker, isSelected, onPress }) {
const scaleAnim = useRef(new Animated.Value(0)).current;
useEffect(() => {
Animated.spring(scaleAnim, {
toValue: 1,
friction: 5,
tension: 50,
useNativeDriver: true,
}).start();
}, []);
return (
<Marker
coordinate={{ latitude: marker.lat, longitude: marker.long }}
tracksViewChanges={false}
anchor={{ x: 0.5, y: 0.5 }}
onPress={onPress}
>
<Animated.View
style={{
transform: [{ scale: scaleAnim }],
alignItems: 'center',
justifyContent: 'center',
}}
>
<View style={[
styles.markerContent,
isSelected && { borderWidth: 3, borderColor: '#00A811' }
]}>
<Image
source={{ uri: 'https://reactnative.dev/img/tiny_logo.png' }}
style={styles.markerImage}
/>
</View>
</Animated.View>
</Marker>
);
}
export default function App() {
const [markers, setMarkers] = useState(INITIAL_MARKERS);
const [selectedId, setSelectedId] = useState(null);
// Replacing array with new object references on every region change
// simulates real-world cache/filter pattern that triggers the bug
const handleRegionChangeComplete = useCallback(() => {
setMarkers(INITIAL_MARKERS.map(m => ({ ...m })));
}, []);
return (
<View style={styles.container}>
<MapView
style={styles.map}
initialRegion={{
latitude: 37.78825,
longitude: -122.4324,
latitudeDelta: 0.05,
longitudeDelta: 0.05,
}}
onRegionChangeComplete={handleRegionChangeComplete}
>
{markers.map((marker) => (
<MarkerComponent
key={`marker_${marker.id}`}
marker={marker}
isSelected={selectedId === marker.id}
onPress={() => setSelectedId(marker.id)}
/>
))}
</MapView>
</View>
);
}
const styles = StyleSheet.create({
container: { flex: 1 },
map: { ...StyleSheet.absoluteFillObject },
markerContent: {
backgroundColor: 'white',
borderRadius: 8,
padding: 4,
alignItems: 'center',
shadowColor: '#000',
shadowOffset: { width: 0, height: 2 },
shadowOpacity: 0.3,
shadowRadius: 3,
},
markerImage: {
width: 30,
height: 30,
},
});
Steps to reproduce
Enable New Architecture in app.json: "newArchEnabled": true (default on Expo SDK 54)
Run the reproducible sample above on a physical iOS device or simulator
Allow markers to fully render on initial load
Zoom out then zoom back in, or pan the map in any direction
Observe: one or more markers within the visible viewport disappear entirely
Note: the underlying data array is unchanged — only the native map view drops the markers
Expected result
The markers in current view are all visible on the map
Actual result
Some markers disappear after pan/zoom in/out
React Native Maps Version
1.20.1
What platforms are you seeing the problem on?
iOS (Apple Maps)
React Native Version
0.81.5
What version of Expo are you using?
SDK 53
Device(s)
iphone 16 pro, iphone 17
Additional information
Expo SDK 54, but was also visible on SDK53
- 主要语言
- TypeScript
- 星标
- 16k
- 派生
- 5k
- 平均合并
- 17 小时 45 分钟
- 30 天内合并 PR
- 2
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
react-native-maps/react-native-maps 的其他 Issue
-
难度 1/5 1-3 小时 新手友好度 88/100
-
难度 2/5 1-3 小时 新手友好度 88/100
-
难度 1/5 1 小时以内 新手友好度 90/100
-
难度 2/5 1-3 小时 新手友好度 78/100
-
难度 2/5 1-3 小时 新手友好度 84/100
react-native-maps/react-native-maps#5987 · 1 条评论 ·
查看 react-native-maps/react-native-maps 的全部 Issue
相似的 Issue
-
blocklist removal
难度 2/5 1-3 小时 新手友好度 65/100
MetaMask/eth-phishing-detect#296544 ·
-
难度 2/5 1-3 小时 新手友好度 70/100
pastelsky/bundlephobia#1122 ·
-
难度 2/5 1-3 小时 新手友好度 70/100
-
category/development priority/P2 scope/file-operations scope/testing type/enhancement
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 75/100