@draftbit/core 47.0.1-17098e.2 → 47.0.1-2aab54.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.
Files changed (141) hide show
  1. package/lib/commonjs/components/Button.js +15 -27
  2. package/lib/commonjs/components/Checkbox/Checkbox.js +3 -1
  3. package/lib/commonjs/components/Checkbox/CheckboxGroup.js +17 -2
  4. package/lib/commonjs/components/DeprecatedButton.js +151 -0
  5. package/lib/commonjs/components/DeprecatedCardWrapper.js +2 -2
  6. package/lib/commonjs/components/DeprecatedFAB.js +2 -1
  7. package/lib/commonjs/components/Picker/Picker.js +4 -3
  8. package/lib/commonjs/components/Picker/PickerComponent.ios.js +2 -2
  9. package/lib/commonjs/components/Touchable.js +11 -27
  10. package/lib/commonjs/components/Touchable.web.js +9 -0
  11. package/lib/commonjs/index.js +25 -82
  12. package/lib/commonjs/mappings/Button.js +10 -14
  13. package/lib/commonjs/mappings/NativeBase/AlertDialog.js +93 -0
  14. package/lib/commonjs/mappings/NativeBase/Button.js +84 -0
  15. package/lib/commonjs/mappings/NativeBase/DataDisplay.js +48 -0
  16. package/lib/commonjs/mappings/NativeBase/Feedback.js +74 -0
  17. package/lib/commonjs/mappings/NativeBase/Layout.js +114 -0
  18. package/lib/commonjs/mappings/NativeBase/Media.js +49 -0
  19. package/lib/commonjs/mappings/NativeBase/Menu.js +111 -0
  20. package/lib/commonjs/mappings/NativeBase/Modal.js +93 -0
  21. package/lib/commonjs/mappings/NativeBase/Other.js +94 -0
  22. package/lib/commonjs/mappings/NativeBase/Popover.js +99 -0
  23. package/lib/commonjs/mappings/Touchable.js +20 -0
  24. package/lib/module/components/Button.js +9 -21
  25. package/lib/module/components/Checkbox/Checkbox.js +3 -2
  26. package/lib/module/components/DeprecatedButton.js +141 -0
  27. package/lib/module/components/DeprecatedCardWrapper.js +2 -2
  28. package/lib/module/components/DeprecatedFAB.js +3 -2
  29. package/lib/module/components/Picker/Picker.js +4 -3
  30. package/lib/module/components/Picker/PickerComponent.ios.js +1 -1
  31. package/lib/module/components/Touchable.js +10 -25
  32. package/lib/module/components/Touchable.web.js +2 -0
  33. package/lib/module/index.js +121 -31
  34. package/lib/module/mappings/Button.js +11 -15
  35. package/lib/module/mappings/NativeBase/AlertDialog.js +86 -0
  36. package/lib/module/mappings/NativeBase/Button.js +86 -0
  37. package/lib/module/mappings/NativeBase/DataDisplay.js +41 -0
  38. package/lib/module/mappings/NativeBase/Feedback.js +67 -0
  39. package/lib/module/mappings/NativeBase/Layout.js +107 -0
  40. package/lib/module/mappings/NativeBase/Media.js +42 -0
  41. package/lib/module/mappings/NativeBase/Menu.js +104 -0
  42. package/lib/module/mappings/NativeBase/Modal.js +86 -0
  43. package/lib/module/mappings/NativeBase/Other.js +87 -0
  44. package/lib/module/mappings/NativeBase/Popover.js +92 -0
  45. package/lib/module/mappings/Touchable.js +13 -0
  46. package/lib/typescript/src/components/Button.d.ts +0 -2
  47. package/lib/typescript/src/components/Button.d.ts.map +1 -1
  48. package/lib/typescript/src/components/Checkbox/Checkbox.d.ts +2 -2
  49. package/lib/typescript/src/components/Checkbox/Checkbox.d.ts.map +1 -1
  50. package/lib/typescript/src/components/DeprecatedButton.d.ts +54 -0
  51. package/lib/typescript/src/components/DeprecatedButton.d.ts.map +1 -0
  52. package/lib/typescript/src/components/DeprecatedCardWrapper.d.ts.map +1 -1
  53. package/lib/typescript/src/components/DeprecatedFAB.d.ts +2 -2
  54. package/lib/typescript/src/components/DeprecatedFAB.d.ts.map +1 -1
  55. package/lib/typescript/src/components/Picker/Picker.d.ts.map +1 -1
  56. package/lib/typescript/src/components/Touchable.d.ts +2 -9
  57. package/lib/typescript/src/components/Touchable.d.ts.map +1 -1
  58. package/lib/typescript/src/components/Touchable.web.d.ts +3 -0
  59. package/lib/typescript/src/components/Touchable.web.d.ts.map +1 -0
  60. package/lib/typescript/src/index.d.ts +102 -29
  61. package/lib/typescript/src/index.d.ts.map +1 -1
  62. package/lib/typescript/src/mappings/Button.d.ts +2 -224
  63. package/lib/typescript/src/mappings/Button.d.ts.map +1 -1
  64. package/lib/typescript/src/mappings/NativeBase/AlertDialog.d.ts +134 -0
  65. package/lib/typescript/src/mappings/NativeBase/AlertDialog.d.ts.map +1 -0
  66. package/lib/typescript/src/mappings/NativeBase/Button.d.ts +1 -0
  67. package/lib/typescript/src/mappings/NativeBase/Button.d.ts.map +1 -0
  68. package/lib/typescript/src/mappings/{Pressable.d.ts → NativeBase/DataDisplay.d.ts} +34 -40
  69. package/lib/typescript/src/mappings/NativeBase/DataDisplay.d.ts.map +1 -0
  70. package/lib/typescript/src/mappings/NativeBase/Feedback.d.ts +2 -0
  71. package/lib/typescript/src/mappings/NativeBase/Feedback.d.ts.map +1 -0
  72. package/lib/typescript/src/mappings/NativeBase/Layout.d.ts +146 -0
  73. package/lib/typescript/src/mappings/NativeBase/Layout.d.ts.map +1 -0
  74. package/lib/typescript/src/mappings/NativeBase/Media.d.ts +48 -0
  75. package/lib/typescript/src/mappings/NativeBase/Media.d.ts.map +1 -0
  76. package/lib/typescript/src/mappings/NativeBase/Menu.d.ts +227 -0
  77. package/lib/typescript/src/mappings/NativeBase/Menu.d.ts.map +1 -0
  78. package/lib/typescript/src/mappings/NativeBase/Modal.d.ts +133 -0
  79. package/lib/typescript/src/mappings/NativeBase/Modal.d.ts.map +1 -0
  80. package/lib/typescript/src/mappings/NativeBase/Other.d.ts +179 -0
  81. package/lib/typescript/src/mappings/NativeBase/Other.d.ts.map +1 -0
  82. package/lib/typescript/src/mappings/NativeBase/Popover.d.ts +136 -0
  83. package/lib/typescript/src/mappings/NativeBase/Popover.d.ts.map +1 -0
  84. package/lib/typescript/src/mappings/Touchable.d.ts +22 -0
  85. package/lib/typescript/src/mappings/Touchable.d.ts.map +1 -0
  86. package/package.json +3 -3
  87. package/src/components/Button.js +11 -18
  88. package/src/components/Button.tsx +11 -45
  89. package/src/components/Checkbox/Checkbox.js +3 -2
  90. package/src/components/Checkbox/Checkbox.tsx +7 -5
  91. package/src/components/DeprecatedButton.js +95 -0
  92. package/src/components/DeprecatedButton.tsx +214 -0
  93. package/src/components/DeprecatedCardWrapper.js +2 -2
  94. package/src/components/DeprecatedCardWrapper.tsx +4 -3
  95. package/src/components/DeprecatedFAB.js +3 -2
  96. package/src/components/DeprecatedFAB.tsx +5 -5
  97. package/src/components/Picker/Picker.js +4 -3
  98. package/src/components/Picker/Picker.tsx +4 -4
  99. package/src/components/Picker/PickerComponent.ios.js +1 -1
  100. package/src/components/Picker/PickerComponent.ios.tsx +1 -1
  101. package/src/components/Touchable.js +11 -16
  102. package/src/components/Touchable.tsx +11 -42
  103. package/src/components/Touchable.web.js +2 -0
  104. package/src/components/Touchable.web.tsx +3 -0
  105. package/src/index.js +112 -31
  106. package/src/index.tsx +123 -43
  107. package/src/mappings/Button.js +10 -14
  108. package/src/mappings/Button.ts +10 -14
  109. package/src/mappings/NativeBase/AlertDialog.js +103 -0
  110. package/src/mappings/NativeBase/AlertDialog.ts +118 -0
  111. package/src/mappings/NativeBase/Button.js +84 -0
  112. package/src/mappings/NativeBase/Button.ts +83 -0
  113. package/src/mappings/NativeBase/DataDisplay.js +54 -0
  114. package/src/mappings/NativeBase/DataDisplay.ts +64 -0
  115. package/src/mappings/NativeBase/Feedback.js +89 -0
  116. package/src/mappings/NativeBase/Feedback.ts +100 -0
  117. package/src/mappings/NativeBase/Layout.js +140 -0
  118. package/src/mappings/NativeBase/Layout.ts +152 -0
  119. package/src/mappings/NativeBase/Media.js +56 -0
  120. package/src/mappings/NativeBase/Media.ts +65 -0
  121. package/src/mappings/NativeBase/Menu.js +134 -0
  122. package/src/mappings/NativeBase/Menu.ts +150 -0
  123. package/src/mappings/NativeBase/Modal.js +103 -0
  124. package/src/mappings/NativeBase/Modal.ts +118 -0
  125. package/src/mappings/NativeBase/Other.js +123 -0
  126. package/src/mappings/NativeBase/Other.ts +139 -0
  127. package/src/mappings/NativeBase/Popover.js +123 -0
  128. package/src/mappings/NativeBase/Popover.ts +136 -0
  129. package/src/mappings/Touchable.js +17 -0
  130. package/src/mappings/Touchable.ts +23 -0
  131. package/lib/commonjs/components/Pressable.js +0 -48
  132. package/lib/commonjs/mappings/Pressable.js +0 -52
  133. package/lib/module/components/Pressable.js +0 -40
  134. package/lib/module/mappings/Pressable.js +0 -45
  135. package/lib/typescript/src/components/Pressable.d.ts +0 -18
  136. package/lib/typescript/src/components/Pressable.d.ts.map +0 -1
  137. package/lib/typescript/src/mappings/Pressable.d.ts.map +0 -1
  138. package/src/components/Pressable.js +0 -17
  139. package/src/components/Pressable.tsx +0 -67
  140. package/src/mappings/Pressable.js +0 -52
  141. package/src/mappings/Pressable.ts +0 -63
