react-native-radar 3.20.4 → 3.21.0-beta.1

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.
Files changed (133) hide show
  1. package/Radar.podspec +22 -0
  2. package/android/build.gradle +77 -35
  3. package/android/gradle.properties +5 -1
  4. package/android/src/main/AndroidManifest.xml +1 -3
  5. package/android/src/main/java/{io/radar/react/RNRadarModule.java → com/radar/RadarModuleImpl.java} +131 -258
  6. package/android/src/main/java/com/radar/RadarPackage.kt +35 -0
  7. package/android/src/main/java/{io/radar/react/RNRadarUtils.java → com/radar/RadarUtils.java} +3 -2
  8. package/android/src/newarch/java/com/radar/RadarModule.kt +381 -0
  9. package/android/src/oldarch/java/com/radar/RadarModule.java +416 -0
  10. package/android/src/{main/java/io/radar/react/RNRadarReceiver.java → oldarch/java/com/radar/RadarOldArchReceiver.java} +8 -8
  11. package/android/src/{main/java/io/radar/react/RNRadarVerifiedReceiver.java → oldarch/java/com/radar/RadarOldArchVerifiedReceiver.java} +4 -4
  12. package/app.plugin.js +1 -1
  13. package/ios/RNRadar.h +11 -2
  14. package/ios/{RNRadar.m → RNRadar.mm} +77 -39
  15. package/lib/commonjs/@types/RadarNativeInterface.js +2 -0
  16. package/lib/commonjs/@types/RadarNativeInterface.js.map +1 -0
  17. package/lib/commonjs/@types/types.js +2 -0
  18. package/lib/commonjs/@types/types.js.map +1 -0
  19. package/lib/commonjs/NativeRadar.js +2 -0
  20. package/lib/commonjs/NativeRadar.js.map +1 -0
  21. package/lib/commonjs/helpers.js +2 -0
  22. package/lib/commonjs/helpers.js.map +1 -0
  23. package/lib/commonjs/index.js +2 -0
  24. package/lib/commonjs/index.js.map +1 -0
  25. package/lib/commonjs/index.native.js +2 -0
  26. package/lib/commonjs/index.native.js.map +1 -0
  27. package/lib/commonjs/index.web.js +2 -0
  28. package/lib/commonjs/index.web.js.map +1 -0
  29. package/lib/commonjs/package.json +1 -0
  30. package/lib/commonjs/plugin/types.js +2 -0
  31. package/lib/commonjs/plugin/types.js.map +1 -0
  32. package/lib/commonjs/plugin/withRadar.js +2 -0
  33. package/lib/commonjs/plugin/withRadar.js.map +1 -0
  34. package/lib/commonjs/plugin/withRadarAndroid.js +2 -0
  35. package/lib/commonjs/plugin/withRadarAndroid.js.map +1 -0
  36. package/lib/commonjs/plugin/withRadarIOS.js +2 -0
  37. package/lib/commonjs/plugin/withRadarIOS.js.map +1 -0
  38. package/lib/commonjs/ui/autocomplete.js +2 -0
  39. package/lib/commonjs/ui/autocomplete.js.map +1 -0
  40. package/lib/commonjs/ui/images.js +2 -0
  41. package/lib/commonjs/ui/images.js.map +1 -0
  42. package/lib/commonjs/ui/map.js +2 -0
  43. package/lib/commonjs/ui/map.js.map +1 -0
  44. package/lib/commonjs/ui/styles.js +2 -0
  45. package/lib/commonjs/ui/styles.js.map +1 -0
  46. package/lib/commonjs/version.js +2 -0
  47. package/lib/commonjs/version.js.map +1 -0
  48. package/{dist → lib/typescript/src}/@types/RadarNativeInterface.d.ts +18 -7
  49. package/lib/typescript/src/@types/RadarNativeInterface.d.ts.map +1 -0
  50. package/{dist → lib/typescript/src}/@types/types.d.ts +5 -3
  51. package/lib/typescript/src/@types/types.d.ts.map +1 -0
  52. package/lib/typescript/src/NativeRadar.d.ts +87 -0
  53. package/lib/typescript/src/NativeRadar.d.ts.map +1 -0
  54. package/{dist → lib/typescript/src}/index.d.ts +1 -0
  55. package/lib/typescript/src/index.d.ts.map +1 -0
  56. package/lib/typescript/src/index.native.d.ts +7 -0
  57. package/lib/typescript/src/index.native.d.ts.map +1 -0
  58. package/lib/typescript/src/plugin/types.d.ts +13 -0
  59. package/lib/typescript/src/plugin/types.d.ts.map +1 -0
  60. package/{plugin/build → lib/typescript/src/plugin}/withRadar.d.ts +2 -1
  61. package/lib/typescript/src/plugin/withRadar.d.ts.map +1 -0
  62. package/{plugin/build → lib/typescript/src/plugin}/withRadarAndroid.d.ts +1 -0
  63. package/lib/typescript/src/plugin/withRadarAndroid.d.ts.map +1 -0
  64. package/{plugin/build → lib/typescript/src/plugin}/withRadarIOS.d.ts +1 -0
  65. package/lib/typescript/src/plugin/withRadarIOS.d.ts.map +1 -0
  66. package/lib/typescript/src/version.d.ts +2 -0
  67. package/lib/typescript/src/version.d.ts.map +1 -0
  68. package/package.json +85 -34
  69. package/react-native.config.js +10 -0
  70. package/src/@types/RadarNativeInterface.ts +127 -0
  71. package/src/@types/types.ts +808 -0
  72. package/src/NativeRadar.ts +95 -0
  73. package/src/helpers.js +11 -0
  74. package/src/index.native.ts +419 -0
  75. package/src/index.tsx +22 -0
  76. package/src/index.web.js +528 -0
  77. package/{plugin/build/types.d.ts → src/plugin/types.ts} +1 -1
  78. package/src/plugin/withRadar.ts +39 -0
  79. package/src/plugin/withRadarAndroid.ts +147 -0
  80. package/src/plugin/withRadarIOS.ts +80 -0
  81. package/src/ui/autocomplete.jsx +324 -0
  82. package/src/ui/back.png +0 -0
  83. package/src/ui/close.png +0 -0
  84. package/src/ui/images.js +5 -0
  85. package/src/ui/map-logo.png +0 -0
  86. package/src/ui/map.jsx +122 -0
  87. package/src/ui/marker.png +0 -0
  88. package/src/ui/radar-logo.png +0 -0
  89. package/src/ui/search.png +0 -0
  90. package/src/ui/styles.js +125 -0
  91. package/src/version.ts +3 -0
  92. package/android/build.gradle.template +0 -49
  93. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  94. package/android/gradle/wrapper/gradle-wrapper.properties +0 -6
  95. package/android/gradlew +0 -160
  96. package/android/gradlew.bat +0 -90
  97. package/android/proguard-rules.pro +0 -4
  98. package/android/src/main/java/io/radar/react/RNRadarPackage.java +0 -29
  99. package/dist/@types/RadarNativeInterface.js +0 -2
  100. package/dist/@types/types.js +0 -150
  101. package/dist/helpers.d.ts +0 -2
  102. package/dist/helpers.js +0 -11
  103. package/dist/index.js +0 -29
  104. package/dist/index.native.d.ts +0 -3
  105. package/dist/index.native.js +0 -150
  106. package/dist/index.web.d.ts +0 -113
  107. package/dist/index.web.js +0 -516
  108. package/dist/ui/autocomplete.d.ts +0 -5
  109. package/dist/ui/autocomplete.js +0 -206
  110. package/dist/ui/images.d.ts +0 -5
  111. package/dist/ui/images.js +0 -8
  112. package/dist/ui/map.d.ts +0 -6
  113. package/dist/ui/map.js +0 -122
  114. package/dist/ui/styles.d.ts +0 -172
  115. package/dist/ui/styles.js +0 -125
  116. package/ios/Cartfile.private +0 -1
  117. package/ios/Cartfile.resolved +0 -1
  118. package/ios/Cartfile.resolved.template +0 -1
  119. package/ios/RNRadar.xcodeproj/project.pbxproj +0 -521
  120. package/ios/RNRadar.xcodeproj/xcshareddata/xcschemes/RNRadar.xcscheme +0 -76
  121. package/plugin/build/index.d.ts +0 -3
  122. package/plugin/build/index.js +0 -6
  123. package/plugin/build/types.js +0 -2
  124. package/plugin/build/withRadar.js +0 -26
  125. package/plugin/build/withRadarAndroid.js +0 -98
  126. package/plugin/build/withRadarIOS.js +0 -76
  127. package/react-native-radar.podspec +0 -19
  128. /package/{dist → lib/commonjs}/ui/back.png +0 -0
  129. /package/{dist → lib/commonjs}/ui/close.png +0 -0
  130. /package/{dist → lib/commonjs}/ui/map-logo.png +0 -0
  131. /package/{dist → lib/commonjs}/ui/marker.png +0 -0
  132. /package/{dist → lib/commonjs}/ui/radar-logo.png +0 -0
  133. /package/{dist → lib/commonjs}/ui/search.png +0 -0
