@draftbit/core 46.4.4-602cb9.2 → 46.4.4-618dac.2
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/commonjs/components/Accordion/AccordionItem.js +5 -25
- package/lib/commonjs/components/BottomSheet/BottomSheet.native.js +68 -0
- package/lib/commonjs/components/BottomSheet/BottomSheet.web.js +97 -0
- package/lib/commonjs/components/BottomSheet/index.js +15 -0
- package/lib/commonjs/components/BottomSheet/types.js +5 -0
- package/lib/commonjs/components/Checkbox/CheckboxGroup.js +3 -18
- package/lib/commonjs/components/CircleImage.js +16 -2
- package/lib/commonjs/components/DatePicker/DatePicker.js +1 -6
- package/lib/commonjs/components/Divider.js +2 -16
- package/lib/commonjs/components/Text.js +6 -2
- package/lib/commonjs/components/TextField.js +5 -1
- package/lib/commonjs/index.js +8 -0
- package/lib/commonjs/mappings/BottomSheet.js +22 -0
- package/lib/commonjs/mappings/DatePicker.js +0 -1
- package/lib/commonjs/mappings/TextField.js +1 -1
- package/lib/commonjs/mappings/TextInput.js +1 -1
- package/lib/module/components/BottomSheet/BottomSheet.native.js +50 -0
- package/lib/module/components/BottomSheet/BottomSheet.web.js +78 -0
- package/lib/module/components/BottomSheet/index.js +2 -0
- package/lib/module/components/BottomSheet/types.js +1 -0
- package/lib/module/components/DatePicker/DatePicker.js +1 -5
- package/lib/module/components/Text.js +6 -2
- package/lib/module/components/TextField.js +5 -1
- package/lib/module/index.js +1 -0
- package/lib/module/mappings/BottomSheet.js +13 -0
- package/lib/module/mappings/DatePicker.js +1 -2
- package/lib/module/mappings/TextField.js +1 -1
- package/lib/module/mappings/TextInput.js +1 -1
- package/lib/typescript/src/components/BottomSheet/BottomSheet.native.d.ts +4 -0
- package/lib/typescript/src/components/BottomSheet/BottomSheet.web.d.ts +4 -0
- package/lib/typescript/src/components/BottomSheet/index.d.ts +1 -0
- package/lib/typescript/src/components/BottomSheet/types.d.ts +8 -0
- package/lib/typescript/src/components/Text.d.ts +2 -1
- package/lib/typescript/src/components/TextField.d.ts +2 -1
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/mappings/BottomSheet.d.ts +19 -0
- package/lib/typescript/src/mappings/DatePicker.d.ts +0 -1
- package/lib/typescript/src/mappings/TextField.d.ts +2 -2
- package/lib/typescript/src/mappings/TextInput.d.ts +1 -1
- package/package.json +5 -3
- package/src/components/BottomSheet/BottomSheet.native.js +37 -0
- package/src/components/BottomSheet/BottomSheet.native.tsx +60 -0
- package/src/components/BottomSheet/BottomSheet.web.js +56 -0
- package/src/components/BottomSheet/BottomSheet.web.tsx +90 -0
- package/src/components/BottomSheet/index.js +2 -0
- package/src/components/BottomSheet/index.tsx +2 -0
- package/src/components/BottomSheet/types.js +1 -0
- package/src/components/BottomSheet/types.tsx +8 -0
- package/src/components/DatePicker/DatePicker.js +0 -3
- package/src/components/DatePicker/DatePicker.tsx +0 -4
- package/src/components/Text.js +8 -2
- package/src/components/Text.tsx +6 -1
- package/src/components/TextField.js +6 -1
- package/src/components/TextField.tsx +7 -1
- package/src/index.js +1 -0
- package/src/index.tsx +1 -0
- package/src/mappings/BottomSheet.js +20 -0
- package/src/mappings/BottomSheet.ts +25 -0
- package/src/mappings/DatePicker.js +1 -9
- package/src/mappings/DatePicker.ts +0 -9
- package/src/mappings/TextField.js +1 -1
- package/src/mappings/TextField.ts +1 -1
- package/src/mappings/TextInput.js +1 -1
- package/src/mappings/TextInput.ts +1 -1
|
@@ -11,10 +11,14 @@ class Text extends React.Component {
|
|
|
11
11
|
super(...arguments);
|
|
12
12
|
|
|
13
13
|
_defineProperty(this, "_root", void 0);
|
|
14
|
+
|
|
15
|
+
_defineProperty(this, "state", {
|
|
16
|
+
nativeProps: {}
|
|
17
|
+
});
|
|
14
18
|
}
|
|
15
19
|
|
|
16
20
|
setNativeProps(args) {
|
|
17
|
-
|
|
21
|
+
this.state.nativeProps = args || {};
|
|
18
22
|
}
|
|
19
23
|
|
|
20
24
|
render() {
|
|
@@ -23,7 +27,7 @@ class Text extends React.Component {
|
|
|
23
27
|
...rest
|
|
24
28
|
} = this.props;
|
|
25
29
|
const writingDirection = I18nManager.isRTL ? "rtl" : "ltr";
|
|
26
|
-
return /*#__PURE__*/React.createElement(NativeText, _extends({}, rest, {
|
|
30
|
+
return /*#__PURE__*/React.createElement(NativeText, _extends({}, rest, this.state.nativeProps, {
|
|
27
31
|
ref: c => {
|
|
28
32
|
this._root = c;
|
|
29
33
|
},
|
|
@@ -16,6 +16,7 @@ class TextField extends React.Component {
|
|
|
16
16
|
super(...arguments);
|
|
17
17
|
|
|
18
18
|
_defineProperty(this, "state", {
|
|
19
|
+
nativeProps: {},
|
|
19
20
|
labeled: new Animated.Value(this.props.value || this.props.error ? 0 : 1),
|
|
20
21
|
focused: false,
|
|
21
22
|
placeholder: this.props.error ? this.props.placeholder : "",
|
|
@@ -146,7 +147,9 @@ class TextField extends React.Component {
|
|
|
146
147
|
* @internal
|
|
147
148
|
*/
|
|
148
149
|
setNativeProps(args) {
|
|
149
|
-
|
|
150
|
+
this.setState(state => ({ ...state,
|
|
151
|
+
nativeState: args || {}
|
|
152
|
+
}));
|
|
150
153
|
}
|
|
151
154
|
|
|
152
155
|
isFocused() {
|
|
@@ -426,6 +429,7 @@ class TextField extends React.Component {
|
|
|
426
429
|
underlineColorAndroid: "transparent",
|
|
427
430
|
style: inputStyles,
|
|
428
431
|
...rest,
|
|
432
|
+
...this.state.nativeProps,
|
|
429
433
|
value: this.state.value
|
|
430
434
|
})), rightIconName ? /*#__PURE__*/React.createElement(Icon, {
|
|
431
435
|
name: rightIconName,
|
package/lib/module/index.js
CHANGED
|
@@ -29,6 +29,7 @@ export { default as Touchable } from "./components/Touchable";
|
|
|
29
29
|
export { AccordionGroup, AccordionItem } from "./components/Accordion";
|
|
30
30
|
export { ActionSheet, ActionSheetItem, ActionSheetCancel } from "./components/ActionSheet";
|
|
31
31
|
export { Swiper, SwiperItem } from "./components/Swiper";
|
|
32
|
+
export { BottomSheet } from "./components/BottomSheet";
|
|
32
33
|
export { Center, Circle, Square, Row, Stack, Spacer } from "./components/Layout";
|
|
33
34
|
export { RadioButton, RadioButtonGroup, RadioButtonRow, RadioButtonFieldGroup } from "./components/RadioButton/index";
|
|
34
35
|
/* Deprecated: Fix or Delete! */
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { COMPONENT_TYPES, createNumberProp, StylesPanelSections } from "@draftbit/types";
|
|
2
|
+
export const SEED_DATA = {
|
|
3
|
+
name: "Bottom Sheet",
|
|
4
|
+
tag: "BottomSheet",
|
|
5
|
+
category: COMPONENT_TYPES.container,
|
|
6
|
+
stylesPanelSections: [StylesPanelSections.Background, StylesPanelSections.Borders, StylesPanelSections.Size, StylesPanelSections.MarginsAndPaddings, StylesPanelSections.Position, StylesPanelSections.Effects],
|
|
7
|
+
props: {
|
|
8
|
+
step: createNumberProp({
|
|
9
|
+
label: "Step",
|
|
10
|
+
description: "Step can be -1, 0, 1, or 2."
|
|
11
|
+
})
|
|
12
|
+
}
|
|
13
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { COMPONENT_TYPES, FORM_TYPES, PROP_TYPES, FIELD_NAME, GROUPS, Triggers
|
|
1
|
+
import { COMPONENT_TYPES, FORM_TYPES, PROP_TYPES, FIELD_NAME, GROUPS, Triggers } from "@draftbit/types";
|
|
2
2
|
const SEED_DATA_PROPS = {
|
|
3
3
|
label: {
|
|
4
4
|
label: "Label",
|
|
@@ -137,7 +137,6 @@ export const SEED_DATA = [{
|
|
|
137
137
|
category: COMPONENT_TYPES.input,
|
|
138
138
|
layout: null,
|
|
139
139
|
triggers: [Triggers.OnDateChange],
|
|
140
|
-
StylesPanelSections: [StylesPanelSections.Background, StylesPanelSections.Borders, StylesPanelSections.MarginsAndPaddings, StylesPanelSections.Position, StylesPanelSections.Size, StylesPanelSections.Typography],
|
|
141
140
|
props: { ...SEED_DATA_PROPS,
|
|
142
141
|
type: {
|
|
143
142
|
label: "Appearance",
|
|
@@ -16,7 +16,7 @@ const SEED_DATA_PROPS = {
|
|
|
16
16
|
description: "Can automatically capitalize sentences, words, and characters (Default: none).",
|
|
17
17
|
editable: true,
|
|
18
18
|
required: false,
|
|
19
|
-
defaultValue:
|
|
19
|
+
defaultValue: "none",
|
|
20
20
|
options: ["none", "sentences", "words", "characters"],
|
|
21
21
|
formType: FORM_TYPES.flatArray,
|
|
22
22
|
propType: PROP_TYPES.STRING
|
|
@@ -94,7 +94,7 @@ export const SEED_DATA = [{
|
|
|
94
94
|
description: "Can automatically capitalize sentences, words, and characters (Default: none).",
|
|
95
95
|
editable: true,
|
|
96
96
|
required: false,
|
|
97
|
-
defaultValue:
|
|
97
|
+
defaultValue: "none",
|
|
98
98
|
options: ["none", "sentences", "words", "characters"],
|
|
99
99
|
formType: FORM_TYPES.flatArray,
|
|
100
100
|
propType: PROP_TYPES.STRING
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as BottomSheet } from "./BottomSheet";
|
|
@@ -6,7 +6,8 @@ declare type Props = {
|
|
|
6
6
|
} & TextProps;
|
|
7
7
|
declare class Text extends React.Component<Props> {
|
|
8
8
|
_root: any;
|
|
9
|
-
|
|
9
|
+
state: any;
|
|
10
|
+
setNativeProps(args: TextProps): void;
|
|
10
11
|
render(): JSX.Element;
|
|
11
12
|
}
|
|
12
13
|
export declare const BaseLink: ({ style, theme, title, ...props }: any) => JSX.Element;
|
|
@@ -27,6 +27,7 @@ export declare type Props = {
|
|
|
27
27
|
}) => React.ReactNode;
|
|
28
28
|
} & TextInputProps & IconSlot;
|
|
29
29
|
interface State {
|
|
30
|
+
nativeProps: any;
|
|
30
31
|
labeled: Animated.Value;
|
|
31
32
|
focused?: boolean;
|
|
32
33
|
placeholder?: string | undefined;
|
|
@@ -57,7 +58,7 @@ declare class TextField extends React.Component<Props, State> {
|
|
|
57
58
|
/**
|
|
58
59
|
* @internal
|
|
59
60
|
*/
|
|
60
|
-
setNativeProps(args: Props): void
|
|
61
|
+
setNativeProps(args: Props): void;
|
|
61
62
|
isFocused(): boolean | undefined;
|
|
62
63
|
clear(): void | undefined;
|
|
63
64
|
focus(): void | undefined;
|
|
@@ -29,6 +29,7 @@ export { default as Touchable } from "./components/Touchable";
|
|
|
29
29
|
export { AccordionGroup, AccordionItem } from "./components/Accordion";
|
|
30
30
|
export { ActionSheet, ActionSheetItem, ActionSheetCancel, } from "./components/ActionSheet";
|
|
31
31
|
export { Swiper, SwiperItem } from "./components/Swiper";
|
|
32
|
+
export { BottomSheet } from "./components/BottomSheet";
|
|
32
33
|
export { Center, Circle, Square, Row, Stack, Spacer, } from "./components/Layout";
|
|
33
34
|
export { RadioButton, RadioButtonGroup, RadioButtonRow, RadioButtonFieldGroup, } from "./components/RadioButton/index";
|
|
34
35
|
export { default as CardBlock } from "./components/CardBlock";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare const SEED_DATA: {
|
|
2
|
+
name: string;
|
|
3
|
+
tag: string;
|
|
4
|
+
category: string;
|
|
5
|
+
stylesPanelSections: string[];
|
|
6
|
+
props: {
|
|
7
|
+
step: {
|
|
8
|
+
label: string;
|
|
9
|
+
description: string;
|
|
10
|
+
formType: string;
|
|
11
|
+
propType: string;
|
|
12
|
+
group: string;
|
|
13
|
+
defaultValue: null;
|
|
14
|
+
editable: boolean;
|
|
15
|
+
required: boolean;
|
|
16
|
+
step: number;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
};
|
|
@@ -64,7 +64,7 @@ export declare const SEED_DATA: ({
|
|
|
64
64
|
description: string;
|
|
65
65
|
editable: boolean;
|
|
66
66
|
required: boolean;
|
|
67
|
-
defaultValue:
|
|
67
|
+
defaultValue: string;
|
|
68
68
|
options: string[];
|
|
69
69
|
formType: string;
|
|
70
70
|
propType: string;
|
|
@@ -371,7 +371,7 @@ export declare const SEED_DATA: ({
|
|
|
371
371
|
description: string;
|
|
372
372
|
editable: boolean;
|
|
373
373
|
required: boolean;
|
|
374
|
-
defaultValue:
|
|
374
|
+
defaultValue: string;
|
|
375
375
|
options: string[];
|
|
376
376
|
formType: string;
|
|
377
377
|
propType: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@draftbit/core",
|
|
3
|
-
"version": "46.4.4-
|
|
3
|
+
"version": "46.4.4-618dac.2+618dac9",
|
|
4
4
|
"description": "Core (non-native) Components",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -41,7 +41,8 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@date-io/date-fns": "^1.3.13",
|
|
43
43
|
"@draftbit/react-theme-provider": "^2.1.1",
|
|
44
|
-
"@draftbit/types": "^46.4.4-
|
|
44
|
+
"@draftbit/types": "^46.4.4-618dac.2+618dac9",
|
|
45
|
+
"@gorhom/bottom-sheet": "4.4.5",
|
|
45
46
|
"@material-ui/core": "^4.11.0",
|
|
46
47
|
"@material-ui/pickers": "^3.2.10",
|
|
47
48
|
"@react-native-community/slider": "4.2.3",
|
|
@@ -54,6 +55,7 @@
|
|
|
54
55
|
"lodash.omit": "^4.5.0",
|
|
55
56
|
"lodash.tonumber": "^4.0.3",
|
|
56
57
|
"react-native-modal-datetime-picker": "^13.0.0",
|
|
58
|
+
"react-native-scroll-bottom-sheet": "0.7.0",
|
|
57
59
|
"react-native-svg": "12.3.0",
|
|
58
60
|
"react-native-typography": "^1.4.1",
|
|
59
61
|
"react-native-web-swiper": "^2.2.3"
|
|
@@ -81,5 +83,5 @@
|
|
|
81
83
|
]
|
|
82
84
|
]
|
|
83
85
|
},
|
|
84
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "618dac9ee8e7861d982d4e91880448d415fc6d76"
|
|
85
87
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React, { useCallback, useMemo, useRef } from "react";
|
|
2
|
+
import { View, StyleSheet } from "react-native";
|
|
3
|
+
import BottomSheet, { BottomSheetView } from "@gorhom/bottom-sheet";
|
|
4
|
+
import { extractStyles } from "../../utilities";
|
|
5
|
+
const BottomSheetComponent = ({ style, children, step, }) => {
|
|
6
|
+
const bottomSheetRef = useRef(null);
|
|
7
|
+
const { viewStyles } = extractStyles(style);
|
|
8
|
+
// variables
|
|
9
|
+
const snapPoints = useMemo(() => ["25%", "50%", "90%"], []);
|
|
10
|
+
// callbacks
|
|
11
|
+
const handleSheetChanges = useCallback((index) => {
|
|
12
|
+
console.log("handleSheetChanges", index);
|
|
13
|
+
}, []);
|
|
14
|
+
React.useEffect(() => {
|
|
15
|
+
var _a;
|
|
16
|
+
if (step === -1) {
|
|
17
|
+
(_a = bottomSheetRef === null || bottomSheetRef === void 0 ? void 0 : bottomSheetRef.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
18
|
+
}
|
|
19
|
+
}, [step]);
|
|
20
|
+
return (React.createElement(View, { style: [
|
|
21
|
+
containerStyle.container,
|
|
22
|
+
viewStyles,
|
|
23
|
+
{ backgroundColor: step !== -1 ? "grey" : "transparent" },
|
|
24
|
+
] },
|
|
25
|
+
React.createElement(BottomSheet, { ref: bottomSheetRef, index: step, snapPoints: snapPoints, onChange: handleSheetChanges },
|
|
26
|
+
React.createElement(BottomSheetView, null, children))));
|
|
27
|
+
};
|
|
28
|
+
export default BottomSheetComponent;
|
|
29
|
+
const containerStyle = StyleSheet.create({
|
|
30
|
+
container: {
|
|
31
|
+
flex: 1,
|
|
32
|
+
},
|
|
33
|
+
contentContainer: {
|
|
34
|
+
flex: 1,
|
|
35
|
+
alignItems: "center",
|
|
36
|
+
},
|
|
37
|
+
});
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React, { useCallback, useMemo, useRef } from "react";
|
|
2
|
+
import { View, StyleSheet } from "react-native";
|
|
3
|
+
import BottomSheet, { BottomSheetView } from "@gorhom/bottom-sheet";
|
|
4
|
+
|
|
5
|
+
import { extractStyles } from "../../utilities";
|
|
6
|
+
import { BottomSheetProps } from "./types";
|
|
7
|
+
|
|
8
|
+
const BottomSheetComponent: React.FC<BottomSheetProps> = ({
|
|
9
|
+
style,
|
|
10
|
+
children,
|
|
11
|
+
step,
|
|
12
|
+
}) => {
|
|
13
|
+
const bottomSheetRef = useRef<BottomSheet>(null);
|
|
14
|
+
const { viewStyles } = extractStyles(style);
|
|
15
|
+
|
|
16
|
+
// variables
|
|
17
|
+
const snapPoints = useMemo(() => ["25%", "50%", "90%"], []);
|
|
18
|
+
|
|
19
|
+
// callbacks
|
|
20
|
+
const handleSheetChanges = useCallback((index: number) => {
|
|
21
|
+
console.log("handleSheetChanges", index);
|
|
22
|
+
}, []);
|
|
23
|
+
|
|
24
|
+
React.useEffect(() => {
|
|
25
|
+
if (step === -1) {
|
|
26
|
+
bottomSheetRef?.current?.close();
|
|
27
|
+
}
|
|
28
|
+
}, [step]);
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<View
|
|
32
|
+
style={[
|
|
33
|
+
containerStyle.container,
|
|
34
|
+
viewStyles,
|
|
35
|
+
{ backgroundColor: step !== -1 ? "grey" : "transparent" },
|
|
36
|
+
]}
|
|
37
|
+
>
|
|
38
|
+
<BottomSheet
|
|
39
|
+
ref={bottomSheetRef}
|
|
40
|
+
index={step}
|
|
41
|
+
snapPoints={snapPoints}
|
|
42
|
+
onChange={handleSheetChanges}
|
|
43
|
+
>
|
|
44
|
+
<BottomSheetView>{children}</BottomSheetView>
|
|
45
|
+
</BottomSheet>
|
|
46
|
+
</View>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export default BottomSheetComponent;
|
|
51
|
+
|
|
52
|
+
const containerStyle = StyleSheet.create({
|
|
53
|
+
container: {
|
|
54
|
+
flex: 1,
|
|
55
|
+
},
|
|
56
|
+
contentContainer: {
|
|
57
|
+
flex: 1,
|
|
58
|
+
alignItems: "center",
|
|
59
|
+
},
|
|
60
|
+
});
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { StyleSheet, View, Dimensions } from "react-native";
|
|
3
|
+
import ScrollBottomSheet from "react-native-scroll-bottom-sheet";
|
|
4
|
+
import { extractStyles } from "../../utilities";
|
|
5
|
+
const windowHeight = Dimensions.get("window").height;
|
|
6
|
+
const BottomSheetComponent = ({ style, children, step, }) => {
|
|
7
|
+
const { viewStyles } = extractStyles(style);
|
|
8
|
+
const bottomSheetRef = React.useRef();
|
|
9
|
+
const webStep = React.useMemo(() => step + 1, [step]);
|
|
10
|
+
const snapPoints = React.useMemo(() => ["25%", "50%", windowHeight - 200], []);
|
|
11
|
+
React.useEffect(() => {
|
|
12
|
+
var _a;
|
|
13
|
+
(_a = bottomSheetRef === null || bottomSheetRef === void 0 ? void 0 : bottomSheetRef.current) === null || _a === void 0 ? void 0 : _a.snapTo(snapPoints.length - webStep);
|
|
14
|
+
// bottomSheetRef.current.snapTo(step);
|
|
15
|
+
}, [webStep, step, snapPoints]);
|
|
16
|
+
if (step === -1) {
|
|
17
|
+
return React.createElement(React.Fragment, null);
|
|
18
|
+
}
|
|
19
|
+
return (React.createElement(View, { style: styles.container },
|
|
20
|
+
React.createElement(ScrollBottomSheet, { ref: bottomSheetRef, componentType: "ScrollView", snapPoints: snapPoints, initialSnapIndex: 0, renderHandle: () => (React.createElement(View, { style: styles.header },
|
|
21
|
+
React.createElement(View, { style: styles.panelHandle }))), contentContainerStyle: styles.contentContainerStyle },
|
|
22
|
+
React.createElement(View, { style: {
|
|
23
|
+
...styles.container,
|
|
24
|
+
...viewStyles,
|
|
25
|
+
backgroundColor: webStep !== -1 ? "grey" : "transparent",
|
|
26
|
+
} }, children))));
|
|
27
|
+
};
|
|
28
|
+
export default BottomSheetComponent;
|
|
29
|
+
const styles = StyleSheet.create({
|
|
30
|
+
container: {
|
|
31
|
+
flex: 1,
|
|
32
|
+
},
|
|
33
|
+
contentContainerStyle: {
|
|
34
|
+
padding: 16,
|
|
35
|
+
},
|
|
36
|
+
header: {
|
|
37
|
+
alignItems: "center",
|
|
38
|
+
backgroundColor: "white",
|
|
39
|
+
paddingVertical: 20,
|
|
40
|
+
borderTopLeftRadius: 20,
|
|
41
|
+
borderTopRightRadius: 20,
|
|
42
|
+
},
|
|
43
|
+
panelHandle: {
|
|
44
|
+
width: 40,
|
|
45
|
+
height: 2,
|
|
46
|
+
backgroundColor: "rgba(0,0,0,0.3)",
|
|
47
|
+
borderRadius: 4,
|
|
48
|
+
},
|
|
49
|
+
item: {
|
|
50
|
+
padding: 20,
|
|
51
|
+
justifyContent: "center",
|
|
52
|
+
backgroundColor: "white",
|
|
53
|
+
alignItems: "center",
|
|
54
|
+
marginVertical: 10,
|
|
55
|
+
},
|
|
56
|
+
});
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { StyleSheet, View, Dimensions } from "react-native";
|
|
3
|
+
import ScrollBottomSheet from "react-native-scroll-bottom-sheet";
|
|
4
|
+
|
|
5
|
+
import { extractStyles } from "../../utilities";
|
|
6
|
+
import { BottomSheetProps } from "./types";
|
|
7
|
+
|
|
8
|
+
const windowHeight = Dimensions.get("window").height;
|
|
9
|
+
|
|
10
|
+
const BottomSheetComponent: React.FC<BottomSheetProps> = ({
|
|
11
|
+
style,
|
|
12
|
+
children,
|
|
13
|
+
step,
|
|
14
|
+
}) => {
|
|
15
|
+
const { viewStyles } = extractStyles(style);
|
|
16
|
+
const bottomSheetRef = React.useRef<any>();
|
|
17
|
+
|
|
18
|
+
const webStep = React.useMemo(() => step + 1, [step]);
|
|
19
|
+
const snapPoints = React.useMemo(
|
|
20
|
+
() => ["25%", "50%", windowHeight - 200],
|
|
21
|
+
[]
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
React.useEffect(() => {
|
|
25
|
+
bottomSheetRef?.current?.snapTo(snapPoints.length - webStep);
|
|
26
|
+
// bottomSheetRef.current.snapTo(step);
|
|
27
|
+
}, [webStep, step, snapPoints]);
|
|
28
|
+
|
|
29
|
+
if (step === -1) {
|
|
30
|
+
return <></>;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<View style={styles.container}>
|
|
35
|
+
<ScrollBottomSheet
|
|
36
|
+
ref={bottomSheetRef}
|
|
37
|
+
componentType="ScrollView"
|
|
38
|
+
snapPoints={snapPoints}
|
|
39
|
+
initialSnapIndex={0}
|
|
40
|
+
renderHandle={() => (
|
|
41
|
+
<View style={styles.header}>
|
|
42
|
+
<View style={styles.panelHandle} />
|
|
43
|
+
</View>
|
|
44
|
+
)}
|
|
45
|
+
contentContainerStyle={styles.contentContainerStyle}
|
|
46
|
+
>
|
|
47
|
+
<View
|
|
48
|
+
style={{
|
|
49
|
+
...styles.container,
|
|
50
|
+
...viewStyles,
|
|
51
|
+
backgroundColor: webStep !== -1 ? "grey" : "transparent",
|
|
52
|
+
}}
|
|
53
|
+
>
|
|
54
|
+
{children}
|
|
55
|
+
</View>
|
|
56
|
+
</ScrollBottomSheet>
|
|
57
|
+
</View>
|
|
58
|
+
);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export default BottomSheetComponent;
|
|
62
|
+
|
|
63
|
+
const styles = StyleSheet.create({
|
|
64
|
+
container: {
|
|
65
|
+
flex: 1,
|
|
66
|
+
},
|
|
67
|
+
contentContainerStyle: {
|
|
68
|
+
padding: 16,
|
|
69
|
+
},
|
|
70
|
+
header: {
|
|
71
|
+
alignItems: "center",
|
|
72
|
+
backgroundColor: "white",
|
|
73
|
+
paddingVertical: 20,
|
|
74
|
+
borderTopLeftRadius: 20,
|
|
75
|
+
borderTopRightRadius: 20,
|
|
76
|
+
},
|
|
77
|
+
panelHandle: {
|
|
78
|
+
width: 40,
|
|
79
|
+
height: 2,
|
|
80
|
+
backgroundColor: "rgba(0,0,0,0.3)",
|
|
81
|
+
borderRadius: 4,
|
|
82
|
+
},
|
|
83
|
+
item: {
|
|
84
|
+
padding: 20,
|
|
85
|
+
justifyContent: "center",
|
|
86
|
+
backgroundColor: "white",
|
|
87
|
+
alignItems: "center",
|
|
88
|
+
marginVertical: 10,
|
|
89
|
+
},
|
|
90
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -6,7 +6,6 @@ import { withTheme } from "../../theming";
|
|
|
6
6
|
import Portal from "../Portal/Portal";
|
|
7
7
|
import Touchable from "../Touchable";
|
|
8
8
|
import DateTimePicker from "./DatePickerComponent";
|
|
9
|
-
import { extractStyles } from "../../utilities";
|
|
10
9
|
const AnimatedText = Animated.createAnimatedComponent(Text);
|
|
11
10
|
const FOCUS_ANIMATION_DURATION = 150;
|
|
12
11
|
const BLUR_ANIMATION_DURATION = 180;
|
|
@@ -242,12 +241,10 @@ const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disab
|
|
|
242
241
|
},
|
|
243
242
|
],
|
|
244
243
|
};
|
|
245
|
-
const { textStyles } = extractStyles(style);
|
|
246
244
|
const inputStyles = [
|
|
247
245
|
styles.input,
|
|
248
246
|
inputStyle,
|
|
249
247
|
type === "solid" ? { marginHorizontal: 12 } : {},
|
|
250
|
-
textStyles,
|
|
251
248
|
];
|
|
252
249
|
// const render = (props) => <NativeTextInput {...props} />;
|
|
253
250
|
return (React.createElement(View, { style: [styles.container, style] },
|
|
@@ -23,7 +23,6 @@ import DateTimePicker from "./DatePickerComponent";
|
|
|
23
23
|
|
|
24
24
|
import type { Theme } from "../../styles/DefaultTheme";
|
|
25
25
|
import type { IconSlot } from "../../interfaces/Icon";
|
|
26
|
-
import { extractStyles } from "../../utilities";
|
|
27
26
|
|
|
28
27
|
const AnimatedText = Animated.createAnimatedComponent(Text);
|
|
29
28
|
|
|
@@ -348,13 +347,10 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
348
347
|
],
|
|
349
348
|
};
|
|
350
349
|
|
|
351
|
-
const { textStyles } = extractStyles(style);
|
|
352
|
-
|
|
353
350
|
const inputStyles = [
|
|
354
351
|
styles.input,
|
|
355
352
|
inputStyle,
|
|
356
353
|
type === "solid" ? { marginHorizontal: 12 } : {},
|
|
357
|
-
textStyles,
|
|
358
354
|
];
|
|
359
355
|
|
|
360
356
|
// const render = (props) => <NativeTextInput {...props} />;
|
package/src/components/Text.js
CHANGED
|
@@ -2,13 +2,19 @@ import * as React from "react";
|
|
|
2
2
|
import { Text as NativeText, I18nManager } from "react-native";
|
|
3
3
|
import { withTheme } from "../theming";
|
|
4
4
|
class Text extends React.Component {
|
|
5
|
+
constructor() {
|
|
6
|
+
super(...arguments);
|
|
7
|
+
this.state = {
|
|
8
|
+
nativeProps: {},
|
|
9
|
+
};
|
|
10
|
+
}
|
|
5
11
|
setNativeProps(args) {
|
|
6
|
-
|
|
12
|
+
this.state.nativeProps = args || {};
|
|
7
13
|
}
|
|
8
14
|
render() {
|
|
9
15
|
const { style, ...rest } = this.props;
|
|
10
16
|
const writingDirection = I18nManager.isRTL ? "rtl" : "ltr";
|
|
11
|
-
return (React.createElement(NativeText, { ...rest, ref: (c) => {
|
|
17
|
+
return (React.createElement(NativeText, { ...rest, ...this.state.nativeProps, ref: (c) => {
|
|
12
18
|
this._root = c;
|
|
13
19
|
}, style: [
|
|
14
20
|
{
|
package/src/components/Text.tsx
CHANGED
|
@@ -10,8 +10,12 @@ type Props = {
|
|
|
10
10
|
class Text extends React.Component<Props> {
|
|
11
11
|
_root: any;
|
|
12
12
|
|
|
13
|
+
state: any = {
|
|
14
|
+
nativeProps: {},
|
|
15
|
+
};
|
|
16
|
+
|
|
13
17
|
setNativeProps(args: TextProps) {
|
|
14
|
-
|
|
18
|
+
this.state.nativeProps = args || {};
|
|
15
19
|
}
|
|
16
20
|
|
|
17
21
|
render() {
|
|
@@ -21,6 +25,7 @@ class Text extends React.Component<Props> {
|
|
|
21
25
|
return (
|
|
22
26
|
<NativeText
|
|
23
27
|
{...rest}
|
|
28
|
+
{...this.state.nativeProps}
|
|
24
29
|
ref={(c) => {
|
|
25
30
|
this._root = c;
|
|
26
31
|
}}
|
|
@@ -10,6 +10,7 @@ class TextField extends React.Component {
|
|
|
10
10
|
constructor() {
|
|
11
11
|
super(...arguments);
|
|
12
12
|
this.state = {
|
|
13
|
+
nativeProps: {},
|
|
13
14
|
labeled: new Animated.Value(this.props.value || this.props.error ? 0 : 1),
|
|
14
15
|
focused: false,
|
|
15
16
|
placeholder: this.props.error ? this.props.placeholder : "",
|
|
@@ -121,7 +122,10 @@ class TextField extends React.Component {
|
|
|
121
122
|
* @internal
|
|
122
123
|
*/
|
|
123
124
|
setNativeProps(args) {
|
|
124
|
-
|
|
125
|
+
this.setState((state) => ({
|
|
126
|
+
...state,
|
|
127
|
+
nativeState: args || {},
|
|
128
|
+
}));
|
|
125
129
|
}
|
|
126
130
|
isFocused() {
|
|
127
131
|
return this._root && this._root.isFocused();
|
|
@@ -381,6 +385,7 @@ class TextField extends React.Component {
|
|
|
381
385
|
underlineColorAndroid: "transparent",
|
|
382
386
|
style: inputStyles,
|
|
383
387
|
...rest,
|
|
388
|
+
...this.state.nativeProps,
|
|
384
389
|
value: this.state.value,
|
|
385
390
|
})),
|
|
386
391
|
rightIconName ? (React.createElement(Icon, { name: rightIconName, size: ICON_SIZE, color: colors.light, style: {
|