@@ -0,0 +1,214 @@
1
+ import * as React from "react";
2
+ import {
3
+ ActivityIndicator,
4
+ View,
5
+ Text,
6
+ StyleSheet,
7
+ TouchableHighlightProps,
8
+ StyleProp,
9
+ ViewStyle,
10
+ TextStyle,
11
+ } from "react-native";
12
+ import color from "color";
13
+ import Config from "./Config";
14
+ import Touchable from "./Touchable";
15
+ import Elevation from "./Elevation";
16
+ import { withTheme } from "../theming";
17
+
18
+ import type { Theme } from "../styles/DefaultTheme";
19
+ import type { IconSlot } from "../interfaces/Icon";
20
+
21
+ /**
22
+ * A button is component that the user can press to trigger an action.
23
+ *
24
+ * <div class="screenshots">
25
+ * <figure>
26
+ * <img src="screenshots/button-1.png" />
27
+ * <figcaption>Text button</figcaption>
28
+ * </figure>
29
+ * <figure>
30
+ * <img src="screenshots/button-2.png" />
31
+ * <figcaption>Outlined button</figcaption>
32
+ * </figure>
33
+ * <figure>
34
+ * <img src="screenshots/button-3.png" />
35
+ * <figcaption>Contained button</figcaption>
36
+ * </figure>
37
+ * </div>
38
+ *
39
+ * ## Usage
40
+ * ```js
41
+ * import * as React from 'react';
42
+ * import { Button } from '@draftbit/ui';
43
+ *
44
+ * const MyComponent = () => (
45
+ * <Button icon="add-a-photo" type="solid" onPress={() => console.log('Pressed')}>
46
+ * Press me
47
+ * </Button>
48
+ * );
49
+ *
50
+ * export default MyComponent;
51
+ * ```
52
+ */
53
+
54
+ type Props = {
55
+ disabled?: boolean;
56
+ type?: "solid" | "outline" | "text";
57
+ loading?: boolean;
58
+ icon?: string;
59
+ labelColor?: string;
60
+ color?: string;
61
+ children?: React.ReactNode;
62
+ onPress: () => void;
63
+ elevation?: number;
64
+ style?: StyleProp<ViewStyle>;
65
+ theme: Theme;
66
+ } & TouchableHighlightProps &
67
+ IconSlot;
68
+
69
+ const Button: React.FC<React.PropsWithChildren<Props>> = ({
70
+ Icon,
71
+ icon,
72
+ disabled = false,
73
+ type = "solid",
74
+ loading = false,
75
+ labelColor,
76
+ color: colorOverride,
77
+ children,
78
+ onPress,
79
+ elevation = 0,
80
+ style,
81
+ theme: { colors, disabledOpacity, roundness, typography },
82
+ ...rest
83
+ }) => {
84
+ let backgroundColor, borderColor, textColor, borderWidth;
85
+ const buttonColor = colorOverride || colors.primary;
86
+
87
+ if (type === "solid") {
88
+ backgroundColor = buttonColor;
89
+
90
+ if (disabled) {
91
+ textColor = color(colors.surface).alpha(disabledOpacity).rgb().string();
92
+ } else {
93
+ textColor = labelColor || colors.surface;
94
+ }
95
+ } else {
96
+ backgroundColor = "transparent";
97
+
98
+ if (disabled) {
99
+ textColor = color(buttonColor).alpha(disabledOpacity).rgb().string();
100
+ } else {
101
+ textColor = labelColor || buttonColor;
102
+ }
103
+ }
104
+
105
+ if (type === "outline") {
106
+ if (disabled) {
107
+ borderColor = color(buttonColor).alpha(disabledOpacity).rgb().string();
108
+ } else {
109
+ borderColor = buttonColor;
110
+ }
111
+ borderWidth = StyleSheet.hairlineWidth;
112
+ } else {
113
+ borderColor = "transparent";
114
+ borderWidth = 0;
115
+ }
116
+
117
+ const buttonStyle = {
118
+ backgroundColor,
119
+ borderColor,
120
+ borderWidth,
121
+ borderRadius: roundness,
122
+ };
123
+
124
+ const textStyle: StyleProp<TextStyle> = {
125
+ textAlign: "center",
126
+ color: textColor,
127
+ marginVertical: 16,
128
+ marginHorizontal: 16,
129
+ };
130
+
131
+ const iconStyle = [
132
+ styles.icon,
133
+ {
134
+ marginLeft: 16,
135
+ marginRight: -8,
136
+ width: Config.buttonIconSize,
137
+ },
138
+ ];
139
+
140
+ const {
141
+ margin,
142
+ marginEnd,
143
+ marginTop,
144
+ marginLeft,
145
+ marginRight,
146
+ marginBottom,
147
+ marginHorizontal,
148
+ marginVertical,
149
+ ...innerStyles
150
+ } = StyleSheet.flatten(style || {});
151
+
152
+ const margins = {
153
+ margin,
154
+ marginEnd,
155
+ marginTop,
156
+ marginLeft,
157
+ marginRight,
158
+ marginBottom,
159
+ marginHorizontal,
160
+ marginVertical,
161
+ };
162
+
163
+ return (
164
+ <Elevation style={{ elevation, alignSelf: "stretch", ...margins }}>
165
+ <Touchable
166
+ {...rest}
167
+ onPress={onPress}
168
+ accessibilityState={{ disabled }}
169
+ accessibilityRole="button"
170
+ disabled={disabled || loading}
171
+ style={[styles.button, buttonStyle, innerStyles]}
172
+ >
173
+ <View style={styles.content}>
174
+ {icon && loading !== true ? (
175
+ <View style={iconStyle}>
176
+ <Icon
177
+ name={icon}
178
+ size={Config.buttonIconSize}
179
+ color={textColor}
180
+ />
181
+ </View>
182
+ ) : null}
183
+ {loading ? (
184
+ <ActivityIndicator
185
+ size="small"
186
+ color={textColor}
187
+ style={iconStyle}
188
+ />
189
+ ) : null}
190
+ <Text numberOfLines={1} style={[textStyle, typography.button]}>
191
+ {children}
192
+ </Text>
193
+ </View>
194
+ </Touchable>
195
+ </Elevation>
196
+ );
197
+ };
198
+
199
+ const styles = StyleSheet.create({
200
+ button: {
201
+ minWidth: 64,
202
+ borderStyle: "solid",
203
+ },
204
+ content: {
205
+ flexDirection: "row",
206
+ alignItems: "center",
207
+ justifyContent: "center",
208
+ },
209
+ icon: {
210
+ width: Config.buttonIconSize,
211
+ },
212
+ });
213
+
214
+ export default withTheme(Button);
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import { withTheme } from "../theming";
3
- import { Pressable } from "react-native";
3
+ import Touchable from "./Touchable";
4
4
  const getWidth = (numColumns) => {
5
5
  switch (numColumns) {
6
6
  case 1:
@@ -13,6 +13,6 @@ const getWidth = (numColumns) => {
13
13
  };
14
14
  const Card = ({ numColumns = 3, children, onPress, style, ...rest }) => {
15
15
  const width = getWidth(numColumns);
16
- return (React.createElement(Pressable, { disabled: !onPress, onPress: onPress, style: [style, { width }], ...rest }, children));
16
+ return (React.createElement(Touchable, { disabled: !onPress, onPress: onPress, style: [style, { width }], ...rest }, children));
17
17
  };
18
18
  export default withTheme(Card);
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
2
  import { withTheme } from "../theming";
3
- import { StyleProp, ViewStyle, Pressable } from "react-native";
3
+ import Touchable from "./Touchable";
4
+ import { StyleProp, ViewStyle } from "react-native";
4
5
  import theme from "../styles/DefaultTheme";
5
6
 
6
7
  type Props = {
@@ -31,14 +32,14 @@ const Card: React.FC<React.PropsWithChildren<Props>> = ({
31
32
  }) => {
32
33
  const width = getWidth(numColumns);
33
34
  return (
34
- <Pressable
35
+ <Touchable
35
36
  disabled={!onPress}
36
37
  onPress={onPress}
37
38
  style={[style, { width }]}
38
39
  {...rest}
39
40
  >
40
41
  {children}
41
- </Pressable>
42
+ </Touchable>
42
43
  );
43
44
  };
44
45
 
@@ -1,8 +1,9 @@
1
1
  import * as React from "react";
2
- import { ActivityIndicator, View, StyleSheet, Pressable, } from "react-native";
2
+ import { ActivityIndicator, View, StyleSheet, } from "react-native";
3
3
  import color from "color";
4
4
  import Config from "./Config";
5
5
  import Text from "./Text";
6
+ import Touchable from "./Touchable";
6
7
  import Elevation from "./Elevation";
7
8
  import { withTheme } from "../theming";
8
9
  const FAB = ({ Icon, icon, disabled = false, type = "solid", loading = false, color: colorOverride, label, onPress, elevation = 0, style, theme: { colors, disabledOpacity, roundness, typography }, ...rest }) => {
@@ -82,7 +83,7 @@ const FAB = ({ Icon, icon, disabled = false, type = "solid", loading = false, co
82
83
  });
83
84
  }
84
85
  return (React.createElement(Elevation, { style: [{ elevation }, style] },
85
- React.createElement(Pressable, { ...rest, onPress: onPress, accessibilityState: { disabled }, accessibilityRole: "button", disabled: disabled || loading, style: buttonStyles },
86
+ React.createElement(Touchable, { ...rest, onPress: onPress, accessibilityState: { disabled }, accessibilityRole: "button", disabled: disabled || loading, style: buttonStyles },
86
87
  React.createElement(View, { style: styles.content },
87
88
  icon && loading !== true ? (React.createElement(View, { style: iconStyle },
88
89
  React.createElement(Icon, { name: icon, size: Config.buttonIconSize, color: textColor }))) : null,
@@ -3,15 +3,15 @@ import {
3
3
  ActivityIndicator,
4
4
  View,
5
5
  StyleSheet,
6
+ TouchableHighlightProps,
6
7
  StyleProp,
7
8
  ViewStyle,
8
9
  TextStyle,
9
- Pressable,
10
- PressableProps,
11
10
  } from "react-native";
12
11
  import color from "color";
13
12
  import Config from "./Config";
14
13
  import Text from "./Text";
14
+ import Touchable from "./Touchable";
15
15
  import Elevation from "./Elevation";
16
16
  import { withTheme } from "../theming";
17
17
 
@@ -65,7 +65,7 @@ type Props = {
65
65
  elevation?: number;
66
66
  theme: Theme;
67
67
  style?: StyleProp<ViewStyle>;
68
- } & PressableProps &
68
+ } & TouchableHighlightProps &
69
69
  IconSlot;
70
70
 
71
71
  const FAB: React.FC<React.PropsWithChildren<Props>> = ({
@@ -169,7 +169,7 @@ const FAB: React.FC<React.PropsWithChildren<Props>> = ({
169
169
 
170
170
  return (
171
171
  <Elevation style={[{ elevation }, style]}>
172
- <Pressable
172
+ <Touchable
173
173
  {...rest}
174
174
  onPress={onPress}
175
175
  accessibilityState={{ disabled }}
@@ -200,7 +200,7 @@ const FAB: React.FC<React.PropsWithChildren<Props>> = ({
200
200
  </Text>
201
201
  ) : null}
202
202
  </View>
203
- </Pressable>
203
+ </Touchable>
204
204
  </Elevation>
205
205
  );
206
206
  };
@@ -1,11 +1,12 @@
1
1
  import * as React from "react";
2
- import { View, StyleSheet, Text, Platform, Dimensions, Pressable, } from "react-native";
2
+ import { View, StyleSheet, Text, Platform, Dimensions, } from "react-native";
3
3
  import { omit, pickBy, identity, isObject } from "lodash";
4
4
  import { SafeAreaView } from "react-native-safe-area-context";
5
5
  import { Picker as NativePicker } from "@react-native-picker/picker";
6
6
  import { withTheme } from "../../theming";
7
7
  import Portal from "../Portal/Portal";
8
- import { Button } from "../Button";
8
+ import Button from "../DeprecatedButton";
9
+ import Touchable from "../Touchable";
9
10
  import { extractStyles, extractBorderAndMarginStyles, borderStyleNames, marginStyleNames, } from "../../utilities";
10
11
  function normalizeOptions(options) {
11
12
  if (options.length === 0) {
@@ -165,7 +166,7 @@ const Picker = ({ error, options = [], onValueChange, defaultValue, Icon, style,
165
166
  return (
166
167
  /* marginsContainer */
167
168
  React.createElement(View, { style: [styles.marginsContainer, marginStyles] },
168
- React.createElement(Pressable, { disabled: disabled, onPress: togglePickerVisible, style: styles.touchableContainer },
169
+ React.createElement(Touchable, { disabled: disabled, onPress: togglePickerVisible, style: styles.touchableContainer },
169
170
  React.createElement(View, { pointerEvents: "none", style: [
170
171
  styles.outsetContainer,
171
172
  stylesWithoutBordersAndMargins,
@@ -7,7 +7,6 @@ import {
7
7
  ViewStyle,
8
8
  StyleProp,
9
9
  Dimensions,
10
- Pressable,
11
10
  } from "react-native";
12
11
  import { omit, pickBy, identity, isObject } from "lodash";
13
12
  import { SafeAreaView } from "react-native-safe-area-context";
@@ -15,7 +14,8 @@ import { Picker as NativePicker } from "@react-native-picker/picker";
15
14
 
16
15
  import { withTheme } from "../../theming";
17
16
  import Portal from "../Portal/Portal";
18
- import { Button } from "../Button";
17
+ import Button from "../DeprecatedButton";
18
+ import Touchable from "../Touchable";
19
19
  import type { Theme } from "../../styles/DefaultTheme";
20
20
  import type { IconSlot } from "../../interfaces/Icon";
21
21
  import {
@@ -306,7 +306,7 @@ const Picker: React.FC<PickerProps> = ({
306
306
  /* marginsContainer */
307
307
  <View style={[styles.marginsContainer, marginStyles]}>
308
308
  {/* touchableContainer */}
309
- <Pressable
309
+ <Touchable
310
310
  disabled={disabled}
311
311
  onPress={togglePickerVisible}
312
312
  style={styles.touchableContainer}
@@ -342,7 +342,7 @@ const Picker: React.FC<PickerProps> = ({
342
342
  </View>
343
343
  </View>
344
344
  {assistiveTextLabel}
345
- </Pressable>
345
+ </Touchable>
346
346
 
347
347
  {/* iosPicker */}
348
348
  {isIos && pickerVisible ? (
@@ -5,7 +5,7 @@ import omit from "lodash.omit";
5
5
  import { Picker as NativePicker } from "@react-native-picker/picker";
6
6
  import { withTheme } from "../../theming";
7
7
  import Portal from "../Portal/Portal";
8
- import { Button } from "../Button";
8
+ import Button from "../DeprecatedButton";
9
9
  import TextField from "../TextField";
10
10
  import Touchable from "../Touchable";
11
11
  import { extractStyles } from "../../utilities";
@@ -8,7 +8,7 @@ import { Picker as NativePicker } from "@react-native-picker/picker";
8
8
  import { withTheme } from "../../theming";
9
9
 
10
10
  import Portal from "../Portal/Portal";
11
- import { Button } from "../Button";
11
+ import Button from "../DeprecatedButton";
12
12
  import TextField from "../TextField";
13
13
  import Touchable from "../Touchable";
14
14
  import { PickerComponentProps } from "./PickerTypes";
@@ -1,17 +1,12 @@
1
- import React, { useCallback } from "react";
2
- import { Pressable, } from "react-native";
3
- export default function Touchable({ children, disabled, onPress, onLongPress, hitSlop, delayLongPress, activeOpacity, disabledOpacity, style, ...props }) {
4
- const getOpacity = useCallback((pressed) => {
5
- if (disabled) {
6
- return disabledOpacity;
7
- }
8
- else {
9
- if (pressed)
10
- return activeOpacity;
11
- else
12
- return 1;
13
- }
14
- }, [activeOpacity, disabled, disabledOpacity]);
15
- const _style = useCallback(({ pressed }) => [style, { opacity: getOpacity(pressed) }], [getOpacity, style]);
16
- return (React.createElement(Pressable, { onPress: onPress, onLongPress: onLongPress, disabled: disabled, delayLongPress: delayLongPress ? delayLongPress : 500, hitSlop: hitSlop ? hitSlop : 8, style: _style, ...props }, children));
1
+ import React from "react";
2
+ import { Pressable } from "react-native";
3
+ export default function Touchable({ children, disabled, onPress, style, ...props }) {
4
+ return (React.createElement(Pressable, { onPress: onPress, disabled: disabled, hitSlop: 8, style: ({ pressed }) => {
5
+ return [
6
+ {
7
+ opacity: pressed || disabled ? 0.75 : 1,
8
+ },
9
+ style,
10
+ ];
11
+ }, ...props }, children));
17
12
  }
@@ -1,64 +1,33 @@
1
- import React, { useCallback } from "react";
2
- import {
3
- Pressable,
4
- PressableProps,
5
- PressableStateCallbackType,
6
- StyleProp,
7
- ViewStyle,
8
- } from "react-native";
1
+ import React from "react";
2
+ import { Pressable, ViewStyle, PressableProps } from "react-native";
9
3
 
10
4
  type Props = {
11
5
  disabled?: boolean;
12
6
  children: React.ReactNode;
13
7
  style?: ViewStyle;
14
8
  onPress?: () => void;
15
- onLongPress?: () => void;
16
- delayLongPress?: number;
17
- hitSlop?: number;
18
- pressRetentionOffset?: number;
19
- activeOpacity?: number;
20
- disabledOpacity?: number;
21
9
  } & PressableProps;
22
10
 
23
- export type StyleType = (
24
- state: PressableStateCallbackType
25
- ) => StyleProp<ViewStyle>;
26
-
27
11
  export default function Touchable({
28
12
  children,
29
13
  disabled,
30
14
  onPress,
31
- onLongPress,
32
- hitSlop,
33
- delayLongPress,
34
- activeOpacity,
35
- disabledOpacity,
36
15
  style,
37
16
  ...props
38
17
  }: Props) {
39
- const getOpacity = useCallback(
40
- (pressed: boolean) => {
41
- if (disabled) {
42
- return disabledOpacity;
43
- } else {
44
- if (pressed) return activeOpacity;
45
- else return 1;
46
- }
47
- },
48
- [activeOpacity, disabled, disabledOpacity]
49
- );
50
- const _style = useCallback<StyleType>(
51
- ({ pressed }) => [style as ViewStyle, { opacity: getOpacity(pressed) }],
52
- [getOpacity, style]
53
- );
54
18
  return (
55
19
  <Pressable
56
20
  onPress={onPress}
57
- onLongPress={onLongPress}
58
21
  disabled={disabled}
59
- delayLongPress={delayLongPress ? delayLongPress : 500}
60
- hitSlop={hitSlop ? hitSlop : 8}
61
- style={_style}
22
+ hitSlop={8}
23
+ style={({ pressed }) => {
24
+ return [
25
+ {
26
+ opacity: pressed || disabled ? 0.75 : 1,
27
+ },
28
+ style,
29
+ ];
30
+ }}
62
31
  {...props}
63
32
  >
64
33
  {children}
@@ -0,0 +1,2 @@
1
+ import { TouchableOpacity } from "react-native";
2
+ export default TouchableOpacity;
@@ -0,0 +1,3 @@
1
+ import { TouchableOpacity } from "react-native";
2
+
3
+ export default TouchableOpacity;
package/src/index.js CHANGED
@@ -2,51 +2,132 @@ export { injectIcon } from "./interfaces/Icon";
2
2
  export { withTheme, ThemeProvider } from "./theming";
3
3
  export { default as Provider } from "./Provider";
4
4
  export { default as DefaultTheme } from "./styles/DefaultTheme";
5
- export { Link } from "./components/Text";
5
+ /** Replaced By NativeBase
6
+ * export { default as Avatar } from "./components/CircleImage";
7
+ * export { default as Container } from "./components/Container";
8
+ * export { default as FAB } from "./components/FAB";
9
+ * export {
10
+ Center,
11
+ Circle,
12
+ Square,
13
+ Row,
14
+ Stack,
15
+ Spacer,
16
+ } from "./components/Layout";
17
+ */
18
+ // BASIC
19
+ export { default as ScreenContainer } from "./components/ScreenContainer";
6
20
  export { default as Banner } from "./components/Banner";
21
+ // BUTTONS
7
22
  export { Button, ButtonSolid, ButtonOutline } from "./components/Button";
8
- export { default as Avatar } from "./components/CircleImage";
9
- export { default as AvatarEdit } from "./components/AvatarEdit";
10
- export { default as Card } from "./components/Card";
11
- export { default as Carousel } from "./components/Carousel";
12
- export { Checkbox, CheckboxGroup, CheckboxRow } from "./components/Checkbox";
13
- export { default as CircleImage } from "./components/CircleImage";
14
- export { default as Container } from "./components/Container";
15
- export { default as Divider } from "./components/Divider";
16
- export { default as FAB } from "./components/FAB";
17
- export { default as FieldSearchBarFull } from "./components/FieldSearchBarFull";
23
+ export { Link } from "./components/Text";
18
24
  export { default as IconButton } from "./components/IconButton";
19
- export { default as Image } from "./components/Image";
20
- export { default as SVG } from "./components/SVG";
25
+ export { default as Touchable } from "./components/Touchable";
26
+ export { default as ToggleButton } from "./components/ToggleButton";
27
+ // INPUTS
28
+ export { default as DatePicker } from "./components/DatePicker/DatePicker";
21
29
  export { default as NumberInput } from "./components/NumberInput";
22
- export { default as ScreenContainer } from "./components/ScreenContainer";
30
+ export { default as TextField } from "./components/TextField";
31
+ export { default as FieldSearchBarFull } from "./components/FieldSearchBarFull";
32
+ export { default as Picker } from "./components/Picker/Picker";
33
+ // CONTROLS
34
+ export { Checkbox, CheckboxGroup, CheckboxRow } from "./components/Checkbox";
35
+ export { RadioButton, RadioButtonGroup, RadioButtonRow, RadioButtonFieldGroup, } from "./components/RadioButton/index";
36
+ export { default as Slider } from "./components/Slider";
37
+ export { default as Stepper } from "./components/Stepper";
23
38
  export { default as StarRating } from "./components/StarRating";
24
- export { default as Surface } from "./components/Surface";
25
39
  export { default as Switch, SwitchRow } from "./components/Switch";
26
- export { default as TextField } from "./components/TextField";
27
- export { default as ToggleButton } from "./components/ToggleButton";
28
- export { default as Touchable } from "./components/Touchable";
40
+ // MEDIA
41
+ export { default as SVG } from "./components/SVG";
42
+ export { default as Image } from "./components/Image";
43
+ // export { default as Avatar } from "./components/CircleImage"; Replaced by NativeBase
44
+ export { default as AvatarEdit } from "./components/AvatarEdit";
45
+ export { default as CircleImage } from "./components/CircleImage";
46
+ // SWIPER
47
+ export { Swiper, SwiperItem } from "./components/Swiper";
48
+ // CONTAINERS
29
49
  export { AccordionGroup, AccordionItem } from "./components/Accordion";
50
+ export { default as Surface } from "./components/Surface";
51
+ // ACTIONSHEET
30
52
  export { ActionSheet, ActionSheetItem, ActionSheetCancel, } from "./components/ActionSheet";
31
- export { Swiper, SwiperItem } from "./components/Swiper";
32
- export { Center, Circle, Square, Row, Stack, Spacer, } from "./components/Layout";
33
- export { RadioButton, RadioButtonGroup, RadioButtonRow, RadioButtonFieldGroup, } from "./components/RadioButton/index";
34
- /* Deprecated: Fix or Delete! */
35
- export { default as CardBlock } from "./components/CardBlock";
36
- export { default as CardContainer } from "./components/CardContainer";
37
- export { default as CardContainerRating } from "./components/CardContainerRating";
38
- export { default as CardInline } from "./components/CardInline";
39
- export { default as DatePicker } from "./components/DatePicker/DatePicker";
53
+ // OTHER
54
+ export { default as Carousel } from "./components/Carousel";
55
+ export { default as Divider } from "./components/Divider";
40
56
  export { default as HeaderLarge } from "./components/HeaderLarge";
41
57
  export { default as HeaderMedium } from "./components/HeaderMedium";
42
58
  export { default as HeaderOverline } from "./components/HeaderOverline";
43
- export { default as Picker } from "./components/Picker/Picker";
44
59
  export { default as ProgressBar } from "./components/ProgressBar";
45
60
  export { default as ProgressCircle } from "./components/ProgressCircle";
46
61
  export { default as RowBodyIcon } from "./components/RowBodyIcon";
47
62
  export { default as RowHeadlineImageCaption } from "./components/RowHeadlineImageCaption";
48
63
  export { default as RowHeadlineImageIcon } from "./components/RowHeadlineImageIcon";
49
- export { default as Slider } from "./components/Slider";
50
- export { default as Stepper } from "./components/Stepper";
64
+ export { default as Card } from "./components/Card";
65
+ export { default as CardBlock } from "./components/CardBlock";
66
+ export { default as CardContainer } from "./components/CardContainer";
67
+ export { default as CardContainerRating } from "./components/CardContainerRating";
68
+ export { default as CardInline } from "./components/CardInline";
51
69
  export { useAuthState } from "./components/useAuthState";
52
- // a comment to fix sourcemap comment issue
70
+ /**
71
+ * NativeBase Components Jan 2023
72
+ *
73
+ * ALERT
74
+ * - AlertDialog
75
+ * - AlertDialog.Header
76
+ * - AlertDialog.Body
77
+ * - AlertDialog.Footer
78
+ * - AlertDialog.Content
79
+ * - AlertDialog.CloseButton
80
+ *
81
+ * FORMS
82
+ * - Button -- COMMENTED OUT
83
+ * - Button.Group -- COMMENTED OUT
84
+ * - Fab
85
+ *
86
+ * DATA DISPLAY
87
+ * - Badge
88
+ * - Divider
89
+ *
90
+ * FEEDBACK
91
+ * - Alert
92
+ * - Alert.Icon
93
+ * - Progress
94
+ *
95
+ * LAYOUT
96
+ * - AspectRatio
97
+ * - Box
98
+ * - Center
99
+ * - Square
100
+ * - Circle
101
+ * - Column
102
+ * - Container
103
+ * - Flex
104
+ * - Spacer
105
+ * - Row
106
+ * - Stack
107
+ * - ZStack
108
+ *
109
+ * MEDIA
110
+ * - Avatar
111
+ * - Avatar.Badge
112
+ * - Avatar.Group
113
+ *
114
+ * MENU
115
+ * - Menu
116
+ * - Menu.Item
117
+ * - Menu.Group
118
+ * - Menu.OptionGroup
119
+ * - Menu.ItemOption
120
+ * - Menu.Trigger
121
+ *
122
+ * MODAL
123
+ * - Modal
124
+ * - Modal.Content
125
+ * - Modal.Header
126
+ * - Modal.Footer
127
+ * - Modal.Body
128
+ * - Modal.CloseButton
129
+ *
130
+ * OTHER
131
+ * - Tooltip
132
+ *
133
+ * */