@@ -1,206 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
- return new (P || (P = Promise))(function (resolve, reject) {
28
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
- step((generator = generator.apply(thisArg, _arguments || [])).next());
32
- });
33
- };
34
- var __importDefault = (this && this.__importDefault) || function (mod) {
35
- return (mod && mod.__esModule) ? mod : { "default": mod };
36
- };
37
- Object.defineProperty(exports, "__esModule", { value: true });
38
- // Autocomplete.js
39
- const react_1 = __importStar(require("react"));
40
- const react_native_1 = require("react-native");
41
- const index_native_1 = __importDefault(require("../index.native"));
42
- const images_1 = require("./images");
43
- const styles_1 = __importDefault(require("./styles"));
44
- const defaultAutocompleteOptions = {
45
- debounceMS: 200, // Debounce time in milliseconds
46
- minCharacters: 3, // Minimum number of characters to trigger autocomplete
47
- limit: 8, // Maximum number of results to return
48
- placeholder: "Search address", // Placeholder text for the input field
49
- showMarkers: true,
50
- disabled: false,
51
- };
52
- const autocompleteUI = ({ options = {} }) => {
53
- const [query, setQuery] = (0, react_1.useState)("");
54
- const [results, setResults] = (0, react_1.useState)([]);
55
- const [isOpen, setIsOpen] = (0, react_1.useState)(false);
56
- const animationValue = (0, react_1.useRef)(new react_native_1.Animated.Value(0)).current; // animation value
57
- const timerRef = (0, react_1.useRef)(null);
58
- const textInputRef = (0, react_1.useRef)(null);
59
- const config = Object.assign(Object.assign({}, defaultAutocompleteOptions), options);
60
- const style = config.style || {};
61
- const fetchResults = (0, react_1.useCallback)((searchQuery) => __awaiter(void 0, void 0, void 0, function* () {
62
- if (searchQuery.length < config.minCharacters)
63
- return;
64
- const { limit, layers, countryCode } = config;
65
- const params = { query: searchQuery, limit, layers, countryCode };
66
- if (config.near && config.near.latitude && config.near.longitude) {
67
- params.near = config.near;
68
- }
69
- try {
70
- const result = yield index_native_1.default.autocomplete(params);
71
- if (config.onResults && typeof config.onResults === "function") {
72
- config.onResults(result.addresses);
73
- }
74
- setResults(result.addresses);
75
- setIsOpen(true);
76
- }
77
- catch (error) {
78
- if (config.onError && typeof config.onError === "function") {
79
- config.onError(error);
80
- }
81
- }
82
- }), [config]);
83
- const handleInput = (0, react_1.useCallback)((text) => {
84
- setQuery(text);
85
- // Clear the existing timer
86
- if (timerRef.current) {
87
- clearTimeout(timerRef.current);
88
- }
89
- if (text.length < config.minCharacters) {
90
- return;
91
- }
92
- // Set the new timer
93
- timerRef.current = setTimeout(() => {
94
- fetchResults(text);
95
- }, config.debounceMS);
96
- }, [config, fetchResults]);
97
- const handleSelect = (item) => {
98
- setQuery(item.formattedAddress);
99
- setIsOpen(false);
100
- if (typeof config.onSelection === "function") {
101
- config.onSelection(item);
102
- }
103
- };
104
- const renderFooter = () => {
105
- if (results.length === 0)
106
- return null;
107
- return (<react_native_1.View style={styles.footerContainer}>
108
- <react_native_1.View style={{ flexDirection: "row", alignItems: "center" }}>
109
- <react_native_1.Text style={styles.footerText}>Powered by</react_native_1.Text>
110
- <react_native_1.Image source={images_1.RADAR_LOGO} resizeMode="contain" style={styles_1.default.logo}/>
111
- </react_native_1.View>
112
- </react_native_1.View>);
113
- };
114
- const renderItem = ({ item }) => {
115
- var _a;
116
- return (<react_native_1.Pressable style={({ pressed }) => [
117
- Object.assign(Object.assign({}, styles.resultItem), { backgroundColor: pressed
118
- ? styles.resultItem.pressedBackgroundColor
119
- : styles.resultItem.backgroundColor }),
120
- ]} onPress={() => handleSelect(item)}>
121
- <react_native_1.View style={styles.addressContainer}>
122
- <react_native_1.View style={styles.pinIconContainer}>
123
- {config.showMarkers ? (<react_native_1.Image source={images_1.MARKER_ICON} style={styles.pinIcon}/>) : null}
124
- </react_native_1.View>
125
- <react_native_1.View style={styles.addressTextContainer}>
126
- <react_native_1.Text numberOfLines={1} style={styles.addressText}>
127
- {item.addressLabel || (item === null || item === void 0 ? void 0 : item.placeLabel)}
128
- </react_native_1.Text>
129
- {(item === null || item === void 0 ? void 0 : item.formattedAddress.length) > 0 && (<react_native_1.Text numberOfLines={1} style={styles.addressSubtext}>
130
- {(_a = item === null || item === void 0 ? void 0 : item.formattedAddress) === null || _a === void 0 ? void 0 : _a.replace(`${(item === null || item === void 0 ? void 0 : item.addressLabel) || (item === null || item === void 0 ? void 0 : item.placeLabel)}, `, "")}
131
- </react_native_1.Text>)}
132
- </react_native_1.View>
133
- </react_native_1.View>
134
- </react_native_1.Pressable>);
135
- };
136
- const styles = Object.assign(Object.assign({}, styles_1.default), { container: react_native_1.StyleSheet.compose(styles_1.default.container, style.container), input: react_native_1.StyleSheet.compose(styles_1.default.input, style.input), inputContainer: react_native_1.StyleSheet.compose(styles_1.default.inputContainer, style.inputContainer), modalInputContainer: react_native_1.StyleSheet.compose(styles_1.default.modalInputContainer, style.modalInputContainer), resultList: react_native_1.StyleSheet.compose(styles_1.default.resultList, style.resultList), resultItem: react_native_1.StyleSheet.compose(Object.assign(Object.assign({}, styles_1.default.resultItem), { pressedBackgroundColor: '#F6FAFC' }), style.resultItem), addressContainer: react_native_1.StyleSheet.compose(styles_1.default.addressContainer, style.addressContainer), pinIconContainer: react_native_1.StyleSheet.compose(styles_1.default.pinIconContainer, style.pinIconContainer), pinIcon: react_native_1.StyleSheet.compose(styles_1.default.pinIcon, style.pinIcon), addressTextContainer: react_native_1.StyleSheet.compose(styles_1.default.addressTextContainer, style.addressTextContainer), addressText: react_native_1.StyleSheet.compose(styles_1.default.addressText, style.addressText), addressSubtext: react_native_1.StyleSheet.compose(styles_1.default.addressSubtext, style.addressSubtext), footerContainer: react_native_1.StyleSheet.compose(styles_1.default.footerContainer, style.footerContainer), footerText: react_native_1.StyleSheet.compose(styles_1.default.footerText, style.footerText) });
137
- (0, react_1.useEffect)(() => {
138
- react_native_1.Animated.timing(animationValue, {
139
- toValue: isOpen ? 1 : 0,
140
- duration: 300,
141
- easing: react_native_1.Easing.inOut(react_native_1.Easing.ease),
142
- useNativeDriver: false,
143
- }).start();
144
- }, [isOpen]);
145
- const screenHeight = react_native_1.Dimensions.get("window").height;
146
- const inputHeight = animationValue.interpolate({
147
- inputRange: [0, 1],
148
- outputRange: [40, screenHeight],
149
- });
150
- const modalOpacity = animationValue.interpolate({
151
- inputRange: [0, 0.5, 1],
152
- outputRange: [0, 0, 1],
153
- });
154
- return (<react_native_1.View style={styles.container}>
155
- <react_native_1.Animated.View style={{ height: inputHeight }}>
156
- <react_native_1.TouchableOpacity style={styles.inputContainer} onPress={() => {
157
- if (config.disabled)
158
- return;
159
- setIsOpen(true);
160
- // Set the focus on the other textinput after it opens
161
- setTimeout(() => {
162
- textInputRef.current.focus();
163
- }, 100);
164
- }}>
165
- <react_native_1.Image source={images_1.SEARCH_ICON} style={styles.inputIcon}/>
166
- <react_native_1.TextInput style={styles.input} onFocus={() => {
167
- setIsOpen(true);
168
- setTimeout(() => {
169
- textInputRef.current.focus();
170
- }, 100);
171
- }} value={query} returnKeyType="done" placeholder={config.placeholder} placeholderTextColor="#acbdc8"/>
172
- </react_native_1.TouchableOpacity>
173
- </react_native_1.Animated.View>
174
- <react_native_1.Modal animationType="slide" transparent={false} visible={isOpen} onRequestClose={() => setIsOpen(false)}>
175
- <react_native_1.Animated.View style={{ flex: 1, opacity: modalOpacity }}>
176
- <react_native_1.SafeAreaView>
177
- <react_native_1.KeyboardAvoidingView behavior={react_native_1.Platform.OS === "ios" ? "padding" : "height"} keyboardVerticalOffset={50} style={styles.container}>
178
- <react_native_1.View style={styles.modalInputContainer}>
179
- <react_native_1.TouchableOpacity onPress={() => {
180
- setIsOpen(false);
181
- }}>
182
- <react_native_1.Image source={images_1.BACK_ICON} style={styles.inputIcon}/>
183
- </react_native_1.TouchableOpacity>
184
- <react_native_1.TextInput ref={textInputRef} style={styles.input} onChangeText={handleInput} value={query} placeholder={config.placeholder} returnKeyType="done" onSubmitEditing={() => {
185
- setIsOpen(false);
186
- }} placeholderTextColor="#acbdc8"/>
187
- <react_native_1.TouchableOpacity onPress={() => {
188
- setQuery("");
189
- }}>
190
- <react_native_1.Image source={images_1.CLOSE_ICON} style={styles.closeIcon}/>
191
- </react_native_1.TouchableOpacity>
192
- </react_native_1.View>
193
- {results.length > 0 && (<react_native_1.View style={styles.resultListWrapper}>
194
- <react_native_1.FlatList style={styles.resultList} data={results} onScroll={() => {
195
- textInputRef.current.blur();
196
- react_native_1.Keyboard.dismiss();
197
- }} keyboardShouldPersistTaps="handled" renderItem={renderItem} keyExtractor={(item) => item.formattedAddress + item.postalCode}/>
198
- {renderFooter()}
199
- </react_native_1.View>)}
200
- </react_native_1.KeyboardAvoidingView>
201
- </react_native_1.SafeAreaView>
202
- </react_native_1.Animated.View>
203
- </react_native_1.Modal>
204
- </react_native_1.View>);
205
- };
206
- exports.default = autocompleteUI;
@@ -1,5 +0,0 @@
1
- export const BACK_ICON: any;
2
- export const SEARCH_ICON: any;
3
- export const RADAR_LOGO: any;
4
- export const MARKER_ICON: any;
5
- export const CLOSE_ICON: any;
package/dist/ui/images.js DELETED
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CLOSE_ICON = exports.MARKER_ICON = exports.RADAR_LOGO = exports.SEARCH_ICON = exports.BACK_ICON = void 0;
4
- exports.BACK_ICON = require('./back.png');
5
- exports.SEARCH_ICON = require('./search.png');
6
- exports.RADAR_LOGO = require('./radar-logo.png');
7
- exports.MARKER_ICON = require('./marker.png');
8
- exports.CLOSE_ICON = require('./close.png');
package/dist/ui/map.d.ts DELETED
@@ -1,6 +0,0 @@
1
- export default RadarMap;
2
- declare function RadarMap({ mapOptions, children }: {
3
- mapOptions: any;
4
- children: any;
5
- }): React.JSX.Element | null;
6
- import React from 'react';
package/dist/ui/map.js DELETED
@@ -1,122 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
- return new (P || (P = Promise))(function (resolve, reject) {
28
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
- step((generator = generator.apply(thisArg, _arguments || [])).next());
32
- });
33
- };
34
- var __importDefault = (this && this.__importDefault) || function (mod) {
35
- return (mod && mod.__esModule) ? mod : { "default": mod };
36
- };
37
- Object.defineProperty(exports, "__esModule", { value: true });
38
- const react_1 = __importStar(require("react"));
39
- const react_native_1 = require("react-native");
40
- const index_native_1 = __importDefault(require("../index.native"));
41
- const helpers_1 = require("../helpers");
42
- const styles_1 = __importDefault(require("./styles"));
43
- let MapLibreGL;
44
- try {
45
- MapLibreGL = require('@maplibre/maplibre-react-native');
46
- }
47
- catch (e) {
48
- MapLibreGL = null;
49
- }
50
- const DEFAULT_STYLE = 'radar-default-v1';
51
- const createStyleURL = (style = DEFAULT_STYLE) => __awaiter(void 0, void 0, void 0, function* () {
52
- const host = yield (0, helpers_1.getHost)();
53
- const publishableKey = yield (0, helpers_1.getPublishableKey)();
54
- return `${host}/maps/styles/${style}?publishableKey=${publishableKey}`;
55
- });
56
- const RadarMap = ({ mapOptions, children }) => {
57
- const [styleURL, setStyleURL] = (0, react_1.useState)(null);
58
- const [userLocation, setUserLocation] = (0, react_1.useState)(null);
59
- (0, react_1.useEffect)(() => {
60
- createStyleURL((mapOptions === null || mapOptions === void 0 ? void 0 : mapOptions.mapStyle) || DEFAULT_STYLE).then((result) => {
61
- setStyleURL(result);
62
- });
63
- }, [mapOptions]);
64
- (0, react_1.useEffect)(() => {
65
- index_native_1.default.getLocation().then((result) => {
66
- var _a, _b;
67
- if (((_a = result === null || result === void 0 ? void 0 : result.location) === null || _a === void 0 ? void 0 : _a.latitude) && ((_b = result === null || result === void 0 ? void 0 : result.location) === null || _b === void 0 ? void 0 : _b.longitude)) {
68
- setUserLocation({
69
- latitude: result.location.latitude,
70
- longitude: result.location.longitude,
71
- });
72
- }
73
- }).catch((err) => {
74
- // eslint-disable-next-line no-console
75
- console.warn(`Radar SDK: Failed to get location: ${err}`);
76
- });
77
- }, [mapOptions]);
78
- if (!styleURL) {
79
- return null;
80
- }
81
- if (!MapLibreGL) {
82
- return null;
83
- }
84
- const geoJSONUserLocation = {
85
- type: 'FeatureCollection',
86
- features: (userLocation === null || userLocation === void 0 ? void 0 : userLocation.longitude) !== undefined ? [
87
- {
88
- type: 'Feature',
89
- geometry: {
90
- type: 'Point',
91
- coordinates: [userLocation.longitude, userLocation.latitude],
92
- },
93
- },
94
- ] : [],
95
- };
96
- const userLocationMapIndicator = (<MapLibreGL.ShapeSource id="user-location" shape={geoJSONUserLocation}>
97
- <MapLibreGL.CircleLayer id="user-location-inner" style={{
98
- circleRadius: 15,
99
- circleColor: '#000257',
100
- circleOpacity: 0.2,
101
- circlePitchAlignment: 'map',
102
- }}/>
103
- <MapLibreGL.CircleLayer id="user-location-middle" style={{
104
- circleRadius: 9,
105
- circleColor: '#fff',
106
- circlePitchAlignment: 'map',
107
- }}/>
108
- <MapLibreGL.CircleLayer id="user-location-outer" style={{
109
- circleRadius: 6,
110
- circleColor: '#000257',
111
- circlePitchAlignment: 'map',
112
- }}/>
113
- </MapLibreGL.ShapeSource>);
114
- return (<react_native_1.View style={styles_1.default.mapContainer}>
115
- <MapLibreGL.MapView style={styles_1.default.map} pitchEnabled={false} compassEnabled={false} logoEnabled={false} attributionEnabled onRegionDidChange={(mapOptions === null || mapOptions === void 0 ? void 0 : mapOptions.onRegionDidChange) ? mapOptions.onRegionDidChange : null} styleURL={styleURL}>
116
- {userLocationMapIndicator}
117
- {children}
118
- </MapLibreGL.MapView>
119
- <react_native_1.Image source={require('./map-logo.png')} style={styles_1.default.mapLogo}/>
120
- </react_native_1.View>);
121
- };
122
- exports.default = RadarMap;
@@ -1,172 +0,0 @@
1
- export default styles;
2
- declare namespace styles {
3
- namespace container {
4
- let width: "100%";
5
- let height: "100%";
6
- let alignItems: "center";
7
- let paddingTop: number;
8
- }
9
- namespace inputContainer {
10
- export let flexDirection: "row";
11
- let alignItems_1: "center";
12
- export { alignItems_1 as alignItems };
13
- export let marginHorizontal: number;
14
- export let backgroundColor: string;
15
- export let borderRadius: number;
16
- export let borderColor: string;
17
- export let borderWidth: number;
18
- let width_1: "95%";
19
- export { width_1 as width };
20
- }
21
- namespace modalInputContainer {
22
- let flexDirection_1: "row";
23
- export { flexDirection_1 as flexDirection };
24
- let alignItems_2: "center";
25
- export { alignItems_2 as alignItems };
26
- let marginHorizontal_1: number;
27
- export { marginHorizontal_1 as marginHorizontal };
28
- let backgroundColor_1: string;
29
- export { backgroundColor_1 as backgroundColor };
30
- let borderRadius_1: number;
31
- export { borderRadius_1 as borderRadius };
32
- let borderColor_1: string;
33
- export { borderColor_1 as borderColor };
34
- let borderWidth_1: number;
35
- export { borderWidth_1 as borderWidth };
36
- }
37
- namespace inputIcon {
38
- export let marginLeft: number;
39
- let height_1: number;
40
- export { height_1 as height };
41
- let width_2: number;
42
- export { width_2 as width };
43
- let backgroundColor_2: string;
44
- export { backgroundColor_2 as backgroundColor };
45
- }
46
- namespace closeIcon {
47
- export let marginRight: number;
48
- let height_2: number;
49
- export { height_2 as height };
50
- let width_3: number;
51
- export { width_3 as width };
52
- let backgroundColor_3: string;
53
- export { backgroundColor_3 as backgroundColor };
54
- }
55
- namespace input {
56
- export let flex: number;
57
- let backgroundColor_4: string;
58
- export { backgroundColor_4 as backgroundColor };
59
- let height_3: number;
60
- export { height_3 as height };
61
- export let fontSize: number;
62
- export let paddingHorizontal: number;
63
- let borderRadius_2: number;
64
- export { borderRadius_2 as borderRadius };
65
- }
66
- namespace resultListWrapper {
67
- let width_4: "100%";
68
- export { width_4 as width };
69
- export let marginBottom: number;
70
- let backgroundColor_5: string;
71
- export { backgroundColor_5 as backgroundColor };
72
- let borderRadius_3: number;
73
- export { borderRadius_3 as borderRadius };
74
- export let paddingVertical: number;
75
- }
76
- namespace resultList {
77
- let width_5: "100%";
78
- export { width_5 as width };
79
- }
80
- namespace resultItem {
81
- export let paddingRight: number;
82
- let paddingVertical_1: number;
83
- export { paddingVertical_1 as paddingVertical };
84
- let paddingHorizontal_1: number;
85
- export { paddingHorizontal_1 as paddingHorizontal };
86
- let fontSize_1: number;
87
- export { fontSize_1 as fontSize };
88
- let backgroundColor_6: string;
89
- export { backgroundColor_6 as backgroundColor };
90
- }
91
- namespace addressContainer {
92
- let flexDirection_2: "row";
93
- export { flexDirection_2 as flexDirection };
94
- let alignItems_3: "center";
95
- export { alignItems_3 as alignItems };
96
- }
97
- namespace pinIconContainer {
98
- let width_6: number;
99
- export { width_6 as width };
100
- let marginRight_1: number;
101
- export { marginRight_1 as marginRight };
102
- }
103
- namespace pinIcon {
104
- let height_4: number;
105
- export { height_4 as height };
106
- let width_7: number;
107
- export { width_7 as width };
108
- }
109
- namespace addressTextContainer {
110
- let flex_1: number;
111
- export { flex_1 as flex };
112
- }
113
- namespace addressText {
114
- let fontSize_2: number;
115
- export { fontSize_2 as fontSize };
116
- export let lineHeight: number;
117
- export let color: string;
118
- export let fontWeight: "600";
119
- }
120
- namespace addressSubtext {
121
- let fontSize_3: number;
122
- export { fontSize_3 as fontSize };
123
- let color_1: string;
124
- export { color_1 as color };
125
- }
126
- namespace footerContainer {
127
- let flexDirection_3: "row";
128
- export { flexDirection_3 as flexDirection };
129
- let alignItems_4: "center";
130
- export { alignItems_4 as alignItems };
131
- let paddingVertical_2: number;
132
- export { paddingVertical_2 as paddingVertical };
133
- let marginRight_2: number;
134
- export { marginRight_2 as marginRight };
135
- export let alignSelf: "flex-end";
136
- }
137
- namespace footerText {
138
- export let marginTop: number;
139
- let marginRight_3: number;
140
- export { marginRight_3 as marginRight };
141
- let fontSize_4: number;
142
- export { fontSize_4 as fontSize };
143
- let color_2: string;
144
- export { color_2 as color };
145
- }
146
- namespace logo {
147
- let width_8: number;
148
- export { width_8 as width };
149
- let height_5: number;
150
- export { height_5 as height };
151
- export let resizeMode: "contain";
152
- }
153
- namespace mapContainer {
154
- let flex_2: number;
155
- export { flex_2 as flex };
156
- }
157
- namespace map {
158
- let flex_3: number;
159
- export { flex_3 as flex };
160
- }
161
- namespace mapLogo {
162
- export let position: "absolute";
163
- export let bottom: number;
164
- export let left: number;
165
- let width_9: number;
166
- export { width_9 as width };
167
- let height_6: number;
168
- export { height_6 as height };
169
- let resizeMode_1: "contain";
170
- export { resizeMode_1 as resizeMode };
171
- }
172
- }
package/dist/ui/styles.js DELETED
@@ -1,125 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const react_native_1 = require("react-native");
4
- const styles = react_native_1.StyleSheet.create({
5
- container: {
6
- width: '100%',
7
- height: '100%',
8
- alignItems: 'center',
9
- paddingTop: 8,
10
- },
11
- inputContainer: {
12
- flexDirection: 'row',
13
- alignItems: 'center',
14
- marginHorizontal: 16,
15
- backgroundColor: 'white',
16
- borderRadius: 5,
17
- borderColor: '#DBE5EB',
18
- borderWidth: 1,
19
- width: '95%', // only difference between this and the modalInputContainer
20
- },
21
- modalInputContainer: {
22
- flexDirection: 'row',
23
- alignItems: 'center',
24
- marginHorizontal: 16,
25
- backgroundColor: 'white',
26
- borderRadius: 5,
27
- borderColor: '#DBE5EB',
28
- borderWidth: 1,
29
- },
30
- inputIcon: {
31
- marginLeft: 10,
32
- height: 18,
33
- width: 18,
34
- backgroundColor: 'white',
35
- },
36
- closeIcon: {
37
- marginRight: 10,
38
- height: 18,
39
- width: 18,
40
- backgroundColor: 'white',
41
- },
42
- input: {
43
- flex: 1,
44
- backgroundColor: 'white',
45
- height: 40,
46
- fontSize: 14,
47
- paddingHorizontal: 8,
48
- borderRadius: 5,
49
- },
50
- resultListWrapper: {
51
- width: '100%',
52
- marginBottom: 30,
53
- backgroundColor: 'white',
54
- borderRadius: 5,
55
- paddingVertical: 8,
56
- },
57
- resultList: {
58
- width: '100%',
59
- },
60
- resultItem: {
61
- paddingRight: 16,
62
- paddingVertical: 8,
63
- paddingHorizontal: 16,
64
- fontSize: 12,
65
- backgroundColor: 'white',
66
- },
67
- addressContainer: {
68
- flexDirection: 'row',
69
- alignItems: 'center',
70
- },
71
- pinIconContainer: {
72
- width: 28,
73
- marginRight: 8,
74
- },
75
- pinIcon: {
76
- height: 26,
77
- width: 26,
78
- },
79
- addressTextContainer: {
80
- flex: 1,
81
- },
82
- addressText: {
83
- fontSize: 14,
84
- lineHeight: 24,
85
- color: '#000',
86
- fontWeight: '600',
87
- },
88
- addressSubtext: {
89
- fontSize: 14,
90
- color: '#5A6872',
91
- },
92
- footerContainer: {
93
- flexDirection: 'row',
94
- alignItems: 'center',
95
- paddingVertical: 10,
96
- marginRight: 16,
97
- alignSelf: 'flex-end',
98
- },
99
- footerText: {
100
- marginTop: 2,
101
- marginRight: 4,
102
- fontSize: 10,
103
- color: '#5A6872',
104
- },
105
- logo: {
106
- width: 50,
107
- height: 15,
108
- resizeMode: 'contain',
109
- },
110
- mapContainer: {
111
- flex: 1,
112
- },
113
- map: {
114
- flex: 1,
115
- },
116
- mapLogo: {
117
- position: 'absolute',
118
- bottom: -10,
119
- left: 5,
120
- width: 50,
121
- height: 50,
122
- resizeMode: 'contain',
123
- },
124
- });
125
- exports.default = styles;
@@ -1 +0,0 @@
1
- github "radarlabs/radar-sdk-ios"
@@ -1 +0,0 @@
1
- github "radarlabs/radar-sdk-ios" "3.21.2"
@@ -1 +0,0 @@
1
- github "radarlabs/radar-sdk-ios" "{{ version }}"