react-native-expo-cropper 1.2.44 → 1.2.46
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/.babelrc +6 -6
- package/App.js +27 -27
- package/app.json +2 -2
- package/babel.config.js +5 -5
- package/dist/CustomCamera.js +8 -4
- package/dist/ImageCropper.js +37 -13
- package/dist/ImageCropperStyles.js +11 -0
- package/dist/ImageMaskProcessor.js +25 -25
- package/dist/ImageProcessor.js +7 -7
- package/index.js +6 -6
- package/package.json +59 -59
- package/src/CustomCamera.js +355 -352
- package/src/ImageCropper.js +1453 -1447
- package/src/ImageCropperStyles.js +255 -244
- package/src/ImageMaskProcessor.js +143 -143
- package/src/ImageProcessor.js +20 -20
|
@@ -1,244 +1,255 @@
|
|
|
1
|
-
import { StyleSheet, Dimensions } from 'react-native';
|
|
2
|
-
|
|
3
|
-
const { width: SCREEN_WIDTH, height: SCREEN_HEIGHT } = Dimensions.get('window');
|
|
4
|
-
const IMAGE_HEIGHT = SCREEN_HEIGHT;
|
|
5
|
-
const IMAGE_WIDTH = SCREEN_WIDTH;
|
|
6
|
-
|
|
7
|
-
const PRIMARY_GREEN = '#198754';
|
|
8
|
-
const DEEP_BLACK = '#0B0B0B';
|
|
9
|
-
const GLOW_WHITE = 'rgba(255, 255, 255, 0.85)';
|
|
10
|
-
|
|
11
|
-
const styles = StyleSheet.create({
|
|
12
|
-
container: {
|
|
13
|
-
flex: 1,
|
|
14
|
-
alignItems: 'center',
|
|
15
|
-
justifyContent: 'flex-start', // ✅ Start from top, allow content to flow down
|
|
16
|
-
backgroundColor: DEEP_BLACK,
|
|
17
|
-
},
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
alignItems: 'center',
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
},
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
alignItems: 'center',
|
|
147
|
-
justifyContent: 'center',
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
},
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
},
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
},
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
1
|
+
import { StyleSheet, Dimensions } from 'react-native';
|
|
2
|
+
|
|
3
|
+
const { width: SCREEN_WIDTH, height: SCREEN_HEIGHT } = Dimensions.get('window');
|
|
4
|
+
const IMAGE_HEIGHT = SCREEN_HEIGHT;
|
|
5
|
+
const IMAGE_WIDTH = SCREEN_WIDTH;
|
|
6
|
+
|
|
7
|
+
const PRIMARY_GREEN = '#198754';
|
|
8
|
+
const DEEP_BLACK = '#0B0B0B';
|
|
9
|
+
const GLOW_WHITE = 'rgba(255, 255, 255, 0.85)';
|
|
10
|
+
|
|
11
|
+
const styles = StyleSheet.create({
|
|
12
|
+
container: {
|
|
13
|
+
flex: 1,
|
|
14
|
+
alignItems: 'center',
|
|
15
|
+
justifyContent: 'flex-start', // ✅ Start from top, allow content to flow down
|
|
16
|
+
backgroundColor: DEEP_BLACK,
|
|
17
|
+
},
|
|
18
|
+
// Wrapper for crop preview (9/16, same as CustomCamera); width set dynamically for tablet
|
|
19
|
+
commonWrapper: {
|
|
20
|
+
aspectRatio: 9 / 16,
|
|
21
|
+
borderRadius: 30,
|
|
22
|
+
overflow: 'hidden',
|
|
23
|
+
alignItems: 'center',
|
|
24
|
+
justifyContent: 'center',
|
|
25
|
+
position: 'relative',
|
|
26
|
+
backgroundColor: 'black',
|
|
27
|
+
marginBottom: 0,
|
|
28
|
+
},
|
|
29
|
+
buttonContainer: {
|
|
30
|
+
position: 'absolute',
|
|
31
|
+
bottom: 50,
|
|
32
|
+
left: 0,
|
|
33
|
+
right: 0,
|
|
34
|
+
flexDirection: 'row',
|
|
35
|
+
flexWrap: 'wrap',
|
|
36
|
+
justifyContent: 'center',
|
|
37
|
+
alignItems: 'center',
|
|
38
|
+
paddingHorizontal: 10,
|
|
39
|
+
zIndex: 10,
|
|
40
|
+
gap: 10,
|
|
41
|
+
},
|
|
42
|
+
buttonContainerBelow: {
|
|
43
|
+
// ✅ Buttons positioned BELOW image, not overlapping, above Android navigation bar
|
|
44
|
+
position: 'absolute',
|
|
45
|
+
bottom: 0,
|
|
46
|
+
left: 0,
|
|
47
|
+
right: 0,
|
|
48
|
+
flexDirection: 'row',
|
|
49
|
+
justifyContent: 'center',
|
|
50
|
+
alignItems: 'center',
|
|
51
|
+
paddingHorizontal: 10,
|
|
52
|
+
paddingTop: 16,
|
|
53
|
+
gap: 8,
|
|
54
|
+
backgroundColor: DEEP_BLACK, // Fond noir pour séparer visuellement
|
|
55
|
+
},
|
|
56
|
+
iconButton: {
|
|
57
|
+
backgroundColor: PRIMARY_GREEN,
|
|
58
|
+
width: 60,
|
|
59
|
+
height: 60,
|
|
60
|
+
borderRadius: 30,
|
|
61
|
+
alignItems: 'center',
|
|
62
|
+
justifyContent: 'center',
|
|
63
|
+
marginRight: 5,
|
|
64
|
+
},
|
|
65
|
+
rotationButton: {
|
|
66
|
+
// Cercle, même couleur que Reset/Confirm (#549433), même hauteur que les autres boutons
|
|
67
|
+
backgroundColor: '#549433',
|
|
68
|
+
width: 56,
|
|
69
|
+
height: 48, // Même hauteur approximative que les boutons rectangulaires (padding 10 + texte)
|
|
70
|
+
borderRadius: 28,
|
|
71
|
+
alignItems: 'center',
|
|
72
|
+
justifyContent: 'center',
|
|
73
|
+
},
|
|
74
|
+
button: {
|
|
75
|
+
flex: 1,
|
|
76
|
+
minHeight: 48, // Même hauteur que le bouton de rotation
|
|
77
|
+
paddingVertical: 12,
|
|
78
|
+
paddingHorizontal: 10,
|
|
79
|
+
alignItems: "center",
|
|
80
|
+
justifyContent: "center",
|
|
81
|
+
backgroundColor: "#549433",
|
|
82
|
+
borderRadius: 5,
|
|
83
|
+
},
|
|
84
|
+
buttonText: {
|
|
85
|
+
color: 'white',
|
|
86
|
+
fontSize: 18,
|
|
87
|
+
fontWeight: '600',
|
|
88
|
+
textAlign: 'center',
|
|
89
|
+
},
|
|
90
|
+
iconText: {
|
|
91
|
+
color: PRIMARY_GREEN,
|
|
92
|
+
fontSize: 16,
|
|
93
|
+
fontWeight: '600',
|
|
94
|
+
textAlign: 'center',
|
|
95
|
+
},
|
|
96
|
+
imageContainer: {
|
|
97
|
+
width: IMAGE_WIDTH,
|
|
98
|
+
height: "80%",
|
|
99
|
+
justifyContent: 'center',
|
|
100
|
+
alignItems: 'center',
|
|
101
|
+
overflow: 'hidden',
|
|
102
|
+
backgroundColor: 'black',
|
|
103
|
+
},
|
|
104
|
+
|
|
105
|
+
image: {
|
|
106
|
+
width: '100%',
|
|
107
|
+
height: '100%',
|
|
108
|
+
resizeMode: 'contain',
|
|
109
|
+
},
|
|
110
|
+
|
|
111
|
+
overlay: {
|
|
112
|
+
position: 'absolute',
|
|
113
|
+
top: 0,
|
|
114
|
+
left: 0,
|
|
115
|
+
width: '100%',
|
|
116
|
+
height: '100%',
|
|
117
|
+
zIndex: 1,
|
|
118
|
+
},
|
|
119
|
+
|
|
120
|
+
croppedImage: {
|
|
121
|
+
width: IMAGE_WIDTH,
|
|
122
|
+
height: IMAGE_HEIGHT,
|
|
123
|
+
resizeMode: 'cover',
|
|
124
|
+
marginTop: 10,
|
|
125
|
+
borderWidth: 2,
|
|
126
|
+
borderColor: 'white',
|
|
127
|
+
borderRadius: 10,
|
|
128
|
+
},
|
|
129
|
+
fixedButtonContainer: {
|
|
130
|
+
position: 'absolute',
|
|
131
|
+
bottom: 100,
|
|
132
|
+
left: 0,
|
|
133
|
+
right: 0,
|
|
134
|
+
flexDirection: 'row',
|
|
135
|
+
justifyContent: 'center',
|
|
136
|
+
flexWrap: 'wrap',
|
|
137
|
+
gap: 10,
|
|
138
|
+
paddingHorizontal: 10,
|
|
139
|
+
},
|
|
140
|
+
fixedButton: {
|
|
141
|
+
backgroundColor: PRIMARY_GREEN,
|
|
142
|
+
paddingVertical: 18,
|
|
143
|
+
paddingHorizontal: 30,
|
|
144
|
+
borderRadius: 12,
|
|
145
|
+
margin: 6,
|
|
146
|
+
alignItems: 'center',
|
|
147
|
+
justifyContent: 'center',
|
|
148
|
+
borderWidth: 0,
|
|
149
|
+
width: SCREEN_WIDTH * 0.4,
|
|
150
|
+
height: 60,
|
|
151
|
+
},
|
|
152
|
+
centerButtonsContainer: {
|
|
153
|
+
position: 'absolute',
|
|
154
|
+
bottom: 20,
|
|
155
|
+
left: 0,
|
|
156
|
+
right: 0,
|
|
157
|
+
alignItems: 'center',
|
|
158
|
+
justifyContent: 'center',
|
|
159
|
+
zIndex: 10,
|
|
160
|
+
gap: 10,
|
|
161
|
+
},
|
|
162
|
+
welcomeText: {
|
|
163
|
+
position: 'absolute',
|
|
164
|
+
top: '40%',
|
|
165
|
+
left: 20,
|
|
166
|
+
right: 20,
|
|
167
|
+
textAlign: 'center',
|
|
168
|
+
color: GLOW_WHITE,
|
|
169
|
+
fontSize: 40,
|
|
170
|
+
fontWeight: '800',
|
|
171
|
+
zIndex: 10,
|
|
172
|
+
},
|
|
173
|
+
startButton: {
|
|
174
|
+
backgroundColor: PRIMARY_GREEN,
|
|
175
|
+
paddingVertical: 18,
|
|
176
|
+
paddingHorizontal: 30,
|
|
177
|
+
borderRadius: 12,
|
|
178
|
+
margin: 6,
|
|
179
|
+
alignItems: 'center',
|
|
180
|
+
justifyContent: 'center',
|
|
181
|
+
borderWidth: 0,
|
|
182
|
+
width: SCREEN_WIDTH * 0.9,
|
|
183
|
+
height: 70,
|
|
184
|
+
},
|
|
185
|
+
startButtonText: {
|
|
186
|
+
color: 'white',
|
|
187
|
+
fontSize: 18,
|
|
188
|
+
fontWeight: '600',
|
|
189
|
+
textAlign: 'center',
|
|
190
|
+
},
|
|
191
|
+
|
|
192
|
+
loadingOverlay: {
|
|
193
|
+
flex: 1,
|
|
194
|
+
backgroundColor: 'rgba(0,0,0,0.5)',
|
|
195
|
+
justifyContent: 'center',
|
|
196
|
+
alignItems: 'center',
|
|
197
|
+
position: 'absolute',
|
|
198
|
+
top: 0,
|
|
199
|
+
bottom: 0,
|
|
200
|
+
left: 0,
|
|
201
|
+
right: 0,
|
|
202
|
+
zIndex: 9999,
|
|
203
|
+
},
|
|
204
|
+
loadingGif: {
|
|
205
|
+
width: 120,
|
|
206
|
+
height: 120,
|
|
207
|
+
},
|
|
208
|
+
|
|
209
|
+
fullscreenImageContainer: {
|
|
210
|
+
position: 'absolute',
|
|
211
|
+
top: 0,
|
|
212
|
+
left: 0,
|
|
213
|
+
width: SCREEN_WIDTH,
|
|
214
|
+
height: SCREEN_HEIGHT,
|
|
215
|
+
backgroundColor: 'black',
|
|
216
|
+
justifyContent: 'center',
|
|
217
|
+
alignItems: 'center',
|
|
218
|
+
zIndex: 9999,
|
|
219
|
+
},
|
|
220
|
+
previewContainer: {
|
|
221
|
+
flex: 1,
|
|
222
|
+
backgroundColor: DEEP_BLACK,
|
|
223
|
+
justifyContent: 'center',
|
|
224
|
+
alignItems: 'center',
|
|
225
|
+
width: '100%',
|
|
226
|
+
},
|
|
227
|
+
previewImage: {
|
|
228
|
+
width: SCREEN_WIDTH,
|
|
229
|
+
height: '80%',
|
|
230
|
+
},
|
|
231
|
+
previewButtonContainer: {
|
|
232
|
+
position: 'absolute',
|
|
233
|
+
bottom: 50,
|
|
234
|
+
left: 0,
|
|
235
|
+
right: 0,
|
|
236
|
+
flexDirection: 'row',
|
|
237
|
+
justifyContent: 'space-around',
|
|
238
|
+
paddingHorizontal: 20,
|
|
239
|
+
},
|
|
240
|
+
previewButton: {
|
|
241
|
+
backgroundColor: PRIMARY_GREEN,
|
|
242
|
+
width: 60,
|
|
243
|
+
height: 60,
|
|
244
|
+
borderRadius: 30,
|
|
245
|
+
alignItems: 'center',
|
|
246
|
+
justifyContent: 'center',
|
|
247
|
+
},
|
|
248
|
+
useButton: {
|
|
249
|
+
backgroundColor: GLOW_WHITE,
|
|
250
|
+
},
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
export default styles;
|