-
-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[10.0.0-alpha.5] _cameraRef?.current?.setCamera causing markerpoint get detached from maps-base #409
Comments
Did you fix the issue? @ngdbao |
sadly, not yet :) |
can you share the code used for adding the markers or the vector layer |
it's simply a PointAnnotation with prop draggable false, wrapping a raw react native component children |
@ngdbao Could you show more code? Maybe some small example which will help us reproduce error? Especially code related to adding your markers. |
Hi, I renderred the markerpoint by Pointannotation geo coordinate and anchor like this: const renderMarkerPoint = useMemo(
() =>
dataCheckpointWithKeyid?.map((mark, index) => {
return viewMapLoaded ? (
<MarkerPoint
key={`${(index || -1) + 1}`}
index={index}
item={mark}
onPressChangePoint={onPressChangePoint}
// onChangeViewCamera={onChangeViewCamera}
isLastItem={index === dataCheckpointWithKeyid.length - 1}
isFirstItem={index === 0}
/>
) : null;
}),
[dataCheckpointWithKeyid, viewMapLoaded],
); const MarkerPoint = ({
item,
index,
onPressChangePoint,
isLastItem,
isFirstItem,
}) => {
const [imageLoaded, setImageLoaded] = useState(false);
const markerRef = useRef<any>(null);
const id = String(index);
const handleOnLoad = useCallback(() => {
Platform.OS === 'android' ? setImageLoaded(true) : null;
}, []);
useEffect(() => {
if (imageLoaded) {
markerRef?.current?.refresh();
console.log(`====Image ${index} refresh====`);
}
}, [imageLoaded]);
const handleSelected = useCallback(() => {
onPressChangePoint?.(index);
}, [index, onPressChangePoint]);
const anchor = useMemo(() => {
return isLastItem ? { x: 0.5, y: 0.4 } : isFirstItem ? { x: 0.5, y: 1 } : { x: 0.46, y: 0.21 };
}, [isFirstItem, isLastItem]);
const MapCheckPoint = (
<MapLibreGL.PointAnnotation
key={id}
ref={markerRef}
id={id}
anchor={anchor}
coordinate={[item?.geo?.lon || 0, item?.geo?.lat || 0]}
draggable={false}
onSelected={handleSelected}>
<View style={stylesCallout.checkpointContainer}>
<View style={stylesCallout.container}>
<View style={stylesCallout.content}>
<AppImage
disabled={true}
url={item?.images}
defaultSource={CHECKPOINT_ICON}
style={stylesCallout.startImage}
onLoad={handleOnLoad}
shouldLoading
resizeMode="cover"
/>
<AppText style={stylesCallout.textStart}>{MapDefaultText.START || ''}</AppText>
<AppText numberOfLines={1} style={stylesCallout.locationStart}>
{truncateText(item?.location, 25) || ''}
</AppText>
</View>
</View>
</View>
</MapLibreGL.PointAnnotation>
);
return MapCheckPoint;
};
MarkerPoint.propTypes = {
item: PropTypes.any,
index: PropTypes.number,
onPressChangePoint: PropTypes.func,
isLastItem: PropTypes.bool,
isFirstItem: PropTypes.bool,
onChangeViewCamera: PropTypes.func,
viewMapLoaded: PropTypes.bool,
};
export default React.memo(MarkerPoint); only PointAnnotation, but ShapeSource or LineLayer works fine |
I'm having a similar issue with PointAnnotation being detached from the basemap coordinates, but only on iOS. On Android, my PointAnnotations work wonderfully. On iOS, they are all stuck at the top-left (0,0) view coordinates of the MapView. I've determined that the coordinate properties of the PointAnnotations are correctly being set with valid geographic coordinates. I'm on the bleeding edge, with 10.0.0-alpha.10 and I've customized the iOS Podfile to work with the latest MapLibre Native 6.5.4. |
Is anyone still seeing such problems with |
In my testing with 10.0.0-alpha.25, PointAnnotation is now actually being positioned properly at geographic coordinates on iOS! That's progress!
|
Will need a reproduction. It's working in our app: ScreenRecording_11-14-2024.19-21-58_1.mp4 |
context:
{renderMarkerPoint}
{renderUnSelectedMarkerPoint}
{renderSelectedMarkerPoint}
are using
MapLibreGL.PointAnnotation
MapLibreGL.ShapeSource
MapLibreGL.LineLayer
tap on any of them, would trigger this function to move camera (which triggered by onSelected prop)
Expected Behavior
Everything works well on v8 or v9 as normal, just move camera only when tapping markers
Actual Behavior
On pre-release version v10
all of markers, and camera view get detached from map base, please take a look on this video:
RPReplay_Final1718697445.mp4
Version(s) affected
The text was updated successfully, but these errors were encountered: