@zhenryx/react-native-components 0.0.2 → 0.0.3
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/dist/Dialog/Dialog.d.ts +0 -1
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +2 -2
- package/dist/Header/Header.d.ts.map +1 -1
- package/dist/Header/Header.js +5 -2
- package/dist/Overlay/Overlay.d.ts +3 -4
- package/dist/Overlay/Overlay.d.ts.map +1 -1
- package/dist/Overlay/Overlay.js +21 -42
- package/dist/Popup/Popup.d.ts +2 -3
- package/dist/Popup/Popup.d.ts.map +1 -1
- package/dist/Popup/Popup.js +67 -89
- package/package.json +5 -3
package/dist/Dialog/Dialog.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../src/components/Dialog/Dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAA+B,SAAS,EAAE,MAAM,cAAc,CAAC;AAItE,MAAM,WAAW,WAAW;IAC1B,
|
|
1
|
+
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../src/components/Dialog/Dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAA+B,SAAS,EAAE,MAAM,cAAc,CAAC;AAItE,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,OAAO,CAAA;IAChB,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC3B;AACD,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAkDxC,CAAC"}
|
package/dist/Dialog/Dialog.js
CHANGED
|
@@ -9,7 +9,7 @@ const react_native_1 = require("react-native");
|
|
|
9
9
|
const Text_1 = require("../Text/Text");
|
|
10
10
|
const ThemeConfig_1 = require("../ThemeConfig/ThemeConfig");
|
|
11
11
|
const Popup_1 = require("../Popup/Popup");
|
|
12
|
-
const Dialog = ({
|
|
12
|
+
const Dialog = ({ visible = false, type = "alert", title = "提示", content, titleStyle, contentStyle, closeOnOverlayPress = false, round = false, confirmText = "确认", cancelText = '取消', onConfirm = () => null, onCancel = () => null, children }) => {
|
|
13
13
|
const { theme } = (0, ThemeConfig_1.useTheme)();
|
|
14
14
|
const confirmTextColor = theme['$primary-color'] || '#e25829ff';
|
|
15
15
|
const paddingHorizontal = theme['$dialog-padding-horizontal'] || 20;
|
|
@@ -32,7 +32,7 @@ const Dialog = ({ useModal = true, visible = false, type = "alert", title = "提
|
|
|
32
32
|
<react_native_1.Pressable style={styles.dialog_footer_button_confirm} onPress={handleConfirm}><Text_1.Text style={[styles.dialog_footer_button_confirm_text, { color: confirmTextColor }]}>{confirmText}</Text_1.Text></react_native_1.Pressable>
|
|
33
33
|
</react_native_1.View>
|
|
34
34
|
</react_native_1.View>);
|
|
35
|
-
return (<Popup_1.Popup
|
|
35
|
+
return (<Popup_1.Popup visible={visible} closeable={false} closeOnOverlayPress={closeOnOverlayPress} onClose={handleClose} round={round}>
|
|
36
36
|
{renderDialog()}
|
|
37
37
|
</Popup_1.Popup>);
|
|
38
38
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Header.d.ts","sourceRoot":"","sources":["../../src/components/Header/Header.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAW,SAAS,EAAE,MAAM,OAAO,CAAA;AACjD,OAAO,EAAQ,SAAS,EAAE,SAAS,EAAE,SAAS,EAAgC,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"Header.d.ts","sourceRoot":"","sources":["../../src/components/Header/Header.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAW,SAAS,EAAE,MAAM,OAAO,CAAA;AACjD,OAAO,EAAQ,SAAS,EAAE,SAAS,EAAE,SAAS,EAAgC,MAAM,cAAc,CAAA;AAKlG,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,SAAS,CAAC;IAC1B,eAAe,CAAC,EAAE,SAAS,CAAC;IAC5B,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B,cAAc,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACtC,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAwDxC,CAAA"}
|
package/dist/Header/Header.js
CHANGED
|
@@ -26,18 +26,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
exports.Header = void 0;
|
|
27
27
|
const react_1 = __importStar(require("react"));
|
|
28
28
|
const react_native_1 = require("react-native");
|
|
29
|
+
const react_native_safe_area_context_1 = require("react-native-safe-area-context");
|
|
29
30
|
const Text_1 = require("../Text/Text");
|
|
30
31
|
const ThemeConfig_1 = require("../ThemeConfig/ThemeConfig");
|
|
31
32
|
const Header = ({ title = '自定义头部导航', backGroundColor, leftComponent, centerComponent, rightComponent, containerStyle, titleStyle: customTitleStyle, showBack = true, onBack }) => {
|
|
32
33
|
const { theme } = (0, ThemeConfig_1.useTheme)();
|
|
34
|
+
const insets = (0, react_native_safe_area_context_1.useSafeAreaInsets)();
|
|
33
35
|
const headerStyle = (0, react_1.useMemo)(() => ({
|
|
34
|
-
height: theme['$header-height'] || 44,
|
|
36
|
+
height: (theme['$header-height'] || 44) + insets.top,
|
|
37
|
+
paddingTop: insets.top,
|
|
35
38
|
backgroundColor: backGroundColor || theme['$header-background'] || 'transparent',
|
|
36
39
|
flexDirection: 'row',
|
|
37
40
|
justifyContent: 'space-between',
|
|
38
41
|
alignItems: 'center',
|
|
39
42
|
paddingHorizontal: theme['$header-spacing'] || 15,
|
|
40
|
-
}), [theme, backGroundColor]);
|
|
43
|
+
}), [theme, backGroundColor, insets.top]);
|
|
41
44
|
const defaultTitleStyle = (0, react_1.useMemo)(() => ({
|
|
42
45
|
fontSize: theme['$header-title-fontsize'] || 18,
|
|
43
46
|
fontWeight: theme['$header-title-fontweight'] || '500'
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { StyleProp, ViewStyle } from
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
3
|
export interface OverLayProps {
|
|
4
|
-
useModal?: boolean;
|
|
5
4
|
children?: React.ReactNode;
|
|
6
5
|
visible: boolean;
|
|
7
6
|
overlayStyle?: StyleProp<ViewStyle>;
|
|
8
|
-
onOverlayPress
|
|
7
|
+
onOverlayPress?: () => void;
|
|
9
8
|
}
|
|
10
9
|
export declare const OverLay: React.FC<OverLayProps>;
|
|
11
10
|
//# sourceMappingURL=Overlay.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Overlay.d.ts","sourceRoot":"","sources":["../../src/components/Overlay/Overlay.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"Overlay.d.ts","sourceRoot":"","sources":["../../src/components/Overlay/Overlay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAC3D,OAAO,EAKL,SAAS,EACT,SAAS,EAEV,MAAM,cAAc,CAAC;AAGtB,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACpC,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;CAC7B;AACD,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CA8C1C,CAAC"}
|
package/dist/Overlay/Overlay.js
CHANGED
|
@@ -25,68 +25,47 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.OverLay = void 0;
|
|
27
27
|
const react_1 = __importStar(require("react"));
|
|
28
|
-
const ThemeConfig_1 = require("../ThemeConfig/ThemeConfig");
|
|
29
28
|
const react_native_1 = require("react-native");
|
|
30
|
-
const
|
|
29
|
+
const ThemeConfig_1 = require("../ThemeConfig/ThemeConfig");
|
|
30
|
+
const OverLay = ({ children, visible, overlayStyle, onOverlayPress, }) => {
|
|
31
31
|
const { theme } = (0, ThemeConfig_1.useTheme)();
|
|
32
|
-
const [
|
|
33
|
-
const
|
|
34
|
-
const fadeInstance = (0, react_1.useRef)(null);
|
|
32
|
+
const [mounted, setMounted] = (0, react_1.useState)(visible);
|
|
33
|
+
const opacity = (0, react_1.useRef)(new react_native_1.Animated.Value(visible ? 1 : 0)).current;
|
|
35
34
|
(0, react_1.useEffect)(() => {
|
|
36
35
|
if (visible) {
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
if (fadeInstance.current) {
|
|
40
|
-
fadeInstance.current.stop();
|
|
36
|
+
setMounted(true);
|
|
41
37
|
}
|
|
42
|
-
|
|
38
|
+
react_native_1.Animated.timing(opacity, {
|
|
43
39
|
toValue: visible ? 1 : 0,
|
|
44
40
|
duration: 250,
|
|
41
|
+
easing: react_native_1.Easing.out(react_native_1.Easing.cubic),
|
|
45
42
|
useNativeDriver: true,
|
|
46
|
-
})
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
fadeInstance.current = null;
|
|
50
|
-
if (!visible) {
|
|
51
|
-
setRealVisible(false);
|
|
52
|
-
}
|
|
43
|
+
}).start(({ finished }) => {
|
|
44
|
+
if (finished && !visible) {
|
|
45
|
+
setMounted(false);
|
|
53
46
|
}
|
|
54
47
|
});
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
styles.container,
|
|
65
|
-
{ backgroundColor: dynamicBg, opacity: opacityAnim },
|
|
66
|
-
overlayStyle,
|
|
67
|
-
], [dynamicBg, opacityAnim, overlayStyle]);
|
|
68
|
-
const renderContent = () => (<react_native_1.Animated.View style={containerStyle}>
|
|
48
|
+
}, [visible, opacity]);
|
|
49
|
+
if (!mounted)
|
|
50
|
+
return null;
|
|
51
|
+
return (<react_native_1.Animated.View style={[
|
|
52
|
+
react_native_1.StyleSheet.absoluteFill,
|
|
53
|
+
{ backgroundColor: theme['$overlay-bg-color'] ?? 'rgba(0,0,0,0.35)' },
|
|
54
|
+
{ opacity },
|
|
55
|
+
overlayStyle,
|
|
56
|
+
]}>
|
|
69
57
|
{onOverlayPress && (<react_native_1.Pressable style={react_native_1.StyleSheet.absoluteFill} onPress={onOverlayPress}/>)}
|
|
70
58
|
<react_native_1.View style={styles.content} pointerEvents="box-none">
|
|
71
59
|
{children}
|
|
72
60
|
</react_native_1.View>
|
|
73
61
|
</react_native_1.Animated.View>);
|
|
74
|
-
if (useModal) {
|
|
75
|
-
return (<react_native_1.Modal visible={realVisible} transparent animationType='none' statusBarTranslucent onRequestClose={onOverlayPress}>
|
|
76
|
-
{renderContent()}
|
|
77
|
-
</react_native_1.Modal>);
|
|
78
|
-
}
|
|
79
|
-
return realVisible ? renderContent() : null;
|
|
80
62
|
};
|
|
81
63
|
exports.OverLay = OverLay;
|
|
64
|
+
exports.OverLay.displayName = 'OverLay';
|
|
82
65
|
const styles = react_native_1.StyleSheet.create({
|
|
83
|
-
container: {
|
|
84
|
-
...react_native_1.StyleSheet.absoluteFillObject,
|
|
85
|
-
},
|
|
86
66
|
content: {
|
|
87
67
|
flex: 1,
|
|
88
68
|
alignItems: 'center',
|
|
89
69
|
justifyContent: 'center',
|
|
90
|
-
}
|
|
70
|
+
},
|
|
91
71
|
});
|
|
92
|
-
exports.OverLay.displayName = 'OverLay';
|
package/dist/Popup/Popup.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { StyleProp, ViewStyle } from
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
3
|
export interface PopupProps {
|
|
4
|
-
useModal?: boolean;
|
|
5
4
|
visible?: boolean;
|
|
6
5
|
position?: 'bottom' | 'center' | 'top';
|
|
7
6
|
height?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popup.d.ts","sourceRoot":"","sources":["../../src/components/Popup/Popup.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"Popup.d.ts","sourceRoot":"","sources":["../../src/components/Popup/Popup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAC3D,OAAO,EAGL,SAAS,EACT,SAAS,EAGV,MAAM,cAAc,CAAC;AAGtB,MAAM,WAAW,UAAU;IACzB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,KAAK,CAAC;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,YAAY,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACpC,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CAuHtC,CAAC"}
|
package/dist/Popup/Popup.js
CHANGED
|
@@ -25,117 +25,95 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.Popup = void 0;
|
|
27
27
|
const react_1 = __importStar(require("react"));
|
|
28
|
-
const Overlay_1 = require("../Overlay/Overlay");
|
|
29
28
|
const react_native_1 = require("react-native");
|
|
29
|
+
const Overlay_1 = require("../Overlay/Overlay");
|
|
30
30
|
const ThemeConfig_1 = require("../ThemeConfig/ThemeConfig");
|
|
31
|
-
const
|
|
32
|
-
const Popup = (
|
|
33
|
-
const { useModal = true, visible = false, position = 'center', height, width, round = false, closeable = false, closeOnOverlayPress = false, overlayStyle, style, children, onClose, } = props;
|
|
31
|
+
const DURATION = 250;
|
|
32
|
+
const Popup = ({ visible = false, position = 'center', height, width, round = false, closeable = false, closeOnOverlayPress = false, overlayStyle, style, children, onClose, }) => {
|
|
34
33
|
const { theme } = (0, ThemeConfig_1.useTheme)();
|
|
35
34
|
const radius = theme['$popup-border-radius'] ?? 10;
|
|
36
35
|
const minHeight = theme['$popup-height'] ?? 100;
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const
|
|
36
|
+
const centerRadius = theme['$popup-center-border-radius'] ?? 10;
|
|
37
|
+
const closeIconSize = {
|
|
38
|
+
width: theme['$popup-closeicon-width'] ?? 12,
|
|
39
|
+
height: theme['$popup-closeicon-height'] ?? 12,
|
|
40
|
+
};
|
|
41
|
+
const progress = (0, react_1.useRef)(new react_native_1.Animated.Value(visible ? 1 : 0)).current;
|
|
42
|
+
const [mounted, setMounted] = (0, react_1.useState)(visible);
|
|
43
43
|
(0, react_1.useEffect)(() => {
|
|
44
|
-
if (visible)
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
if (fadeInstance.current) {
|
|
48
|
-
fadeInstance.current.stop();
|
|
49
|
-
}
|
|
50
|
-
fadeInstance.current = react_native_1.Animated.timing(animatedValue, {
|
|
44
|
+
if (visible)
|
|
45
|
+
setMounted(true);
|
|
46
|
+
react_native_1.Animated.timing(progress, {
|
|
51
47
|
toValue: visible ? 1 : 0,
|
|
52
|
-
duration:
|
|
53
|
-
easing: visible
|
|
48
|
+
duration: DURATION,
|
|
49
|
+
easing: visible
|
|
50
|
+
? react_native_1.Easing.out(react_native_1.Easing.cubic)
|
|
51
|
+
: react_native_1.Easing.in(react_native_1.Easing.cubic),
|
|
54
52
|
useNativeDriver: true,
|
|
55
|
-
})
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
fadeInstance.current = null;
|
|
59
|
-
if (!visible) {
|
|
60
|
-
setRealVisible(false);
|
|
61
|
-
}
|
|
53
|
+
}).start(({ finished }) => {
|
|
54
|
+
if (finished && !visible) {
|
|
55
|
+
setMounted(false);
|
|
62
56
|
}
|
|
63
57
|
});
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
58
|
+
}, [visible, progress]);
|
|
59
|
+
if (!mounted)
|
|
60
|
+
return null;
|
|
61
|
+
const baseStyle = {
|
|
62
|
+
backgroundColor: '#fff',
|
|
63
|
+
...(height ? { height } : { minHeight }),
|
|
64
|
+
width: position === 'center'
|
|
65
|
+
? (width ?? 300)
|
|
66
|
+
: '100%',
|
|
67
|
+
};
|
|
68
|
+
if (position !== 'center') {
|
|
69
|
+
//上弹出层or下弹出层
|
|
70
|
+
Object.assign(baseStyle, {
|
|
71
|
+
position: 'absolute',
|
|
72
|
+
left: 0,
|
|
73
|
+
right: 0,
|
|
74
|
+
...(position === 'bottom' ? { bottom: 0 } : { top: 0 }),
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
if (round) {
|
|
78
|
+
if (position === 'center') {
|
|
79
|
+
baseStyle.borderRadius = centerRadius;
|
|
87
80
|
}
|
|
88
|
-
if (
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
else if (position === 'bottom') {
|
|
93
|
-
base.borderTopLeftRadius = radius;
|
|
94
|
-
base.borderTopRightRadius = radius;
|
|
95
|
-
}
|
|
96
|
-
else {
|
|
97
|
-
base.borderBottomLeftRadius = radius;
|
|
98
|
-
base.borderBottomRightRadius = radius;
|
|
99
|
-
}
|
|
81
|
+
else if (position === 'bottom') {
|
|
82
|
+
baseStyle.borderTopLeftRadius = radius;
|
|
83
|
+
baseStyle.borderTopRightRadius = radius;
|
|
100
84
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
if (position === 'center') {
|
|
105
|
-
return {
|
|
106
|
-
opacity: animatedValue
|
|
107
|
-
};
|
|
85
|
+
else {
|
|
86
|
+
baseStyle.borderBottomLeftRadius = radius;
|
|
87
|
+
baseStyle.borderBottomRightRadius = radius;
|
|
108
88
|
}
|
|
109
|
-
|
|
110
|
-
|
|
89
|
+
}
|
|
90
|
+
const animatedStyle = position === 'center'
|
|
91
|
+
? { opacity: progress }
|
|
92
|
+
: {
|
|
111
93
|
transform: [
|
|
112
94
|
{
|
|
113
|
-
translateY:
|
|
95
|
+
translateY: progress.interpolate({
|
|
114
96
|
inputRange: [0, 1],
|
|
115
|
-
outputRange:
|
|
97
|
+
outputRange: [
|
|
98
|
+
position === 'bottom'
|
|
99
|
+
? height ?? minHeight
|
|
100
|
+
: -(height ?? minHeight),
|
|
101
|
+
0,
|
|
102
|
+
],
|
|
116
103
|
}),
|
|
117
104
|
},
|
|
118
105
|
],
|
|
119
106
|
};
|
|
120
|
-
}
|
|
121
|
-
const closeIconStyle = (0, react_1.useMemo)(() => ({
|
|
122
|
-
width: closeIconWidth,
|
|
123
|
-
height: closeIconHeight,
|
|
124
|
-
}), [closeIconWidth, closeIconHeight]);
|
|
125
|
-
const closeButtonPressableStyle = (0, react_1.useMemo)(() => ({
|
|
126
|
-
position: 'absolute',
|
|
127
|
-
right: 10,
|
|
128
|
-
[position === 'top' ? 'bottom' : 'top']: 10,
|
|
129
|
-
zIndex: 999,
|
|
130
|
-
}), [position]);
|
|
131
|
-
if (!realVisible) {
|
|
132
|
-
return null;
|
|
133
|
-
}
|
|
134
|
-
return (<Overlay_1.OverLay useModal={useModal} visible={realVisible} overlayStyle={overlayStyle} onOverlayPress={closeOnOverlayPress ? onClose : undefined}>
|
|
107
|
+
return (<Overlay_1.OverLay visible={mounted} overlayStyle={overlayStyle} onOverlayPress={closeOnOverlayPress ? onClose : undefined}>
|
|
135
108
|
<react_native_1.Animated.View style={[baseStyle, animatedStyle, style]}>
|
|
136
109
|
{children}
|
|
137
|
-
|
|
138
|
-
|
|
110
|
+
|
|
111
|
+
{closeable && (<react_native_1.Pressable hitSlop={15} onPress={onClose} style={{
|
|
112
|
+
position: 'absolute',
|
|
113
|
+
right: 10,
|
|
114
|
+
[position === 'top' ? 'bottom' : 'top']: 10,
|
|
115
|
+
}}>
|
|
116
|
+
<react_native_1.Image source={require('./assets/icon-close.png')} style={closeIconSize}/>
|
|
139
117
|
</react_native_1.Pressable>)}
|
|
140
118
|
</react_native_1.Animated.View>
|
|
141
119
|
</Overlay_1.OverLay>);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zhenryx/react-native-components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -27,10 +27,12 @@
|
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/react": "18.2.0",
|
|
29
29
|
"@types/react-native": "0.70.0",
|
|
30
|
-
"typescript": "5.0.4"
|
|
30
|
+
"typescript": "5.0.4",
|
|
31
|
+
"react-native-safe-area-context": "^4.8.0"
|
|
31
32
|
},
|
|
32
33
|
"peerDependencies": {
|
|
33
34
|
"react": ">=18.1.0",
|
|
34
|
-
"react-native": ">=0.70.0"
|
|
35
|
+
"react-native": ">=0.70.0",
|
|
36
|
+
"react-native-safe-area-context": ">=4.0.0"
|
|
35
37
|
}
|
|
36
38
|
}
|