Replies: 1 comment
-
|
Thank you for your input. Please try to format your request more readable next time 🙏. Yes, it would be great to support |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Problem
Currently, there's no way to prevent infinite horizontal world wrapping in maplibre-react-native.
When users pan the map left or right, the world repeats infinitely, which creates a confusing UX for applications that want to display the map like a traditional "paper world map" with fixed edges.
Proposed Solution
Expose the native maximumScreenBounds property that already exists in MapLibre Native iOS (added in PR #2475, merged January 9, 2025).
Technical Details
iOS Implementation: The property already exists in MapLibre Native iOS 6.11.0+:
// From MLNMapView.h
@Property (nonatomic) MLNCoordinateBounds maximumScreenBounds;
What it does:
Constrains the entire visible screen area (not just the camera center) to stay within specified bounds
Prevents infinite world wrapping while still allowing zoom and pan within bounds
Matches the behavior of renderWorldCopies: false in MapLibre GL JS
Current Workarounds (All Inadequate):
--- Camera.maxBounds - Only restricts the camera center, doesn't prevent world wrapping
--- MapView.scrollEnabled={false} - Completely disables panning (too restrictive)
--- Manual bounds checking in onRegionIsChanging - Janky, doesn't work smoothly
Use Case
Displaying poll results or statistics on a world map where users need to:
Zoom in/out to see details
Pan within world boundaries
NOT see infinite repeating worlds when panning horizontally
What Needs to be Done
iOS (MapLibre Native iOS 6.17.1+):
Add property to MLRNMapViewManager.m:
RCT_REMAP_VIEW_PROPERTY(maximumScreenBounds, reactMaximumScreenBounds, MLNCoordinateBounds)
Add handling in MLRNMapView.m to convert the bounds prop to native type
Android (MapLibre Native Android):
Check if setLatLngBoundsForCameraTarget() provides equivalent functionality
Expose through MapView manager
TypeScript: Add to MapViewProps interface:
/**
*/
maximumScreenBounds?: {
ne: [number, number];
sw: [number, number];
};
Environment
maplibre-react-native version: 10.4.2
MapLibre Native iOS version: 6.17.1 (from podspec)
Platform: iOS & Android (Expo/EAS)
React Native version: 0.76+
Additional Context
The native iOS feature has been available since January 2025
Related MapLibre GL JS option: renderWorldCopies
Similar issue in rnmapbox: #372
Benefits
✅ Provides native, smooth bounds constraint
✅ Better UX than current workarounds
✅ Brings parity with MapLibre GL JS
✅ Requested by users building data visualization apps
Beta Was this translation helpful? Give feedback.
All reactions