@one-am/react-native-simple-image-slider 0.14.0 → 0.16.0
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/README.md +15 -9
- package/lib/commonjs/@types/common.js.map +1 -1
- package/lib/commonjs/@types/icons.js.map +1 -1
- package/lib/commonjs/@types/pinch-to-zoom.js +0 -4
- package/lib/commonjs/@types/pinch-to-zoom.js.map +1 -1
- package/lib/commonjs/@types/slider.js.map +1 -1
- package/lib/commonjs/AbsoluteComponentContainer.js +34 -0
- package/lib/commonjs/AbsoluteComponentContainer.js.map +1 -0
- package/lib/commonjs/BaseSimpleImageSlider.js +129 -157
- package/lib/commonjs/BaseSimpleImageSlider.js.map +1 -1
- package/lib/commonjs/FullScreenImageSlider.js +46 -51
- package/lib/commonjs/FullScreenImageSlider.js.map +1 -1
- package/lib/commonjs/PageCounter.js +30 -23
- package/lib/commonjs/PageCounter.js.map +1 -1
- package/lib/commonjs/PinchToZoom.js +16 -13
- package/lib/commonjs/PinchToZoom.js.map +1 -1
- package/lib/commonjs/SimpleImageSlider.js +31 -25
- package/lib/commonjs/SimpleImageSlider.js.map +1 -1
- package/lib/commonjs/SimpleImageSliderThemeProvider.js +26 -20
- package/lib/commonjs/SimpleImageSliderThemeProvider.js.map +1 -1
- package/lib/commonjs/icons/IconX.js +16 -14
- package/lib/commonjs/icons/IconX.js.map +1 -1
- package/lib/commonjs/index.js +10 -2
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/utils/clamp.js.map +1 -1
- package/lib/commonjs/utils/renderProp.js +3 -2
- package/lib/commonjs/utils/renderProp.js.map +1 -1
- package/lib/module/@types/common.js +1 -1
- package/lib/module/@types/common.js.map +1 -1
- package/lib/module/@types/icons.js +2 -0
- package/lib/module/@types/icons.js.map +1 -1
- package/lib/module/@types/pinch-to-zoom.js +1 -1
- package/lib/module/@types/pinch-to-zoom.js.map +1 -1
- package/lib/module/@types/slider.js +2 -0
- package/lib/module/@types/slider.js.map +1 -1
- package/lib/module/AbsoluteComponentContainer.js +28 -0
- package/lib/module/AbsoluteComponentContainer.js.map +1 -0
- package/lib/module/BaseSimpleImageSlider.js +130 -156
- package/lib/module/BaseSimpleImageSlider.js.map +1 -1
- package/lib/module/FullScreenImageSlider.js +47 -50
- package/lib/module/FullScreenImageSlider.js.map +1 -1
- package/lib/module/PageCounter.js +31 -23
- package/lib/module/PageCounter.js.map +1 -1
- package/lib/module/PinchToZoom.js +17 -12
- package/lib/module/PinchToZoom.js.map +1 -1
- package/lib/module/SimpleImageSlider.js +31 -23
- package/lib/module/SimpleImageSlider.js.map +1 -1
- package/lib/module/SimpleImageSliderThemeProvider.js +27 -20
- package/lib/module/SimpleImageSliderThemeProvider.js.map +1 -1
- package/lib/module/icons/IconX.js +16 -12
- package/lib/module/icons/IconX.js.map +1 -1
- package/lib/module/index.js +4 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/package.json +1 -0
- package/lib/module/utils/clamp.js +2 -0
- package/lib/module/utils/clamp.js.map +1 -1
- package/lib/module/utils/renderProp.js +4 -1
- package/lib/module/utils/renderProp.js.map +1 -1
- package/lib/typescript/src/@types/pinch-to-zoom.d.ts +3 -4
- package/lib/typescript/src/@types/pinch-to-zoom.d.ts.map +1 -1
- package/lib/typescript/src/AbsoluteComponentContainer.d.ts +7 -0
- package/lib/typescript/src/AbsoluteComponentContainer.d.ts.map +1 -0
- package/lib/typescript/src/BaseSimpleImageSlider.d.ts +1 -1
- package/lib/typescript/src/BaseSimpleImageSlider.d.ts.map +1 -1
- package/lib/typescript/src/FullScreenImageSlider.d.ts +4 -4
- package/lib/typescript/src/FullScreenImageSlider.d.ts.map +1 -1
- package/lib/typescript/src/PageCounter.d.ts.map +1 -1
- package/lib/typescript/src/PinchToZoom.d.ts.map +1 -1
- package/lib/typescript/src/SimpleImageSlider.d.ts +15 -3
- package/lib/typescript/src/SimpleImageSlider.d.ts.map +1 -1
- package/lib/typescript/src/SimpleImageSliderThemeProvider.d.ts +10 -2
- package/lib/typescript/src/SimpleImageSliderThemeProvider.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +2 -3
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +161 -161
- package/src/@types/pinch-to-zoom.ts +3 -5
- package/src/AbsoluteComponentContainer.tsx +30 -0
- package/src/BaseSimpleImageSlider.tsx +119 -150
- package/src/FullScreenImageSlider.tsx +40 -38
- package/src/PageCounter.tsx +35 -17
- package/src/PinchToZoom.tsx +10 -9
- package/src/SimpleImageSlider.tsx +10 -0
- package/src/SimpleImageSliderThemeProvider.tsx +32 -13
- package/src/index.tsx +7 -2
- package/lib/commonjs/@types/styled.d.js +0 -4
- package/lib/commonjs/@types/styled.d.js.map +0 -1
- package/lib/module/@types/styled.d.js +0 -2
- package/lib/module/@types/styled.d.js.map +0 -1
- package/src/@types/styled.d.ts +0 -17
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","defaultTheme","colors","pageCounterBackground","pageCounterBorder","fullScreenCloseButton","descriptionContainerBorder","ThemeContext","createContext","useSimpleImageSliderTheme","useContext","SimpleImageSliderThemeProvider","overrides","children","theme","useMemo","jsx","Provider","value"],"sourceRoot":"../../src","sources":["SimpleImageSliderThemeProvider.tsx"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAA0F,IAAAC,WAAA,GAAAD,OAAA;AAAA,SAAAE,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAA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AEe,SAASI,8BAA8BA,CAAC;EACnDC,SAAS;EACTC;AACiC,CAAC,EAAE;EACpC,MAAMC,KAA6B,GAAG,IAAAC,cAAO,EACzC,OAAO;IACH,GAAGd,YAAY;IACfC,MAAM,EAAE;MACJ,GAAGD,YAAY,CAACC,MAAM;MACtB,GAAGU,SAAS,EAAEV;IAClB;EACJ,CAAC,CAAC,EACF,CAACU,SAAS,EAAEV,MAAM,CACtB,CAAC;EAED,oBAAO,IAAAtB,WAAA,CAAAoC,GAAA,EAACT,YAAY,CAACU,QAAQ;IAACC,KAAK,EAAEJ,KAAM;IAAAD,QAAA,EAAEA;EAAQ,CAAwB,CAAC;AAClF","ignoreList":[]}
|
|
@@ -6,10 +6,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _reactNativeSvg = _interopRequireWildcard(require("react-native-svg"));
|
|
9
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
9
10
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
10
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
|
11
|
-
function _interopRequireDefault(
|
|
12
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
11
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
13
|
function IconX({
|
|
14
14
|
size = 24,
|
|
15
15
|
color = '#1f2937',
|
|
@@ -20,22 +20,24 @@ function IconX({
|
|
|
20
20
|
/*#__PURE__*/
|
|
21
21
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
22
22
|
// @ts-ignore
|
|
23
|
-
|
|
23
|
+
(0, _jsxRuntime.jsxs)(_reactNativeSvg.default, {
|
|
24
24
|
width: size,
|
|
25
25
|
height: size,
|
|
26
26
|
viewBox: "0 0 24 24",
|
|
27
27
|
strokeWidth: stroke,
|
|
28
28
|
stroke: color,
|
|
29
|
-
fill: "none"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
29
|
+
fill: "none",
|
|
30
|
+
...props,
|
|
31
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeSvg.Path, {
|
|
32
|
+
stroke: "none",
|
|
33
|
+
d: "M0 0h24v24H0z",
|
|
34
|
+
fill: "none"
|
|
35
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeSvg.Path, {
|
|
36
|
+
d: "M18 6l-12 12"
|
|
37
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeSvg.Path, {
|
|
38
|
+
d: "M6 6l12 12"
|
|
39
|
+
})]
|
|
40
|
+
})
|
|
39
41
|
);
|
|
40
42
|
}
|
|
41
43
|
var _default = exports.default = IconX;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNativeSvg","_interopRequireWildcard","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNativeSvg","_interopRequireWildcard","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","IconX","size","color","stroke","props","jsxs","width","height","viewBox","strokeWidth","fill","children","jsx","Path","d","_default","exports"],"sourceRoot":"../../../src","sources":["icons/IconX.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,eAAA,GAAAC,uBAAA,CAAAF,OAAA;AAA6C,IAAAG,WAAA,GAAAH,OAAA;AAAA,SAAAI,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAH,wBAAAG,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAA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CAAAiC,GAAA,EAACnC,eAAA,CAAAoC,IAAI;QAACC,CAAC,EAAC;MAAY,CAAE,CAAC;IAAA,CACtB;EAAC;AAEd;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA9B,OAAA,GACcc,KAAK","ignoreList":[]}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -39,11 +39,19 @@ Object.defineProperty(exports, "SimpleImageSliderThemeProvider", {
|
|
|
39
39
|
return _SimpleImageSliderThemeProvider.default;
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
|
-
|
|
42
|
+
Object.defineProperty(exports, "useSimpleImageSliderTheme", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function () {
|
|
45
|
+
return _SimpleImageSliderThemeProvider.useSimpleImageSliderTheme;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
var _SimpleImageSliderThemeProvider = _interopRequireWildcard(require("./SimpleImageSliderThemeProvider"));
|
|
43
49
|
var _BaseSimpleImageSlider = _interopRequireDefault(require("./BaseSimpleImageSlider"));
|
|
44
50
|
var _SimpleImageSlider = _interopRequireDefault(require("./SimpleImageSlider"));
|
|
45
51
|
var _FullScreenImageSlider = _interopRequireDefault(require("./FullScreenImageSlider"));
|
|
46
52
|
var _PinchToZoom = _interopRequireDefault(require("./PinchToZoom"));
|
|
47
53
|
var _PageCounter = _interopRequireDefault(require("./PageCounter"));
|
|
48
|
-
function _interopRequireDefault(
|
|
54
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
55
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
56
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
49
57
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_SimpleImageSliderThemeProvider","
|
|
1
|
+
{"version":3,"names":["_SimpleImageSliderThemeProvider","_interopRequireWildcard","require","_BaseSimpleImageSlider","_interopRequireDefault","_SimpleImageSlider","_FullScreenImageSlider","_PinchToZoom","_PageCounter","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,+BAAA,GAAAC,uBAAA,CAAAC,OAAA;AAKA,IAAAC,sBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,kBAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,sBAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,YAAA,GAAAH,sBAAA,CAAAF,OAAA;AAEA,IAAAM,YAAA,GAAAJ,sBAAA,CAAAF,OAAA;AAAmE,SAAAE,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,yBAAAH,CAAA,6BAAAI,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAD,wBAAA,YAAAA,CAAAH,CAAA,WAAAA,CAAA,GAAAM,CAAA,GAAAD,CAAA,KAAAL,CAAA;AAAA,SAAAR,wBAAAQ,CAAA,EAAAK,CAAA,SAAAA,CAAA,IAAAL,CAAA,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AAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["clamp","value","min","max","Math","exports"],"sourceRoot":"../../../src","sources":["utils/clamp.ts"],"mappings":";;;;;;AAAO,MAAMA,KAAK,GAAGA,CAACC,KAAa,EAAEC,GAAW,EAAEC,GAAW,KAAK;EAC9D,SAAS;;EACT,OAAOC,IAAI,CAACF,GAAG,CAACE,IAAI,CAACD,GAAG,CAACF,KAAK,EAAEC,GAAG,CAAC,EAAEC,GAAG,CAAC;AAC9C,CAAC;AAACE,OAAA,CAAAL,KAAA,GAAAA,KAAA","ignoreList":[]}
|
|
@@ -5,13 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = renderProp;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
9
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
9
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
|
10
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
10
11
|
function renderProp(Component) {
|
|
11
12
|
return Component ? typeof Component === 'string' ? Component : /*#__PURE__*/(0, _react.isValidElement)(Component) ? Component :
|
|
12
13
|
/*#__PURE__*/
|
|
13
14
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
14
15
|
// @ts-ignore
|
|
15
|
-
|
|
16
|
+
(0, _jsxRuntime.jsx)(Component, {}) : null;
|
|
16
17
|
}
|
|
17
18
|
//# sourceMappingURL=renderProp.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","renderProp","Component","isValidElement","jsx"],"sourceRoot":"../../../src","sources":["utils/renderProp.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAA8C,IAAAC,WAAA,GAAAD,OAAA;AAAA,SAAAE,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAJ,wBAAAI,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAG,CAAA,KAAAA,CAAA,CAAAV,GAAA,IAAAU,CAAA,CAAAC,GAAA,IAAAP,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAG,CAAA,IAAAT,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAe,GAAA,CAAAlB,CAAA,EAAAQ,CAAA,GAAAA,CAAA;AAS/B,SAASW,UAAUA,CAACC,SAAqB,EAAE;EACtD,OAAOA,SAAS,GACZ,OAAOA,SAAS,KAAK,QAAQ,GACzBA,SAAS,GACT,iBAAAC,qBAAc,EAACD,SAAS,CAAC,GACzBA,SAAS;EAAA;EAET;EACA;EACA,IAAAtB,WAAA,CAAAwB,GAAA,EAACF,SAAS,IAAE,CACf,GACD,IAAI;AACZ","ignoreList":[]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
//# sourceMappingURL=common.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["@types/common.ts"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["@types/common.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["@types/icons.ts"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["@types/icons.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
//# sourceMappingURL=pinch-to-zoom.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["@types/pinch-to-zoom.ts"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["@types/pinch-to-zoom.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["@types/slider.ts"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["@types/slider.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { useMemo } from 'react';
|
|
4
|
+
import { StyleSheet, View } from 'react-native';
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
export function AbsoluteComponentContainer({
|
|
7
|
+
position,
|
|
8
|
+
children
|
|
9
|
+
}) {
|
|
10
|
+
const styles = useMemo(() => makeStyles(position), [position]);
|
|
11
|
+
return /*#__PURE__*/_jsx(View, {
|
|
12
|
+
style: styles.container,
|
|
13
|
+
children: children
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
const makeStyles = position => {
|
|
17
|
+
return StyleSheet.create({
|
|
18
|
+
container: {
|
|
19
|
+
zIndex: 1000,
|
|
20
|
+
position: 'absolute',
|
|
21
|
+
bottom: position === 'bottom-left' || position === 'bottom-right' ? 16 : 'auto',
|
|
22
|
+
top: position === 'top-left' || position === 'top-right' ? 16 : 'auto',
|
|
23
|
+
left: position === 'top-left' || position === 'bottom-left' ? 16 : 'auto',
|
|
24
|
+
right: position === 'top-right' || position === 'bottom-right' ? 16 : 'auto'
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=AbsoluteComponentContainer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useMemo","StyleSheet","View","jsx","_jsx","AbsoluteComponentContainer","position","children","styles","makeStyles","style","container","create","zIndex","bottom","top","left","right"],"sourceRoot":"../../src","sources":["AbsoluteComponentContainer.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,OAAO,QAAQ,OAAO;AAGtC,SAASC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAMhD,OAAO,SAASC,0BAA0BA,CAAC;EACvCC,QAAQ;EACRC;AAC6B,CAAC,EAAE;EAChC,MAAMC,MAAM,GAAGR,OAAO,CAAC,MAAMS,UAAU,CAACH,QAAQ,CAAC,EAAE,CAACA,QAAQ,CAAC,CAAC;EAE9D,oBAAOF,IAAA,CAACF,IAAI;IAACQ,KAAK,EAAEF,MAAM,CAACG,SAAU;IAAAJ,QAAA,EAAEA;EAAQ,CAAO,CAAC;AAC3D;AAEA,MAAME,UAAU,GAAIH,QAAmE,IAAK;EACxF,OAAOL,UAAU,CAACW,MAAM,CAAC;IACrBD,SAAS,EAAE;MACPE,MAAM,EAAE,IAAI;MACZP,QAAQ,EAAE,UAAU;MACpBQ,MAAM,EAAER,QAAQ,KAAK,aAAa,IAAIA,QAAQ,KAAK,cAAc,GAAG,EAAE,GAAG,MAAM;MAC/ES,GAAG,EAAET,QAAQ,KAAK,UAAU,IAAIA,QAAQ,KAAK,WAAW,GAAG,EAAE,GAAG,MAAM;MACtEU,IAAI,EAAEV,QAAQ,KAAK,UAAU,IAAIA,QAAQ,KAAK,aAAa,GAAG,EAAE,GAAG,MAAM;MACzEW,KAAK,EAAEX,QAAQ,KAAK,WAAW,IAAIA,QAAQ,KAAK,cAAc,GAAG,EAAE,GAAG;IAC1E;EACJ,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
|
|
@@ -1,67 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
1
3
|
import React, { forwardRef, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
2
4
|
import { FlashList } from '@shopify/flash-list';
|
|
3
5
|
import mergeRefs from 'merge-refs';
|
|
4
6
|
import { Image } from 'expo-image';
|
|
5
|
-
import { Pressable } from 'react-native';
|
|
6
|
-
import styled from 'styled-components/native';
|
|
7
|
+
import { Platform, Pressable, StyleSheet } from 'react-native';
|
|
7
8
|
import PageCounter from './PageCounter';
|
|
8
9
|
import PinchToZoom from './PinchToZoom';
|
|
9
10
|
import { GestureHandlerRootView, ScrollView } from 'react-native-gesture-handler';
|
|
10
11
|
import renderProp from './utils/renderProp';
|
|
11
12
|
import Animated from 'react-native-reanimated';
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
bottom: ${({
|
|
16
|
-
position
|
|
17
|
-
}) => position === 'bottom-left' || position === 'bottom-right' ? `16px` : 'auto'};
|
|
18
|
-
top: ${({
|
|
19
|
-
position
|
|
20
|
-
}) => position === 'top-left' || position === 'top-right' ? `16px` : 'auto'};
|
|
21
|
-
left: ${({
|
|
22
|
-
position
|
|
23
|
-
}) => position === 'top-left' || position === 'bottom-left' ? `16px` : 'auto'};
|
|
24
|
-
right: ${({
|
|
25
|
-
position
|
|
26
|
-
}) => position === 'top-right' || position === 'bottom-right' ? `16px` : 'auto'};
|
|
27
|
-
`;
|
|
28
|
-
const StyledPageCounter = styled(PageCounter)`
|
|
29
|
-
z-index: 1000;
|
|
30
|
-
position: absolute;
|
|
31
|
-
bottom: ${({
|
|
32
|
-
position
|
|
33
|
-
}) => position === 'bottom-left' || position === 'bottom-right' ? `16px` : 'auto'};
|
|
34
|
-
top: ${({
|
|
35
|
-
position
|
|
36
|
-
}) => position === 'top-left' || position === 'top-right' ? `16px` : 'auto'};
|
|
37
|
-
left: ${({
|
|
38
|
-
position
|
|
39
|
-
}) => position === 'top-left' || position === 'bottom-left' ? `16px` : 'auto'};
|
|
40
|
-
right: ${({
|
|
41
|
-
position
|
|
42
|
-
}) => position === 'top-right' || position === 'bottom-right' ? `16px` : 'auto'};
|
|
43
|
-
`;
|
|
44
|
-
const StyledContainer = styled(GestureHandlerRootView)`
|
|
45
|
-
aspect-ratio: ${({
|
|
46
|
-
aspectRatio
|
|
47
|
-
}) => aspectRatio ?? 4 / 3};
|
|
48
|
-
width: 100%;
|
|
49
|
-
`;
|
|
50
|
-
const StyledImage = styled(Image)`
|
|
51
|
-
width: ${({
|
|
52
|
-
imageWidth
|
|
53
|
-
}) => imageWidth ? `${imageWidth}px` : '100%'};
|
|
54
|
-
height: ${({
|
|
55
|
-
imageHeight
|
|
56
|
-
}) => imageHeight ? `${imageHeight}px` : '100%'};
|
|
57
|
-
aspect-ratio: ${({
|
|
58
|
-
imageAspectRatio
|
|
59
|
-
}) => imageAspectRatio};
|
|
60
|
-
`;
|
|
61
|
-
const AnimatedStyledImage = Animated.createAnimatedComponent(StyledImage);
|
|
62
|
-
const StyledPinchToZoom = styled(PinchToZoom)`
|
|
63
|
-
z-index: 1000;
|
|
64
|
-
`;
|
|
13
|
+
import { AbsoluteComponentContainer } from './AbsoluteComponentContainer';
|
|
14
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
|
+
const AnimatedImage = Animated.createAnimatedComponent(Image);
|
|
65
16
|
|
|
66
17
|
/**
|
|
67
18
|
* @description A simple image slider that displays a list of images. This is the component
|
|
@@ -80,7 +31,7 @@ const BaseSimpleImageSlider = /*#__PURE__*/forwardRef(function BaseSimpleImageSl
|
|
|
80
31
|
pageCounterPosition = 'bottom-left',
|
|
81
32
|
pageCounterStyle,
|
|
82
33
|
pageCounterTextStyle,
|
|
83
|
-
PageCounterComponent,
|
|
34
|
+
PageCounterComponent = PageCounter,
|
|
84
35
|
renderPageCounter,
|
|
85
36
|
TopRightComponent,
|
|
86
37
|
TopLeftComponent,
|
|
@@ -97,82 +48,92 @@ const BaseSimpleImageSlider = /*#__PURE__*/forwardRef(function BaseSimpleImageSl
|
|
|
97
48
|
if (renderPageCounter !== undefined && PageCounterComponent !== undefined) {
|
|
98
49
|
throw new Error('You should provide either `renderPageCounter` or `PageCounterComponent`, not both.');
|
|
99
50
|
}
|
|
100
|
-
const ActualPageCounterComponent = PageCounterComponent ? makeStyledPageCounter(PageCounterComponent) : StyledPageCounter;
|
|
101
51
|
const listRef = useRef(null);
|
|
52
|
+
const styles = useMemo(() => makeStyles({
|
|
53
|
+
imageAspectRatio,
|
|
54
|
+
imageWidth,
|
|
55
|
+
imageHeight
|
|
56
|
+
}), [imageAspectRatio, imageHeight, imageWidth]);
|
|
57
|
+
const slicedData = useMemo(() => maxItems !== undefined ? data?.slice(0, maxItems) ?? [] : data ?? [], [data, maxItems]);
|
|
58
|
+
const estimatedItemSize = useMemo(() => {
|
|
59
|
+
return imageWidth ?? (imageHeight ? imageHeight * (imageAspectRatio ?? 4 / 3) : 350);
|
|
60
|
+
}, [imageAspectRatio, imageHeight, imageWidth]);
|
|
102
61
|
const [currentItem, setCurrentItem] = useState(0);
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
const keyExtractor = useCallback(item => item.key, []);
|
|
113
|
-
const renderItem = useCallback(({
|
|
114
|
-
item,
|
|
115
|
-
index
|
|
116
|
-
}) => {
|
|
117
|
-
const ImageComponent = sharedTransitionTag && index === currentItem ? AnimatedStyledImage : StyledImage;
|
|
118
|
-
return /*#__PURE__*/React.createElement(Pressable, {
|
|
119
|
-
onPress: () => {
|
|
120
|
-
var _listRef$current2;
|
|
121
|
-
(_listRef$current2 = listRef.current) === null || _listRef$current2 === void 0 || _listRef$current2.recordInteraction();
|
|
122
|
-
onItemPress === null || onItemPress === void 0 || onItemPress(item, index);
|
|
123
|
-
}
|
|
124
|
-
}, /*#__PURE__*/React.createElement(ImageComponent, {
|
|
125
|
-
sharedTransitionTag: sharedTransitionTag,
|
|
126
|
-
transition: 200,
|
|
127
|
-
placeholder: item.placeholder,
|
|
128
|
-
placeholderContentFit: 'cover',
|
|
129
|
-
imageWidth: imageWidth,
|
|
130
|
-
imageHeight: imageHeight,
|
|
131
|
-
imageAspectRatio: imageAspectRatio,
|
|
132
|
-
recyclingKey: item.key,
|
|
133
|
-
source: item.source,
|
|
134
|
-
contentFit: 'cover',
|
|
135
|
-
contentPosition: 'center',
|
|
136
|
-
style: imageStyle
|
|
137
|
-
}));
|
|
138
|
-
}, [currentItem, imageAspectRatio, imageHeight, imageStyle, imageWidth, onItemPress, sharedTransitionTag]);
|
|
139
|
-
const onViewableItemsChanged = useCallback(({
|
|
62
|
+
const [scrollEnabled, setScrollEnabled] = useState(true);
|
|
63
|
+
const [snapToInterval, setSnapToInterval] = useState(undefined);
|
|
64
|
+
const handleScaleChange = useCallback(() => {
|
|
65
|
+
setScrollEnabled(false);
|
|
66
|
+
}, []);
|
|
67
|
+
const handleScaleReset = useCallback(() => {
|
|
68
|
+
setScrollEnabled(true);
|
|
69
|
+
}, []);
|
|
70
|
+
const handleViewableItemsChanged = useCallback(({
|
|
140
71
|
viewableItems
|
|
141
72
|
}) => {
|
|
142
|
-
|
|
143
|
-
const newIndex = (_viewableItems$ = viewableItems[0]) === null || _viewableItems$ === void 0 ? void 0 : _viewableItems$.index;
|
|
73
|
+
const newIndex = viewableItems[0]?.index;
|
|
144
74
|
if (newIndex !== undefined && newIndex !== null) {
|
|
145
75
|
setCurrentItem(newIndex);
|
|
146
|
-
onViewableItemChange
|
|
76
|
+
onViewableItemChange?.(newIndex);
|
|
147
77
|
}
|
|
148
78
|
}, [onViewableItemChange]);
|
|
149
|
-
const
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
}, []);
|
|
153
|
-
const onScaleReset = useCallback(() => {
|
|
154
|
-
setScrollEnabled(true);
|
|
155
|
-
}, []);
|
|
156
|
-
const estimatedItemSize = useMemo(() => {
|
|
157
|
-
return imageWidth ?? (imageHeight ? imageHeight * (imageAspectRatio ?? 4 / 3) : 350);
|
|
158
|
-
}, [imageAspectRatio, imageHeight, imageWidth]);
|
|
159
|
-
const internalOnPinchToZoomStatusChange = useCallback(status => {
|
|
160
|
-
var _listRef$current3;
|
|
161
|
-
(_listRef$current3 = listRef.current) === null || _listRef$current3 === void 0 || _listRef$current3.recordInteraction();
|
|
162
|
-
onPinchToZoomStatusChange === null || onPinchToZoomStatusChange === void 0 || onPinchToZoomStatusChange(status);
|
|
79
|
+
const handlePinchToZoomStatusChange = useCallback(status => {
|
|
80
|
+
listRef.current?.recordInteraction();
|
|
81
|
+
onPinchToZoomStatusChange?.(status);
|
|
163
82
|
}, [onPinchToZoomStatusChange]);
|
|
164
|
-
const
|
|
83
|
+
const renderItem = useCallback(({
|
|
84
|
+
item,
|
|
85
|
+
index
|
|
86
|
+
}) => {
|
|
87
|
+
const ImageComponent = sharedTransitionTag && index === currentItem ? AnimatedImage : Image;
|
|
88
|
+
return /*#__PURE__*/_jsx(Pressable, {
|
|
89
|
+
onPress: () => {
|
|
90
|
+
listRef.current?.recordInteraction();
|
|
91
|
+
onItemPress?.(item, index);
|
|
92
|
+
},
|
|
93
|
+
children: /*#__PURE__*/_jsx(ImageComponent, {
|
|
94
|
+
sharedTransitionTag: sharedTransitionTag,
|
|
95
|
+
transition: 200
|
|
96
|
+
// https://github.com/expo/expo/issues/34810
|
|
97
|
+
/* eslint-disable-next-line @typescript-eslint/no-unsafe-assignment */,
|
|
98
|
+
placeholder: item.placeholder,
|
|
99
|
+
placeholderContentFit: 'cover',
|
|
100
|
+
recyclingKey: item.key
|
|
101
|
+
// https://github.com/expo/expo/issues/34810
|
|
102
|
+
/* eslint-disable-next-line @typescript-eslint/no-unsafe-assignment */,
|
|
103
|
+
source: item.source,
|
|
104
|
+
contentFit: 'cover',
|
|
105
|
+
contentPosition: 'center',
|
|
106
|
+
style: [styles.image, imageStyle]
|
|
107
|
+
})
|
|
108
|
+
});
|
|
109
|
+
}, [currentItem, imageStyle, onItemPress, sharedTransitionTag, styles.image]);
|
|
110
|
+
const keyExtractor = useCallback(item => item.key, []);
|
|
111
|
+
const handleListLayout = useCallback(event => {
|
|
112
|
+
if (Platform.OS === 'ios') {
|
|
113
|
+
// temporary workaround for iOS scrolling a bit more than expected
|
|
114
|
+
setSnapToInterval(event.nativeEvent.layout.width - 0.5);
|
|
115
|
+
}
|
|
116
|
+
}, []);
|
|
117
|
+
useEffect(() => {
|
|
118
|
+
setCurrentItem(indexOverride ?? 0);
|
|
119
|
+
listRef.current?.scrollToIndex({
|
|
120
|
+
index: indexOverride ?? 0,
|
|
121
|
+
animated: false
|
|
122
|
+
});
|
|
123
|
+
}, [indexOverride, slicedData]);
|
|
124
|
+
const list = /*#__PURE__*/_jsx(FlashList, {
|
|
165
125
|
renderScrollComponent: ScrollView,
|
|
166
126
|
scrollEnabled: scrollEnabled,
|
|
167
127
|
disableScrollViewPanResponder: enablePinchToZoom ? !scrollEnabled : false,
|
|
168
128
|
ref: mergeRefs(ref, listRef),
|
|
169
129
|
initialScrollIndex: indexOverride ?? currentItem ?? 0,
|
|
170
|
-
onViewableItemsChanged:
|
|
130
|
+
onViewableItemsChanged: handleViewableItemsChanged,
|
|
171
131
|
viewabilityConfig: {
|
|
172
132
|
itemVisiblePercentThreshold: 55
|
|
173
133
|
},
|
|
174
134
|
decelerationRate: 'fast',
|
|
175
|
-
pagingEnabled:
|
|
135
|
+
pagingEnabled: snapToInterval === undefined,
|
|
136
|
+
snapToInterval: snapToInterval,
|
|
176
137
|
showsHorizontalScrollIndicator: false,
|
|
177
138
|
showsVerticalScrollIndicator: false,
|
|
178
139
|
horizontal: true,
|
|
@@ -183,49 +144,62 @@ const BaseSimpleImageSlider = /*#__PURE__*/forwardRef(function BaseSimpleImageSl
|
|
|
183
144
|
estimatedListSize: {
|
|
184
145
|
width: estimatedItemSize,
|
|
185
146
|
height: imageHeight ?? estimatedItemSize / imageAspectRatio
|
|
186
|
-
}
|
|
147
|
+
},
|
|
148
|
+
onLayout: handleListLayout
|
|
149
|
+
});
|
|
150
|
+
return /*#__PURE__*/_jsxs(GestureHandlerRootView, {
|
|
151
|
+
style: [styles.container, style],
|
|
152
|
+
children: [enablePinchToZoom ? /*#__PURE__*/_jsx(PinchToZoom, {
|
|
153
|
+
style: styles.pinchToZoom,
|
|
154
|
+
onDismiss: onPinchToZoomRequestClose,
|
|
155
|
+
onStatusChange: handlePinchToZoomStatusChange,
|
|
156
|
+
onScaleChange: handleScaleChange,
|
|
157
|
+
onScaleReset: handleScaleReset,
|
|
158
|
+
maximumZoomScale: 5,
|
|
159
|
+
minimumZoomScale: 1,
|
|
160
|
+
children: list
|
|
161
|
+
}) : list, showPageCounter ? renderPageCounter ? renderPageCounter(currentItem + 1, slicedData.length) : /*#__PURE__*/_jsx(AbsoluteComponentContainer, {
|
|
162
|
+
position: pageCounterPosition,
|
|
163
|
+
children: /*#__PURE__*/_jsx(PageCounterComponent, {
|
|
164
|
+
totalPages: slicedData.length,
|
|
165
|
+
currentPage: currentItem + 1,
|
|
166
|
+
style: pageCounterStyle,
|
|
167
|
+
textStyle: pageCounterTextStyle
|
|
168
|
+
})
|
|
169
|
+
}) : null, TopRightComponent ? /*#__PURE__*/_jsx(AbsoluteComponentContainer, {
|
|
170
|
+
position: 'top-right',
|
|
171
|
+
children: renderProp(TopRightComponent)
|
|
172
|
+
}) : null, TopLeftComponent ? /*#__PURE__*/_jsx(AbsoluteComponentContainer, {
|
|
173
|
+
position: 'top-left',
|
|
174
|
+
children: renderProp(TopLeftComponent)
|
|
175
|
+
}) : null, BottomRightComponent ? /*#__PURE__*/_jsx(AbsoluteComponentContainer, {
|
|
176
|
+
position: 'bottom-right',
|
|
177
|
+
children: renderProp(BottomRightComponent)
|
|
178
|
+
}) : null, BottomLeftComponent ? /*#__PURE__*/_jsx(AbsoluteComponentContainer, {
|
|
179
|
+
position: 'bottom-left',
|
|
180
|
+
children: renderProp(BottomLeftComponent)
|
|
181
|
+
}) : null]
|
|
187
182
|
});
|
|
188
|
-
return /*#__PURE__*/React.createElement(StyledContainer, {
|
|
189
|
-
aspectRatio: imageAspectRatio,
|
|
190
|
-
style: style
|
|
191
|
-
}, enablePinchToZoom ? /*#__PURE__*/React.createElement(StyledPinchToZoom, {
|
|
192
|
-
onDismiss: onPinchToZoomRequestClose,
|
|
193
|
-
onStatusChange: internalOnPinchToZoomStatusChange,
|
|
194
|
-
onScaleChange: onScaleChange,
|
|
195
|
-
onScaleReset: onScaleReset,
|
|
196
|
-
maximumZoomScale: 5,
|
|
197
|
-
minimumZoomScale: 1
|
|
198
|
-
}, list) : list, showPageCounter ? renderPageCounter ? renderPageCounter(currentItem + 1, slicedData.length) : /*#__PURE__*/React.createElement(ActualPageCounterComponent, {
|
|
199
|
-
position: pageCounterPosition,
|
|
200
|
-
totalPages: slicedData.length,
|
|
201
|
-
currentPage: currentItem + 1,
|
|
202
|
-
style: pageCounterStyle,
|
|
203
|
-
textStyle: pageCounterTextStyle
|
|
204
|
-
}) : null, TopRightComponent ? /*#__PURE__*/React.createElement(StyledAbsoluteComponentContainer, {
|
|
205
|
-
position: 'top-right'
|
|
206
|
-
}, renderProp(TopRightComponent)) : null, TopLeftComponent ? /*#__PURE__*/React.createElement(StyledAbsoluteComponentContainer, {
|
|
207
|
-
position: 'top-left'
|
|
208
|
-
}, renderProp(TopLeftComponent)) : null, BottomRightComponent ? /*#__PURE__*/React.createElement(StyledAbsoluteComponentContainer, {
|
|
209
|
-
position: 'bottom-right'
|
|
210
|
-
}, renderProp(BottomRightComponent)) : null, BottomLeftComponent ? /*#__PURE__*/React.createElement(StyledAbsoluteComponentContainer, {
|
|
211
|
-
position: 'bottom-left'
|
|
212
|
-
}, renderProp(BottomLeftComponent)) : null);
|
|
213
183
|
});
|
|
214
|
-
const
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
184
|
+
const makeStyles = ({
|
|
185
|
+
imageAspectRatio,
|
|
186
|
+
imageWidth,
|
|
187
|
+
imageHeight
|
|
188
|
+
}) => {
|
|
189
|
+
return StyleSheet.create({
|
|
190
|
+
container: {
|
|
191
|
+
width: '100%',
|
|
192
|
+
aspectRatio: imageAspectRatio ?? 4 / 3
|
|
193
|
+
},
|
|
194
|
+
pinchToZoom: {
|
|
195
|
+
zIndex: 1000
|
|
196
|
+
},
|
|
197
|
+
image: {
|
|
198
|
+
width: imageWidth ?? '100%',
|
|
199
|
+
height: imageHeight ?? '100%',
|
|
200
|
+
aspectRatio: imageAspectRatio ?? 4 / 3
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
};
|
|
230
204
|
export default BaseSimpleImageSlider;
|
|
231
205
|
//# sourceMappingURL=BaseSimpleImageSlider.js.map
|