Skip to content

Attach Ref to RadarMap #416

@tsellers1990

Description

@tsellers1990

Hello,

We're patching this missing ref functionality in, but I wanted to open the issue here to make it easier to see what we mean.

Currently, you can't apply a ref to the MapLibreGL map. If you attempt to apply a ref like this , it just applies it to the parent view. Not being able to use the MapView methods really limits what we can do with the map.

Here is the diff that solves that:

diff --git a/node_modules/react-native-radar/dist/ui/map.jsx b/node_modules/react-native-radar/dist/ui/map.jsx
index 528f95e..f88e172 100644
--- a/node_modules/react-native-radar/dist/ui/map.jsx
+++ b/node_modules/react-native-radar/dist/ui/map.jsx
@@ -114,6 +114,7 @@ const RadarMap = ({ mapOptions, children }) => {
   return (
     <View style={styles.mapContainer}>
       <MapLibreGL.MapView
+        ref={mapOptions?.mapRef}
         style={styles.map}
         pitchEnabled={false}
         compassEnabled={false}

This issue body was partially generated by patch-package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions