react-native-expo-cropper 1.2.44 → 1.2.45
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/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 +1445 -1447
- package/src/ImageCropperStyles.js +255 -244
- package/src/ImageMaskProcessor.js +143 -143
- package/src/ImageProcessor.js +20 -20
package/.babelrc
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
{
|
|
2
|
-
"presets": [
|
|
3
|
-
"@babel/preset-env",
|
|
4
|
-
"@babel/preset-react"
|
|
5
|
-
]
|
|
6
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"presets": [
|
|
3
|
+
"@babel/preset-env",
|
|
4
|
+
"@babel/preset-react"
|
|
5
|
+
]
|
|
6
|
+
}
|
|
7
7
|
|
package/App.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { SafeAreaView, StatusBar, StyleSheet } from 'react-native';
|
|
3
|
-
import ImageCropper from './src/ImageCropper';
|
|
4
|
-
|
|
5
|
-
const App = () => {
|
|
6
|
-
const handleCrop = (uri) => {
|
|
7
|
-
console.log('Cropped Image URI:', uri);
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
return (
|
|
11
|
-
<>
|
|
12
|
-
<StatusBar backgroundColor="black" barStyle="light-content" />
|
|
13
|
-
<SafeAreaView style={styles.container}>
|
|
14
|
-
<ImageCropper onCrop={handleCrop} />
|
|
15
|
-
</SafeAreaView>
|
|
16
|
-
</>
|
|
17
|
-
);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const styles = StyleSheet.create({
|
|
21
|
-
container: {
|
|
22
|
-
flex: 1,
|
|
23
|
-
backgroundColor: 'black',
|
|
24
|
-
},
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
export default App;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SafeAreaView, StatusBar, StyleSheet } from 'react-native';
|
|
3
|
+
import ImageCropper from './src/ImageCropper';
|
|
4
|
+
|
|
5
|
+
const App = () => {
|
|
6
|
+
const handleCrop = (uri) => {
|
|
7
|
+
console.log('Cropped Image URI:', uri);
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
return (
|
|
11
|
+
<>
|
|
12
|
+
<StatusBar backgroundColor="black" barStyle="light-content" />
|
|
13
|
+
<SafeAreaView style={styles.container}>
|
|
14
|
+
<ImageCropper onCrop={handleCrop} />
|
|
15
|
+
</SafeAreaView>
|
|
16
|
+
</>
|
|
17
|
+
);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const styles = StyleSheet.create({
|
|
21
|
+
container: {
|
|
22
|
+
flex: 1,
|
|
23
|
+
backgroundColor: 'black',
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export default App;
|
package/app.json
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
{
|
|
2
|
-
"expo": {}
|
|
1
|
+
{
|
|
2
|
+
"expo": {}
|
|
3
3
|
}
|
package/babel.config.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
presets: [
|
|
3
|
-
'@babel/preset-env',
|
|
4
|
-
'@babel/preset-react'
|
|
5
|
-
]
|
|
1
|
+
module.exports = {
|
|
2
|
+
presets: [
|
|
3
|
+
'@babel/preset-env',
|
|
4
|
+
'@babel/preset-react'
|
|
5
|
+
]
|
|
6
6
|
};
|
|
@@ -14,18 +14,18 @@ function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present,
|
|
|
14
14
|
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
|
|
15
15
|
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
16
16
|
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
17
|
-
/**
|
|
18
|
-
* ImageMaskProcessor - Module pour appliquer un masque alpha à une image
|
|
19
|
-
*
|
|
20
|
-
* NOTE: Ce module est actuellement désactivé par défaut (enableMask = false)
|
|
21
|
-
* car captureRef peut se bloquer sur certaines configurations.
|
|
22
|
-
*
|
|
23
|
-
* Pour activer le masque, mettre enableMask = true dans ImageCropper.js
|
|
24
|
-
* ATTENTION: Peut causer des blocages sur certaines configurations
|
|
17
|
+
/**
|
|
18
|
+
* ImageMaskProcessor - Module pour appliquer un masque alpha à une image
|
|
19
|
+
*
|
|
20
|
+
* NOTE: Ce module est actuellement désactivé par défaut (enableMask = false)
|
|
21
|
+
* car captureRef peut se bloquer sur certaines configurations.
|
|
22
|
+
*
|
|
23
|
+
* Pour activer le masque, mettre enableMask = true dans ImageCropper.js
|
|
24
|
+
* ATTENTION: Peut causer des blocages sur certaines configurations
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
|
-
/**
|
|
28
|
-
* Crée un chemin SVG à partir de points
|
|
27
|
+
/**
|
|
28
|
+
* Crée un chemin SVG à partir de points
|
|
29
29
|
*/
|
|
30
30
|
var createPathFromPoints = function createPathFromPoints(points) {
|
|
31
31
|
if (points.length < 3) return '';
|
|
@@ -36,9 +36,9 @@ var createPathFromPoints = function createPathFromPoints(points) {
|
|
|
36
36
|
return path + 'Z';
|
|
37
37
|
};
|
|
38
38
|
|
|
39
|
-
/**
|
|
40
|
-
* Composant MaskView - Vue avec image et masque SVG
|
|
41
|
-
* Utilisé pour capturer l'image avec le masque appliqué
|
|
39
|
+
/**
|
|
40
|
+
* Composant MaskView - Vue avec image et masque SVG
|
|
41
|
+
* Utilisé pour capturer l'image avec le masque appliqué
|
|
42
42
|
*/
|
|
43
43
|
var MaskView = exports.MaskView = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
44
44
|
var imageUri = _ref.imageUri,
|
|
@@ -78,18 +78,18 @@ var MaskView = exports.MaskView = /*#__PURE__*/(0, _react.forwardRef)(function (
|
|
|
78
78
|
});
|
|
79
79
|
MaskView.displayName = 'MaskView';
|
|
80
80
|
|
|
81
|
-
/**
|
|
82
|
-
* Applique un masque alpha à une image en utilisant captureRef
|
|
83
|
-
*
|
|
84
|
-
* @param {string} imageUri - URI de l'image à masquer
|
|
85
|
-
* @param {Array} points - Points définissant le masque (coordonnées normalisées)
|
|
86
|
-
* @param {number} width - Largeur de l'image
|
|
87
|
-
* @param {number} height - Hauteur de l'image
|
|
88
|
-
* @param {React.Ref} maskViewRef - Référence à la vue MaskView
|
|
89
|
-
* @returns {Promise<string>} URI de l'image masquée
|
|
90
|
-
*
|
|
91
|
-
* NOTE: Cette fonction utilise captureRef qui peut se bloquer.
|
|
92
|
-
* Utiliser uniquement si enableMask = true dans ImageCropper.js
|
|
81
|
+
/**
|
|
82
|
+
* Applique un masque alpha à une image en utilisant captureRef
|
|
83
|
+
*
|
|
84
|
+
* @param {string} imageUri - URI de l'image à masquer
|
|
85
|
+
* @param {Array} points - Points définissant le masque (coordonnées normalisées)
|
|
86
|
+
* @param {number} width - Largeur de l'image
|
|
87
|
+
* @param {number} height - Hauteur de l'image
|
|
88
|
+
* @param {React.Ref} maskViewRef - Référence à la vue MaskView
|
|
89
|
+
* @returns {Promise<string>} URI de l'image masquée
|
|
90
|
+
*
|
|
91
|
+
* NOTE: Cette fonction utilise captureRef qui peut se bloquer.
|
|
92
|
+
* Utiliser uniquement si enableMask = true dans ImageCropper.js
|
|
93
93
|
*/
|
|
94
94
|
// width/height = dimensions de sortie souhaitées EN PIXELS (pas dp)
|
|
95
95
|
var applyMaskToImage = exports.applyMaskToImage = /*#__PURE__*/function () {
|
package/dist/ImageProcessor.js
CHANGED
|
@@ -11,13 +11,13 @@ function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present,
|
|
|
11
11
|
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
|
|
12
12
|
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
13
13
|
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
14
|
-
/**
|
|
15
|
-
* Retourne l'image originale sans redimensionnement pour préserver la qualité maximale.
|
|
16
|
-
* Le redimensionnement destructif a été supprimé pour éviter la perte de résolution.
|
|
17
|
-
*
|
|
18
|
-
* @param {string} uri - URI de l'image originale
|
|
19
|
-
* @param {number} addheight - Paramètre conservé pour compatibilité (non utilisé)
|
|
20
|
-
* @returns {Promise<string>} URI de l'image originale (sans modification)
|
|
14
|
+
/**
|
|
15
|
+
* Retourne l'image originale sans redimensionnement pour préserver la qualité maximale.
|
|
16
|
+
* Le redimensionnement destructif a été supprimé pour éviter la perte de résolution.
|
|
17
|
+
*
|
|
18
|
+
* @param {string} uri - URI de l'image originale
|
|
19
|
+
* @param {number} addheight - Paramètre conservé pour compatibilité (non utilisé)
|
|
20
|
+
* @returns {Promise<string>} URI de l'image originale (sans modification)
|
|
21
21
|
*/
|
|
22
22
|
var enhanceImage = exports.enhanceImage = /*#__PURE__*/function () {
|
|
23
23
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(uri, addheight) {
|
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { registerRootComponent } from 'expo';
|
|
2
|
-
import App from './App';
|
|
3
|
-
|
|
4
|
-
registerRootComponent(App);
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { registerRootComponent } from 'expo';
|
|
2
|
+
import App from './App';
|
|
3
|
+
|
|
4
|
+
registerRootComponent(App);
|
|
5
|
+
|
|
6
|
+
|
package/package.json
CHANGED
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "react-native-expo-cropper",
|
|
3
|
-
"version": "1.2.
|
|
4
|
-
"description": "Recadrage polygonal d'images.",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"author": "PCS AGRI",
|
|
7
|
-
"license": "MIT",
|
|
8
|
-
"keywords": [
|
|
9
|
-
"react-native",
|
|
10
|
-
"expo",
|
|
11
|
-
"image-cropper",
|
|
12
|
-
"camera",
|
|
13
|
-
"polygonal",
|
|
14
|
-
"image",
|
|
15
|
-
"react-native-component"
|
|
16
|
-
],
|
|
17
|
-
"peerDependencies": {
|
|
18
|
-
"expo": "54.0.0",
|
|
19
|
-
"react": "19.1.0",
|
|
20
|
-
"react-native": "0.81.4"
|
|
21
|
-
},
|
|
22
|
-
"dependencies": {
|
|
23
|
-
"@expo/vector-icons": "^15.0.2",
|
|
24
|
-
"expo": "54.0.0",
|
|
25
|
-
"expo-camera": "~17.0.8",
|
|
26
|
-
"expo-image-manipulator": "~14.0.7",
|
|
27
|
-
"expo-image-picker": "~17.0.8",
|
|
28
|
-
"expo-media-library": "~18.2.0",
|
|
29
|
-
"expo-screen-orientation": "~9.0.7",
|
|
30
|
-
"react-native-svg": "15.12.1",
|
|
31
|
-
"react-native-view-shot": "4.0.3",
|
|
32
|
-
"@react-native-masked-view/masked-view": "^0.3.1"
|
|
33
|
-
},
|
|
34
|
-
"overrides": {
|
|
35
|
-
"glob": "^10.5.0"
|
|
36
|
-
},
|
|
37
|
-
"engines": {
|
|
38
|
-
"node": ">=14"
|
|
39
|
-
},
|
|
40
|
-
"repository": {
|
|
41
|
-
"type": "git",
|
|
42
|
-
"url": "git+https://github.com/pcsagri/react-native-expo-cropper.git"
|
|
43
|
-
},
|
|
44
|
-
"bugs": {
|
|
45
|
-
"url": "https://github.com/pcsagri/react-native-expo-cropper/issues"
|
|
46
|
-
},
|
|
47
|
-
"homepage": "https://github.com/pcsagri/react-native-expo-cropper#readme",
|
|
48
|
-
"scripts": {
|
|
49
|
-
"test": "echo \"Error: no test specified\" && exit 1",
|
|
50
|
-
"build": "npx --package=@babel/cli babel src --out-dir dist"
|
|
51
|
-
},
|
|
52
|
-
"devDependencies": {
|
|
53
|
-
"@babel/cli": "^7.28.3",
|
|
54
|
-
"@babel/core": "^7.28.5",
|
|
55
|
-
"@babel/preset-env": "^7.28.5",
|
|
56
|
-
"@babel/preset-react": "^7.28.5",
|
|
57
|
-
"baseline-browser-mapping": "^2.9.6"
|
|
58
|
-
}
|
|
59
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "react-native-expo-cropper",
|
|
3
|
+
"version": "1.2.45",
|
|
4
|
+
"description": "Recadrage polygonal d'images.",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"author": "PCS AGRI",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"react-native",
|
|
10
|
+
"expo",
|
|
11
|
+
"image-cropper",
|
|
12
|
+
"camera",
|
|
13
|
+
"polygonal",
|
|
14
|
+
"image",
|
|
15
|
+
"react-native-component"
|
|
16
|
+
],
|
|
17
|
+
"peerDependencies": {
|
|
18
|
+
"expo": "54.0.0",
|
|
19
|
+
"react": "19.1.0",
|
|
20
|
+
"react-native": "0.81.4"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@expo/vector-icons": "^15.0.2",
|
|
24
|
+
"expo": "54.0.0",
|
|
25
|
+
"expo-camera": "~17.0.8",
|
|
26
|
+
"expo-image-manipulator": "~14.0.7",
|
|
27
|
+
"expo-image-picker": "~17.0.8",
|
|
28
|
+
"expo-media-library": "~18.2.0",
|
|
29
|
+
"expo-screen-orientation": "~9.0.7",
|
|
30
|
+
"react-native-svg": "15.12.1",
|
|
31
|
+
"react-native-view-shot": "4.0.3",
|
|
32
|
+
"@react-native-masked-view/masked-view": "^0.3.1"
|
|
33
|
+
},
|
|
34
|
+
"overrides": {
|
|
35
|
+
"glob": "^10.5.0"
|
|
36
|
+
},
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=14"
|
|
39
|
+
},
|
|
40
|
+
"repository": {
|
|
41
|
+
"type": "git",
|
|
42
|
+
"url": "git+https://github.com/pcsagri/react-native-expo-cropper.git"
|
|
43
|
+
},
|
|
44
|
+
"bugs": {
|
|
45
|
+
"url": "https://github.com/pcsagri/react-native-expo-cropper/issues"
|
|
46
|
+
},
|
|
47
|
+
"homepage": "https://github.com/pcsagri/react-native-expo-cropper#readme",
|
|
48
|
+
"scripts": {
|
|
49
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
50
|
+
"build": "npx --package=@babel/cli babel src --out-dir dist"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@babel/cli": "^7.28.3",
|
|
54
|
+
"@babel/core": "^7.28.5",
|
|
55
|
+
"@babel/preset-env": "^7.28.5",
|
|
56
|
+
"@babel/preset-react": "^7.28.5",
|
|
57
|
+
"baseline-browser-mapping": "^2.9.6"
|
|
58
|
+
}
|
|
59
|
+
}
|