@draftbit/core 46.1.4-e6469c.0 → 46.2.1-de631b.0

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.
Files changed (125) hide show
  1. package/lib/commonjs/components/ActionSheet/index.js.map +1 -1
  2. package/lib/commonjs/components/Carousel.js +3 -1
  3. package/lib/commonjs/components/Carousel.js.map +1 -1
  4. package/lib/commonjs/components/Config.js +3 -3
  5. package/lib/commonjs/components/Config.js.map +1 -1
  6. package/lib/commonjs/components/DatePicker/DatePicker.js +3 -3
  7. package/lib/commonjs/components/DatePicker/DatePicker.js.map +1 -1
  8. package/lib/commonjs/components/DatePicker/DatePickerComponentType.js.map +1 -1
  9. package/lib/commonjs/components/DeprecatedCardWrapper.js +2 -14
  10. package/lib/commonjs/components/DeprecatedCardWrapper.js.map +1 -1
  11. package/lib/commonjs/components/Picker/Picker.js +4 -5
  12. package/lib/commonjs/components/Picker/Picker.js.map +1 -1
  13. package/lib/commonjs/components/Picker/PickerComponent.android.js +135 -0
  14. package/lib/commonjs/components/Picker/PickerComponent.android.js.map +1 -0
  15. package/lib/commonjs/components/Picker/PickerComponent.ios.js +161 -0
  16. package/lib/commonjs/components/Picker/PickerComponent.ios.js.map +1 -0
  17. package/lib/commonjs/components/Picker/PickerComponent.web.js +136 -0
  18. package/lib/commonjs/components/Picker/PickerComponent.web.js.map +1 -0
  19. package/lib/commonjs/components/Picker/PickerTypes.js +6 -0
  20. package/lib/commonjs/components/Picker/PickerTypes.js.map +1 -0
  21. package/lib/commonjs/components/RadioButton/RadioButton.js +1 -1
  22. package/lib/commonjs/components/RadioButton/RadioButton.js.map +1 -1
  23. package/lib/commonjs/components/RadioButton/RadioButtonRow.js +1 -1
  24. package/lib/commonjs/components/RadioButton/RadioButtonRow.js.map +1 -1
  25. package/lib/commonjs/components/StepIndicator.js +1 -1
  26. package/lib/commonjs/components/StepIndicator.js.map +1 -1
  27. package/lib/commonjs/components/Stepper.js +1 -1
  28. package/lib/commonjs/components/Stepper.js.map +1 -1
  29. package/lib/commonjs/mappings/NumberInput.js +241 -0
  30. package/lib/commonjs/mappings/NumberInput.js.map +1 -0
  31. package/lib/commonjs/mappings/RadioButton.js.map +1 -1
  32. package/lib/commonjs/mappings/RadioButtonGroup.js.map +1 -1
  33. package/lib/commonjs/mappings/RadioButtonRow.js.map +1 -1
  34. package/lib/commonjs/mappings/TextArea.js +181 -2
  35. package/lib/commonjs/mappings/TextArea.js.map +1 -1
  36. package/lib/commonjs/mappings/TextField.js +191 -2
  37. package/lib/commonjs/mappings/TextField.js.map +1 -1
  38. package/lib/commonjs/mappings/TextInput.js +180 -29
  39. package/lib/commonjs/mappings/TextInput.js.map +1 -1
  40. package/lib/commonjs/utilities.js +1 -1
  41. package/lib/commonjs/utilities.js.map +1 -1
  42. package/lib/module/components/Carousel.js +3 -1
  43. package/lib/module/components/Carousel.js.map +1 -1
  44. package/lib/module/components/Config.js +3 -3
  45. package/lib/module/components/Config.js.map +1 -1
  46. package/lib/module/components/DatePicker/DatePicker.js +3 -3
  47. package/lib/module/components/DatePicker/DatePicker.js.map +1 -1
  48. package/lib/module/components/Picker/Picker.js +4 -5
  49. package/lib/module/components/Picker/Picker.js.map +1 -1
  50. package/lib/module/components/Picker/PickerComponent.android.js +112 -0
  51. package/lib/module/components/Picker/PickerComponent.android.js.map +1 -0
  52. package/lib/module/components/Picker/PickerComponent.ios.js +135 -0
  53. package/lib/module/components/Picker/PickerComponent.ios.js.map +1 -0
  54. package/lib/module/components/Picker/PickerComponent.web.js +113 -0
  55. package/lib/module/components/Picker/PickerComponent.web.js.map +1 -0
  56. package/lib/module/components/Picker/PickerTypes.js +2 -0
  57. package/lib/module/components/Picker/PickerTypes.js.map +1 -0
  58. package/lib/module/components/RadioButton/RadioButton.js +1 -1
  59. package/lib/module/components/RadioButton/RadioButton.js.map +1 -1
  60. package/lib/module/components/RadioButton/RadioButtonRow.js +1 -1
  61. package/lib/module/components/RadioButton/RadioButtonRow.js.map +1 -1
  62. package/lib/module/components/StepIndicator.js +1 -1
  63. package/lib/module/components/StepIndicator.js.map +1 -1
  64. package/lib/module/components/Stepper.js +1 -1
  65. package/lib/module/components/Stepper.js.map +1 -1
  66. package/lib/module/components/Touchable.js +2 -16
  67. package/lib/module/components/Touchable.js.map +1 -1
  68. package/lib/module/mappings/NumberInput.js +231 -0
  69. package/lib/module/mappings/NumberInput.js.map +1 -0
  70. package/lib/module/mappings/TextArea.js +182 -3
  71. package/lib/module/mappings/TextArea.js.map +1 -1
  72. package/lib/module/mappings/TextField.js +192 -3
  73. package/lib/module/mappings/TextField.js.map +1 -1
  74. package/lib/module/mappings/TextInput.js +180 -29
  75. package/lib/module/mappings/TextInput.js.map +1 -1
  76. package/lib/module/utilities.js +1 -1
  77. package/lib/module/utilities.js.map +1 -1
  78. package/lib/typescript/src/components/Picker/PickerComponent.android.d.ts +6 -0
  79. package/lib/typescript/src/components/Picker/PickerComponent.ios.d.ts +7 -0
  80. package/lib/typescript/src/components/Picker/PickerComponent.web.d.ts +6 -0
  81. package/lib/typescript/src/components/Picker/PickerTypes.d.ts +18 -0
  82. package/lib/typescript/src/mappings/NumberInput.d.ts +297 -0
  83. package/lib/typescript/src/mappings/TextArea.d.ts +1 -11
  84. package/lib/typescript/src/mappings/TextField.d.ts +4 -4
  85. package/lib/typescript/src/mappings/TextInput.d.ts +3 -254
  86. package/package.json +3 -3
  87. package/src/components/ActionSheet/ActionSheet.js +1 -1
  88. package/src/components/Carousel.js +4 -2
  89. package/src/components/Checkbox/Checkbox.js +3 -3
  90. package/src/components/Checkbox/CheckboxGroupRow.js +2 -2
  91. package/src/components/Checkbox/CheckboxRow.js +3 -3
  92. package/src/components/CircularProgress.js +29 -26
  93. package/src/components/DatePicker/DatePicker.js +1 -1
  94. package/src/components/NumberInput.js +1 -1
  95. package/src/components/Picker/Picker.js +8 -8
  96. package/src/components/Picker/Picker.tsx +8 -6
  97. package/src/components/Picker/PickerComponent.android.js +69 -0
  98. package/src/components/Picker/PickerComponent.android.tsx +116 -0
  99. package/src/components/Picker/PickerComponent.ios.js +79 -0
  100. package/src/components/Picker/PickerComponent.ios.tsx +142 -0
  101. package/src/components/Picker/PickerComponent.web.js +70 -0
  102. package/src/components/Picker/PickerComponent.web.tsx +117 -0
  103. package/src/components/Picker/PickerTypes.js +1 -0
  104. package/src/components/Picker/PickerTypes.ts +18 -0
  105. package/src/components/Portal/Portal.js +2 -2
  106. package/src/components/Portal/PortalConsumer.js +0 -1
  107. package/src/components/Portal/PortalHost.js +43 -41
  108. package/src/components/Portal/PortalManager.js +21 -18
  109. package/src/components/ProgressBar.js +9 -9
  110. package/src/components/RadioButton/RadioButton.js +3 -3
  111. package/src/components/RadioButton/RadioButtonGroup.js +1 -1
  112. package/src/components/RadioButton/RadioButtonRow.js +3 -3
  113. package/src/components/StepIndicator.js +225 -225
  114. package/src/components/Stepper.js +2 -2
  115. package/src/components/Text.js +0 -1
  116. package/src/components/TextField.js +62 -59
  117. package/src/constants.js +1 -1
  118. package/src/mappings/NumberInput.js +248 -0
  119. package/src/mappings/NumberInput.ts +267 -0
  120. package/src/mappings/TextArea.js +210 -3
  121. package/src/mappings/TextArea.ts +216 -3
  122. package/src/mappings/TextField.js +220 -3
  123. package/src/mappings/TextField.ts +227 -3
  124. package/src/mappings/TextInput.js +208 -31
  125. package/src/mappings/TextInput.ts +214 -34
