ferns-ui 0.47.7 → 0.47.9
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/DateTimeActionSheet.js +1 -1
- package/dist/SideDrawer.js +12 -6
- package/dist/SideDrawer.js.map +1 -1
- package/package.json +1 -1
- package/src/DateTimeActionSheet.tsx +1 -1
- package/src/SideDrawer.tsx +23 -17
|
@@ -128,7 +128,7 @@ mode, value, onChange, visible, onDismiss, transformValue, }) => {
|
|
|
128
128
|
}
|
|
129
129
|
setHour(h);
|
|
130
130
|
setMinute(datetime.minute);
|
|
131
|
-
setAmPm(datetime.toFormat("a") === "
|
|
131
|
+
setAmPm(datetime.toFormat("a") === "AM" ? "am" : "pm");
|
|
132
132
|
setDate(datetime.toISO());
|
|
133
133
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
134
134
|
}, [value, transformValue, (_b = transformValue === null || transformValue === void 0 ? void 0 : transformValue.options) === null || _b === void 0 ? void 0 : _b.timezone]);
|
package/dist/SideDrawer.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { useCallback } from "react";
|
|
2
2
|
import { Platform, SafeAreaView } from "react-native";
|
|
3
3
|
import { Drawer } from "react-native-drawer-layout";
|
|
4
|
-
import { Box } from "./Box";
|
|
5
4
|
const DEFAULT_STYLES = {
|
|
6
5
|
width: Platform.OS === "web" ? "40%" : "95%",
|
|
7
6
|
height: "100%",
|
|
@@ -9,11 +8,18 @@ const DEFAULT_STYLES = {
|
|
|
9
8
|
borderWidth: 1,
|
|
10
9
|
borderColor: "gray",
|
|
11
10
|
};
|
|
11
|
+
const addWebScroll = (isOpen) => {
|
|
12
|
+
if (Platform.OS === "web") {
|
|
13
|
+
return { display: isOpen ? "flex" : "none", overflow: "scroll" };
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
return {};
|
|
17
|
+
}
|
|
18
|
+
};
|
|
12
19
|
export const SideDrawer = ({ position = "left", isOpen, renderContent, onClose = () => { }, onOpen = () => { }, drawerType = "front", children, drawerStyles = {}, }) => {
|
|
13
|
-
const renderDrawerContent = () => {
|
|
20
|
+
const renderDrawerContent = useCallback(() => {
|
|
14
21
|
return React.createElement(SafeAreaView, null, renderContent());
|
|
15
|
-
};
|
|
16
|
-
return (React.createElement(
|
|
17
|
-
React.createElement(Drawer, { drawerPosition: position, drawerStyle: [DEFAULT_STYLES, drawerStyles], drawerType: drawerType, open: isOpen, renderDrawerContent: renderDrawerContent, onClose: onClose, onOpen: onOpen }, children)));
|
|
22
|
+
}, [renderContent]);
|
|
23
|
+
return (React.createElement(Drawer, { drawerPosition: position, drawerStyle: [DEFAULT_STYLES, drawerStyles, addWebScroll(isOpen)], drawerType: drawerType, open: isOpen, renderDrawerContent: renderDrawerContent, onClose: onClose, onOpen: onOpen }, children));
|
|
18
24
|
};
|
|
19
25
|
//# sourceMappingURL=SideDrawer.js.map
|
package/dist/SideDrawer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SideDrawer.js","sourceRoot":"","sources":["../src/SideDrawer.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"SideDrawer.js","sourceRoot":"","sources":["../src/SideDrawer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAe,WAAW,EAAC,MAAM,OAAO,CAAC;AACvD,OAAO,EAAC,QAAQ,EAAE,YAAY,EAAuB,MAAM,cAAc,CAAC;AAC1E,OAAO,EAAC,MAAM,EAAC,MAAM,4BAA4B,CAAC;AAIlD,MAAM,cAAc,GAAyB;IAC3C,KAAK,EAAE,QAAQ,CAAC,EAAE,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK;IAC5C,MAAM,EAAE,MAAM;IACd,eAAe,EAAE,WAAW;IAC5B,WAAW,EAAE,CAAC;IACd,WAAW,EAAE,MAAM;CACpB,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,MAAe,EAAa,EAAE;IAClD,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,EAAE,CAAC;QAC1B,OAAO,EAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAC,CAAC;IACjE,CAAC;SAAM,CAAC;QACN,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,EACzB,QAAQ,GAAG,MAAM,EACjB,MAAM,EACN,aAAa,EACb,OAAO,GAAG,GAAG,EAAE,GAAE,CAAC,EAClB,MAAM,GAAG,GAAG,EAAE,GAAE,CAAC,EACjB,UAAU,GAAG,OAAO,EACpB,QAAQ,EACR,YAAY,GAAG,EAAE,GACD,EAAgB,EAAE;IAClC,MAAM,mBAAmB,GAAG,WAAW,CAAC,GAAiB,EAAE;QACzD,OAAO,oBAAC,YAAY,QAAE,aAAa,EAAE,CAAgB,CAAC;IACxD,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC;IAEpB,OAAO,CACL,oBAAC,MAAM,IACL,cAAc,EAAE,QAAQ,EACxB,WAAW,EAAE,CAAC,cAAc,EAAE,YAAY,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC,EACjE,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,MAAM,EACZ,mBAAmB,EAAE,mBAAmB,EACxC,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,IAEb,QAAQ,CACF,CACV,CAAC;AACJ,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -216,7 +216,7 @@ export const DateTimeActionSheet = ({
|
|
|
216
216
|
}
|
|
217
217
|
setHour(h);
|
|
218
218
|
setMinute(datetime.minute);
|
|
219
|
-
setAmPm(datetime.toFormat("a") === "
|
|
219
|
+
setAmPm(datetime.toFormat("a") === "AM" ? "am" : "pm");
|
|
220
220
|
setDate(datetime.toISO());
|
|
221
221
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
222
222
|
}, [value, transformValue, transformValue?.options?.timezone]);
|
package/src/SideDrawer.tsx
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import React, {ReactElement} from "react";
|
|
1
|
+
import React, {ReactElement, useCallback} from "react";
|
|
2
2
|
import {Platform, SafeAreaView, StyleProp, ViewStyle} from "react-native";
|
|
3
3
|
import {Drawer} from "react-native-drawer-layout";
|
|
4
4
|
|
|
5
|
-
import {Box} from "./Box";
|
|
6
5
|
import {SideDrawerProps} from "./Common";
|
|
7
6
|
|
|
8
7
|
const DEFAULT_STYLES: StyleProp<ViewStyle> = {
|
|
@@ -13,6 +12,14 @@ const DEFAULT_STYLES: StyleProp<ViewStyle> = {
|
|
|
13
12
|
borderColor: "gray",
|
|
14
13
|
};
|
|
15
14
|
|
|
15
|
+
const addWebScroll = (isOpen: boolean): ViewStyle => {
|
|
16
|
+
if (Platform.OS === "web") {
|
|
17
|
+
return {display: isOpen ? "flex" : "none", overflow: "scroll"};
|
|
18
|
+
} else {
|
|
19
|
+
return {};
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
|
|
16
23
|
export const SideDrawer = ({
|
|
17
24
|
position = "left",
|
|
18
25
|
isOpen,
|
|
@@ -23,22 +30,21 @@ export const SideDrawer = ({
|
|
|
23
30
|
children,
|
|
24
31
|
drawerStyles = {},
|
|
25
32
|
}: SideDrawerProps): ReactElement => {
|
|
26
|
-
const renderDrawerContent = (): ReactElement => {
|
|
33
|
+
const renderDrawerContent = useCallback((): ReactElement => {
|
|
27
34
|
return <SafeAreaView>{renderContent()}</SafeAreaView>;
|
|
28
|
-
};
|
|
35
|
+
}, [renderContent]);
|
|
36
|
+
|
|
29
37
|
return (
|
|
30
|
-
<
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
</Drawer>
|
|
42
|
-
</Box>
|
|
38
|
+
<Drawer
|
|
39
|
+
drawerPosition={position}
|
|
40
|
+
drawerStyle={[DEFAULT_STYLES, drawerStyles, addWebScroll(isOpen)]}
|
|
41
|
+
drawerType={drawerType}
|
|
42
|
+
open={isOpen}
|
|
43
|
+
renderDrawerContent={renderDrawerContent}
|
|
44
|
+
onClose={onClose}
|
|
45
|
+
onOpen={onOpen}
|
|
46
|
+
>
|
|
47
|
+
{children}
|
|
48
|
+
</Drawer>
|
|
43
49
|
);
|
|
44
50
|
};
|