dhre-ui-kit 0.0.247 → 0.0.249
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/index.d.ts +4 -2
- package/lib/index.js +104 -112
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +105 -113
- package/lib/index.mjs.map +1 -1
- package/package.json +2 -1
package/lib/index.d.ts
CHANGED
|
@@ -743,13 +743,15 @@ declare const _default$3: (props: IProps) => React$1.JSX.Element;
|
|
|
743
743
|
interface CustomSlideButtonProps {
|
|
744
744
|
label?: string;
|
|
745
745
|
onComplete?: () => void;
|
|
746
|
+
onReset?: () => void;
|
|
746
747
|
icon: React$1.ReactElement;
|
|
747
748
|
size?: number;
|
|
748
749
|
textStyle?: TextStyle;
|
|
749
750
|
containerStyle?: ViewStyle;
|
|
750
751
|
sliderStyle?: ViewStyle;
|
|
751
|
-
|
|
752
|
-
|
|
752
|
+
sliderBackgroundColor?: string;
|
|
753
|
+
sliderTextColor?: string;
|
|
754
|
+
resetTimer?: number;
|
|
753
755
|
}
|
|
754
756
|
type SlideButtonHandle = {
|
|
755
757
|
reset?: () => void;
|
package/lib/index.js
CHANGED
|
@@ -7,7 +7,7 @@ var reactRedux = require('react-redux');
|
|
|
7
7
|
var reactNative = require('react-native');
|
|
8
8
|
var reactNativeGestureHandler = require('react-native-gesture-handler');
|
|
9
9
|
var blur = require('@react-native-community/blur');
|
|
10
|
-
var
|
|
10
|
+
var LottieView = require('lottie-react-native');
|
|
11
11
|
var Tooltip = require('react-native-walkthrough-tooltip');
|
|
12
12
|
var Pdf = require('react-native-pdf');
|
|
13
13
|
var Progress = require('react-native-progress');
|
|
@@ -19,6 +19,7 @@ var reactNativeElementDropdown = require('react-native-element-dropdown');
|
|
|
19
19
|
var DocumentPicker = require('react-native-document-picker');
|
|
20
20
|
var RNFS = require('react-native-fs');
|
|
21
21
|
var OTPVerify = require('react-native-otp-verify');
|
|
22
|
+
var stylehelper = require('src/utils/stylehelper');
|
|
22
23
|
var Clipboard = require('@react-native-clipboard/clipboard');
|
|
23
24
|
|
|
24
25
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -42,7 +43,7 @@ function _interopNamespace(e) {
|
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
45
|
-
var
|
|
46
|
+
var LottieView__default = /*#__PURE__*/_interopDefaultLegacy(LottieView);
|
|
46
47
|
var Tooltip__default = /*#__PURE__*/_interopDefaultLegacy(Tooltip);
|
|
47
48
|
var Pdf__default = /*#__PURE__*/_interopDefaultLegacy(Pdf);
|
|
48
49
|
var Progress__namespace = /*#__PURE__*/_interopNamespace(Progress);
|
|
@@ -746,6 +747,13 @@ const BottomDrawer = ({
|
|
|
746
747
|
|
|
747
748
|
const createStyles$3 = (theme) => {
|
|
748
749
|
return reactNative.StyleSheet.create({
|
|
750
|
+
container: {
|
|
751
|
+
position: "absolute",
|
|
752
|
+
left: 0,
|
|
753
|
+
right: 0,
|
|
754
|
+
bottom: 0,
|
|
755
|
+
top: 0
|
|
756
|
+
},
|
|
749
757
|
backdrop: {
|
|
750
758
|
flex: 1,
|
|
751
759
|
justifyContent: "center",
|
|
@@ -781,68 +789,22 @@ const createStyles$3 = (theme) => {
|
|
|
781
789
|
});
|
|
782
790
|
};
|
|
783
791
|
|
|
792
|
+
const loaderJson = { "nm": "Main Scene", "ddd": 0, "h": 100, "w": 100, "meta": { "g": "@lottiefiles/creator 1.44.0" }, "layers": [{ "ty": 4, "nm": "6", "sr": 1, "st": 0, "op": 120, "ip": 0, "hd": false, "ddd": 0, "bm": 0, "hasMask": false, "ao": 0, "ks": { "a": { "a": 0, "k": [-2.905, -24.228, 0], "ix": 1 }, "s": { "a": 0, "k": [100, 100, 100], "ix": 6 }, "sk": { "a": 0, "k": 0 }, "p": { "a": 0, "k": [50, 50, 0], "ix": 2 }, "r": { "a": 1, "k": [{ "o": { "x": 0.333, "y": 0 }, "i": { "x": 0.223, "y": 1 }, "s": [0], "t": 10 }, { "s": [360], "t": 100 }], "ix": 10 }, "sa": { "a": 0, "k": 0 }, "o": { "a": 0, "k": 100, "ix": 11 } }, "shapes": [{ "ty": "gr", "bm": 0, "hd": false, "mn": "ADBE Vector Group", "nm": "Ellipse 1", "ix": 1, "cix": 2, "np": 3, "it": [{ "ty": "el", "bm": 0, "hd": false, "mn": "ADBE Vector Shape - Ellipse", "nm": "Ellipse Path 1", "d": 1, "p": { "a": 0, "k": [0, 0], "ix": 3 }, "s": { "a": 0, "k": [14.822, 14.822], "ix": 2 } }, { "ty": "fl", "bm": 0, "hd": false, "mn": "ADBE Vector Graphic - Fill", "nm": "Fill 1", "c": { "a": 0, "k": [0.8, 0.8, 0.8], "ix": 4 }, "r": 1, "o": { "a": 0, "k": 100, "ix": 5 } }, { "ty": "tr", "a": { "a": 0, "k": [0, 0], "ix": 1 }, "s": { "a": 1, "k": [{ "o": { "x": 0.333, "y": 0 }, "i": { "x": 0.236, "y": 1 }, "s": [100, 100], "t": 10 }, { "s": [0, 0], "t": 100 }], "ix": 3 }, "sk": { "a": 0, "k": 0, "ix": 4 }, "p": { "a": 0, "k": [-2.905, -64.316], "ix": 2 }, "r": { "a": 0, "k": 357, "ix": 6 }, "sa": { "a": 0, "k": 0, "ix": 5 }, "o": { "a": 0, "k": 100, "ix": 7 } }] }], "ind": 1 }, { "ty": 4, "nm": "5", "sr": 1, "st": 0, "op": 120, "ip": 0, "hd": false, "ddd": 0, "bm": 0, "hasMask": false, "ao": 0, "ks": { "a": { "a": 0, "k": [-2.905, -24.228, 0], "ix": 1 }, "s": { "a": 0, "k": [100, 100, 100], "ix": 6 }, "sk": { "a": 0, "k": 0 }, "p": { "a": 0, "k": [50, 50, 0], "ix": 2 }, "r": { "a": 1, "k": [{ "o": { "x": 0.333, "y": 0 }, "i": { "x": 0.223, "y": 1 }, "s": [0], "t": 8 }, { "s": [360], "t": 98 }], "ix": 10 }, "sa": { "a": 0, "k": 0 }, "o": { "a": 0, "k": 100, "ix": 11 } }, "shapes": [{ "ty": "gr", "bm": 0, "hd": false, "mn": "ADBE Vector Group", "nm": "Ellipse 1", "ix": 1, "cix": 2, "np": 3, "it": [{ "ty": "el", "bm": 0, "hd": false, "mn": "ADBE Vector Shape - Ellipse", "nm": "Ellipse Path 1", "d": 1, "p": { "a": 0, "k": [0, 0], "ix": 3 }, "s": { "a": 0, "k": [14.822, 14.822], "ix": 2 } }, { "ty": "fl", "bm": 0, "hd": false, "mn": "ADBE Vector Graphic - Fill", "nm": "Fill 1", "c": { "a": 0, "k": [0.8, 0.8, 0.8], "ix": 4 }, "r": 1, "o": { "a": 0, "k": 100, "ix": 5 } }, { "ty": "tr", "a": { "a": 0, "k": [0, 0], "ix": 1 }, "s": { "a": 1, "k": [{ "o": { "x": 0.333, "y": 0 }, "i": { "x": 0.236, "y": 1 }, "s": [80, 80], "t": 8 }, { "s": [20, 20], "t": 98 }], "ix": 3 }, "sk": { "a": 0, "k": 0, "ix": 4 }, "p": { "a": 0, "k": [-2.905, -64.316], "ix": 2 }, "r": { "a": 0, "k": 357, "ix": 6 }, "sa": { "a": 0, "k": 0, "ix": 5 }, "o": { "a": 0, "k": 100, "ix": 7 } }] }], "ind": 2 }, { "ty": 4, "nm": "4", "sr": 1, "st": 0, "op": 120, "ip": 0, "hd": false, "ddd": 0, "bm": 0, "hasMask": false, "ao": 0, "ks": { "a": { "a": 0, "k": [-2.905, -24.228, 0], "ix": 1 }, "s": { "a": 0, "k": [100, 100, 100], "ix": 6 }, "sk": { "a": 0, "k": 0 }, "p": { "a": 0, "k": [50, 50, 0], "ix": 2 }, "r": { "a": 1, "k": [{ "o": { "x": 0.333, "y": 0 }, "i": { "x": 0.223, "y": 1 }, "s": [0], "t": 6 }, { "s": [360], "t": 96 }], "ix": 10 }, "sa": { "a": 0, "k": 0 }, "o": { "a": 0, "k": 100, "ix": 11 } }, "shapes": [{ "ty": "gr", "bm": 0, "hd": false, "mn": "ADBE Vector Group", "nm": "Ellipse 1", "ix": 1, "cix": 2, "np": 3, "it": [{ "ty": "el", "bm": 0, "hd": false, "mn": "ADBE Vector Shape - Ellipse", "nm": "Ellipse Path 1", "d": 1, "p": { "a": 0, "k": [0, 0], "ix": 3 }, "s": { "a": 0, "k": [14.822, 14.822], "ix": 2 } }, { "ty": "fl", "bm": 0, "hd": false, "mn": "ADBE Vector Graphic - Fill", "nm": "Fill 1", "c": { "a": 0, "k": [0.8, 0.8, 0.8], "ix": 4 }, "r": 1, "o": { "a": 0, "k": 100, "ix": 5 } }, { "ty": "tr", "a": { "a": 0, "k": [0, 0], "ix": 1 }, "s": { "a": 1, "k": [{ "o": { "x": 0.333, "y": 0 }, "i": { "x": 0.236, "y": 1 }, "s": [60, 60], "t": 6 }, { "s": [40, 40], "t": 96 }], "ix": 3 }, "sk": { "a": 0, "k": 0, "ix": 4 }, "p": { "a": 0, "k": [-2.905, -64.316], "ix": 2 }, "r": { "a": 0, "k": 357, "ix": 6 }, "sa": { "a": 0, "k": 0, "ix": 5 }, "o": { "a": 0, "k": 100, "ix": 7 } }] }], "ind": 3 }, { "ty": 4, "nm": "3", "sr": 1, "st": 0, "op": 120, "ip": 0, "hd": false, "ddd": 0, "bm": 0, "hasMask": false, "ao": 0, "ks": { "a": { "a": 0, "k": [-2.905, -24.228, 0], "ix": 1 }, "s": { "a": 0, "k": [100, 100, 100], "ix": 6 }, "sk": { "a": 0, "k": 0 }, "p": { "a": 0, "k": [50, 50, 0], "ix": 2 }, "r": { "a": 1, "k": [{ "o": { "x": 0.333, "y": 0 }, "i": { "x": 0.223, "y": 1 }, "s": [0], "t": 4 }, { "s": [360], "t": 94 }], "ix": 10 }, "sa": { "a": 0, "k": 0 }, "o": { "a": 0, "k": 100, "ix": 11 } }, "shapes": [{ "ty": "gr", "bm": 0, "hd": false, "mn": "ADBE Vector Group", "nm": "Ellipse 1", "ix": 1, "cix": 2, "np": 3, "it": [{ "ty": "el", "bm": 0, "hd": false, "mn": "ADBE Vector Shape - Ellipse", "nm": "Ellipse Path 1", "d": 1, "p": { "a": 0, "k": [0, 0], "ix": 3 }, "s": { "a": 0, "k": [14.822, 14.822], "ix": 2 } }, { "ty": "fl", "bm": 0, "hd": false, "mn": "ADBE Vector Graphic - Fill", "nm": "Fill 1", "c": { "a": 0, "k": [0.8, 0.8, 0.8], "ix": 4 }, "r": 1, "o": { "a": 0, "k": 100, "ix": 5 } }, { "ty": "tr", "a": { "a": 0, "k": [0, 0], "ix": 1 }, "s": { "a": 1, "k": [{ "o": { "x": 0.333, "y": 0 }, "i": { "x": 0.236, "y": 1 }, "s": [40, 40], "t": 4 }, { "s": [60, 60], "t": 94 }], "ix": 3 }, "sk": { "a": 0, "k": 0, "ix": 4 }, "p": { "a": 0, "k": [-2.905, -64.316], "ix": 2 }, "r": { "a": 0, "k": 357, "ix": 6 }, "sa": { "a": 0, "k": 0, "ix": 5 }, "o": { "a": 0, "k": 100, "ix": 7 } }] }], "ind": 4 }, { "ty": 4, "nm": "2", "sr": 1, "st": 0, "op": 120, "ip": 0, "hd": false, "ddd": 0, "bm": 0, "hasMask": false, "ao": 0, "ks": { "a": { "a": 0, "k": [-2.905, -24.228, 0], "ix": 1 }, "s": { "a": 0, "k": [100, 100, 100], "ix": 6 }, "sk": { "a": 0, "k": 0 }, "p": { "a": 0, "k": [50, 50, 0], "ix": 2 }, "r": { "a": 1, "k": [{ "o": { "x": 0.333, "y": 0 }, "i": { "x": 0.223, "y": 1 }, "s": [0], "t": 2 }, { "s": [360], "t": 92 }], "ix": 10 }, "sa": { "a": 0, "k": 0 }, "o": { "a": 0, "k": 100, "ix": 11 } }, "shapes": [{ "ty": "gr", "bm": 0, "hd": false, "mn": "ADBE Vector Group", "nm": "Ellipse 1", "ix": 1, "cix": 2, "np": 3, "it": [{ "ty": "el", "bm": 0, "hd": false, "mn": "ADBE Vector Shape - Ellipse", "nm": "Ellipse Path 1", "d": 1, "p": { "a": 0, "k": [0, 0], "ix": 3 }, "s": { "a": 0, "k": [14.822, 14.822], "ix": 2 } }, { "ty": "fl", "bm": 0, "hd": false, "mn": "ADBE Vector Graphic - Fill", "nm": "Fill 1", "c": { "a": 0, "k": [0.8, 0.8, 0.8], "ix": 4 }, "r": 1, "o": { "a": 0, "k": 100, "ix": 5 } }, { "ty": "tr", "a": { "a": 0, "k": [0, 0], "ix": 1 }, "s": { "a": 1, "k": [{ "o": { "x": 0.333, "y": 0 }, "i": { "x": 0.236, "y": 1 }, "s": [20, 20], "t": 2 }, { "s": [80, 80], "t": 92 }], "ix": 3 }, "sk": { "a": 0, "k": 0, "ix": 4 }, "p": { "a": 0, "k": [-2.905, -64.316], "ix": 2 }, "r": { "a": 0, "k": 357, "ix": 6 }, "sa": { "a": 0, "k": 0, "ix": 5 }, "o": { "a": 0, "k": 100, "ix": 7 } }] }], "ind": 5 }, { "ty": 4, "nm": "1", "sr": 1, "st": 0, "op": 120, "ip": 0, "hd": false, "ddd": 0, "bm": 0, "hasMask": false, "ao": 0, "ks": { "a": { "a": 0, "k": [-2.905, -24.228, 0], "ix": 1 }, "s": { "a": 0, "k": [100, 100, 100], "ix": 6 }, "sk": { "a": 0, "k": 0 }, "p": { "a": 0, "k": [50, 50, 0], "ix": 2 }, "r": { "a": 1, "k": [{ "o": { "x": 0.333, "y": 0 }, "i": { "x": 0.223, "y": 1 }, "s": [0], "t": 0 }, { "s": [360], "t": 90 }], "ix": 10 }, "sa": { "a": 0, "k": 0 }, "o": { "a": 0, "k": 100, "ix": 11 } }, "shapes": [{ "ty": "gr", "bm": 0, "hd": false, "mn": "ADBE Vector Group", "nm": "Ellipse 1", "ix": 1, "cix": 2, "np": 3, "it": [{ "ty": "el", "bm": 0, "hd": false, "mn": "ADBE Vector Shape - Ellipse", "nm": "Ellipse Path 1", "d": 1, "p": { "a": 0, "k": [0, 0], "ix": 3 }, "s": { "a": 0, "k": [14.822, 14.822], "ix": 2 } }, { "ty": "fl", "bm": 0, "hd": false, "mn": "ADBE Vector Graphic - Fill", "nm": "Fill 1", "c": { "a": 0, "k": [0.8, 0.8, 0.8], "ix": 4 }, "r": 1, "o": { "a": 0, "k": 100, "ix": 5 } }, { "ty": "tr", "a": { "a": 0, "k": [0, 0], "ix": 1 }, "s": { "a": 1, "k": [{ "o": { "x": 0.333, "y": 0 }, "i": { "x": 0.236, "y": 1 }, "s": [0, 0], "t": 0 }, { "s": [100, 100], "t": 90 }], "ix": 3 }, "sk": { "a": 0, "k": 0, "ix": 4 }, "p": { "a": 0, "k": [-2.905, -64.316], "ix": 2 }, "r": { "a": 0, "k": 357, "ix": 6 }, "sa": { "a": 0, "k": 0, "ix": 5 }, "o": { "a": 0, "k": 100, "ix": 7 } }] }], "ind": 6 }], "v": "5.7.0", "fr": 60, "op": 90, "ip": 0, "assets": [] };
|
|
784
793
|
const CustomLoader = ({ loading, loadingText = "Loading..." }) => {
|
|
785
|
-
const rotateAnim = React.useRef(new reactNative.Animated.Value(0)).current;
|
|
786
794
|
const { theme, mode } = useTheme();
|
|
787
795
|
const styles = createStyles$3(theme);
|
|
788
|
-
React.useEffect(() => {
|
|
789
|
-
if (loading) {
|
|
790
|
-
reactNative.Animated.loop(
|
|
791
|
-
reactNative.Animated.timing(rotateAnim, {
|
|
792
|
-
toValue: 1,
|
|
793
|
-
duration: 1500,
|
|
794
|
-
easing: reactNative.Easing.linear,
|
|
795
|
-
useNativeDriver: true
|
|
796
|
-
})
|
|
797
|
-
).start();
|
|
798
|
-
} else {
|
|
799
|
-
rotateAnim.stopAnimation();
|
|
800
|
-
rotateAnim.setValue(0);
|
|
801
|
-
}
|
|
802
|
-
return () => {
|
|
803
|
-
rotateAnim.stopAnimation();
|
|
804
|
-
};
|
|
805
|
-
}, [loading, rotateAnim]);
|
|
806
796
|
if (!loading) return null;
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
), /* @__PURE__ */ React__default["default"].createElement(
|
|
819
|
-
Svg.Stop,
|
|
820
|
-
{
|
|
821
|
-
offset: "100%",
|
|
822
|
-
stopColor: mode === "dark" ? "#FFFFFF" : "#AAAAAA",
|
|
823
|
-
stopOpacity: ".9"
|
|
824
|
-
}
|
|
825
|
-
))), /* @__PURE__ */ React__default["default"].createElement(
|
|
826
|
-
Svg.Circle,
|
|
827
|
-
{
|
|
828
|
-
cx: "50",
|
|
829
|
-
cy: "50",
|
|
830
|
-
r: "40",
|
|
831
|
-
stroke: "url(#grad)",
|
|
832
|
-
strokeWidth: "8",
|
|
833
|
-
fill: "none",
|
|
834
|
-
strokeDasharray: "250",
|
|
835
|
-
strokeLinecap: "round"
|
|
836
|
-
}
|
|
837
|
-
))), /* @__PURE__ */ React__default["default"].createElement(
|
|
838
|
-
CustomText$1,
|
|
839
|
-
{
|
|
840
|
-
text: loadingText,
|
|
841
|
-
style: styles.text,
|
|
842
|
-
variant: FontStyle.B4_REGULAR,
|
|
843
|
-
textColor: "#000000"
|
|
844
|
-
}
|
|
845
|
-
))));
|
|
797
|
+
else {
|
|
798
|
+
return /* @__PURE__ */ React__default["default"].createElement(reactNative.View, { style: styles.container }, /* @__PURE__ */ React__default["default"].createElement(reactNative.View, { style: styles.backdrop }, /* @__PURE__ */ React__default["default"].createElement(reactNative.View, { style: styles.box }, /* @__PURE__ */ React__default["default"].createElement(reactNative.View, { style: styles.loader }, /* @__PURE__ */ React__default["default"].createElement(LottieView__default["default"], { style: styles.loader, source: loaderJson, autoPlay: true, loop: true })), /* @__PURE__ */ React__default["default"].createElement(
|
|
799
|
+
CustomText$1,
|
|
800
|
+
{
|
|
801
|
+
text: loadingText,
|
|
802
|
+
style: styles.text,
|
|
803
|
+
variant: FontStyle.B4_REGULAR,
|
|
804
|
+
textColor: "#000000"
|
|
805
|
+
}
|
|
806
|
+
))));
|
|
807
|
+
}
|
|
846
808
|
};
|
|
847
809
|
var CustomLoader$1 = withThemeProvider(CustomLoader);
|
|
848
810
|
|
|
@@ -4417,8 +4379,8 @@ const styles$3 = reactNative.StyleSheet.create({
|
|
|
4417
4379
|
alignItems: "center"
|
|
4418
4380
|
},
|
|
4419
4381
|
sliderContainer: {
|
|
4420
|
-
height: verticalScale(48),
|
|
4421
|
-
borderRadius: moderateScale(25),
|
|
4382
|
+
height: stylehelper.verticalScale(48),
|
|
4383
|
+
borderRadius: stylehelper.moderateScale(25),
|
|
4422
4384
|
overflow: "hidden",
|
|
4423
4385
|
justifyContent: "center"
|
|
4424
4386
|
},
|
|
@@ -4429,11 +4391,11 @@ const styles$3 = reactNative.StyleSheet.create({
|
|
|
4429
4391
|
justifyContent: "center"
|
|
4430
4392
|
},
|
|
4431
4393
|
button: {
|
|
4432
|
-
height: verticalScale(40),
|
|
4394
|
+
height: stylehelper.verticalScale(40),
|
|
4433
4395
|
justifyContent: "center",
|
|
4434
4396
|
alignItems: "center",
|
|
4435
|
-
borderRadius: moderateScale(20),
|
|
4436
|
-
margin:
|
|
4397
|
+
borderRadius: stylehelper.moderateScale(20),
|
|
4398
|
+
margin: 4
|
|
4437
4399
|
},
|
|
4438
4400
|
buttonTextContainer: {
|
|
4439
4401
|
position: "absolute",
|
|
@@ -4442,7 +4404,8 @@ const styles$3 = reactNative.StyleSheet.create({
|
|
|
4442
4404
|
bottom: 0,
|
|
4443
4405
|
top: 0,
|
|
4444
4406
|
alignItems: "center",
|
|
4445
|
-
justifyContent: "center"
|
|
4407
|
+
justifyContent: "center",
|
|
4408
|
+
borderRadius: 25
|
|
4446
4409
|
}
|
|
4447
4410
|
});
|
|
4448
4411
|
|
|
@@ -4451,30 +4414,25 @@ const CustomSlideButton = React__default["default"].forwardRef(
|
|
|
4451
4414
|
({
|
|
4452
4415
|
label,
|
|
4453
4416
|
onComplete,
|
|
4417
|
+
onReset,
|
|
4454
4418
|
icon,
|
|
4455
4419
|
textStyle,
|
|
4456
4420
|
containerStyle,
|
|
4457
4421
|
sliderStyle,
|
|
4458
4422
|
size = BUTTON_WIDTH,
|
|
4459
|
-
|
|
4460
|
-
|
|
4423
|
+
sliderBackgroundColor = "#fff",
|
|
4424
|
+
sliderTextColor = "#000",
|
|
4425
|
+
resetTimer = 2e3
|
|
4461
4426
|
}, ref) => {
|
|
4462
4427
|
const value = React.useRef(0);
|
|
4463
4428
|
const cardRef = React.useRef(null);
|
|
4464
4429
|
const [translateX] = React.useState(new reactNative.Animated.Value(0));
|
|
4465
|
-
const
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
});
|
|
4430
|
+
const sliderConteinerRef = React.useRef(null);
|
|
4431
|
+
const [color, setColor] = React.useState(new reactNative.Animated.Value(0));
|
|
4432
|
+
const [sliderBackgroundColorRef, setSliderBackgroundColorRef] = React.useState(new reactNative.Animated.Value(0));
|
|
4469
4433
|
React__default["default"].useImperativeHandle(ref, () => ({
|
|
4470
4434
|
reset() {
|
|
4471
|
-
|
|
4472
|
-
toValue: 0,
|
|
4473
|
-
useNativeDriver: false
|
|
4474
|
-
}).start();
|
|
4475
|
-
slideTailCardRef?.current?.setNativeProps({
|
|
4476
|
-
style: { width: 0 }
|
|
4477
|
-
});
|
|
4435
|
+
resetAll();
|
|
4478
4436
|
}
|
|
4479
4437
|
}));
|
|
4480
4438
|
const handleLayout = (event) => {
|
|
@@ -4485,68 +4443,102 @@ const CustomSlideButton = React__default["default"].forwardRef(
|
|
|
4485
4443
|
// Change the width here
|
|
4486
4444
|
});
|
|
4487
4445
|
value.current = width;
|
|
4446
|
+
sliderConteinerRef?.current?.setNativeProps({
|
|
4447
|
+
style: { width }
|
|
4448
|
+
});
|
|
4488
4449
|
}
|
|
4489
4450
|
};
|
|
4451
|
+
const resetAll = () => {
|
|
4452
|
+
reactNative.Animated.timing(translateX, {
|
|
4453
|
+
toValue: 0,
|
|
4454
|
+
useNativeDriver: false
|
|
4455
|
+
}).start();
|
|
4456
|
+
reactNative.Animated.timing(sliderBackgroundColorRef, {
|
|
4457
|
+
toValue: 0,
|
|
4458
|
+
duration: 0,
|
|
4459
|
+
// no transition time, immediate change
|
|
4460
|
+
useNativeDriver: false
|
|
4461
|
+
// because we're animating the color, not layout
|
|
4462
|
+
}).start();
|
|
4463
|
+
reactNative.Animated.timing(color, {
|
|
4464
|
+
toValue: 0,
|
|
4465
|
+
delay: 300,
|
|
4466
|
+
// no transition time, immediate change
|
|
4467
|
+
useNativeDriver: false
|
|
4468
|
+
// because we're animating the color, not layout
|
|
4469
|
+
}).start();
|
|
4470
|
+
onReset?.();
|
|
4471
|
+
};
|
|
4490
4472
|
const panResponder = reactNative.PanResponder.create({
|
|
4491
4473
|
onMoveShouldSetPanResponder: (e, gestureState) => {
|
|
4492
4474
|
return gestureState.dx !== 0;
|
|
4493
4475
|
},
|
|
4494
4476
|
onPanResponderMove: (evt, gestureState) => {
|
|
4495
|
-
if (gestureState.dx > 0) {
|
|
4477
|
+
if (gestureState.dx > 0 && gestureState.dx <= value?.current - BUTTON_WIDTH - 8) {
|
|
4496
4478
|
translateX.setValue(gestureState.dx);
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
|
|
4479
|
+
let colorValue = gestureState.dx > value.current / 3 ? 1 : 0;
|
|
4480
|
+
reactNative.Animated.timing(color, {
|
|
4481
|
+
toValue: colorValue,
|
|
4482
|
+
duration: 0,
|
|
4483
|
+
// no transition time, immediate change
|
|
4484
|
+
useNativeDriver: false
|
|
4485
|
+
// because we're animating the color, not layout
|
|
4486
|
+
}).start();
|
|
4500
4487
|
}
|
|
4501
4488
|
},
|
|
4502
4489
|
onPanResponderRelease: (e, gestureState) => {
|
|
4503
|
-
if (gestureState.dx >= value.current * 0.
|
|
4490
|
+
if (gestureState.dx >= value.current * 0.8) {
|
|
4504
4491
|
reactNative.Animated.timing(translateX, {
|
|
4505
|
-
toValue: value
|
|
4492
|
+
toValue: value?.current - (BUTTON_WIDTH + 8),
|
|
4506
4493
|
// Slide to the end
|
|
4507
4494
|
duration: 300,
|
|
4508
4495
|
useNativeDriver: false
|
|
4509
|
-
}).start(
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
// Change the width here
|
|
4515
|
-
});
|
|
4516
|
-
} else {
|
|
4517
|
-
reactNative.Animated.spring(translateX, {
|
|
4518
|
-
toValue: 0,
|
|
4496
|
+
}).start();
|
|
4497
|
+
reactNative.Animated.timing(sliderBackgroundColorRef, {
|
|
4498
|
+
toValue: 1,
|
|
4499
|
+
duration: 0,
|
|
4500
|
+
// no transition time, immediate change
|
|
4519
4501
|
useNativeDriver: false
|
|
4502
|
+
// because we're animating the color, not layout
|
|
4520
4503
|
}).start();
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
|
|
4504
|
+
onComplete?.();
|
|
4505
|
+
setTimeout(() => {
|
|
4506
|
+
resetAll();
|
|
4507
|
+
}, resetTimer);
|
|
4508
|
+
} else {
|
|
4509
|
+
resetAll();
|
|
4524
4510
|
}
|
|
4525
4511
|
}
|
|
4526
4512
|
});
|
|
4513
|
+
const textColor = color.interpolate({
|
|
4514
|
+
inputRange: [0, 1],
|
|
4515
|
+
outputRange: [sliderTextColor, "transparent"]
|
|
4516
|
+
});
|
|
4517
|
+
const backgroundColor = sliderBackgroundColorRef.interpolate({
|
|
4518
|
+
inputRange: [0, 1],
|
|
4519
|
+
outputRange: [sliderBackgroundColor, "transparent"]
|
|
4520
|
+
});
|
|
4527
4521
|
const { theme } = useTheme();
|
|
4528
4522
|
return /* @__PURE__ */ React__default["default"].createElement(reactNative.View, { style: {
|
|
4529
4523
|
...styles$3.sliderContainer,
|
|
4530
4524
|
backgroundColor: theme.SURFACE_INVERTED,
|
|
4531
4525
|
...containerStyle
|
|
4532
|
-
}, onLayout: handleLayout, ref: cardRef },
|
|
4526
|
+
}, onLayout: handleLayout, ref: cardRef }, /* @__PURE__ */ React__default["default"].createElement(
|
|
4533
4527
|
reactNative.Animated.View,
|
|
4534
4528
|
{
|
|
4535
|
-
|
|
4536
|
-
|
|
4529
|
+
style: [styles$3.buttonTextContainer, { backgroundColor, transform: [{ translateX }] }],
|
|
4530
|
+
ref: sliderConteinerRef
|
|
4537
4531
|
}
|
|
4538
|
-
), /* @__PURE__ */ React__default["default"].createElement(
|
|
4539
|
-
|
|
4532
|
+
), /* @__PURE__ */ React__default["default"].createElement(
|
|
4533
|
+
reactNative.View,
|
|
4540
4534
|
{
|
|
4541
|
-
|
|
4542
|
-
|
|
4543
|
-
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
}
|
|
4549
|
-
)), /* @__PURE__ */ React__default["default"].createElement(
|
|
4535
|
+
style: styles$3.buttonTextContainer
|
|
4536
|
+
},
|
|
4537
|
+
/* @__PURE__ */ React__default["default"].createElement(reactNative.Animated.Text, { style: [{
|
|
4538
|
+
alignSelf: "center",
|
|
4539
|
+
...textStyle
|
|
4540
|
+
}, { color: textColor }] }, label)
|
|
4541
|
+
), /* @__PURE__ */ React__default["default"].createElement(
|
|
4550
4542
|
reactNative.Animated.View,
|
|
4551
4543
|
{
|
|
4552
4544
|
style: [styles$3.slider, { transform: [{ translateX }] }],
|