@codeleap/mobile 4.2.1 → 4.2.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/components/Backdrop/index.js +10 -15
- package/dist/components/Backdrop/index.js.map +1 -1
- package/dist/components/Backdrop/types.d.ts +3 -0
- package/dist/components/Modal/index.js +13 -9
- package/dist/components/Modal/index.js.map +1 -1
- package/dist/components/Modal/types.d.ts +3 -0
- package/dist/components/View/index.d.ts +2 -0
- package/dist/components/View/index.js +3 -0
- package/dist/components/View/index.js.map +1 -1
- package/dist/types/utility.d.ts +3 -1
- package/dist/utils/index.js.map +1 -1
- package/package.json +5 -5
- package/package.json.bak +1 -1
- package/src/components/Backdrop/index.tsx +16 -18
- package/src/components/Backdrop/types.ts +3 -0
- package/src/components/Modal/index.tsx +28 -18
- package/src/components/Modal/types.ts +3 -0
- package/src/components/View/index.tsx +4 -0
- package/src/types/utility.ts +6 -3
- package/src/utils/index.ts +1 -0
|
@@ -43,32 +43,24 @@ exports.Backdrop = void 0;
|
|
|
43
43
|
var react_1 = __importDefault(require("react"));
|
|
44
44
|
var Touchable_1 = require("../Touchable");
|
|
45
45
|
var View_1 = require("../View");
|
|
46
|
-
var utils_1 = require("../../utils");
|
|
47
46
|
var Registry_1 = require("../../Registry");
|
|
48
47
|
var hooks_1 = require("../../hooks");
|
|
48
|
+
var react_native_reanimated_1 = require("react-native-reanimated");
|
|
49
49
|
__exportStar(require("./styles"), exports);
|
|
50
50
|
__exportStar(require("./types"), exports);
|
|
51
51
|
var Backdrop = function (props) {
|
|
52
|
-
var _a = __assign(__assign({}, exports.Backdrop.defaultProps), props), visible = _a.visible, children = _a.children, _b = _a.wrapperProps, wrapperProps = _b === void 0 ? {} : _b, style = _a.style, rest = __rest(_a, ["visible", "children", "wrapperProps", "style"]);
|
|
52
|
+
var _a = __assign(__assign({}, exports.Backdrop.defaultProps), props), visible = _a.visible, children = _a.children, _b = _a.wrapperProps, wrapperProps = _b === void 0 ? {} : _b, style = _a.style, entering = _a.entering, exiting = _a.exiting, rest = __rest(_a, ["visible", "children", "wrapperProps", "style", "entering", "exiting"]);
|
|
53
53
|
var styles = (0, hooks_1.useStylesFor)(exports.Backdrop.styleRegistryName, style);
|
|
54
|
-
var animation = (0, utils_1.useAnimatedVariantStyles)({
|
|
55
|
-
variantStyles: styles,
|
|
56
|
-
animatedProperties: ['wrapper:hidden', 'wrapper:visible'],
|
|
57
|
-
updater: function (s) {
|
|
58
|
-
'worklet';
|
|
59
|
-
return visible ? s['wrapper:visible'] : s['wrapper:hidden'];
|
|
60
|
-
},
|
|
61
|
-
dependencies: [visible],
|
|
62
|
-
transition: styles.transition,
|
|
63
|
-
});
|
|
64
54
|
var isPressable = !!(props === null || props === void 0 ? void 0 : props.onPress);
|
|
65
|
-
|
|
55
|
+
if (!visible)
|
|
56
|
+
return null;
|
|
57
|
+
return (<View_1.View.Animated pointerEvents={visible ? 'auto' : 'none'} entering={entering} exiting={exiting} {...wrapperProps} style={styles.wrapper}>
|
|
66
58
|
{isPressable
|
|
67
59
|
? <Touchable_1.Touchable {...rest} style={styles.touchable} noFeedback android_ripple={null}/>
|
|
68
60
|
: null}
|
|
69
61
|
|
|
70
62
|
{children}
|
|
71
|
-
</View_1.View>);
|
|
63
|
+
</View_1.View.Animated>);
|
|
72
64
|
};
|
|
73
65
|
exports.Backdrop = Backdrop;
|
|
74
66
|
exports.Backdrop.styleRegistryName = 'Backdrop';
|
|
@@ -77,6 +69,9 @@ exports.Backdrop.rootElement = 'wrapper';
|
|
|
77
69
|
exports.Backdrop.withVariantTypes = function (styles) {
|
|
78
70
|
return exports.Backdrop;
|
|
79
71
|
};
|
|
80
|
-
exports.Backdrop.defaultProps = {
|
|
72
|
+
exports.Backdrop.defaultProps = {
|
|
73
|
+
entering: react_native_reanimated_1.FadeIn.build(),
|
|
74
|
+
exiting: react_native_reanimated_1.FadeOut.build(),
|
|
75
|
+
};
|
|
81
76
|
Registry_1.MobileStyleRegistry.registerComponent(exports.Backdrop);
|
|
82
77
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Backdrop/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAyB;AACzB,0CAAwC;AACxC,gCAA8B;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Backdrop/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAyB;AACzB,0CAAwC;AACxC,gCAA8B;AAI9B,2CAAoD;AACpD,qCAA0C;AAC1C,mEAAyD;AAEzD,2CAAwB;AACxB,0CAAuB;AAEhB,IAAM,QAAQ,GAAG,UAAC,KAAoB;IAC3C,IAAM,2BASD,gBAAQ,CAAC,YAAY,GACrB,KAAK,CACT,EAVC,OAAO,aAAA,EACP,QAAQ,cAAA,EACR,oBAAiB,EAAjB,YAAY,mBAAG,EAAE,KAAA,EACjB,KAAK,WAAA,EACL,QAAQ,cAAA,EACR,OAAO,aAAA,EACJ,IAAI,cAPH,uEAQL,CAGA,CAAA;IAED,IAAM,MAAM,GAAG,IAAA,oBAAY,EAAC,gBAAQ,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAA;IAE9D,IAAM,WAAW,GAAG,CAAC,CAAC,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,OAAO,CAAA,CAAA;IAEpC,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAA;IAEzB,OAAO,CACL,CAAC,WAAI,CAAC,QAAQ,CACZ,aAAa,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAEzC,QAAQ,CAAC,CAAC,QAAQ,CAAC,CACnB,OAAO,CAAC,CAAC,OAAO,CAAC,CACjB,IAAI,YAAY,CAAC,CACjB,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAGtB;MAAA,CAAC,WAAW;YACV,CAAC,CAAC,CAAC,qBAAS,CAAC,IAAI,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,EAAG;YACnF,CAAC,CAAC,IAAI,CAER;;MAAA,CAAC,QAAQ,CACX;IAAA,EAAE,WAAI,CAAC,QAAQ,CAAC,CACjB,CAAA;AACH,CAAC,CAAA;AArCY,QAAA,QAAQ,YAqCpB;AAED,gBAAQ,CAAC,iBAAiB,GAAG,UAAU,CAAA;AACvC,gBAAQ,CAAC,QAAQ,GAAG,CAAC,SAAS,EAAE,WAAW,EAAE,YAAY,CAAC,CAAA;AAC1D,gBAAQ,CAAC,WAAW,GAAG,SAAS,CAAA;AAEhC,gBAAQ,CAAC,gBAAgB,GAAG,UAAsB,MAAS;IACzD,OAAO,gBAA+E,CAAA;AACxF,CAAC,CAAA;AAED,gBAAQ,CAAC,YAAY,GAAG;IACtB,QAAQ,EAAE,gCAAM,CAAC,KAAK,EAAE;IACxB,OAAO,EAAE,iCAAO,CAAC,KAAK,EAAE;CACC,CAAA;AAE3B,8BAAmB,CAAC,iBAAiB,CAAC,gBAAQ,CAAC,CAAA"}
|
|
@@ -3,9 +3,12 @@ import { ReactNode } from 'react';
|
|
|
3
3
|
import { TouchableProps } from '../Touchable';
|
|
4
4
|
import { ViewProps } from '../View/types';
|
|
5
5
|
import { BackdropComposition } from './styles';
|
|
6
|
+
import { ReanimatedEnteringAnimation, ReanimatedExitingAnimation } from '../../types';
|
|
6
7
|
export type BackdropProps = Omit<TouchableProps, 'style'> & {
|
|
7
8
|
children?: ReactNode;
|
|
8
9
|
visible: boolean;
|
|
9
10
|
wrapperProps?: ViewProps;
|
|
10
11
|
style?: StyledProp<BackdropComposition>;
|
|
12
|
+
exiting?: ReanimatedExitingAnimation;
|
|
13
|
+
entering?: ReanimatedEnteringAnimation;
|
|
11
14
|
};
|
|
@@ -53,6 +53,7 @@ var react_2 = require("react");
|
|
|
53
53
|
var styles_1 = require("@codeleap/styles");
|
|
54
54
|
var Registry_1 = require("../../Registry");
|
|
55
55
|
var hooks_2 = require("../../hooks");
|
|
56
|
+
var react_native_reanimated_1 = require("react-native-reanimated");
|
|
56
57
|
__exportStar(require("./styles"), exports);
|
|
57
58
|
__exportStar(require("./types"), exports);
|
|
58
59
|
var DefaultHeader = function (props) {
|
|
@@ -71,7 +72,7 @@ var DefaultHeader = function (props) {
|
|
|
71
72
|
};
|
|
72
73
|
var Modal = function (modalProps) {
|
|
73
74
|
var _a;
|
|
74
|
-
var _b = __assign(__assign({}, exports.Modal.defaultProps), modalProps), visible = _b.visible, closable = _b.closable, footer = _b.footer, children = _b.children, _c = _b.toggle, toggle = _c === void 0 ? function () { return null; } : _c, dismissOnBackdrop = _b.dismissOnBackdrop, _d = _b.header, header = _d === void 0 ? null : _d, debugName = _b.debugName, scroll = _b.scroll, renderHeader = _b.renderHeader, _e = _b.zIndex, zIndex = _e === void 0 ? null : _e, _f = _b.scrollProps, scrollProps = _f === void 0 ? {} : _f, closeOnHardwareBackPress = _b.closeOnHardwareBackPress, style = _b.style, props = __rest(_b, ["visible", "closable", "footer", "children", "toggle", "dismissOnBackdrop", "header", "debugName", "scroll", "renderHeader", "zIndex", "scrollProps", "closeOnHardwareBackPress", "style"]);
|
|
75
|
+
var _b = __assign(__assign({}, exports.Modal.defaultProps), modalProps), visible = _b.visible, closable = _b.closable, footer = _b.footer, children = _b.children, _c = _b.toggle, toggle = _c === void 0 ? function () { return null; } : _c, dismissOnBackdrop = _b.dismissOnBackdrop, _d = _b.header, header = _d === void 0 ? null : _d, debugName = _b.debugName, scroll = _b.scroll, renderHeader = _b.renderHeader, _e = _b.zIndex, zIndex = _e === void 0 ? null : _e, _f = _b.scrollProps, scrollProps = _f === void 0 ? {} : _f, closeOnHardwareBackPress = _b.closeOnHardwareBackPress, style = _b.style, boxExiting = _b.boxExiting, boxEntering = _b.boxEntering, props = __rest(_b, ["visible", "closable", "footer", "children", "toggle", "dismissOnBackdrop", "header", "debugName", "scroll", "renderHeader", "zIndex", "scrollProps", "closeOnHardwareBackPress", "style", "boxExiting", "boxEntering"]);
|
|
75
76
|
var themeValues = (0, styles_1.useTheme)(function (store) { var _a; return (_a = store.current) === null || _a === void 0 ? void 0 : _a.values; });
|
|
76
77
|
var _g = (0, react_2.useState)(0), modalHeight = _g[0], setModalHeight = _g[1];
|
|
77
78
|
var styles = (0, hooks_2.useStylesFor)(exports.Modal.styleRegistryName, style);
|
|
@@ -106,7 +107,7 @@ var Modal = function (modalProps) {
|
|
|
106
107
|
};
|
|
107
108
|
return (<View_1.View style={[
|
|
108
109
|
styles === null || styles === void 0 ? void 0 : styles.wrapper,
|
|
109
|
-
__assign({ zIndex: common_1.TypeGuards.isNumber(zIndex) ? zIndex : (_a = styles === null || styles === void 0 ? void 0 : styles.wrapper) === null || _a === void 0 ? void 0 : _a.zIndex }, topSpacing)
|
|
110
|
+
__assign({ zIndex: common_1.TypeGuards.isNumber(zIndex) ? zIndex : (_a = styles === null || styles === void 0 ? void 0 : styles.wrapper) === null || _a === void 0 ? void 0 : _a.zIndex }, topSpacing),
|
|
110
111
|
]} pointerEvents={visible ? 'auto' : 'none'}>
|
|
111
112
|
<Backdrop_1.Backdrop visible={visible} debugName={"Modal ".concat(debugName, " backdrop")} style={{
|
|
112
113
|
'wrapper:hidden': styles['backdrop:hidden'],
|
|
@@ -119,16 +120,17 @@ var Modal = function (modalProps) {
|
|
|
119
120
|
|
|
120
121
|
<ScrollComponent contentContainerStyle={styles === null || styles === void 0 ? void 0 : styles.scrollContent} showsVerticalScrollIndicator={false} keyboardAware animated {...scrollProps} style={scrollStyle}>
|
|
121
122
|
{dismissOnBackdrop ? (<Touchable_1.Touchable onPress={closable && visible ? toggle : (function () { })} debounce={400} debugName={'Modal backdrop touchable'} style={styles === null || styles === void 0 ? void 0 : styles.backdropTouchable} android_ripple={null} noFeedback/>) : null}
|
|
123
|
+
{visible ? (<View_1.View animated
|
|
124
|
+
// @ts-ignore
|
|
125
|
+
entering={boxEntering} exiting={boxExiting} {...props} onLayout={onModalLayout} style={styles === null || styles === void 0 ? void 0 : styles.box}>
|
|
126
|
+
{header ? header : <Header {...headerProps}/>}
|
|
122
127
|
|
|
123
|
-
|
|
124
|
-
{header ? header : <Header {...headerProps}/>}
|
|
128
|
+
<View_1.View style={styles === null || styles === void 0 ? void 0 : styles.body}>{children}</View_1.View>
|
|
125
129
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
{typeof footer === 'string' ? <Text_1.Text text={footer}/> : footer}
|
|
130
|
+
{footer ? (<View_1.View style={styles === null || styles === void 0 ? void 0 : styles.footer}>
|
|
131
|
+
{typeof footer === 'string' ? <Text_1.Text text={footer}/> : footer}
|
|
132
|
+
</View_1.View>) : null}
|
|
130
133
|
</View_1.View>) : null}
|
|
131
|
-
</View_1.View>
|
|
132
134
|
</ScrollComponent>
|
|
133
135
|
</View_1.View>);
|
|
134
136
|
};
|
|
@@ -145,6 +147,8 @@ exports.Modal.defaultProps = {
|
|
|
145
147
|
dismissOnBackdrop: true,
|
|
146
148
|
scroll: true,
|
|
147
149
|
closeOnHardwareBackPress: true,
|
|
150
|
+
boxEntering: react_native_reanimated_1.SlideInDown.build(),
|
|
151
|
+
boxExiting: react_native_reanimated_1.SlideOutDown.build(),
|
|
148
152
|
};
|
|
149
153
|
Registry_1.MobileStyleRegistry.registerComponent(exports.Modal);
|
|
150
154
|
exports.default = exports.Modal;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Modal/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAyB;AACzB,gCAA8B;AAC9B,oCAAkC;AAClC,2CAA6C;AAC7C,wCAAsC;A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CAAA;AAExB,8BAAmB,CAAC,iBAAiB,CAAC,aAAK,CAAC,CAAA;AAE5C,kBAAe,aAAK,CAAA"}
|
|
@@ -5,6 +5,7 @@ import { ButtonProps } from '../Button';
|
|
|
5
5
|
import { Scroll } from '../Scroll';
|
|
6
6
|
import { ViewProps } from '../View';
|
|
7
7
|
import { ModalComposition } from './styles';
|
|
8
|
+
import { ReanimatedEnteringAnimation, ReanimatedExitingAnimation } from '../../types';
|
|
8
9
|
export type ModalProps = Omit<ViewProps, 'style'> & {
|
|
9
10
|
dismissOnBackdrop?: boolean;
|
|
10
11
|
buttonProps?: ButtonProps;
|
|
@@ -28,6 +29,8 @@ export type ModalProps = Omit<ViewProps, 'style'> & {
|
|
|
28
29
|
style?: StyledProp<ModalComposition>;
|
|
29
30
|
id?: string;
|
|
30
31
|
absolute?: boolean;
|
|
32
|
+
boxEntering?: ReanimatedEnteringAnimation;
|
|
33
|
+
boxExiting?: ReanimatedExitingAnimation;
|
|
31
34
|
};
|
|
32
35
|
export type ModalHeaderProps = Omit<ModalProps, 'renderHeader'> & {
|
|
33
36
|
styles: Record<ModalComposition, ICSS>;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { View as RNView } from 'react-native';
|
|
3
3
|
import { AnyRecord, IJSX, StyledComponentProps } from '@codeleap/styles';
|
|
4
|
+
import Animated from 'react-native-reanimated';
|
|
4
5
|
import { ViewProps } from './types';
|
|
5
6
|
export * from './types';
|
|
6
7
|
export * from './styles';
|
|
7
8
|
export declare const View: {
|
|
8
9
|
<T extends React.ComponentType<{}> = typeof RNView>(props: ViewProps<T>): JSX.Element;
|
|
10
|
+
Animated(props: ViewProps<typeof Animated.View>): JSX.Element;
|
|
9
11
|
styleRegistryName: string;
|
|
10
12
|
elements: string[];
|
|
11
13
|
rootElement: string;
|
|
@@ -43,6 +43,9 @@ var View = function (props) {
|
|
|
43
43
|
return (<Component {...viewProps} style={[styles.wrapper, animatedStyle]}/>);
|
|
44
44
|
};
|
|
45
45
|
exports.View = View;
|
|
46
|
+
exports.View.Animated = function (props) {
|
|
47
|
+
return <exports.View {...props} animated/>;
|
|
48
|
+
};
|
|
46
49
|
exports.View.styleRegistryName = 'View';
|
|
47
50
|
exports.View.elements = ['wrapper'];
|
|
48
51
|
exports.View.rootElement = 'wrapper';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/View/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAyB;AACzB,6CAA6C;AAE7C,2CAAoD;AACpD,oFAA8C;AAE9C,qCAA0C;AAE1C,0CAAuB;AACvB,2CAAwB;AAEjB,IAAM,IAAI,GAAG,UAAgD,KAAmB;IAEnF,IAAA,KAAK,GAKH,KAAK,MALF,EACL,KAIE,KAAK,UAJuB,EAAnB,UAAU,mBAAG,mBAAM,KAAA,EAC9B,KAGE,KAAK,SAHS,EAAhB,QAAQ,mBAAG,KAAK,KAAA,EAChB,aAAa,GAEX,KAAK,cAFM,EACV,SAAS,UACV,KAAK,EANH,mDAML,CADa,CACL;IAET,IAAM,MAAM,GAAG,IAAA,oBAAY,EAAC,YAAI,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAA;IAE1D,IAAM,SAAS,GAAmC,QAAQ,CAAC,CAAC,CAAC,iCAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAA;IAEvF,OAAO,CACL,CAAC,SAAS,CAAC,IAAI,SAAS,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC,EAAG,CACrE,CAAA;AACH,CAAC,CAAA;AAhBY,QAAA,IAAI,QAgBhB;AAED,YAAI,CAAC,iBAAiB,GAAG,MAAM,CAAA;AAC/B,YAAI,CAAC,QAAQ,GAAG,CAAC,SAAS,CAAC,CAAA;AAC3B,YAAI,CAAC,WAAW,GAAG,SAAS,C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CAAC,CAAA;AAC3B,YAAI,CAAC,WAAW,GAAG,SAAS,CAAA;AAE5B,YAAI,CAAC,gBAAgB,GAAG,UAAsB,MAAS;IACrD,OAAO,YAA2H,CAAA;AACpI,CAAC,CAAA;AAED,8BAAmB,CAAC,iBAAiB,CAAC,YAAI,CAAC,CAAA"}
|
package/dist/types/utility.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { StyleProp } from 'react-native';
|
|
3
|
-
import { EasingFn } from 'react-native-reanimated';
|
|
3
|
+
import { EasingFn, EntryAnimationsValues, ExitAnimationsValues, LayoutAnimation } from 'react-native-reanimated';
|
|
4
4
|
export type StylesOf<C extends string> = Partial<Record<C, StyleProp<any>>>;
|
|
5
5
|
type TransitionBase = {
|
|
6
6
|
easing?: EasingFn;
|
|
@@ -11,4 +11,6 @@ export type TransitionConfig = TransitionBase | {
|
|
|
11
11
|
[p: string]: TransitionBase;
|
|
12
12
|
};
|
|
13
13
|
export type ChildrenProp = ReactNode | ReactNode[] | undefined;
|
|
14
|
+
export type ReanimatedExitingAnimation = (values: ExitAnimationsValues) => LayoutAnimation;
|
|
15
|
+
export type ReanimatedEnteringAnimation = (values: EntryAnimationsValues) => LayoutAnimation;
|
|
14
16
|
export {};
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAAyB;AACzB,0CAAuB;AACvB,yCAAsB;AACtB,wDAAqC;AACrC,iDAA8B;AAC9B,+DAAkD;AAEzC,kCAAW;AACpB,kDAA+B;AAC/B,0CAAuB;AACvB,0CAAuB;AACvB,2CAAwB;AACxB,iDAA8B;AAC9B,wDAAqC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAAyB;AACzB,0CAAuB;AACvB,yCAAsB;AACtB,wDAAqC;AACrC,iDAA8B;AAC9B,+DAAkD;AAEzC,kCAAW;AACpB,kDAA+B;AAC/B,0CAAuB;AACvB,0CAAuB;AACvB,2CAAwB;AACxB,iDAA8B;AAC9B,wDAAqC;AAErC,mDAAgC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codeleap/mobile",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.3",
|
|
4
4
|
"main": "src/index.ts",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
|
@@ -9,16 +9,16 @@
|
|
|
9
9
|
"directory": "packages/mobile"
|
|
10
10
|
},
|
|
11
11
|
"devDependencies": {
|
|
12
|
-
"@codeleap/common": "4.2.
|
|
13
|
-
"@codeleap/config": "4.2.
|
|
12
|
+
"@codeleap/common": "4.2.3",
|
|
13
|
+
"@codeleap/config": "4.2.3"
|
|
14
14
|
},
|
|
15
15
|
"scripts": {
|
|
16
16
|
"build": "tsc --build",
|
|
17
17
|
"lint": "eslint -c .eslintrc.js --fix \"./src/**/*.{ts,tsx,js,jsx}\""
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
|
-
"@codeleap/common": "4.2.
|
|
21
|
-
"@codeleap/styles": "4.2.
|
|
20
|
+
"@codeleap/common": "4.2.3",
|
|
21
|
+
"@codeleap/styles": "4.2.3",
|
|
22
22
|
"@d11/react-native-fast-image": "8.8.0",
|
|
23
23
|
"@react-native-firebase/messaging": "14.4.0",
|
|
24
24
|
"@react-navigation/bottom-tabs": "6.5.3",
|
package/package.json.bak
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { Touchable } from '../Touchable'
|
|
3
3
|
import { View } from '../View'
|
|
4
|
-
import {
|
|
4
|
+
import { } from '../../utils'
|
|
5
5
|
import { BackdropProps } from './types'
|
|
6
6
|
import { AnyRecord, IJSX, StyledComponentProps } from '@codeleap/styles'
|
|
7
7
|
import { MobileStyleRegistry } from '../../Registry'
|
|
8
8
|
import { useStylesFor } from '../../hooks'
|
|
9
|
+
import { FadeIn, FadeOut } from 'react-native-reanimated'
|
|
9
10
|
|
|
10
11
|
export * from './styles'
|
|
11
12
|
export * from './types'
|
|
@@ -16,6 +17,8 @@ export const Backdrop = (props: BackdropProps) => {
|
|
|
16
17
|
children,
|
|
17
18
|
wrapperProps = {},
|
|
18
19
|
style,
|
|
20
|
+
entering,
|
|
21
|
+
exiting,
|
|
19
22
|
...rest
|
|
20
23
|
} = {
|
|
21
24
|
...Backdrop.defaultProps,
|
|
@@ -24,37 +27,29 @@ export const Backdrop = (props: BackdropProps) => {
|
|
|
24
27
|
|
|
25
28
|
const styles = useStylesFor(Backdrop.styleRegistryName, style)
|
|
26
29
|
|
|
27
|
-
const animation = useAnimatedVariantStyles({
|
|
28
|
-
variantStyles: styles,
|
|
29
|
-
animatedProperties: ['wrapper:hidden', 'wrapper:visible'],
|
|
30
|
-
updater: (s) => {
|
|
31
|
-
'worklet'
|
|
32
|
-
return visible ? s['wrapper:visible'] : s['wrapper:hidden']
|
|
33
|
-
},
|
|
34
|
-
dependencies: [visible],
|
|
35
|
-
transition: styles.transition,
|
|
36
|
-
})
|
|
37
|
-
|
|
38
30
|
const isPressable = !!props?.onPress
|
|
39
31
|
|
|
32
|
+
if (!visible) return null
|
|
33
|
+
|
|
40
34
|
return (
|
|
41
|
-
<View
|
|
42
|
-
animated
|
|
35
|
+
<View.Animated
|
|
43
36
|
pointerEvents={visible ? 'auto' : 'none'}
|
|
44
|
-
|
|
37
|
+
|
|
38
|
+
entering={entering}
|
|
39
|
+
exiting={exiting}
|
|
45
40
|
{...wrapperProps}
|
|
46
41
|
style={styles.wrapper}
|
|
42
|
+
|
|
47
43
|
>
|
|
48
44
|
{isPressable
|
|
49
45
|
? <Touchable {...rest} style={styles.touchable} noFeedback android_ripple={null} />
|
|
50
46
|
: null}
|
|
51
47
|
|
|
52
48
|
{children}
|
|
53
|
-
</View>
|
|
49
|
+
</View.Animated>
|
|
54
50
|
)
|
|
55
51
|
}
|
|
56
52
|
|
|
57
|
-
|
|
58
53
|
Backdrop.styleRegistryName = 'Backdrop'
|
|
59
54
|
Backdrop.elements = ['wrapper', 'touchable', 'transition']
|
|
60
55
|
Backdrop.rootElement = 'wrapper'
|
|
@@ -63,6 +58,9 @@ Backdrop.withVariantTypes = <S extends AnyRecord>(styles: S) => {
|
|
|
63
58
|
return Backdrop as (props: StyledComponentProps<BackdropProps, typeof styles>) => IJSX
|
|
64
59
|
}
|
|
65
60
|
|
|
66
|
-
Backdrop.defaultProps = {
|
|
61
|
+
Backdrop.defaultProps = {
|
|
62
|
+
entering: FadeIn.build(),
|
|
63
|
+
exiting: FadeOut.build(),
|
|
64
|
+
} as Partial<BackdropProps>
|
|
67
65
|
|
|
68
66
|
MobileStyleRegistry.registerComponent(Backdrop)
|
|
@@ -3,6 +3,7 @@ import { ReactNode } from 'react'
|
|
|
3
3
|
import { TouchableProps } from '../Touchable'
|
|
4
4
|
import { ViewProps } from '../View/types'
|
|
5
5
|
import { BackdropComposition } from './styles'
|
|
6
|
+
import { ReanimatedEnteringAnimation, ReanimatedExitingAnimation } from '../../types'
|
|
6
7
|
|
|
7
8
|
export type BackdropProps =
|
|
8
9
|
Omit<TouchableProps, 'style'> &
|
|
@@ -11,4 +12,6 @@ export type BackdropProps =
|
|
|
11
12
|
visible: boolean
|
|
12
13
|
wrapperProps?: ViewProps
|
|
13
14
|
style?: StyledProp<BackdropComposition>
|
|
15
|
+
exiting?: ReanimatedExitingAnimation
|
|
16
|
+
entering?: ReanimatedEnteringAnimation
|
|
14
17
|
}
|
|
@@ -12,6 +12,7 @@ import { ModalHeaderProps, ModalProps } from './types'
|
|
|
12
12
|
import { AnyRecord, AppIcon, useNestedStylesByKey, IJSX, StyledComponentProps, useTheme, AppTheme, Theme } from '@codeleap/styles'
|
|
13
13
|
import { MobileStyleRegistry } from '../../Registry'
|
|
14
14
|
import { useStylesFor } from '../../hooks'
|
|
15
|
+
import { SlideInDown, SlideOutDown } from 'react-native-reanimated'
|
|
15
16
|
|
|
16
17
|
export * from './styles'
|
|
17
18
|
export * from './types'
|
|
@@ -74,6 +75,8 @@ export const Modal = (modalProps: ModalProps) => {
|
|
|
74
75
|
scrollProps = {},
|
|
75
76
|
closeOnHardwareBackPress,
|
|
76
77
|
style,
|
|
78
|
+
boxExiting,
|
|
79
|
+
boxEntering,
|
|
77
80
|
...props
|
|
78
81
|
} = {
|
|
79
82
|
...Modal.defaultProps,
|
|
@@ -132,7 +135,7 @@ export const Modal = (modalProps: ModalProps) => {
|
|
|
132
135
|
style={[
|
|
133
136
|
styles?.wrapper,
|
|
134
137
|
// @ts-expect-error
|
|
135
|
-
{ zIndex: TypeGuards.isNumber(zIndex) ? zIndex : styles?.wrapper?.zIndex, ...topSpacing }
|
|
138
|
+
{ zIndex: TypeGuards.isNumber(zIndex) ? zIndex : styles?.wrapper?.zIndex, ...topSpacing },
|
|
136
139
|
]}
|
|
137
140
|
pointerEvents={visible ? 'auto' : 'none'}
|
|
138
141
|
>
|
|
@@ -167,24 +170,29 @@ export const Modal = (modalProps: ModalProps) => {
|
|
|
167
170
|
android_ripple={null}
|
|
168
171
|
noFeedback
|
|
169
172
|
/>) : null}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
173
|
+
{
|
|
174
|
+
visible ? (
|
|
175
|
+
<View
|
|
176
|
+
animated
|
|
177
|
+
// @ts-ignore
|
|
178
|
+
entering={boxEntering}
|
|
179
|
+
exiting={boxExiting}
|
|
180
|
+
{...props}
|
|
181
|
+
onLayout={onModalLayout}
|
|
182
|
+
style={styles?.box}
|
|
183
|
+
>
|
|
184
|
+
{header ? header : <Header {...headerProps} />}
|
|
185
|
+
|
|
186
|
+
<View style={styles?.body}>{children}</View>
|
|
187
|
+
|
|
188
|
+
{footer ? (
|
|
189
|
+
<View style={styles?.footer}>
|
|
190
|
+
{typeof footer === 'string' ? <Text text={footer} /> : footer}
|
|
191
|
+
</View>
|
|
192
|
+
) : null}
|
|
185
193
|
</View>
|
|
186
|
-
) : null
|
|
187
|
-
|
|
194
|
+
) : null
|
|
195
|
+
}
|
|
188
196
|
</ScrollComponent>
|
|
189
197
|
</View >
|
|
190
198
|
)
|
|
@@ -204,6 +212,8 @@ Modal.defaultProps = {
|
|
|
204
212
|
dismissOnBackdrop: true,
|
|
205
213
|
scroll: true,
|
|
206
214
|
closeOnHardwareBackPress: true,
|
|
215
|
+
boxEntering: SlideInDown.build(),
|
|
216
|
+
boxExiting: SlideOutDown.build(),
|
|
207
217
|
} as Partial<ModalProps>
|
|
208
218
|
|
|
209
219
|
MobileStyleRegistry.registerComponent(Modal)
|
|
@@ -4,6 +4,7 @@ import { ButtonProps } from '../Button'
|
|
|
4
4
|
import { Scroll } from '../Scroll'
|
|
5
5
|
import { ViewProps } from '../View'
|
|
6
6
|
import { ModalComposition } from './styles'
|
|
7
|
+
import { ReanimatedEnteringAnimation, ReanimatedExitingAnimation } from '../../types'
|
|
7
8
|
|
|
8
9
|
export type ModalProps =
|
|
9
10
|
Omit<ViewProps, 'style'> &
|
|
@@ -30,6 +31,8 @@ export type ModalProps =
|
|
|
30
31
|
style?: StyledProp<ModalComposition>
|
|
31
32
|
id?: string
|
|
32
33
|
absolute?: boolean
|
|
34
|
+
boxEntering?: ReanimatedEnteringAnimation
|
|
35
|
+
boxExiting?: ReanimatedExitingAnimation
|
|
33
36
|
}
|
|
34
37
|
|
|
35
38
|
export type ModalHeaderProps =
|
|
@@ -27,6 +27,10 @@ export const View = <T extends React.ComponentType = typeof RNView>(props: ViewP
|
|
|
27
27
|
)
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
View.Animated = (props: ViewProps<typeof Animated.View>) => {
|
|
31
|
+
return <View {...props} animated />
|
|
32
|
+
}
|
|
33
|
+
|
|
30
34
|
View.styleRegistryName = 'View'
|
|
31
35
|
View.elements = ['wrapper']
|
|
32
36
|
View.rootElement = 'wrapper'
|
package/src/types/utility.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react'
|
|
2
2
|
import { StyleProp } from 'react-native'
|
|
3
|
-
import { EasingFn } from 'react-native-reanimated'
|
|
3
|
+
import { EasingFn, EntryAnimationsValues, ExitAnimationsValues, LayoutAnimation, StyleProps } from 'react-native-reanimated'
|
|
4
4
|
|
|
5
5
|
export type StylesOf<C extends string> = Partial<Record<C, StyleProp<any>>>
|
|
6
6
|
type TransitionBase = {
|
|
@@ -10,7 +10,10 @@ type TransitionBase = {
|
|
|
10
10
|
}
|
|
11
11
|
export type TransitionConfig = TransitionBase | {
|
|
12
12
|
[p: string] : TransitionBase
|
|
13
|
-
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type ChildrenProp = ReactNode | ReactNode[] | undefined
|
|
14
16
|
|
|
17
|
+
export type ReanimatedExitingAnimation = (values: ExitAnimationsValues) => LayoutAnimation
|
|
18
|
+
export type ReanimatedEnteringAnimation = (values: EntryAnimationsValues) => LayoutAnimation
|
|
15
19
|
|
|
16
|
-
export type ChildrenProp = ReactNode | ReactNode[] | undefined
|