react-native-maps 1.24.5 → 1.24.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -42,16 +42,29 @@ export interface FabricMapHandle {
42
42
  setIndoorActiveLevelIndex: (activeLevelIndex: number) => void;
43
43
  }
44
44
 
45
+ // Helper to safely get a node handle for supported types
46
+ function getNodeHandle(ref: unknown): null | number {
47
+ if (
48
+ ref === null ||
49
+ typeof ref === 'number' ||
50
+ (typeof ref === 'object' && ref !== null && '_reactInternals' in ref)
51
+ ) {
52
+ // @ts-expect-error: safe for findNodeHandle
53
+ return findNodeHandle(ref);
54
+ }
55
+ return null;
56
+ }
57
+
45
58
  const createFabricMap = (ViewComponent: React.ComponentType, Commands: any) => {
46
59
  return forwardRef<FabricMapHandle | null, FabricMapViewProps>(
47
60
  (props, ref) => {
48
- const fabricRef = useRef<React.ElementRef<typeof ViewComponent>>(null);
61
+ const fabricRef = useRef<React.ComponentRef<typeof ViewComponent>>(null);
49
62
 
50
63
  useImperativeHandle(ref, () => ({
51
64
  async getMarkersFrames(onlyVisible: boolean) {
52
65
  if (fabricRef.current) {
53
66
  return NativeAirMapsModule.getMarkersFrames(
54
- findNodeHandle(fabricRef.current) ?? -1,
67
+ getNodeHandle(fabricRef.current) ?? -1,
55
68
  onlyVisible,
56
69
  );
57
70
  } else {
@@ -63,7 +76,7 @@ const createFabricMap = (ViewComponent: React.ComponentType, Commands: any) => {
63
76
  async getCoordinateForPoint(point: Point) {
64
77
  if (fabricRef.current) {
65
78
  return NativeAirMapsModule.getCoordinateForPoint(
66
- findNodeHandle(fabricRef.current) ?? -1,
79
+ getNodeHandle(fabricRef.current) ?? -1,
67
80
  point,
68
81
  );
69
82
  } else {
@@ -75,7 +88,7 @@ const createFabricMap = (ViewComponent: React.ComponentType, Commands: any) => {
75
88
  async getPointForCoordinate(coordinate: LatLng) {
76
89
  if (fabricRef.current) {
77
90
  return NativeAirMapsModule.getPointForCoordinate(
78
- findNodeHandle(fabricRef.current) ?? -1,
91
+ getNodeHandle(fabricRef.current) ?? -1,
79
92
  coordinate,
80
93
  );
81
94
  } else {
@@ -87,7 +100,7 @@ const createFabricMap = (ViewComponent: React.ComponentType, Commands: any) => {
87
100
  async getAddressFromCoordinates(coordinate: LatLng) {
88
101
  if (fabricRef.current) {
89
102
  return NativeAirMapsModule.getAddressFromCoordinates(
90
- findNodeHandle(fabricRef.current) ?? -1,
103
+ getNodeHandle(fabricRef.current) ?? -1,
91
104
  coordinate,
92
105
  );
93
106
  } else {
@@ -99,7 +112,7 @@ const createFabricMap = (ViewComponent: React.ComponentType, Commands: any) => {
99
112
  async takeSnapshot(config: SnapshotOptions) {
100
113
  if (fabricRef.current) {
101
114
  return NativeAirMapsModule.takeSnapshot(
102
- findNodeHandle(fabricRef.current) ?? -1,
115
+ getNodeHandle(fabricRef.current) ?? -1,
103
116
  JSON.stringify(config),
104
117
  );
105
118
  } else {
@@ -111,7 +124,7 @@ const createFabricMap = (ViewComponent: React.ComponentType, Commands: any) => {
111
124
  async getCamera() {
112
125
  if (fabricRef.current) {
113
126
  return NativeAirMapsModule.getCamera(
114
- findNodeHandle(fabricRef.current) ?? -1,
127
+ getNodeHandle(fabricRef.current) ?? -1,
115
128
  );
116
129
  } else {
117
130
  throw new Error('getCamera is only supported on iOS with Fabric.');
@@ -120,7 +133,7 @@ const createFabricMap = (ViewComponent: React.ComponentType, Commands: any) => {
120
133
  async getMapBoundaries() {
121
134
  if (fabricRef.current) {
122
135
  return NativeAirMapsModule.getMapBoundaries(
123
- findNodeHandle(fabricRef.current) ?? -1,
136
+ getNodeHandle(fabricRef.current) ?? -1,
124
137
  );
125
138
  } else {
126
139
  throw new Error(
@@ -306,7 +306,7 @@ export type RegionChangeEvent = Readonly<{
306
306
  latitudeDelta: Double; // Non-nullable Double for latitudeDelta
307
307
  longitudeDelta: Double; // Non-nullable Double for longitudeDelta
308
308
  }; // The region object
309
- continuous?: boolean;
309
+ isGesture?: boolean;
310
310
  }>;
311
311
 
312
312
  export type RegionChangeEventHandler = BubblingEventHandler<RegionChangeEvent>;
@@ -300,7 +300,7 @@ export type RegionChangeEvent = Readonly<{
300
300
  latitudeDelta: Double; // Non-nullable Double for latitudeDelta
301
301
  longitudeDelta: Double; // Non-nullable Double for longitudeDelta
302
302
  }; // The region object
303
- continuous?: boolean;
303
+ isGesture?: boolean;
304
304
  }>;
305
305
  export type UserLocationChangeEvent = Readonly<{
306
306
  coordinate?: {