react-native-map4d-map-dtqg 0.1.5 → 0.1.6
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/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +2 -2
- package/android/build.gradle +21 -0
- package/lib/commonjs/components/MFBanDoSo/constants.js +4 -1
- package/lib/commonjs/components/MFBanDoSo/constants.js.map +1 -1
- package/lib/commonjs/components/MFBanDoSo/styles.js +19 -13
- package/lib/commonjs/components/MFBanDoSo/styles.js.map +1 -1
- package/lib/commonjs/components/MFBanDoSo/ui.js +52 -41
- package/lib/commonjs/components/MFBanDoSo/ui.js.map +1 -1
- package/lib/commonjs/components/MFBanDoSo.js +11 -0
- package/lib/commonjs/components/MFBanDoSo.js.map +1 -1
- package/lib/module/components/MFBanDoSo/constants.js +4 -1
- package/lib/module/components/MFBanDoSo/constants.js.map +1 -1
- package/lib/module/components/MFBanDoSo/styles.js +20 -13
- package/lib/module/components/MFBanDoSo/styles.js.map +1 -1
- package/lib/module/components/MFBanDoSo/ui.js +52 -41
- package/lib/module/components/MFBanDoSo/ui.js.map +1 -1
- package/lib/module/components/MFBanDoSo.js +11 -0
- package/lib/module/components/MFBanDoSo.js.map +1 -1
- package/lib/typescript/components/MFBanDoSo/constants.d.ts +3 -0
- package/lib/typescript/components/MFBanDoSo/constants.d.ts.map +1 -1
- package/lib/typescript/components/MFBanDoSo/styles.d.ts +323 -449
- package/lib/typescript/components/MFBanDoSo/styles.d.ts.map +1 -1
- package/lib/typescript/components/MFBanDoSo/ui.d.ts +5 -3
- package/lib/typescript/components/MFBanDoSo/ui.d.ts.map +1 -1
- package/lib/typescript/components/MFBanDoSo.d.ts +1 -0
- package/lib/typescript/components/MFBanDoSo.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/MFBanDoSo/constants.js +6 -0
- package/src/components/MFBanDoSo/styles.js +20 -13
- package/src/components/MFBanDoSo/ui.js +72 -41
- package/src/components/MFBanDoSo.js +12 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/components/MFBanDoSo/styles.js"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/components/MFBanDoSo/styles.js"],"names":[],"mappings":"AAeA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiTG;2BAhUwB,cAAc"}
|
|
@@ -2,26 +2,28 @@ export function LayerButton({ show, isActive, onPress }: {
|
|
|
2
2
|
show: any;
|
|
3
3
|
isActive: any;
|
|
4
4
|
onPress: any;
|
|
5
|
-
}): React.JSX.Element
|
|
5
|
+
}): React.JSX.Element;
|
|
6
6
|
export function LegendButton({ show, isActive, onPress }: {
|
|
7
7
|
show: any;
|
|
8
8
|
isActive: any;
|
|
9
9
|
onPress: any;
|
|
10
|
-
}): React.JSX.Element
|
|
10
|
+
}): React.JSX.Element;
|
|
11
11
|
export function LegendPanel({ show, title, items, getItemColor }: {
|
|
12
12
|
show: any;
|
|
13
13
|
title: any;
|
|
14
14
|
items: any;
|
|
15
15
|
getItemColor: any;
|
|
16
16
|
}): React.JSX.Element | null;
|
|
17
|
-
export function SelectorDrawer({ show, title, groupSections, expandedGroupKeys, backdropAnimatedStyle, panelAnimatedStyle, onClose, onToggleGroup, onToggleGroupChecked, onToggleItem, }: {
|
|
17
|
+
export function SelectorDrawer({ show, title, groupSections, expandedGroupKeys, dragAnim, backdropAnimatedStyle, panelAnimatedStyle, onClose, onDragCancel, onToggleGroup, onToggleGroupChecked, onToggleItem, }: {
|
|
18
18
|
show: any;
|
|
19
19
|
title: any;
|
|
20
20
|
groupSections: any;
|
|
21
21
|
expandedGroupKeys: any;
|
|
22
|
+
dragAnim: any;
|
|
22
23
|
backdropAnimatedStyle: any;
|
|
23
24
|
panelAnimatedStyle: any;
|
|
24
25
|
onClose: any;
|
|
26
|
+
onDragCancel: any;
|
|
25
27
|
onToggleGroup: any;
|
|
26
28
|
onToggleGroupChecked: any;
|
|
27
29
|
onToggleItem: any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../../../src/components/MFBanDoSo/ui.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../../../src/components/MFBanDoSo/ui.js"],"names":[],"mappings":"AAiBA;;;;sBAeC;AAED;;;;sBAsBC;AA6JD;;;;;6BA6CC;AAxMD;;;;;;;;;;;;;6BAyJC;kBAnN6B,OAAO"}
|
|
@@ -21,6 +21,7 @@ export class MFBanDoSo extends MFMapView {
|
|
|
21
21
|
_toggleLegendVisibility(): void;
|
|
22
22
|
_openSelector(): void;
|
|
23
23
|
_closeSelector(): void;
|
|
24
|
+
_snapSelectorOpen(): void;
|
|
24
25
|
componentDidMount(): void;
|
|
25
26
|
componentDidUpdate(prevProps: any, prevState: any): void;
|
|
26
27
|
componentWillUnmount(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MFBanDoSo.d.ts","sourceRoot":"","sources":["../../../src/components/MFBanDoSo.js"],"names":[],"mappings":"AAwCA;IAGI,0BAAgC;IAChC,oBAAuB;IACvB,2BAA2B;IAC3B,8BAA0C;IAC1C;;;;;;;;;;MASC;
|
|
1
|
+
{"version":3,"file":"MFBanDoSo.d.ts","sourceRoot":"","sources":["../../../src/components/MFBanDoSo.js"],"names":[],"mappings":"AAwCA;IAGI,0BAAgC;IAChC,oBAAuB;IACvB,2BAA2B;IAC3B,8BAA0C;IAC1C;;;;;;;;;;MASC;IAoFH,oDAQC;IAeD,4DAQC;IArBD,kCAWC;IAYD,kCAOC;IAED,gCAIC;IAED,sBAYC;IAED,uBAgBC;IAED,0BAOC;IA/JD,0BAIC;IAED,yDAgBC;IAED,6BAEC;IAED,oCA0CC;IA2FD,0BAmBC;CAqEF;;;;;0BAhSyB,aAAa;yBAzBhC,cAAc;iCAwBd,uBAAuB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
const SELECTOR_DRAWER_TRANSLATE_X = -320;
|
|
2
2
|
const SELECTOR_OPEN_DURATION_MS = 240;
|
|
3
3
|
const SELECTOR_CLOSE_DURATION_MS = 210;
|
|
4
|
+
const SELECTOR_SWIPE_ACTIVATION_DISTANCE = 10;
|
|
5
|
+
const SELECTOR_SWIPE_CLOSE_DISTANCE = 80;
|
|
6
|
+
const SELECTOR_SWIPE_CLOSE_VELOCITY = 0.5;
|
|
4
7
|
const SELECTOR_TITLE = 'Chọn lớp dữ liệu trên bản đồ';
|
|
5
8
|
const LEGEND_TITLE = 'Chú giải';
|
|
6
9
|
|
|
@@ -25,6 +28,9 @@ export {
|
|
|
25
28
|
SELECTOR_DRAWER_TRANSLATE_X,
|
|
26
29
|
SELECTOR_OPEN_DURATION_MS,
|
|
27
30
|
SELECTOR_CLOSE_DURATION_MS,
|
|
31
|
+
SELECTOR_SWIPE_ACTIVATION_DISTANCE,
|
|
32
|
+
SELECTOR_SWIPE_CLOSE_DISTANCE,
|
|
33
|
+
SELECTOR_SWIPE_CLOSE_VELOCITY,
|
|
28
34
|
SELECTOR_TITLE,
|
|
29
35
|
LEGEND_TITLE,
|
|
30
36
|
getSourceUrl,
|
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
import { StyleSheet } from 'react-native';
|
|
2
2
|
|
|
3
|
+
// Workaround for a React Native Fabric/Android Yoga bug: an absolutely-positioned
|
|
4
|
+
// view stretched via top+bottom (e.g. StyleSheet.absoluteFillObject) can have its
|
|
5
|
+
// top offset silently dropped, collapsing the view to zero height pinned at the
|
|
6
|
+
// parent's bottom edge. Anchoring with top + height: '100%' instead avoids that
|
|
7
|
+
// code path. Do not replace this with absoluteFillObject/bottom-based stretching.
|
|
8
|
+
const fullFill = {
|
|
9
|
+
position: 'absolute',
|
|
10
|
+
top: 0,
|
|
11
|
+
left: 0,
|
|
12
|
+
right: 0,
|
|
13
|
+
height: '100%',
|
|
14
|
+
};
|
|
15
|
+
|
|
3
16
|
const styles = StyleSheet.create({
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
zIndex: 20,
|
|
7
|
-
elevation: 20,
|
|
17
|
+
hiddenButton: {
|
|
18
|
+
display: 'none',
|
|
8
19
|
},
|
|
9
20
|
layerButton: {
|
|
10
21
|
position: 'absolute',
|
|
@@ -73,22 +84,20 @@ const styles = StyleSheet.create({
|
|
|
73
84
|
backgroundColor: '#6b7280',
|
|
74
85
|
},
|
|
75
86
|
selectorContainer: {
|
|
76
|
-
...
|
|
77
|
-
zIndex: 18,
|
|
78
|
-
elevation: 18,
|
|
87
|
+
...fullFill,
|
|
79
88
|
},
|
|
80
89
|
selectorBackdrop: {
|
|
81
|
-
...
|
|
90
|
+
...fullFill,
|
|
82
91
|
backgroundColor: '#11182740',
|
|
83
92
|
},
|
|
84
93
|
selectorBackdropPressable: {
|
|
85
|
-
...
|
|
94
|
+
...fullFill,
|
|
86
95
|
},
|
|
87
96
|
selectorPanel: {
|
|
88
97
|
position: 'absolute',
|
|
89
98
|
top: 0,
|
|
90
99
|
left: 0,
|
|
91
|
-
|
|
100
|
+
height: '100%',
|
|
92
101
|
width: '76%',
|
|
93
102
|
maxWidth: 320,
|
|
94
103
|
minWidth: 260,
|
|
@@ -243,9 +252,7 @@ const styles = StyleSheet.create({
|
|
|
243
252
|
backgroundColor: '#2563eb',
|
|
244
253
|
},
|
|
245
254
|
legendContainer: {
|
|
246
|
-
...
|
|
247
|
-
zIndex: 10,
|
|
248
|
-
elevation: 10,
|
|
255
|
+
...fullFill,
|
|
249
256
|
},
|
|
250
257
|
legendPanel: {
|
|
251
258
|
position: 'absolute',
|
|
@@ -1,59 +1,58 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useRef } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
Animated,
|
|
4
|
+
PanResponder,
|
|
4
5
|
Pressable,
|
|
5
6
|
ScrollView,
|
|
6
7
|
Text,
|
|
7
8
|
View,
|
|
8
9
|
} from 'react-native';
|
|
10
|
+
import {
|
|
11
|
+
SELECTOR_DRAWER_TRANSLATE_X,
|
|
12
|
+
SELECTOR_SWIPE_ACTIVATION_DISTANCE,
|
|
13
|
+
SELECTOR_SWIPE_CLOSE_DISTANCE,
|
|
14
|
+
SELECTOR_SWIPE_CLOSE_VELOCITY,
|
|
15
|
+
} from './constants';
|
|
9
16
|
import { styles } from './styles';
|
|
10
17
|
|
|
11
18
|
function LayerButton({ show, isActive, onPress }) {
|
|
12
|
-
if (!show) {
|
|
13
|
-
return null;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
19
|
return (
|
|
17
|
-
<
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
</
|
|
20
|
+
<Pressable
|
|
21
|
+
style={[
|
|
22
|
+
styles.layerButton,
|
|
23
|
+
isActive && styles.layerButtonActive,
|
|
24
|
+
!show && styles.hiddenButton,
|
|
25
|
+
]}
|
|
26
|
+
onPress={onPress}
|
|
27
|
+
pointerEvents={show ? 'auto' : 'none'}
|
|
28
|
+
>
|
|
29
|
+
<View style={styles.layerIconBoxPrimary} />
|
|
30
|
+
<View style={styles.layerIconBoxSecondary} />
|
|
31
|
+
</Pressable>
|
|
29
32
|
);
|
|
30
33
|
}
|
|
31
34
|
|
|
32
35
|
function LegendButton({ show, isActive, onPress }) {
|
|
33
|
-
if (!show) {
|
|
34
|
-
return null;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
36
|
return (
|
|
38
|
-
<
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
</
|
|
56
|
-
</
|
|
37
|
+
<Pressable
|
|
38
|
+
style={[
|
|
39
|
+
styles.layerButton,
|
|
40
|
+
styles.legendButton,
|
|
41
|
+
isActive && styles.layerButtonActive,
|
|
42
|
+
!show && styles.hiddenButton,
|
|
43
|
+
]}
|
|
44
|
+
onPress={onPress}
|
|
45
|
+
pointerEvents={show ? 'auto' : 'none'}
|
|
46
|
+
>
|
|
47
|
+
<View style={styles.legendToggleIconRow}>
|
|
48
|
+
<View style={styles.legendToggleIconDot} />
|
|
49
|
+
<View style={styles.legendToggleIconLine} />
|
|
50
|
+
</View>
|
|
51
|
+
<View style={styles.legendToggleIconRow}>
|
|
52
|
+
<View style={styles.legendToggleIconDot} />
|
|
53
|
+
<View style={styles.legendToggleIconLine} />
|
|
54
|
+
</View>
|
|
55
|
+
</Pressable>
|
|
57
56
|
);
|
|
58
57
|
}
|
|
59
58
|
|
|
@@ -62,13 +61,42 @@ function SelectorDrawer({
|
|
|
62
61
|
title,
|
|
63
62
|
groupSections,
|
|
64
63
|
expandedGroupKeys,
|
|
64
|
+
dragAnim,
|
|
65
65
|
backdropAnimatedStyle,
|
|
66
66
|
panelAnimatedStyle,
|
|
67
67
|
onClose,
|
|
68
|
+
onDragCancel,
|
|
68
69
|
onToggleGroup,
|
|
69
70
|
onToggleGroupChecked,
|
|
70
71
|
onToggleItem,
|
|
71
72
|
}) {
|
|
73
|
+
const panResponder = useRef(
|
|
74
|
+
PanResponder.create({
|
|
75
|
+
onMoveShouldSetPanResponder: (evt, gestureState) =>
|
|
76
|
+
Math.abs(gestureState.dx) > SELECTOR_SWIPE_ACTIVATION_DISTANCE &&
|
|
77
|
+
Math.abs(gestureState.dx) > Math.abs(gestureState.dy),
|
|
78
|
+
onPanResponderMove: (evt, gestureState) => {
|
|
79
|
+
const clampedDx = Math.min(0, gestureState.dx);
|
|
80
|
+
const nextValue = 1 + clampedDx / Math.abs(SELECTOR_DRAWER_TRANSLATE_X);
|
|
81
|
+
dragAnim.setValue(Math.max(0, Math.min(1, nextValue)));
|
|
82
|
+
},
|
|
83
|
+
onPanResponderRelease: (evt, gestureState) => {
|
|
84
|
+
const shouldClose =
|
|
85
|
+
gestureState.dx < -SELECTOR_SWIPE_CLOSE_DISTANCE ||
|
|
86
|
+
gestureState.vx < -SELECTOR_SWIPE_CLOSE_VELOCITY;
|
|
87
|
+
|
|
88
|
+
if (shouldClose) {
|
|
89
|
+
onClose();
|
|
90
|
+
} else {
|
|
91
|
+
onDragCancel();
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
onPanResponderTerminate: () => {
|
|
95
|
+
onDragCancel();
|
|
96
|
+
},
|
|
97
|
+
})
|
|
98
|
+
).current;
|
|
99
|
+
|
|
72
100
|
if (!show) {
|
|
73
101
|
return null;
|
|
74
102
|
}
|
|
@@ -81,7 +109,10 @@ function SelectorDrawer({
|
|
|
81
109
|
onPress={onClose}
|
|
82
110
|
/>
|
|
83
111
|
</Animated.View>
|
|
84
|
-
<Animated.View
|
|
112
|
+
<Animated.View
|
|
113
|
+
style={[styles.selectorPanel, panelAnimatedStyle]}
|
|
114
|
+
{...panResponder.panHandlers}
|
|
115
|
+
>
|
|
85
116
|
<View style={styles.selectorHeader}>
|
|
86
117
|
<Text style={styles.selectorTitle}>{title}</Text>
|
|
87
118
|
</View>
|
|
@@ -63,6 +63,7 @@ class MFBanDoSo extends MFMapView {
|
|
|
63
63
|
this._toggleLegendVisibility = this._toggleLegendVisibility.bind(this);
|
|
64
64
|
this._openSelector = this._openSelector.bind(this);
|
|
65
65
|
this._closeSelector = this._closeSelector.bind(this);
|
|
66
|
+
this._snapSelectorOpen = this._snapSelectorOpen.bind(this);
|
|
66
67
|
}
|
|
67
68
|
|
|
68
69
|
componentDidMount() {
|
|
@@ -217,6 +218,15 @@ class MFBanDoSo extends MFMapView {
|
|
|
217
218
|
});
|
|
218
219
|
}
|
|
219
220
|
|
|
221
|
+
_snapSelectorOpen() {
|
|
222
|
+
Animated.timing(this._selectorAnim, {
|
|
223
|
+
toValue: 1,
|
|
224
|
+
duration: SELECTOR_OPEN_DURATION_MS,
|
|
225
|
+
easing: Easing.out(Easing.cubic),
|
|
226
|
+
useNativeDriver: true,
|
|
227
|
+
}).start();
|
|
228
|
+
}
|
|
229
|
+
|
|
220
230
|
_syncGeojsonStyle() {
|
|
221
231
|
if (!this.state.isReady) {
|
|
222
232
|
return;
|
|
@@ -287,9 +297,11 @@ class MFBanDoSo extends MFMapView {
|
|
|
287
297
|
title={selectorTitle}
|
|
288
298
|
groupSections={groupSections}
|
|
289
299
|
expandedGroupKeys={this.state.expandedGroupKeys}
|
|
300
|
+
dragAnim={this._selectorAnim}
|
|
290
301
|
backdropAnimatedStyle={backdropAnimatedStyle}
|
|
291
302
|
panelAnimatedStyle={panelAnimatedStyle}
|
|
292
303
|
onClose={this._toggleSelectorVisibility}
|
|
304
|
+
onDragCancel={this._snapSelectorOpen}
|
|
293
305
|
onToggleGroup={this._toggleGroup}
|
|
294
306
|
onToggleGroupChecked={this._toggleGroupChecked}
|
|
295
307
|
onToggleItem={this._toggleItem}
|