@@ -0,0 +1,70 @@
1
+ import * as React from "react";
2
+ import { View, StyleSheet } from "react-native";
3
+ import { Picker as NativePicker } from "@react-native-picker/picker";
4
+ import omit from "lodash.omit";
5
+ import { withTheme } from "../../theming";
6
+ import { extractStyles } from "../../utilities";
7
+ import TextField from "../TextField";
8
+ import Touchable from "../Touchable";
9
+ const Picker = ({ style, options, placeholder, selectedValue, disabled = false, onValueChange: onValueChangeOverride = () => { }, ...props }) => {
10
+ var _a, _b;
11
+ const { viewStyles: { borderRadius, // eslint-disable-line @typescript-eslint/no-unused-vars
12
+ borderWidth, // eslint-disable-line @typescript-eslint/no-unused-vars
13
+ borderTopWidth, // eslint-disable-line @typescript-eslint/no-unused-vars
14
+ borderRightWidth, // eslint-disable-line @typescript-eslint/no-unused-vars
15
+ borderBottomWidth, // eslint-disable-line @typescript-eslint/no-unused-vars
16
+ borderLeftWidth, // eslint-disable-line @typescript-eslint/no-unused-vars
17
+ borderColor, // eslint-disable-line @typescript-eslint/no-unused-vars
18
+ backgroundColor, // eslint-disable-line @typescript-eslint/no-unused-vars
19
+ padding, // eslint-disable-line @typescript-eslint/no-unused-vars
20
+ paddingTop, // eslint-disable-line @typescript-eslint/no-unused-vars
21
+ paddingRight, // eslint-disable-line @typescript-eslint/no-unused-vars
22
+ paddingBottom, // eslint-disable-line @typescript-eslint/no-unused-vars
23
+ paddingLeft, // eslint-disable-line @typescript-eslint/no-unused-vars
24
+ ...viewStyles }, } = extractStyles(style);
25
+ const textField = React.useRef(undefined);
26
+ const onValueChange = (itemValue, itemIndex) => {
27
+ toggleFocus();
28
+ onValueChangeOverride(itemValue, itemIndex);
29
+ };
30
+ const toggleFocus = () => {
31
+ if (!disabled) {
32
+ // @ts-ignore
33
+ textField.current.toggleFocus(); // cannot determine if method exists due to component being wrapped in a withTheme()
34
+ }
35
+ };
36
+ const stylesWithoutMargin = style &&
37
+ omit(StyleSheet.flatten(style), [
38
+ "margin",
39
+ "marginTop",
40
+ "marginRight",
41
+ "marginBottom",
42
+ "marginLeft",
43
+ ]);
44
+ const selectedLabel = selectedValue &&
45
+ ((_b = (_a = options.find((o) => o.value === selectedValue)) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : selectedValue);
46
+ return (React.createElement(Touchable, { disabled: disabled, onPress: toggleFocus, style: [styles.container, viewStyles] },
47
+ React.createElement(View, null,
48
+ React.createElement(NativePicker, { enabled: !disabled, selectedValue: selectedValue, onValueChange: onValueChange, style: {
49
+ flex: 1,
50
+ opacity: 0,
51
+ position: "absolute",
52
+ top: 0,
53
+ left: 0,
54
+ right: 0,
55
+ bottom: 0,
56
+ width: "100%",
57
+ } }, options.map((o) => (React.createElement(NativePicker.Item, { label: o.label, value: o.value, key: o.value })))),
58
+ React.createElement(View, { pointerEvents: "none" },
59
+ React.createElement(TextField, { ...props, value: selectedLabel, placeholder: placeholder,
60
+ // @ts-ignore
61
+ ref: textField, disabled: disabled,
62
+ // @ts-expect-error
63
+ style: stylesWithoutMargin })))));
64
+ };
65
+ const styles = StyleSheet.create({
66
+ container: {
67
+ alignSelf: "stretch",
68
+ },
69
+ });
70
+ export default withTheme(Picker);
@@ -0,0 +1,117 @@
1
+ import * as React from "react";
2
+ import { View, StyleSheet } from "react-native";
3
+ import { Picker as NativePicker } from "@react-native-picker/picker";
4
+ import omit from "lodash.omit";
5
+ import { withTheme } from "../../theming";
6
+ import { extractStyles } from "../../utilities";
7
+
8
+ import TextField from "../TextField";
9
+ import Touchable from "../Touchable";
10
+ import { PickerComponentProps } from "./PickerTypes";
11
+
12
+ const Picker: React.FC<PickerComponentProps> = ({
13
+ style,
14
+ options,
15
+ placeholder,
16
+ selectedValue,
17
+ disabled = false,
18
+ onValueChange: onValueChangeOverride = () => {},
19
+ ...props
20
+ }) => {
21
+ const {
22
+ viewStyles: {
23
+ borderRadius, // eslint-disable-line @typescript-eslint/no-unused-vars
24
+ borderWidth, // eslint-disable-line @typescript-eslint/no-unused-vars
25
+ borderTopWidth, // eslint-disable-line @typescript-eslint/no-unused-vars
26
+ borderRightWidth, // eslint-disable-line @typescript-eslint/no-unused-vars
27
+ borderBottomWidth, // eslint-disable-line @typescript-eslint/no-unused-vars
28
+ borderLeftWidth, // eslint-disable-line @typescript-eslint/no-unused-vars
29
+ borderColor, // eslint-disable-line @typescript-eslint/no-unused-vars
30
+ backgroundColor, // eslint-disable-line @typescript-eslint/no-unused-vars
31
+ padding, // eslint-disable-line @typescript-eslint/no-unused-vars
32
+ paddingTop, // eslint-disable-line @typescript-eslint/no-unused-vars
33
+ paddingRight, // eslint-disable-line @typescript-eslint/no-unused-vars
34
+ paddingBottom, // eslint-disable-line @typescript-eslint/no-unused-vars
35
+ paddingLeft, // eslint-disable-line @typescript-eslint/no-unused-vars
36
+ ...viewStyles
37
+ },
38
+ } = extractStyles(style);
39
+
40
+ const textField = React.useRef<typeof TextField | undefined>(undefined);
41
+
42
+ const onValueChange = (itemValue: string, itemIndex: number) => {
43
+ toggleFocus();
44
+ onValueChangeOverride(itemValue, itemIndex);
45
+ };
46
+
47
+ const toggleFocus = () => {
48
+ if (!disabled) {
49
+ // @ts-ignore
50
+ textField.current.toggleFocus(); // cannot determine if method exists due to component being wrapped in a withTheme()
51
+ }
52
+ };
53
+
54
+ const stylesWithoutMargin =
55
+ style &&
56
+ omit(StyleSheet.flatten(style), [
57
+ "margin",
58
+ "marginTop",
59
+ "marginRight",
60
+ "marginBottom",
61
+ "marginLeft",
62
+ ]);
63
+
64
+ const selectedLabel =
65
+ selectedValue &&
66
+ (options.find((o) => o.value === selectedValue)?.label ?? selectedValue);
67
+
68
+ return (
69
+ <Touchable
70
+ disabled={disabled}
71
+ onPress={toggleFocus}
72
+ style={[styles.container, viewStyles]}
73
+ >
74
+ <View>
75
+ <NativePicker
76
+ enabled={!disabled}
77
+ selectedValue={selectedValue}
78
+ onValueChange={onValueChange}
79
+ style={{
80
+ flex: 1,
81
+ opacity: 0,
82
+ position: "absolute",
83
+ top: 0,
84
+ left: 0,
85
+ right: 0,
86
+ bottom: 0,
87
+ width: "100%",
88
+ }}
89
+ >
90
+ {options.map((o) => (
91
+ <NativePicker.Item label={o.label} value={o.value} key={o.value} />
92
+ ))}
93
+ </NativePicker>
94
+ <View pointerEvents="none">
95
+ <TextField
96
+ {...props}
97
+ value={selectedLabel}
98
+ placeholder={placeholder}
99
+ // @ts-ignore
100
+ ref={textField} // cannot determine if ref is of correct type due to component being wrapped in a withTheme()
101
+ disabled={disabled}
102
+ // @ts-expect-error
103
+ style={stylesWithoutMargin}
104
+ />
105
+ </View>
106
+ </View>
107
+ </Touchable>
108
+ );
109
+ };
110
+
111
+ const styles = StyleSheet.create({
112
+ container: {
113
+ alignSelf: "stretch",
114
+ },
115
+ });
116
+
117
+ export default withTheme(Picker);
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,18 @@
1
+ import { ViewStyle } from "react-native";
2
+ import { StyleProp } from "react-native";
3
+ import { Props as TextFieldProps } from "../TextField";
4
+
5
+ export interface PickerOption {
6
+ value: string;
7
+ label: string;
8
+ }
9
+
10
+ export interface PickerComponentProps extends TextFieldProps {
11
+ style?: StyleProp<ViewStyle> & { height?: number };
12
+ options: PickerOption[];
13
+ placeholder?: string;
14
+ selectedValue: string;
15
+ disabled?: boolean;
16
+ onValueChange?: (value: string, index: number) => void;
17
+ defaultValue?: string;
18
+ }
@@ -24,12 +24,12 @@ import { ThemeProvider, withTheme } from "../../theming";
24
24
  * ```
25
25
  */
26
26
  class Portal extends React.Component {
27
- // @component ./PortalHost.tsx
28
- static Host = PortalHost;
29
27
  render() {
30
28
  const { children, theme } = this.props;
31
29
  return (React.createElement(PortalContext.Consumer, null, (manager) => (React.createElement(PortalConsumer, { manager: manager },
32
30
  React.createElement(ThemeProvider, { theme: theme }, children)))));
33
31
  }
34
32
  }
33
+ // @component ./PortalHost.tsx
34
+ Portal.Host = PortalHost;
35
35
  export default withTheme(Portal);
@@ -14,7 +14,6 @@ export default class PortalConsumer extends React.Component {
14
14
  this.checkManager();
15
15
  this.props.manager.unmount(this.key);
16
16
  }
17
- key;
18
17
  checkManager() {
19
18
  if (!this.props.manager) {
20
19
  throw new Error("Looks like you forgot to wrap your root component with `Provider` component from `react-native-paper`.\n\n" +
@@ -27,7 +27,48 @@ export const PortalContext = React.createContext(null);
27
27
  * Here any `Portal` elements under `<App />` are rendered alongside `<App />` and will appear above `<App />` like a `Modal`.
28
28
  */
29
29
  export default class PortalHost extends React.Component {
30
- static displayName = "Portal.Host";
30
+ constructor() {
31
+ super(...arguments);
32
+ this.setManager = (manager) => {
33
+ this.manager = manager;
34
+ };
35
+ this.mount = (children) => {
36
+ const key = this.nextKey++;
37
+ if (this.manager) {
38
+ this.manager.mount(key, children);
39
+ }
40
+ else {
41
+ this.queue.push({ type: "mount", key, children });
42
+ }
43
+ return key;
44
+ };
45
+ this.update = (key, children) => {
46
+ if (this.manager) {
47
+ this.manager.update(key, children);
48
+ }
49
+ else {
50
+ const op = { type: "mount", key, children };
51
+ const index = this.queue.findIndex((o) => o.type === "mount" || (o.type === "update" && o.key === key));
52
+ if (index > -1) {
53
+ // @ts-ignore
54
+ this.queue[index] = op;
55
+ }
56
+ else {
57
+ this.queue.push(op);
58
+ }
59
+ }
60
+ };
61
+ this.unmount = (key) => {
62
+ if (this.manager) {
63
+ this.manager.unmount(key);
64
+ }
65
+ else {
66
+ this.queue.push({ type: "unmount", key });
67
+ }
68
+ };
69
+ this.nextKey = 0;
70
+ this.queue = [];
71
+ }
31
72
  componentDidMount() {
32
73
  const manager = this.manager;
33
74
  const queue = this.queue;
@@ -48,46 +89,6 @@ export default class PortalHost extends React.Component {
48
89
  }
49
90
  }
50
91
  }
51
- setManager = (manager) => {
52
- this.manager = manager;
53
- };
54
- mount = (children) => {
55
- const key = this.nextKey++;
56
- if (this.manager) {
57
- this.manager.mount(key, children);
58
- }
59
- else {
60
- this.queue.push({ type: "mount", key, children });
61
- }
62
- return key;
63
- };
64
- update = (key, children) => {
65
- if (this.manager) {
66
- this.manager.update(key, children);
67
- }
68
- else {
69
- const op = { type: "mount", key, children };
70
- const index = this.queue.findIndex((o) => o.type === "mount" || (o.type === "update" && o.key === key));
71
- if (index > -1) {
72
- // @ts-ignore
73
- this.queue[index] = op;
74
- }
75
- else {
76
- this.queue.push(op);
77
- }
78
- }
79
- };
80
- unmount = (key) => {
81
- if (this.manager) {
82
- this.manager.unmount(key);
83
- }
84
- else {
85
- this.queue.push({ type: "unmount", key });
86
- }
87
- };
88
- nextKey = 0;
89
- queue = [];
90
- manager;
91
92
  render() {
92
93
  return (React.createElement(PortalContext.Provider, { value: {
93
94
  mount: this.mount,
@@ -98,6 +99,7 @@ export default class PortalHost extends React.Component {
98
99
  React.createElement(PortalManager, { ref: this.setManager })));
99
100
  }
100
101
  }
102
+ PortalHost.displayName = "Portal.Host";
101
103
  const styles = StyleSheet.create({
102
104
  container: {
103
105
  flex: 1,
@@ -4,25 +4,28 @@ import { View, StyleSheet } from "react-native";
4
4
  * Portal host is the component which actually renders all Portals.
5
5
  */
6
6
  export default class PortalManager extends React.PureComponent {
7
- state = {
8
- portals: [],
9
- };
10
- mount = (key, children) => {
11
- this.setState((state) => ({
12
- portals: [...state.portals, { key, children }],
7
+ constructor() {
8
+ super(...arguments);
9
+ this.state = {
10
+ portals: [],
11
+ };
12
+ this.mount = (key, children) => {
13
+ this.setState((state) => ({
14
+ portals: [...state.portals, { key, children }],
15
+ }));
16
+ };
17
+ this.update = (key, children) => this.setState((state) => ({
18
+ portals: state.portals.map((item) => {
19
+ if (item.key === key) {
20
+ return { ...item, children };
21
+ }
22
+ return item;
23
+ }),
13
24
  }));
14
- };
15
- update = (key, children) => this.setState((state) => ({
16
- portals: state.portals.map((item) => {
17
- if (item.key === key) {
18
- return { ...item, children };
19
- }
20
- return item;
21
- }),
22
- }));
23
- unmount = (key) => this.setState((state) => ({
24
- portals: state.portals.filter((item) => item.key !== key),
25
- }));
25
+ this.unmount = (key) => this.setState((state) => ({
26
+ portals: state.portals.filter((item) => item.key !== key),
27
+ }));
28
+ }
26
29
  render() {
27
30
  return this.state.portals.map(({ key, children }) => (React.createElement(View, { key: key, collapsable: false /* Need collapsable=false here to clip the elevations, otherwise they appear above sibling components */, pointerEvents: "box-none", style: StyleSheet.absoluteFill }, children)));
28
31
  }
@@ -5,6 +5,15 @@ const BAR_WIDTH_ZERO_POSITION = INDETERMINATE_WIDTH_FACTOR / (1 + INDETERMINATE_
5
5
  export default class ProgressBar extends Component {
6
6
  constructor(props) {
7
7
  super(props);
8
+ this.handleLayout = (event) => {
9
+ const { width = 150, onLayout } = this.props;
10
+ if (!width) {
11
+ this.setState({ width: event.nativeEvent.layout.width });
12
+ }
13
+ if (onLayout) {
14
+ onLayout(event);
15
+ }
16
+ };
8
17
  const { progress: progressP = 0, indeterminate = false } = props;
9
18
  const progress = Math.min(Math.max(progressP, 0), 1);
10
19
  this.state = {
@@ -50,15 +59,6 @@ export default class ProgressBar extends Component {
50
59
  }
51
60
  }
52
61
  }
53
- handleLayout = (event) => {
54
- const { width = 150, onLayout } = this.props;
55
- if (!width) {
56
- this.setState({ width: event.nativeEvent.layout.width });
57
- }
58
- if (onLayout) {
59
- onLayout(event);
60
- }
61
- };
62
62
  animate() {
63
63
  const { useNativeDriver = false, indeterminateAnimationDuration = 1000 } = this.props;
64
64
  this.state.animationValue.setValue(0);
@@ -7,10 +7,10 @@ const RadioButton = ({ Icon, disabled = false, color, value = "", selected, unse
7
7
  const { value: contextValue, onValueChange } = useRadioButtonGroupContext();
8
8
  const realValue = getValueForRadioButton(value);
9
9
  const realContextValue = getValueForRadioButton(contextValue);
10
- const isSelected = selected ?? realContextValue === realValue;
10
+ const isSelected = selected !== null && selected !== void 0 ? selected : realContextValue === realValue;
11
11
  const handlePress = () => {
12
- onPress?.(realValue);
13
- onValueChange?.(realValue);
12
+ onPress === null || onPress === void 0 ? void 0 : onPress(realValue);
13
+ onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(realValue);
14
14
  };
15
15
  return (React.createElement(IconButton, { Icon: Icon, icon: isSelected ? selectedIcon : unselectedIcon, color: isSelected ? color : unselectedColor, disabled: disabled, onPress: handlePress, size: size, style: style, ...rest }));
16
16
  };
@@ -20,7 +20,7 @@ const RadioButtonGroup = ({ direction = Direction.Vertical, value = "", onValueC
20
20
  const handleValueChange = (newValue) => {
21
21
  const realNewValue = getValueForRadioButton(newValue);
22
22
  setInternalValue(realNewValue);
23
- onValueChange?.(realNewValue);
23
+ onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(realNewValue);
24
24
  };
25
25
  const _containerStyle = [
26
26
  {
@@ -34,10 +34,10 @@ const RadioButtonRow = ({ Icon, label, value = "", color, unselectedColor, onPre
34
34
  const { value: contextValue, onValueChange, direction: parentDirection, } = useRadioButtonGroupContext();
35
35
  const realValue = getValueForRadioButton(value);
36
36
  const realContextValue = getValueForRadioButton(contextValue);
37
- const isSelected = selected ?? realContextValue === realValue;
37
+ const isSelected = selected !== null && selected !== void 0 ? selected : realContextValue === realValue;
38
38
  const handlePress = () => {
39
- onPress?.(realValue);
40
- onValueChange?.(realValue);
39
+ onPress === null || onPress === void 0 ? void 0 : onPress(realValue);
40
+ onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(realValue);
41
41
  };
42
42
  const { textStyles, viewStyles } = extractStyles(style);
43
43
  return (React.createElement(Touchable, { onPress: handlePress, style: [styles.mainParent, { flexDirection: direction }, viewStyles], disabled: disabled, ...rest },