react-native-radar 3.31.0-beta.1 → 3.31.0
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.
- package/android/src/newarch/java/com/radar/RadarModule.kt +1 -1
- package/android/src/oldarch/java/com/radar/RadarModule.java +1 -1
- package/dist/@types/types.d.ts +2 -7
- package/dist/ui/autocomplete.js +2 -3
- package/dist/ui/autocomplete.jsx +1 -1
- package/dist/ui/map.jsx +27 -44
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/ios/RNRadar.mm +45 -17
- package/package.json +4 -5
- package/src/@types/types.ts +2 -7
- package/src/ui/autocomplete.jsx +1 -1
- package/src/ui/map.jsx +27 -44
- package/src/version.ts +1 -1
- package/src/@types/maplibre-react-native.d.ts +0 -16
|
@@ -143,7 +143,7 @@ class RadarModule(reactContext: ReactApplicationContext) :
|
|
|
143
143
|
override fun initialize(publishableKey: String, fraud: Boolean): Unit {
|
|
144
144
|
val editor = reactApplicationContext.getSharedPreferences("RadarSDK", Context.MODE_PRIVATE).edit()
|
|
145
145
|
editor.putString("x_platform_sdk_type", "ReactNative")
|
|
146
|
-
editor.putString("x_platform_sdk_version", "3.31.0
|
|
146
|
+
editor.putString("x_platform_sdk_version", "3.31.0")
|
|
147
147
|
editor.apply()
|
|
148
148
|
|
|
149
149
|
Radar.initialize(reactApplicationContext, publishableKey, radarReceiver, Radar.RadarLocationServicesProvider.GOOGLE, fraud, null, radarInAppMessageReceiver, currentActivity)
|
|
@@ -102,7 +102,7 @@ public class RadarModule extends ReactContextBaseJavaModule implements Permissio
|
|
|
102
102
|
this.fraud = fraud;
|
|
103
103
|
SharedPreferences.Editor editor = getReactApplicationContext().getSharedPreferences("RadarSDK", Context.MODE_PRIVATE).edit();
|
|
104
104
|
editor.putString("x_platform_sdk_type", "ReactNative");
|
|
105
|
-
editor.putString("x_platform_sdk_version", "3.31.0
|
|
105
|
+
editor.putString("x_platform_sdk_version", "3.31.0");
|
|
106
106
|
editor.apply();
|
|
107
107
|
Radar.initialize(getReactApplicationContext(), publishableKey, receiver, Radar.RadarLocationServicesProvider.GOOGLE, fraud, null, inAppMessageReceiver, getCurrentActivity());
|
|
108
108
|
if (fraud) {
|
package/dist/@types/types.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import type { MapRef } from "@maplibre/maplibre-react-native";
|
|
3
1
|
export type RadarMetadata = Record<string, string | number | boolean>;
|
|
4
2
|
export interface RadarTrackOnceOptions {
|
|
5
3
|
location?: Location;
|
|
@@ -546,8 +544,7 @@ export type RadarTripStatus = "unknown" | "started" | "approaching" | "arrived"
|
|
|
546
544
|
export interface RadarMapOptions {
|
|
547
545
|
mapStyle?: string;
|
|
548
546
|
showUserLocation?: boolean;
|
|
549
|
-
|
|
550
|
-
onRegionDidChange?: (event: RadarMapRegionChangeEvent) => void;
|
|
547
|
+
onRegionDidChange?: (feature: RadarMapRegionChangeEvent) => void;
|
|
551
548
|
onDidFinishLoadingMap?: () => void;
|
|
552
549
|
onWillStartLoadingMap?: () => void;
|
|
553
550
|
onDidFailLoadingMap?: () => void;
|
|
@@ -555,9 +552,7 @@ export interface RadarMapOptions {
|
|
|
555
552
|
export interface RadarMapRegionChangeEvent {
|
|
556
553
|
center: [number, number];
|
|
557
554
|
zoom: number;
|
|
558
|
-
bounds?: [
|
|
555
|
+
bounds?: [number, number, number, number];
|
|
559
556
|
bearing?: number;
|
|
560
557
|
pitch?: number;
|
|
561
|
-
animated: boolean;
|
|
562
|
-
userInteraction: boolean;
|
|
563
558
|
}
|
package/dist/ui/autocomplete.js
CHANGED
|
@@ -48,7 +48,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
48
48
|
// Autocomplete.js
|
|
49
49
|
const react_1 = __importStar(require("react"));
|
|
50
50
|
const react_native_1 = require("react-native");
|
|
51
|
-
const react_native_safe_area_context_1 = require("react-native-safe-area-context");
|
|
52
51
|
const index_native_1 = __importDefault(require("../index.native"));
|
|
53
52
|
const images_1 = require("./images");
|
|
54
53
|
const styles_1 = __importDefault(require("./styles"));
|
|
@@ -184,7 +183,7 @@ const autocompleteUI = ({ options = {} }) => {
|
|
|
184
183
|
</react_native_1.Animated.View>
|
|
185
184
|
<react_native_1.Modal animationType="slide" transparent={false} visible={isOpen} onRequestClose={() => setIsOpen(false)}>
|
|
186
185
|
<react_native_1.Animated.View style={{ flex: 1, opacity: modalOpacity }}>
|
|
187
|
-
<
|
|
186
|
+
<react_native_1.SafeAreaView>
|
|
188
187
|
<react_native_1.KeyboardAvoidingView behavior={react_native_1.Platform.OS === "ios" ? "padding" : "height"} keyboardVerticalOffset={50} style={styles.container}>
|
|
189
188
|
<react_native_1.View style={styles.modalInputContainer}>
|
|
190
189
|
<react_native_1.TouchableOpacity onPress={() => {
|
|
@@ -209,7 +208,7 @@ const autocompleteUI = ({ options = {} }) => {
|
|
|
209
208
|
{renderFooter()}
|
|
210
209
|
</react_native_1.View>)}
|
|
211
210
|
</react_native_1.KeyboardAvoidingView>
|
|
212
|
-
</
|
|
211
|
+
</react_native_1.SafeAreaView>
|
|
213
212
|
</react_native_1.Animated.View>
|
|
214
213
|
</react_native_1.Modal>
|
|
215
214
|
</react_native_1.View>);
|
package/dist/ui/autocomplete.jsx
CHANGED
|
@@ -14,10 +14,10 @@ import {
|
|
|
14
14
|
Dimensions,
|
|
15
15
|
Easing,
|
|
16
16
|
Keyboard,
|
|
17
|
+
SafeAreaView,
|
|
17
18
|
Pressable,
|
|
18
19
|
Platform,
|
|
19
20
|
} from 'react-native';
|
|
20
|
-
import { SafeAreaView } from 'react-native-safe-area-context';
|
|
21
21
|
import Radar from '../index.native';
|
|
22
22
|
import {
|
|
23
23
|
BACK_ICON,
|
package/dist/ui/map.jsx
CHANGED
|
@@ -5,19 +5,10 @@ import { getHost, getPublishableKey } from '../helpers';
|
|
|
5
5
|
import styles from './styles';
|
|
6
6
|
|
|
7
7
|
let MapLibreGL;
|
|
8
|
-
let MapLibreMap;
|
|
9
|
-
let GeoJSONSource;
|
|
10
|
-
let Layer;
|
|
11
8
|
try {
|
|
12
9
|
MapLibreGL = require('@maplibre/maplibre-react-native');
|
|
13
|
-
MapLibreMap = MapLibreGL.Map;
|
|
14
|
-
GeoJSONSource = MapLibreGL.GeoJSONSource;
|
|
15
|
-
Layer = MapLibreGL.Layer;
|
|
16
10
|
} catch (e) {
|
|
17
11
|
MapLibreGL = null;
|
|
18
|
-
MapLibreMap = null;
|
|
19
|
-
GeoJSONSource = null;
|
|
20
|
-
Layer = null;
|
|
21
12
|
}
|
|
22
13
|
|
|
23
14
|
const DEFAULT_STYLE = 'radar-default-v1';
|
|
@@ -34,9 +25,8 @@ const createStyleURL = async (style = DEFAULT_STYLE) => {
|
|
|
34
25
|
* @param {Object} [props.mapOptions] - Map configuration options
|
|
35
26
|
* @param {string} [props.mapOptions.mapStyle] - Map style identifier (defaults to 'radar-default-v1')
|
|
36
27
|
* @param {boolean} [props.mapOptions.showUserLocation] - Whether to show the user's location on the map (default: true)
|
|
37
|
-
* @param {React.Ref} [props.mapOptions.mapRef] - Ref to the underlying MapLibre Map component
|
|
38
28
|
* @param {function} [props.mapOptions.onRegionDidChange] - Callback fired when the map region changes
|
|
39
|
-
* @param {Object} props.mapOptions.onRegionDidChange.
|
|
29
|
+
* @param {Object} props.mapOptions.onRegionDidChange.feature - The region feature data
|
|
40
30
|
* @param {function} [props.mapOptions.onDidFinishLoadingMap] - Callback fired when the map finishes loading
|
|
41
31
|
* @param {function} [props.mapOptions.onWillStartLoadingMap] - Callback fired when the map starts loading
|
|
42
32
|
* @param {function} [props.mapOptions.onDidFailLoadingMap] - Callback fired when the map fails to load
|
|
@@ -90,61 +80,54 @@ const RadarMap = ({ mapOptions, children }) => {
|
|
|
90
80
|
};
|
|
91
81
|
|
|
92
82
|
const userLocationMapIndicator = (
|
|
93
|
-
<
|
|
83
|
+
<MapLibreGL.ShapeSource
|
|
94
84
|
id="user-location"
|
|
95
|
-
|
|
85
|
+
shape={geoJSONUserLocation}
|
|
96
86
|
>
|
|
97
|
-
<
|
|
87
|
+
<MapLibreGL.CircleLayer
|
|
98
88
|
id="user-location-inner"
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
'
|
|
102
|
-
|
|
103
|
-
'
|
|
104
|
-
'circle-pitch-alignment': 'map',
|
|
89
|
+
style={{
|
|
90
|
+
circleRadius: 15,
|
|
91
|
+
circleColor: '#000257',
|
|
92
|
+
circleOpacity: 0.2,
|
|
93
|
+
circlePitchAlignment: 'map',
|
|
105
94
|
}}
|
|
106
95
|
/>
|
|
107
|
-
<
|
|
96
|
+
<MapLibreGL.CircleLayer
|
|
108
97
|
id="user-location-middle"
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
'
|
|
112
|
-
|
|
113
|
-
'circle-pitch-alignment': 'map',
|
|
98
|
+
style={{
|
|
99
|
+
circleRadius: 9,
|
|
100
|
+
circleColor: '#fff',
|
|
101
|
+
circlePitchAlignment: 'map',
|
|
114
102
|
}}
|
|
115
103
|
/>
|
|
116
|
-
<
|
|
104
|
+
<MapLibreGL.CircleLayer
|
|
117
105
|
id="user-location-outer"
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
'
|
|
121
|
-
|
|
122
|
-
'circle-pitch-alignment': 'map',
|
|
106
|
+
style={{
|
|
107
|
+
circleRadius: 6,
|
|
108
|
+
circleColor: '#000257',
|
|
109
|
+
circlePitchAlignment: 'map',
|
|
123
110
|
}}
|
|
124
111
|
/>
|
|
125
|
-
</
|
|
112
|
+
</MapLibreGL.ShapeSource>
|
|
126
113
|
);
|
|
127
114
|
|
|
128
115
|
return (
|
|
129
116
|
<View style={styles.mapContainer}>
|
|
130
|
-
<
|
|
131
|
-
ref={mapOptions?.mapRef}
|
|
117
|
+
<MapLibreGL.MapView
|
|
132
118
|
style={styles.map}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
onRegionDidChange={
|
|
138
|
-
? (event) => mapOptions.onRegionDidChange(event.nativeEvent)
|
|
139
|
-
: null
|
|
140
|
-
}
|
|
119
|
+
pitchEnabled={false}
|
|
120
|
+
compassEnabled={false}
|
|
121
|
+
logoEnabled={false}
|
|
122
|
+
attributionEnabled
|
|
123
|
+
onRegionDidChange={mapOptions?.onRegionDidChange ? mapOptions.onRegionDidChange : null}
|
|
141
124
|
onDidFinishLoadingMap={mapOptions?.onDidFinishLoadingMap ? mapOptions.onDidFinishLoadingMap : null}
|
|
142
125
|
onWillStartLoadingMap={mapOptions?.onWillStartLoadingMap ? mapOptions.onWillStartLoadingMap : null}
|
|
143
126
|
onDidFailLoadingMap={mapOptions?.onDidFailLoadingMap ? mapOptions.onDidFailLoadingMap : null}
|
|
144
127
|
mapStyle={styleURL}>
|
|
145
128
|
{mapOptions?.showUserLocation !== false && userLocationMapIndicator}
|
|
146
129
|
{children}
|
|
147
|
-
</
|
|
130
|
+
</MapLibreGL.MapView>
|
|
148
131
|
<Image
|
|
149
132
|
source={require('./map-logo.png')}
|
|
150
133
|
style={styles.mapLogo}
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "3.31.0
|
|
1
|
+
export declare const VERSION = "3.31.0";
|
package/dist/version.js
CHANGED
|
@@ -3,4 +3,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.VERSION = void 0;
|
|
4
4
|
// This file contains the version of the react-native-radar package
|
|
5
5
|
// It should be updated to match the version in package.json
|
|
6
|
-
exports.VERSION = '3.31.0
|
|
6
|
+
exports.VERSION = '3.31.0';
|
package/ios/RNRadar.mm
CHANGED
|
@@ -9,6 +9,9 @@ static NSString *_publishableKey = nil;
|
|
|
9
9
|
CLLocationManager *locationManager;
|
|
10
10
|
RCTPromiseResolveBlock permissionsRequestResolver;
|
|
11
11
|
bool hasListeners;
|
|
12
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
13
|
+
bool jsEventEmitterReady;
|
|
14
|
+
#endif
|
|
12
15
|
}
|
|
13
16
|
|
|
14
17
|
RCT_EXPORT_MODULE()
|
|
@@ -52,12 +55,21 @@ RCT_EXPORT_MODULE()
|
|
|
52
55
|
hasListeners = NO;
|
|
53
56
|
}
|
|
54
57
|
|
|
58
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
59
|
+
- (void)setEventEmitterCallback:(EventEmitterCallbackWrapper *)eventEmitterCallbackWrapper {
|
|
60
|
+
[super setEventEmitterCallback:eventEmitterCallbackWrapper];
|
|
61
|
+
jsEventEmitterReady = YES;
|
|
62
|
+
}
|
|
63
|
+
#endif
|
|
64
|
+
|
|
55
65
|
- (void)onNewInAppMessage:(RadarInAppMessage *)inAppMessage {
|
|
56
66
|
|
|
57
67
|
NSMutableDictionary *body = [NSMutableDictionary new];
|
|
58
68
|
[body setValue:[Radar dictionaryForInAppMessage:inAppMessage] forKey:@"inAppMessage"];
|
|
59
69
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
60
|
-
|
|
70
|
+
if (jsEventEmitterReady) {
|
|
71
|
+
[self emitNewInAppMessageEmitter:body];
|
|
72
|
+
}
|
|
61
73
|
#else
|
|
62
74
|
if (hasListeners) {
|
|
63
75
|
[self sendEventWithName:@"newInAppMessageEmitter" body:body];
|
|
@@ -69,7 +81,9 @@ RCT_EXPORT_MODULE()
|
|
|
69
81
|
NSMutableDictionary *body = [NSMutableDictionary new];
|
|
70
82
|
[body setValue:[Radar dictionaryForInAppMessage:inAppMessage] forKey:@"inAppMessage"];
|
|
71
83
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
72
|
-
|
|
84
|
+
if (jsEventEmitterReady) {
|
|
85
|
+
[self emitInAppMessageDismissedEmitter:body];
|
|
86
|
+
}
|
|
73
87
|
#else
|
|
74
88
|
if (hasListeners) {
|
|
75
89
|
[self sendEventWithName:@"inAppMessageDismissedEmitter" body:body];
|
|
@@ -81,7 +95,9 @@ RCT_EXPORT_MODULE()
|
|
|
81
95
|
NSMutableDictionary *body = [NSMutableDictionary new];
|
|
82
96
|
[body setValue:[Radar dictionaryForInAppMessage:inAppMessage] forKey:@"inAppMessage"];
|
|
83
97
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
84
|
-
|
|
98
|
+
if (jsEventEmitterReady) {
|
|
99
|
+
[self emitInAppMessageClickedEmitter:body];
|
|
100
|
+
}
|
|
85
101
|
#else
|
|
86
102
|
if (hasListeners) {
|
|
87
103
|
[self sendEventWithName:@"inAppMessageClickedEmitter" body:body];
|
|
@@ -105,7 +121,9 @@ RCT_EXPORT_MODULE()
|
|
|
105
121
|
[body setValue:[user dictionaryValue] forKey:@"user"];
|
|
106
122
|
}
|
|
107
123
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
108
|
-
|
|
124
|
+
if (jsEventEmitterReady) {
|
|
125
|
+
[self emitEventsEmitter:body];
|
|
126
|
+
}
|
|
109
127
|
#else
|
|
110
128
|
if (hasListeners) {
|
|
111
129
|
[self sendEventWithName:@"eventsEmitter" body:body];
|
|
@@ -115,10 +133,12 @@ RCT_EXPORT_MODULE()
|
|
|
115
133
|
|
|
116
134
|
- (void)didUpdateLocation:(CLLocation *)location user:(RadarUser *)user {
|
|
117
135
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
136
|
+
if (jsEventEmitterReady) {
|
|
137
|
+
[self emitLocationEmitter:@{
|
|
138
|
+
@"location": [Radar dictionaryForLocation:location],
|
|
139
|
+
@"user": [user dictionaryValue]
|
|
140
|
+
}];
|
|
141
|
+
}
|
|
122
142
|
#else
|
|
123
143
|
if (hasListeners) {
|
|
124
144
|
[self sendEventWithName:@"locationEmitter" body:@{
|
|
@@ -131,11 +151,13 @@ RCT_EXPORT_MODULE()
|
|
|
131
151
|
|
|
132
152
|
- (void)didUpdateClientLocation:(CLLocation *)location stopped:(BOOL)stopped source:(RadarLocationSource)source {
|
|
133
153
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
154
|
+
if (jsEventEmitterReady) {
|
|
155
|
+
[self emitClientLocationEmitter:@{
|
|
156
|
+
@"location": [Radar dictionaryForLocation:location],
|
|
157
|
+
@"stopped": @(stopped),
|
|
158
|
+
@"source": [Radar stringForLocationSource:source]
|
|
159
|
+
}];
|
|
160
|
+
}
|
|
139
161
|
#else
|
|
140
162
|
if (hasListeners) {
|
|
141
163
|
[self sendEventWithName:@"clientLocationEmitter" body:@{
|
|
@@ -152,7 +174,9 @@ RCT_EXPORT_MODULE()
|
|
|
152
174
|
@"status": [Radar stringForStatus:status]
|
|
153
175
|
};
|
|
154
176
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
155
|
-
|
|
177
|
+
if (jsEventEmitterReady) {
|
|
178
|
+
[self emitErrorEmitter:body];
|
|
179
|
+
}
|
|
156
180
|
#else
|
|
157
181
|
if (hasListeners) {
|
|
158
182
|
[self sendEventWithName:@"errorEmitter" body:body];
|
|
@@ -165,7 +189,9 @@ RCT_EXPORT_MODULE()
|
|
|
165
189
|
@"message": message
|
|
166
190
|
};
|
|
167
191
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
168
|
-
|
|
192
|
+
if (jsEventEmitterReady) {
|
|
193
|
+
[self emitLogEmitter:body];
|
|
194
|
+
}
|
|
169
195
|
#else
|
|
170
196
|
if (hasListeners) {
|
|
171
197
|
[self sendEventWithName:@"logEmitter" body:body];
|
|
@@ -178,7 +204,9 @@ RCT_EXPORT_MODULE()
|
|
|
178
204
|
@"token": [token dictionaryValue]
|
|
179
205
|
};
|
|
180
206
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
181
|
-
|
|
207
|
+
if (jsEventEmitterReady) {
|
|
208
|
+
[self emitTokenEmitter:body];
|
|
209
|
+
}
|
|
182
210
|
#else
|
|
183
211
|
if (hasListeners) {
|
|
184
212
|
[self sendEventWithName:@"tokenEmitter" body:body];
|
|
@@ -189,7 +217,7 @@ RCT_EXPORT_MODULE()
|
|
|
189
217
|
RCT_EXPORT_METHOD(initialize:(NSString *)publishableKey fraud:(BOOL)fraud) {
|
|
190
218
|
_publishableKey = publishableKey;
|
|
191
219
|
[[NSUserDefaults standardUserDefaults] setObject:@"ReactNative" forKey:@"radar-xPlatformSDKType"];
|
|
192
|
-
[[NSUserDefaults standardUserDefaults] setObject:@"3.31.0
|
|
220
|
+
[[NSUserDefaults standardUserDefaults] setObject:@"3.31.0" forKey:@"radar-xPlatformSDKVersion"];
|
|
193
221
|
[Radar initializeWithPublishableKey:publishableKey];
|
|
194
222
|
}
|
|
195
223
|
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "React Native module for Radar, the leading geofencing and location tracking platform",
|
|
4
4
|
"homepage": "https://radar.com",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
|
-
"version": "3.31.0
|
|
6
|
+
"version": "3.31.0",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"files": [
|
|
9
9
|
"dist",
|
|
@@ -56,11 +56,10 @@
|
|
|
56
56
|
]
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
|
-
"@maplibre/maplibre-react-native": ">=
|
|
59
|
+
"@maplibre/maplibre-react-native": ">=10.2.1",
|
|
60
60
|
"expo": ">=43.0.5",
|
|
61
|
-
"react": ">=
|
|
62
|
-
"react-native": ">= 0.
|
|
63
|
-
"react-native-safe-area-context": "^5.6.2"
|
|
61
|
+
"react": ">= 16.8.6",
|
|
62
|
+
"react-native": ">= 0.60.0"
|
|
64
63
|
},
|
|
65
64
|
"peerDependenciesMeta": {
|
|
66
65
|
"@maplibre/maplibre-react-native": {
|
package/src/@types/types.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import { Platform } from "react-native";
|
|
3
|
-
import type { MapRef } from "@maplibre/maplibre-react-native";
|
|
4
2
|
const platform = Platform.OS;
|
|
5
3
|
|
|
6
4
|
export type RadarMetadata = Record<string, string | number | boolean>;
|
|
@@ -852,8 +850,7 @@ export type RadarTripStatus =
|
|
|
852
850
|
export interface RadarMapOptions {
|
|
853
851
|
mapStyle?: string;
|
|
854
852
|
showUserLocation?: boolean;
|
|
855
|
-
|
|
856
|
-
onRegionDidChange?: (event: RadarMapRegionChangeEvent) => void;
|
|
853
|
+
onRegionDidChange?: (feature: RadarMapRegionChangeEvent) => void;
|
|
857
854
|
onDidFinishLoadingMap?: () => void;
|
|
858
855
|
onWillStartLoadingMap?: () => void;
|
|
859
856
|
onDidFailLoadingMap?: () => void;
|
|
@@ -862,9 +859,7 @@ export interface RadarMapOptions {
|
|
|
862
859
|
export interface RadarMapRegionChangeEvent {
|
|
863
860
|
center: [number, number];
|
|
864
861
|
zoom: number;
|
|
865
|
-
bounds?: [
|
|
862
|
+
bounds?: [number, number, number, number];
|
|
866
863
|
bearing?: number;
|
|
867
864
|
pitch?: number;
|
|
868
|
-
animated: boolean;
|
|
869
|
-
userInteraction: boolean;
|
|
870
865
|
}
|
package/src/ui/autocomplete.jsx
CHANGED
|
@@ -14,10 +14,10 @@ import {
|
|
|
14
14
|
Dimensions,
|
|
15
15
|
Easing,
|
|
16
16
|
Keyboard,
|
|
17
|
+
SafeAreaView,
|
|
17
18
|
Pressable,
|
|
18
19
|
Platform,
|
|
19
20
|
} from 'react-native';
|
|
20
|
-
import { SafeAreaView } from 'react-native-safe-area-context';
|
|
21
21
|
import Radar from '../index.native';
|
|
22
22
|
import {
|
|
23
23
|
BACK_ICON,
|
package/src/ui/map.jsx
CHANGED
|
@@ -5,19 +5,10 @@ import { getHost, getPublishableKey } from '../helpers';
|
|
|
5
5
|
import styles from './styles';
|
|
6
6
|
|
|
7
7
|
let MapLibreGL;
|
|
8
|
-
let MapLibreMap;
|
|
9
|
-
let GeoJSONSource;
|
|
10
|
-
let Layer;
|
|
11
8
|
try {
|
|
12
9
|
MapLibreGL = require('@maplibre/maplibre-react-native');
|
|
13
|
-
MapLibreMap = MapLibreGL.Map;
|
|
14
|
-
GeoJSONSource = MapLibreGL.GeoJSONSource;
|
|
15
|
-
Layer = MapLibreGL.Layer;
|
|
16
10
|
} catch (e) {
|
|
17
11
|
MapLibreGL = null;
|
|
18
|
-
MapLibreMap = null;
|
|
19
|
-
GeoJSONSource = null;
|
|
20
|
-
Layer = null;
|
|
21
12
|
}
|
|
22
13
|
|
|
23
14
|
const DEFAULT_STYLE = 'radar-default-v1';
|
|
@@ -34,9 +25,8 @@ const createStyleURL = async (style = DEFAULT_STYLE) => {
|
|
|
34
25
|
* @param {Object} [props.mapOptions] - Map configuration options
|
|
35
26
|
* @param {string} [props.mapOptions.mapStyle] - Map style identifier (defaults to 'radar-default-v1')
|
|
36
27
|
* @param {boolean} [props.mapOptions.showUserLocation] - Whether to show the user's location on the map (default: true)
|
|
37
|
-
* @param {React.Ref} [props.mapOptions.mapRef] - Ref to the underlying MapLibre Map component
|
|
38
28
|
* @param {function} [props.mapOptions.onRegionDidChange] - Callback fired when the map region changes
|
|
39
|
-
* @param {Object} props.mapOptions.onRegionDidChange.
|
|
29
|
+
* @param {Object} props.mapOptions.onRegionDidChange.feature - The region feature data
|
|
40
30
|
* @param {function} [props.mapOptions.onDidFinishLoadingMap] - Callback fired when the map finishes loading
|
|
41
31
|
* @param {function} [props.mapOptions.onWillStartLoadingMap] - Callback fired when the map starts loading
|
|
42
32
|
* @param {function} [props.mapOptions.onDidFailLoadingMap] - Callback fired when the map fails to load
|
|
@@ -90,61 +80,54 @@ const RadarMap = ({ mapOptions, children }) => {
|
|
|
90
80
|
};
|
|
91
81
|
|
|
92
82
|
const userLocationMapIndicator = (
|
|
93
|
-
<
|
|
83
|
+
<MapLibreGL.ShapeSource
|
|
94
84
|
id="user-location"
|
|
95
|
-
|
|
85
|
+
shape={geoJSONUserLocation}
|
|
96
86
|
>
|
|
97
|
-
<
|
|
87
|
+
<MapLibreGL.CircleLayer
|
|
98
88
|
id="user-location-inner"
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
'
|
|
102
|
-
|
|
103
|
-
'
|
|
104
|
-
'circle-pitch-alignment': 'map',
|
|
89
|
+
style={{
|
|
90
|
+
circleRadius: 15,
|
|
91
|
+
circleColor: '#000257',
|
|
92
|
+
circleOpacity: 0.2,
|
|
93
|
+
circlePitchAlignment: 'map',
|
|
105
94
|
}}
|
|
106
95
|
/>
|
|
107
|
-
<
|
|
96
|
+
<MapLibreGL.CircleLayer
|
|
108
97
|
id="user-location-middle"
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
'
|
|
112
|
-
|
|
113
|
-
'circle-pitch-alignment': 'map',
|
|
98
|
+
style={{
|
|
99
|
+
circleRadius: 9,
|
|
100
|
+
circleColor: '#fff',
|
|
101
|
+
circlePitchAlignment: 'map',
|
|
114
102
|
}}
|
|
115
103
|
/>
|
|
116
|
-
<
|
|
104
|
+
<MapLibreGL.CircleLayer
|
|
117
105
|
id="user-location-outer"
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
'
|
|
121
|
-
|
|
122
|
-
'circle-pitch-alignment': 'map',
|
|
106
|
+
style={{
|
|
107
|
+
circleRadius: 6,
|
|
108
|
+
circleColor: '#000257',
|
|
109
|
+
circlePitchAlignment: 'map',
|
|
123
110
|
}}
|
|
124
111
|
/>
|
|
125
|
-
</
|
|
112
|
+
</MapLibreGL.ShapeSource>
|
|
126
113
|
);
|
|
127
114
|
|
|
128
115
|
return (
|
|
129
116
|
<View style={styles.mapContainer}>
|
|
130
|
-
<
|
|
131
|
-
ref={mapOptions?.mapRef}
|
|
117
|
+
<MapLibreGL.MapView
|
|
132
118
|
style={styles.map}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
onRegionDidChange={
|
|
138
|
-
? (event) => mapOptions.onRegionDidChange(event.nativeEvent)
|
|
139
|
-
: null
|
|
140
|
-
}
|
|
119
|
+
pitchEnabled={false}
|
|
120
|
+
compassEnabled={false}
|
|
121
|
+
logoEnabled={false}
|
|
122
|
+
attributionEnabled
|
|
123
|
+
onRegionDidChange={mapOptions?.onRegionDidChange ? mapOptions.onRegionDidChange : null}
|
|
141
124
|
onDidFinishLoadingMap={mapOptions?.onDidFinishLoadingMap ? mapOptions.onDidFinishLoadingMap : null}
|
|
142
125
|
onWillStartLoadingMap={mapOptions?.onWillStartLoadingMap ? mapOptions.onWillStartLoadingMap : null}
|
|
143
126
|
onDidFailLoadingMap={mapOptions?.onDidFailLoadingMap ? mapOptions.onDidFailLoadingMap : null}
|
|
144
127
|
mapStyle={styleURL}>
|
|
145
128
|
{mapOptions?.showUserLocation !== false && userLocationMapIndicator}
|
|
146
129
|
{children}
|
|
147
|
-
</
|
|
130
|
+
</MapLibreGL.MapView>
|
|
148
131
|
<Image
|
|
149
132
|
source={require('./map-logo.png')}
|
|
150
133
|
style={styles.mapLogo}
|
package/src/version.ts
CHANGED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
declare module "@maplibre/maplibre-react-native" {
|
|
2
|
-
export interface MapRef {
|
|
3
|
-
getCenter(): Promise<{ lng: number; lat: number }>;
|
|
4
|
-
getZoom(): Promise<number>;
|
|
5
|
-
getBearing(): Promise<number>;
|
|
6
|
-
getPitch(): Promise<number>;
|
|
7
|
-
getBounds(): Promise<{ ne: [number, number]; sw: [number, number] }>;
|
|
8
|
-
project(coordinate: [number, number]): Promise<{ x: number; y: number }>;
|
|
9
|
-
unproject(point: { x: number; y: number }): Promise<[number, number]>;
|
|
10
|
-
queryRenderedFeatures(
|
|
11
|
-
point: [number, number] | [[number, number], [number, number]],
|
|
12
|
-
filter?: string[],
|
|
13
|
-
layerIDs?: string[],
|
|
14
|
-
): Promise<GeoJSON.FeatureCollection>;
|
|
15
|
-
}
|
|
16
|
-
}
|