@chem-po/react-native 0.0.24 → 0.0.26
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/lib/commonjs/components/form/UploadProgress/index.js +8 -17
- package/lib/commonjs/components/form/UploadProgress/index.js.map +1 -1
- package/lib/commonjs/components/form/input/file/index.js +26 -8
- package/lib/commonjs/components/form/input/file/index.js.map +1 -1
- package/lib/commonjs/components/image/ImageViewModal.backup.js +285 -0
- package/lib/commonjs/components/image/ImageViewModal.backup.js.map +1 -0
- package/lib/commonjs/components/image/ImageViewModal.js +79 -99
- package/lib/commonjs/components/image/ImageViewModal.js.map +1 -1
- package/lib/commonjs/components/image/ImageViewModal.old.js +285 -0
- package/lib/commonjs/components/image/ImageViewModal.old.js.map +1 -0
- package/lib/commonjs/components/loading/ProgressBar.js +78 -0
- package/lib/commonjs/components/loading/ProgressBar.js.map +1 -0
- package/lib/commonjs/components/loading/index.js +11 -0
- package/lib/commonjs/components/loading/index.js.map +1 -1
- package/lib/module/components/form/UploadProgress/index.js +6 -15
- package/lib/module/components/form/UploadProgress/index.js.map +1 -1
- package/lib/module/components/form/input/file/index.js +27 -9
- package/lib/module/components/form/input/file/index.js.map +1 -1
- package/lib/module/components/image/ImageViewModal.backup.js +277 -0
- package/lib/module/components/image/ImageViewModal.backup.js.map +1 -0
- package/lib/module/components/image/ImageViewModal.js +80 -100
- package/lib/module/components/image/ImageViewModal.js.map +1 -1
- package/lib/module/components/image/ImageViewModal.old.js +277 -0
- package/lib/module/components/image/ImageViewModal.old.js.map +1 -0
- package/lib/module/components/loading/ProgressBar.js +70 -0
- package/lib/module/components/loading/ProgressBar.js.map +1 -0
- package/lib/module/components/loading/index.js +1 -0
- package/lib/module/components/loading/index.js.map +1 -1
- package/lib/typescript/components/form/UploadProgress/index.d.ts.map +1 -1
- package/lib/typescript/components/form/input/file/index.d.ts +5 -3
- package/lib/typescript/components/form/input/file/index.d.ts.map +1 -1
- package/lib/typescript/components/image/ImageViewModal.backup.d.ts +9 -0
- package/lib/typescript/components/image/ImageViewModal.backup.d.ts.map +1 -0
- package/lib/typescript/components/image/ImageViewModal.d.ts.map +1 -1
- package/lib/typescript/components/image/ImageViewModal.old.d.ts +9 -0
- package/lib/typescript/components/image/ImageViewModal.old.d.ts.map +1 -0
- package/lib/typescript/components/loading/ProgressBar.d.ts +7 -0
- package/lib/typescript/components/loading/ProgressBar.d.ts.map +1 -0
- package/lib/typescript/components/loading/index.d.ts +1 -0
- package/lib/typescript/components/loading/index.d.ts.map +1 -1
- package/package.json +11 -10
- package/src/components/form/UploadProgress/index.tsx +3 -17
- package/src/components/form/input/file/index.tsx +28 -8
- package/src/components/image/ImageViewModal.backup.tsx +261 -0
- package/src/components/image/ImageViewModal.old.tsx +261 -0
- package/src/components/image/ImageViewModal.tsx +72 -79
- package/src/components/loading/ProgressBar.tsx +75 -0
- package/src/components/loading/index.ts +1 -0
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { useScreen } from '@chem-po/react';
|
|
2
2
|
import { Ionicons } from '@expo/vector-icons';
|
|
3
|
-
import React, { useCallback,
|
|
4
|
-
import {
|
|
3
|
+
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
4
|
+
import { Image, Modal, StyleSheet, TouchableOpacity, View } from 'react-native';
|
|
5
5
|
import { Gesture, GestureDetector, GestureHandlerRootView } from 'react-native-gesture-handler';
|
|
6
|
+
import Animated, { useAnimatedStyle, useSharedValue, withSpring } from 'react-native-reanimated';
|
|
6
7
|
import { LoadingLogo } from '../loading/Loading';
|
|
7
8
|
export const ImageViewModal = ({
|
|
8
9
|
isOpen,
|
|
@@ -17,18 +18,15 @@ export const ImageViewModal = ({
|
|
|
17
18
|
height: screenHeight / 2
|
|
18
19
|
});
|
|
19
20
|
|
|
20
|
-
//
|
|
21
|
-
const scale =
|
|
22
|
-
const translateX =
|
|
23
|
-
const translateY =
|
|
21
|
+
// Shared values for zoom and pan (reanimated)
|
|
22
|
+
const scale = useSharedValue(1);
|
|
23
|
+
const translateX = useSharedValue(0);
|
|
24
|
+
const translateY = useSharedValue(0);
|
|
24
25
|
|
|
25
|
-
//
|
|
26
|
-
const savedScale =
|
|
27
|
-
const savedTranslateX =
|
|
28
|
-
const savedTranslateY =
|
|
29
|
-
const currentScale = useRef(1);
|
|
30
|
-
const currentTranslateX = useRef(0);
|
|
31
|
-
const currentTranslateY = useRef(0);
|
|
26
|
+
// Saved state for gesture handling
|
|
27
|
+
const savedScale = useSharedValue(1);
|
|
28
|
+
const savedTranslateX = useSharedValue(0);
|
|
29
|
+
const savedTranslateY = useSharedValue(0);
|
|
32
30
|
const {
|
|
33
31
|
height,
|
|
34
32
|
width
|
|
@@ -61,122 +59,111 @@ export const ImageViewModal = ({
|
|
|
61
59
|
|
|
62
60
|
// Reset zoom and pan when modal opens/closes
|
|
63
61
|
const resetTransform = useCallback(() => {
|
|
64
|
-
scale.
|
|
65
|
-
translateX.
|
|
66
|
-
translateY.
|
|
67
|
-
savedScale.
|
|
68
|
-
savedTranslateX.
|
|
69
|
-
savedTranslateY.
|
|
70
|
-
|
|
71
|
-
currentTranslateX.current = 0;
|
|
72
|
-
currentTranslateY.current = 0;
|
|
73
|
-
}, [scale, translateX, translateY]);
|
|
62
|
+
scale.value = 1;
|
|
63
|
+
translateX.value = 0;
|
|
64
|
+
translateY.value = 0;
|
|
65
|
+
savedScale.value = 1;
|
|
66
|
+
savedTranslateX.value = 0;
|
|
67
|
+
savedTranslateY.value = 0;
|
|
68
|
+
}, [scale, translateX, translateY, savedScale, savedTranslateX, savedTranslateY]);
|
|
74
69
|
|
|
75
70
|
// Reset when modal closes or src changes
|
|
76
|
-
|
|
71
|
+
useEffect(() => {
|
|
77
72
|
if (!isOpen || !src) {
|
|
78
73
|
resetTransform();
|
|
79
74
|
}
|
|
80
75
|
}, [isOpen, src, resetTransform]);
|
|
81
76
|
|
|
82
|
-
// Pan gesture
|
|
77
|
+
// Pan gesture with worklet
|
|
83
78
|
const panGesture = Gesture.Pan().onUpdate(event => {
|
|
79
|
+
'worklet';
|
|
80
|
+
|
|
84
81
|
// Only allow panning if zoomed in
|
|
85
|
-
if (savedScale.
|
|
86
|
-
const newTranslateX = savedTranslateX.
|
|
87
|
-
const newTranslateY = savedTranslateY.
|
|
82
|
+
if (savedScale.value > 1) {
|
|
83
|
+
const newTranslateX = savedTranslateX.value + event.translationX;
|
|
84
|
+
const newTranslateY = savedTranslateY.value + event.translationY;
|
|
88
85
|
|
|
89
86
|
// Calculate bounds to prevent panning too far
|
|
90
|
-
const maxTranslateX = (width * savedScale.
|
|
91
|
-
const maxTranslateY = (height * savedScale.
|
|
87
|
+
const maxTranslateX = (width * savedScale.value - width) / 2;
|
|
88
|
+
const maxTranslateY = (height * savedScale.value - height) / 2;
|
|
92
89
|
const boundedTranslateX = Math.max(-maxTranslateX, Math.min(maxTranslateX, newTranslateX));
|
|
93
90
|
const boundedTranslateY = Math.max(-maxTranslateY, Math.min(maxTranslateY, newTranslateY));
|
|
94
|
-
translateX.
|
|
95
|
-
translateY.
|
|
96
|
-
currentTranslateX.current = boundedTranslateX;
|
|
97
|
-
currentTranslateY.current = boundedTranslateY;
|
|
91
|
+
translateX.value = boundedTranslateX;
|
|
92
|
+
translateY.value = boundedTranslateY;
|
|
98
93
|
}
|
|
99
94
|
}).onEnd(() => {
|
|
100
|
-
|
|
101
|
-
|
|
95
|
+
'worklet';
|
|
96
|
+
|
|
97
|
+
savedTranslateX.value = translateX.value;
|
|
98
|
+
savedTranslateY.value = translateY.value;
|
|
102
99
|
});
|
|
103
100
|
|
|
104
|
-
// Pinch gesture
|
|
101
|
+
// Pinch gesture with worklet
|
|
105
102
|
const pinchGesture = Gesture.Pinch().onUpdate(event => {
|
|
106
|
-
|
|
103
|
+
'worklet';
|
|
104
|
+
|
|
105
|
+
const newScale = savedScale.value * event.scale;
|
|
107
106
|
// Limit zoom between 1x and 5x
|
|
108
107
|
const boundedScale = Math.max(1, Math.min(5, newScale));
|
|
109
|
-
scale.
|
|
110
|
-
currentScale.current = boundedScale;
|
|
108
|
+
scale.value = boundedScale;
|
|
111
109
|
|
|
112
110
|
// If zooming out to 1x, reset position
|
|
113
111
|
if (boundedScale <= 1) {
|
|
114
|
-
translateX.
|
|
115
|
-
translateY.
|
|
116
|
-
currentTranslateX.current = 0;
|
|
117
|
-
currentTranslateY.current = 0;
|
|
112
|
+
translateX.value = 0;
|
|
113
|
+
translateY.value = 0;
|
|
118
114
|
}
|
|
119
115
|
}).onEnd(() => {
|
|
120
|
-
|
|
116
|
+
'worklet';
|
|
117
|
+
|
|
118
|
+
savedScale.value = scale.value;
|
|
121
119
|
// If scale is close to 1, snap back to 1
|
|
122
|
-
if (savedScale.
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
}), Animated.spring(translateY, {
|
|
130
|
-
toValue: 0,
|
|
131
|
-
useNativeDriver: true
|
|
132
|
-
})]).start();
|
|
133
|
-
savedScale.current = 1;
|
|
134
|
-
savedTranslateX.current = 0;
|
|
135
|
-
savedTranslateY.current = 0;
|
|
136
|
-
currentScale.current = 1;
|
|
137
|
-
currentTranslateX.current = 0;
|
|
138
|
-
currentTranslateY.current = 0;
|
|
120
|
+
if (savedScale.value < 1.1) {
|
|
121
|
+
scale.value = withSpring(1);
|
|
122
|
+
translateX.value = withSpring(0);
|
|
123
|
+
translateY.value = withSpring(0);
|
|
124
|
+
savedScale.value = 1;
|
|
125
|
+
savedTranslateX.value = 0;
|
|
126
|
+
savedTranslateY.value = 0;
|
|
139
127
|
} else {
|
|
140
|
-
savedTranslateX.
|
|
141
|
-
savedTranslateY.
|
|
128
|
+
savedTranslateX.value = translateX.value;
|
|
129
|
+
savedTranslateY.value = translateY.value;
|
|
142
130
|
}
|
|
143
131
|
});
|
|
144
132
|
|
|
145
|
-
// Double tap to zoom
|
|
133
|
+
// Double tap to zoom with worklet
|
|
146
134
|
const doubleTapGesture = Gesture.Tap().numberOfTaps(2).onEnd(() => {
|
|
147
|
-
|
|
135
|
+
'worklet';
|
|
136
|
+
|
|
137
|
+
if (savedScale.value > 1) {
|
|
148
138
|
// Zoom out
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
}), Animated.spring(translateY, {
|
|
156
|
-
toValue: 0,
|
|
157
|
-
useNativeDriver: true
|
|
158
|
-
})]).start();
|
|
159
|
-
savedScale.current = 1;
|
|
160
|
-
savedTranslateX.current = 0;
|
|
161
|
-
savedTranslateY.current = 0;
|
|
162
|
-
currentScale.current = 1;
|
|
163
|
-
currentTranslateX.current = 0;
|
|
164
|
-
currentTranslateY.current = 0;
|
|
139
|
+
scale.value = withSpring(1);
|
|
140
|
+
translateX.value = withSpring(0);
|
|
141
|
+
translateY.value = withSpring(0);
|
|
142
|
+
savedScale.value = 1;
|
|
143
|
+
savedTranslateX.value = 0;
|
|
144
|
+
savedTranslateY.value = 0;
|
|
165
145
|
} else {
|
|
166
146
|
// Zoom in to 2x
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
useNativeDriver: true
|
|
170
|
-
}).start();
|
|
171
|
-
savedScale.current = 2;
|
|
172
|
-
currentScale.current = 2;
|
|
147
|
+
scale.value = withSpring(2);
|
|
148
|
+
savedScale.value = 2;
|
|
173
149
|
}
|
|
174
150
|
});
|
|
175
151
|
|
|
176
|
-
//
|
|
177
|
-
|
|
178
|
-
// Combine gestures - simplified approach
|
|
152
|
+
// Combine gestures
|
|
179
153
|
const combinedGestures = Gesture.Race(doubleTapGesture, Gesture.Simultaneous(panGesture, pinchGesture));
|
|
154
|
+
|
|
155
|
+
// Animated style using reanimated
|
|
156
|
+
const animatedStyle = useAnimatedStyle(() => {
|
|
157
|
+
return {
|
|
158
|
+
transform: [{
|
|
159
|
+
scale: scale.value
|
|
160
|
+
}, {
|
|
161
|
+
translateX: translateX.value
|
|
162
|
+
}, {
|
|
163
|
+
translateY: translateY.value
|
|
164
|
+
}]
|
|
165
|
+
};
|
|
166
|
+
});
|
|
180
167
|
if (!isOpen) {
|
|
181
168
|
return null;
|
|
182
169
|
}
|
|
@@ -201,15 +188,8 @@ export const ImageViewModal = ({
|
|
|
201
188
|
style: [styles.imageContainer, {
|
|
202
189
|
width,
|
|
203
190
|
height,
|
|
204
|
-
opacity: loading ? 0 : 1
|
|
205
|
-
|
|
206
|
-
scale
|
|
207
|
-
}, {
|
|
208
|
-
translateX
|
|
209
|
-
}, {
|
|
210
|
-
translateY
|
|
211
|
-
}]
|
|
212
|
-
}]
|
|
191
|
+
opacity: loading ? 0 : 1
|
|
192
|
+
}, animatedStyle]
|
|
213
193
|
}, /*#__PURE__*/React.createElement(Image, {
|
|
214
194
|
source: src ? {
|
|
215
195
|
uri: src
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useScreen","Ionicons","React","useCallback","useMemo","useRef","useState","Animated","Image","Modal","StyleSheet","TouchableOpacity","View","Gesture","GestureDetector","GestureHandlerRootView","LoadingLogo","ImageViewModal","isOpen","onClose","src","loading","setLoading","screenWidth","s","width","screenHeight","height","imageSize","setImageSize","scale","Value","current","translateX","translateY","savedScale","savedTranslateX","savedTranslateY","currentScale","currentTranslateX","currentTranslateY","ratio","h","Math","min","w","onLoadStart","onLoad","e","naturalWidth","naturalHeight","nativeEvent","source","resetTransform","setValue","useEffect","panGesture","Pan","onUpdate","event","newTranslateX","translationX","newTranslateY","translationY","maxTranslateX","maxTranslateY","boundedTranslateX","max","boundedTranslateY","onEnd","pinchGesture","Pinch","newScale","boundedScale","parallel","spring","toValue","useNativeDriver","start","doubleTapGesture","Tap","numberOfTaps","combinedGestures","Race","Simultaneous","createElement","visible","transparent","animationType","onRequestClose","style","styles","gestureRoot","modalOverlay","backgroundTouchable","activeOpacity","onPress","contentContainer","gesture","imageContainer","opacity","transform","uri","undefined","image","resizeMode","closeButton","name","size","color","loadingContainer","isLoading","create","flex","backgroundColor","absoluteFillObject","justifyContent","alignIt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gB,EAAE;IAChB,GAAGpG,UAAU,CAACyG,kBAAkB;IAChCC,cAAc,EAAE,QAAQ;IACxBC,UAAU,EAAE;EACd;AACF,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["useScreen","Ionicons","React","useCallback","useEffect","useMemo","useState","Image","Modal","StyleSheet","TouchableOpacity","View","Gesture","GestureDetector","GestureHandlerRootView","Animated","useAnimatedStyle","useSharedValue","withSpring","LoadingLogo","ImageViewModal","isOpen","onClose","src","loading","setLoading","screenWidth","s","width","screenHeight","height","imageSize","setImageSize","scale","translateX","translateY","savedScale","savedTranslateX","savedTranslateY","ratio","h","Math","min","w","onLoadStart","onLoad","e","naturalWidth","naturalHeight","nativeEvent","source","resetTransform","value","panGesture","Pan","onUpdate","event","newTranslateX","translationX","newTranslateY","translationY","maxTranslateX","maxTranslateY","boundedTranslateX","max","boundedTranslateY","onEnd","pinchGesture","Pinch","newScale","boundedScale","doubleTapGesture","Tap","numberOfTaps","combinedGestures","Race","Simultaneous","animatedStyle","transform","createElement","visible","transparent","animationType","onRequestClose","style","styles","gestureRoot","modalOverlay","backgroundTouchable","activeOpacity","onPress","contentContainer","gesture","imageContainer","opacity","uri","undefined","image","resizeMode","closeButton","name","size","color","loadingContainer","isLoading","create","flex","backgroundColor","absoluteFillObject","justifyContent","alignItems","padding","overflow","borderRadius","position","top","right"],"sourceRoot":"..\\..\\..\\..\\src","sources":["components/image/ImageViewModal.tsx"],"mappings":"AAAA,SAASA,SAAS,QAAQ,gBAAgB;AAC1C,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,OAAOC,KAAK,IAAIC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AACxE,SAASC,KAAK,EAAEC,KAAK,EAAEC,UAAU,EAAEC,gBAAgB,EAAEC,IAAI,QAAQ,cAAc;AAC/E,SAASC,OAAO,EAAEC,eAAe,EAAEC,sBAAsB,QAAQ,8BAA8B;AAC/F,OAAOC,QA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AE,CACxC,CAAC,GACL,IACA,CACF,CACgB,CACnB,CAAC;AAEZ,CAAC;AAED,MAAMhB,MAAM,GAAG5E,UAAU,CAACgG,MAAM,CAAC;EAC/BnB,WAAW,EAAE;IACXoB,IAAI,EAAE;EACR,CAAC;EACDnB,YAAY,EAAE;IACZmB,IAAI,EAAE,CAAC;IACPC,eAAe,EAAE;EACnB,CAAC;EACDnB,mBAAmB,EAAE;IACnB,GAAG/E,UAAU,CAACmG;EAChB,CAAC;EACDjB,gBAAgB,EAAE;IAChBe,IAAI,EAAE,CAAC;IACPG,cAAc,EAAE,QAAQ;IACxBC,UAAU,EAAE,QAAQ;IACpBC,OAAO,EAAE;EACX,CAAC;EACDlB,cAAc,EAAE;IACdmB,QAAQ,EAAE,QAAQ;IAClBC,YAAY,EAAE;EAChB,CAAC;EACDhB,KAAK,EAAE;IACLrE,KAAK,EAAE,MAAM;IACbE,MAAM,EAAE;EACV,CAAC;EACDqE,WAAW,EAAE;IACXe,QAAQ,EAAE,UAAU;IACpBC,GAAG,EAAE,EAAE;IACPC,KAAK,EAAE,EAAE;IACTxF,KAAK,EAAE,EAAE;IACTE,MAAM,EAAE,EAAE;IACVmF,YAAY,EAAE,EAAE;IAChBN,eAAe,EAAE,oBAAoB;IACrCE,cAAc,EAAE,QAAQ;IACxBC,UAAU,EAAE;EACd,CAAC;EACDP,gBAAgB,EAAE;IAChB,GAAG9F,UAAU,CAACmG,kBAAkB;IAChCC,cAAc,EAAE,QAAQ;IACxBC,UAAU,EAAE;EACd;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
import { useScreen } from '@chem-po/react';
|
|
2
|
+
import { Ionicons } from '@expo/vector-icons';
|
|
3
|
+
import React, { useCallback, useMemo, useRef, useState } from 'react';
|
|
4
|
+
import { Animated, Image, Modal, StyleSheet, TouchableOpacity, View } from 'react-native';
|
|
5
|
+
import { Gesture, GestureDetector, GestureHandlerRootView } from 'react-native-gesture-handler';
|
|
6
|
+
import { LoadingLogo } from '../loading/Loading';
|
|
7
|
+
export const ImageViewModal = ({
|
|
8
|
+
isOpen,
|
|
9
|
+
onClose,
|
|
10
|
+
src
|
|
11
|
+
}) => {
|
|
12
|
+
const [loading, setLoading] = useState(true);
|
|
13
|
+
const screenWidth = useScreen(s => s.width);
|
|
14
|
+
const screenHeight = useScreen(s => s.height);
|
|
15
|
+
const [imageSize, setImageSize] = useState({
|
|
16
|
+
width: screenWidth / 2,
|
|
17
|
+
height: screenHeight / 2
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
// Animated values for zoom and pan
|
|
21
|
+
const scale = useRef(new Animated.Value(1)).current;
|
|
22
|
+
const translateX = useRef(new Animated.Value(0)).current;
|
|
23
|
+
const translateY = useRef(new Animated.Value(0)).current;
|
|
24
|
+
|
|
25
|
+
// Gesture state
|
|
26
|
+
const savedScale = useRef(1);
|
|
27
|
+
const savedTranslateX = useRef(0);
|
|
28
|
+
const savedTranslateY = useRef(0);
|
|
29
|
+
const currentScale = useRef(1);
|
|
30
|
+
const currentTranslateX = useRef(0);
|
|
31
|
+
const currentTranslateY = useRef(0);
|
|
32
|
+
const {
|
|
33
|
+
height,
|
|
34
|
+
width
|
|
35
|
+
} = useMemo(() => {
|
|
36
|
+
if (loading) return imageSize;
|
|
37
|
+
const ratio = imageSize.width / imageSize.height;
|
|
38
|
+
let h = Math.min(imageSize.height, screenHeight * 0.9);
|
|
39
|
+
let w = h * ratio;
|
|
40
|
+
if (w > screenWidth * 0.9) {
|
|
41
|
+
w = Math.min(imageSize.width, screenWidth * 0.9);
|
|
42
|
+
h = w / ratio;
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
height: h,
|
|
46
|
+
width: w
|
|
47
|
+
};
|
|
48
|
+
}, [screenHeight, screenWidth, imageSize, loading]);
|
|
49
|
+
const onLoadStart = useCallback(() => setLoading(true), []);
|
|
50
|
+
const onLoad = useCallback(e => {
|
|
51
|
+
const {
|
|
52
|
+
width: naturalWidth,
|
|
53
|
+
height: naturalHeight
|
|
54
|
+
} = e.nativeEvent.source;
|
|
55
|
+
setImageSize({
|
|
56
|
+
width: naturalWidth,
|
|
57
|
+
height: naturalHeight
|
|
58
|
+
});
|
|
59
|
+
setLoading(false);
|
|
60
|
+
}, []);
|
|
61
|
+
|
|
62
|
+
// Reset zoom and pan when modal opens/closes
|
|
63
|
+
const resetTransform = useCallback(() => {
|
|
64
|
+
scale.setValue(1);
|
|
65
|
+
translateX.setValue(0);
|
|
66
|
+
translateY.setValue(0);
|
|
67
|
+
savedScale.current = 1;
|
|
68
|
+
savedTranslateX.current = 0;
|
|
69
|
+
savedTranslateY.current = 0;
|
|
70
|
+
currentScale.current = 1;
|
|
71
|
+
currentTranslateX.current = 0;
|
|
72
|
+
currentTranslateY.current = 0;
|
|
73
|
+
}, [scale, translateX, translateY]);
|
|
74
|
+
|
|
75
|
+
// Reset when modal closes or src changes
|
|
76
|
+
React.useEffect(() => {
|
|
77
|
+
if (!isOpen || !src) {
|
|
78
|
+
resetTransform();
|
|
79
|
+
}
|
|
80
|
+
}, [isOpen, src, resetTransform]);
|
|
81
|
+
|
|
82
|
+
// Pan gesture
|
|
83
|
+
const panGesture = Gesture.Pan().onUpdate(event => {
|
|
84
|
+
// Only allow panning if zoomed in
|
|
85
|
+
if (savedScale.current > 1) {
|
|
86
|
+
const newTranslateX = savedTranslateX.current + event.translationX;
|
|
87
|
+
const newTranslateY = savedTranslateY.current + event.translationY;
|
|
88
|
+
|
|
89
|
+
// Calculate bounds to prevent panning too far
|
|
90
|
+
const maxTranslateX = (width * savedScale.current - width) / 2;
|
|
91
|
+
const maxTranslateY = (height * savedScale.current - height) / 2;
|
|
92
|
+
const boundedTranslateX = Math.max(-maxTranslateX, Math.min(maxTranslateX, newTranslateX));
|
|
93
|
+
const boundedTranslateY = Math.max(-maxTranslateY, Math.min(maxTranslateY, newTranslateY));
|
|
94
|
+
translateX.setValue(boundedTranslateX);
|
|
95
|
+
translateY.setValue(boundedTranslateY);
|
|
96
|
+
currentTranslateX.current = boundedTranslateX;
|
|
97
|
+
currentTranslateY.current = boundedTranslateY;
|
|
98
|
+
}
|
|
99
|
+
}).onEnd(() => {
|
|
100
|
+
savedTranslateX.current = currentTranslateX.current;
|
|
101
|
+
savedTranslateY.current = currentTranslateY.current;
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
// Pinch gesture
|
|
105
|
+
const pinchGesture = Gesture.Pinch().onUpdate(event => {
|
|
106
|
+
const newScale = savedScale.current * event.scale;
|
|
107
|
+
// Limit zoom between 1x and 5x
|
|
108
|
+
const boundedScale = Math.max(1, Math.min(5, newScale));
|
|
109
|
+
scale.setValue(boundedScale);
|
|
110
|
+
currentScale.current = boundedScale;
|
|
111
|
+
|
|
112
|
+
// If zooming out to 1x, reset position
|
|
113
|
+
if (boundedScale <= 1) {
|
|
114
|
+
translateX.setValue(0);
|
|
115
|
+
translateY.setValue(0);
|
|
116
|
+
currentTranslateX.current = 0;
|
|
117
|
+
currentTranslateY.current = 0;
|
|
118
|
+
}
|
|
119
|
+
}).onEnd(() => {
|
|
120
|
+
savedScale.current = currentScale.current;
|
|
121
|
+
// If scale is close to 1, snap back to 1
|
|
122
|
+
if (savedScale.current < 1.1) {
|
|
123
|
+
Animated.parallel([Animated.spring(scale, {
|
|
124
|
+
toValue: 1,
|
|
125
|
+
useNativeDriver: true
|
|
126
|
+
}), Animated.spring(translateX, {
|
|
127
|
+
toValue: 0,
|
|
128
|
+
useNativeDriver: true
|
|
129
|
+
}), Animated.spring(translateY, {
|
|
130
|
+
toValue: 0,
|
|
131
|
+
useNativeDriver: true
|
|
132
|
+
})]).start();
|
|
133
|
+
savedScale.current = 1;
|
|
134
|
+
savedTranslateX.current = 0;
|
|
135
|
+
savedTranslateY.current = 0;
|
|
136
|
+
currentScale.current = 1;
|
|
137
|
+
currentTranslateX.current = 0;
|
|
138
|
+
currentTranslateY.current = 0;
|
|
139
|
+
} else {
|
|
140
|
+
savedTranslateX.current = currentTranslateX.current;
|
|
141
|
+
savedTranslateY.current = currentTranslateY.current;
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
// Double tap to zoom
|
|
146
|
+
const doubleTapGesture = Gesture.Tap().numberOfTaps(2).onEnd(() => {
|
|
147
|
+
if (savedScale.current > 1) {
|
|
148
|
+
// Zoom out
|
|
149
|
+
Animated.parallel([Animated.spring(scale, {
|
|
150
|
+
toValue: 1,
|
|
151
|
+
useNativeDriver: true
|
|
152
|
+
}), Animated.spring(translateX, {
|
|
153
|
+
toValue: 0,
|
|
154
|
+
useNativeDriver: true
|
|
155
|
+
}), Animated.spring(translateY, {
|
|
156
|
+
toValue: 0,
|
|
157
|
+
useNativeDriver: true
|
|
158
|
+
})]).start();
|
|
159
|
+
savedScale.current = 1;
|
|
160
|
+
savedTranslateX.current = 0;
|
|
161
|
+
savedTranslateY.current = 0;
|
|
162
|
+
currentScale.current = 1;
|
|
163
|
+
currentTranslateX.current = 0;
|
|
164
|
+
currentTranslateY.current = 0;
|
|
165
|
+
} else {
|
|
166
|
+
// Zoom in to 2x
|
|
167
|
+
Animated.spring(scale, {
|
|
168
|
+
toValue: 2,
|
|
169
|
+
useNativeDriver: true
|
|
170
|
+
}).start();
|
|
171
|
+
savedScale.current = 2;
|
|
172
|
+
currentScale.current = 2;
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
// Test simple single tap gesture
|
|
177
|
+
|
|
178
|
+
// Combine gestures - simplified approach
|
|
179
|
+
const combinedGestures = Gesture.Race(doubleTapGesture, Gesture.Simultaneous(panGesture, pinchGesture));
|
|
180
|
+
if (!isOpen) {
|
|
181
|
+
return null;
|
|
182
|
+
}
|
|
183
|
+
return /*#__PURE__*/React.createElement(Modal, {
|
|
184
|
+
visible: isOpen,
|
|
185
|
+
transparent: true,
|
|
186
|
+
animationType: "fade",
|
|
187
|
+
onRequestClose: onClose
|
|
188
|
+
}, /*#__PURE__*/React.createElement(GestureHandlerRootView, {
|
|
189
|
+
style: styles.gestureRoot
|
|
190
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
191
|
+
style: styles.modalOverlay
|
|
192
|
+
}, /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
193
|
+
style: styles.backgroundTouchable,
|
|
194
|
+
activeOpacity: 1,
|
|
195
|
+
onPress: onClose
|
|
196
|
+
}), /*#__PURE__*/React.createElement(View, {
|
|
197
|
+
style: styles.contentContainer
|
|
198
|
+
}, /*#__PURE__*/React.createElement(GestureDetector, {
|
|
199
|
+
gesture: combinedGestures
|
|
200
|
+
}, /*#__PURE__*/React.createElement(Animated.View, {
|
|
201
|
+
style: [styles.imageContainer, {
|
|
202
|
+
width,
|
|
203
|
+
height,
|
|
204
|
+
opacity: loading ? 0 : 1,
|
|
205
|
+
transform: [{
|
|
206
|
+
scale
|
|
207
|
+
}, {
|
|
208
|
+
translateX
|
|
209
|
+
}, {
|
|
210
|
+
translateY
|
|
211
|
+
}]
|
|
212
|
+
}]
|
|
213
|
+
}, /*#__PURE__*/React.createElement(Image, {
|
|
214
|
+
source: src ? {
|
|
215
|
+
uri: src
|
|
216
|
+
} : undefined,
|
|
217
|
+
style: styles.image,
|
|
218
|
+
onLoadStart: onLoadStart,
|
|
219
|
+
onLoad: onLoad,
|
|
220
|
+
resizeMode: "contain"
|
|
221
|
+
}))), /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
222
|
+
style: styles.closeButton,
|
|
223
|
+
onPress: onClose
|
|
224
|
+
}, /*#__PURE__*/React.createElement(Ionicons, {
|
|
225
|
+
name: "close",
|
|
226
|
+
size: 24,
|
|
227
|
+
color: "white"
|
|
228
|
+
})), loading || !src ? /*#__PURE__*/React.createElement(View, {
|
|
229
|
+
style: styles.loadingContainer
|
|
230
|
+
}, /*#__PURE__*/React.createElement(LoadingLogo, {
|
|
231
|
+
isLoading: loading,
|
|
232
|
+
size: 70
|
|
233
|
+
})) : null))));
|
|
234
|
+
};
|
|
235
|
+
const styles = StyleSheet.create({
|
|
236
|
+
gestureRoot: {
|
|
237
|
+
flex: 1
|
|
238
|
+
},
|
|
239
|
+
modalOverlay: {
|
|
240
|
+
flex: 1,
|
|
241
|
+
backgroundColor: 'rgba(0, 0, 0, 0.7)'
|
|
242
|
+
},
|
|
243
|
+
backgroundTouchable: {
|
|
244
|
+
...StyleSheet.absoluteFillObject
|
|
245
|
+
},
|
|
246
|
+
contentContainer: {
|
|
247
|
+
flex: 1,
|
|
248
|
+
justifyContent: 'center',
|
|
249
|
+
alignItems: 'center',
|
|
250
|
+
padding: 16
|
|
251
|
+
},
|
|
252
|
+
imageContainer: {
|
|
253
|
+
overflow: 'hidden',
|
|
254
|
+
borderRadius: 4
|
|
255
|
+
},
|
|
256
|
+
image: {
|
|
257
|
+
width: '100%',
|
|
258
|
+
height: '100%'
|
|
259
|
+
},
|
|
260
|
+
closeButton: {
|
|
261
|
+
position: 'absolute',
|
|
262
|
+
top: 16,
|
|
263
|
+
right: 16,
|
|
264
|
+
width: 40,
|
|
265
|
+
height: 40,
|
|
266
|
+
borderRadius: 20,
|
|
267
|
+
backgroundColor: 'rgba(0, 0, 0, 0.5)',
|
|
268
|
+
justifyContent: 'center',
|
|
269
|
+
alignItems: 'center'
|
|
270
|
+
},
|
|
271
|
+
loadingContainer: {
|
|
272
|
+
...StyleSheet.absoluteFillObject,
|
|
273
|
+
justifyContent: 'center',
|
|
274
|
+
alignItems: 'center'
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
//# sourceMappingURL=ImageViewModal.old.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useScreen","Ionicons","React","useCallback","useMemo","useRef","useState","Animated","Image","Modal","StyleSheet","TouchableOpacity","View","Gesture","GestureDetector","GestureHandlerRootView","LoadingLogo","ImageViewModal","isOpen","onClose","src","loading","setLoading","screenWidth","s","width","screenHeight","height","imageSize","setImageSize","scale","Value","current","translateX","translateY","savedScale","savedTranslateX","savedTranslateY","currentScale","currentTranslateX","currentTranslateY","ratio","h","Math","min","w","onLoadStart","onLoad","e","naturalWidth","naturalHeight","nativeEvent","source","resetTransform","setValue","useEffect","panGesture","Pan","onUpdate","event","newTranslateX","translationX","newTranslateY","translationY","maxTranslateX","maxTranslateY","boundedTranslateX","max","boundedTranslateY","onEnd","pinchGesture","Pinch","newScale","boundedScale","parallel","spring","toValue","useNativeDriver","start","doubleTapGesture","Tap","numberOfTaps","combinedGestures","Race","Simultaneous","createElement","visible","transparent","animationType","onRequestClose","style","styles","gestureRoot","modalOverlay","backgroundTouchable","activeOpacity","onPress","contentContainer","gesture","imageContainer","opacity","transform","uri","undefined","image","resizeMode","closeButton","name","size","color","loadingContainer","isLoading","create","flex","backgroundColor","absoluteFillObject","justifyContent","alignItems","padding","overflow","borderRadius","position","top","right"],"sourceRoot":"..\\..\\..\\..\\src","sources":["components/image/ImageViewModal.old.tsx"],"mappings":"AAAA,SAASA,SAAS,QAAQ,gBAAgB;AAC1C,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,OAAOC,KAAK,IAAIC,WAAW,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AACrE,SAASC,QAAQ,EAAEC,KAAK,EAAEC,KAAK,EAAEC,UAAU,EAAEC,gBAAgB,EAAEC,IAAI,QAAQ,cAAc;AACzF,SAASC,OAAO,EAAEC,eAAe,EAAEC,sBAAsB,QAAQ,8BAA8B;AAC/F,SAASC,WAAW,QAAQ,oBAAoB;AAQhD,OAAO,MAAMC,cAA6C,GAAGA,CAAC;EAAEC,MAAM;EAAEC,OAAO;EAAEC;AAAI,CAAC,KAAK;EACzF,MAAM,CAACC,OAAO,EAAEC,UAAU,CAAC,GAAGhB,QAAQ,CAAC,IAAI,CAAC;EAC5C,MAAMiB,WAAW,GAAGvB,SAAS,CAACwB,CAAC,IAAIA,CAAC,CAACC,KAAK,CAAC;EAC3C,MAAMC,YAAY,GAAG1B,SAAS,CAACwB,CAAC,IAAIA,CAAC,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AAQ;IACxBC,UAAU,EAAE,QAAQ;IACpBC,OAAO,EAAE;EACX,CAAC;EACDnB,cAAc,EAAE;IACdoB,QAAQ,EAAE,QAAQ;IAClBC,YAAY,EAAE;EAChB,CAAC;EACDhB,KAAK,EAAE;IACL/E,KAAK,EAAE,MAAM;IACbE,MAAM,EAAE;EACV,CAAC;EACD+E,WAAW,EAAE;IACXe,QAAQ,EAAE,UAAU;IACpBC,GAAG,EAAE,EAAE;IACPC,KAAK,EAAE,EAAE;IACTlG,KAAK,EAAE,EAAE;IACTE,MAAM,EAAE,EAAE;IACV6F,YAAY,EAAE,EAAE;IAChBN,eAAe,EAAE,oBAAoB;IACrCE,cAAc,EAAE,QAAQ;IACxBC,UAAU,EAAE;EACd,CAAC;EACDP,gBAAgB,EAAE;IAChB,GAAGpG,UAAU,CAACyG,kBAAkB;IAChCC,cAAc,EAAE,QAAQ;IACxBC,UAAU,EAAE;EACd;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { useColorModeValue, useThemeValue } from '@chem-po/react';
|
|
2
|
+
import React, { useEffect, useRef } from 'react';
|
|
3
|
+
import { Animated, StyleSheet, Text, View } from 'react-native';
|
|
4
|
+
export const ProgressBar = ({
|
|
5
|
+
progress,
|
|
6
|
+
label,
|
|
7
|
+
height = 26
|
|
8
|
+
}) => {
|
|
9
|
+
const accentColor = useThemeValue('colors.accent.300');
|
|
10
|
+
const animatedWidth = useRef(new Animated.Value(0)).current;
|
|
11
|
+
const backgroundColor = useColorModeValue('rgba(0, 0, 0, 0.1)', 'rgba(255, 255, 255, 0.2)');
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
Animated.timing(animatedWidth, {
|
|
14
|
+
toValue: progress,
|
|
15
|
+
duration: 300,
|
|
16
|
+
useNativeDriver: false // width animations require layout driver
|
|
17
|
+
}).start();
|
|
18
|
+
}, [progress, animatedWidth]);
|
|
19
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
20
|
+
style: [styles.progressContainer, {
|
|
21
|
+
height,
|
|
22
|
+
backgroundColor
|
|
23
|
+
}]
|
|
24
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
25
|
+
style: styles.progressBar
|
|
26
|
+
}, /*#__PURE__*/React.createElement(Animated.View, {
|
|
27
|
+
style: [styles.progressFill, {
|
|
28
|
+
width: animatedWidth.interpolate({
|
|
29
|
+
inputRange: [0, 1],
|
|
30
|
+
outputRange: ['0%', '100%'],
|
|
31
|
+
extrapolate: 'clamp'
|
|
32
|
+
}),
|
|
33
|
+
backgroundColor: accentColor
|
|
34
|
+
}]
|
|
35
|
+
})), /*#__PURE__*/React.createElement(Text, {
|
|
36
|
+
style: styles.label
|
|
37
|
+
}, label));
|
|
38
|
+
};
|
|
39
|
+
const styles = StyleSheet.create({
|
|
40
|
+
progressContainer: {
|
|
41
|
+
width: '100%',
|
|
42
|
+
justifyContent: 'center',
|
|
43
|
+
alignItems: 'center',
|
|
44
|
+
borderRadius: 20,
|
|
45
|
+
padding: 3
|
|
46
|
+
},
|
|
47
|
+
progressBar: {
|
|
48
|
+
height: '100%',
|
|
49
|
+
width: '100%',
|
|
50
|
+
borderRadius: 20,
|
|
51
|
+
overflow: 'hidden'
|
|
52
|
+
},
|
|
53
|
+
progressFill: {
|
|
54
|
+
height: '100%'
|
|
55
|
+
},
|
|
56
|
+
label: {
|
|
57
|
+
position: 'absolute',
|
|
58
|
+
color: 'white',
|
|
59
|
+
fontSize: 12,
|
|
60
|
+
fontWeight: '500',
|
|
61
|
+
textTransform: 'uppercase',
|
|
62
|
+
textShadowColor: 'rgba(0, 0, 0, 0.67)',
|
|
63
|
+
textShadowOffset: {
|
|
64
|
+
width: 1,
|
|
65
|
+
height: 1
|
|
66
|
+
},
|
|
67
|
+
textShadowRadius: 3
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
//# sourceMappingURL=ProgressBar.js.map
|