@draftbit/core 46.8.1-2ae5b7.2 → 46.8.1-51e99b.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.
@@ -12,7 +12,6 @@ var _theming = require("../../theming");
12
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
13
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
14
14
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
15
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
16
15
  const AccordionItem = _ref => {
17
16
  let {
18
17
  Icon,
@@ -27,9 +26,10 @@ const AccordionItem = _ref => {
27
26
  textStyles,
28
27
  viewStyles
29
28
  } = (0, _utilities.extractStyles)(style);
30
- return /*#__PURE__*/React.createElement(_reactNative.Pressable, _extends({
31
- style: [styles.container, viewStyles]
32
- }, rest), /*#__PURE__*/React.createElement(_reactNative.View, {
29
+ return /*#__PURE__*/React.createElement(_reactNative.Pressable, {
30
+ style: [styles.container, viewStyles],
31
+ ...rest
32
+ }, /*#__PURE__*/React.createElement(_reactNative.View, {
33
33
  style: styles.row
34
34
  }, icon ? /*#__PURE__*/React.createElement(Icon, {
35
35
  name: icon,
@@ -61,4 +61,23 @@ const styles = _reactNative.StyleSheet.create({
61
61
  }
62
62
  });
63
63
  var _default = (0, _theming.withTheme)(AccordionItem);
64
+ exports.default = _default;.StyleSheet.create({
65
+ container: {
66
+ padding: 8
67
+ },
68
+ row: {
69
+ flexDirection: "row",
70
+ alignItems: "center",
71
+ paddingLeft: 8
72
+ },
73
+ item: {
74
+ marginVertical: 6,
75
+ paddingLeft: 8
76
+ },
77
+ content: {
78
+ flex: 1,
79
+ justifyContent: "center"
80
+ }
81
+ });
82
+ var _default = (0, _theming.withTheme)(AccordionItem);
64
83
  exports.default = _default;
@@ -17,47 +17,13 @@ const DeckSwiper = _ref => {
17
17
  verticalEnabled = true,
18
18
  horizontalEnabled = true,
19
19
  visibleCardCount = 1,
20
- data,
21
- keyExtractor,
22
- renderItem,
23
20
  style,
24
21
  children
25
22
  } = _ref;
26
- //Both 'renderItem' and 'data' are optional to allow direct children. But if one is included, both need to be included
27
- if (data && !renderItem || renderItem && !data) {
28
- throw new Error("'renderItem' and 'data' need to both be provided to lazily render. Either remove them entirley or include both");
29
- }
30
- if (data && renderItem && children) {
31
- console.warn("'children' of DeckSwiper ignored due to usage of 'data' and 'renderItem'");
32
- }
33
23
  const childrenArray = _react.default.useMemo(() => _react.default.Children.toArray(children), [children]);
34
24
 
35
25
  // an array of indices based on children count
36
26
  const cardsFillerData = _react.default.useMemo(() => Array.from(Array(childrenArray.length).keys()), [childrenArray]);
37
- const cardsData = data || cardsFillerData;
38
- const renderCard = (card, index) => {
39
- if (renderItem) {
40
- return renderItem({
41
- item: card,
42
- index
43
- });
44
- } else {
45
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, childrenArray[index]);
46
- }
47
- };
48
- const renderFirstCard = () => {
49
- if (cardsData.length) {
50
- return renderCard(cardsData[0], 0);
51
- }
52
- return undefined;
53
- };
54
- const cardKeyExtractor = card => {
55
- if (keyExtractor) {
56
- return keyExtractor(card);
57
- } else {
58
- return card === null || card === void 0 ? void 0 : card.toString();
59
- }
60
- };
61
27
 
62
28
  /**
63
29
  * By default react-native-deck-swiper positions everything with absolute position.
@@ -71,10 +37,10 @@ const DeckSwiper = _ref => {
71
37
 
72
38
  return /*#__PURE__*/_react.default.createElement(_reactNative.View, null, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
73
39
  style: styles.containerHeightFiller
74
- }, renderFirstCard()), /*#__PURE__*/_react.default.createElement(_reactNativeDeckSwiper.default, {
75
- cards: cardsData,
76
- renderCard: renderCard,
77
- keyExtractor: cardKeyExtractor,
40
+ }, childrenArray.length && childrenArray[0]), /*#__PURE__*/_react.default.createElement(_reactNativeDeckSwiper.default, {
41
+ cards: cardsFillerData,
42
+ renderCard: (_, i) => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, childrenArray[i]),
43
+ keyExtractor: card => card === null || card === void 0 ? void 0 : card.toString(),
78
44
  containerStyle: _reactNative.StyleSheet.flatten([styles.cardsContainer, style]),
79
45
  cardStyle: styles.card,
80
46
  onSwiped: onIndexChanged,
@@ -46,6 +46,9 @@ const isWeb = _reactNative.Platform.OS === "web";
46
46
  const unstyledColor = "rgba(165, 173, 183, 1)";
47
47
  const disabledColor = "rgb(240, 240, 240)";
48
48
  const errorColor = "rgba(255, 69, 100, 1)";
49
+
50
+ //Empty string for 'value' is treated as a non-value
51
+ //reason: Draftbit uses empty string as initial value for string state*/
49
52
  const Picker = _ref => {
50
53
  var _find$label, _find;
51
54
  let {
@@ -76,12 +79,12 @@ const Picker = _ref => {
76
79
  setPickerVisible(!pickerVisible);
77
80
  };
78
81
  React.useEffect(() => {
79
- if (value != null) {
82
+ if (value != null && value !== "") {
80
83
  setInternalValue(value);
81
84
  }
82
85
  }, [value]);
83
86
  React.useEffect(() => {
84
- if (defaultValue != null) {
87
+ if (defaultValue != null && defaultValue !== "") {
85
88
  setInternalValue(defaultValue);
86
89
  }
87
90
  }, [defaultValue]);
@@ -96,11 +99,7 @@ const Picker = _ref => {
96
99
  _reactNative.Keyboard.dismiss();
97
100
  }
98
101
  }, [pickerVisible, autoDismissKeyboard]);
99
- const normalizedOptions = normalizeOptions(options);
100
- const pickerOptions = placeholder ? [{
101
- value: placeholder,
102
- label: placeholder
103
- }, ...normalizedOptions] : normalizedOptions;
102
+ const pickerOptions = normalizeOptions(options);
104
103
  const {
105
104
  viewStyles,
106
105
  textStyles
@@ -200,10 +199,10 @@ const Picker = _ref => {
200
199
  } : {})
201
200
  };
202
201
  const handleValueChange = (newValue, itemIndex) => {
203
- if (!placeholder || itemIndex > 0) {
202
+ if (newValue !== "") {
204
203
  onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(newValue, itemIndex);
204
+ setInternalValue(newValue);
205
205
  }
206
- setInternalValue(newValue);
207
206
  };
208
207
  return (
209
208
  /*#__PURE__*/
@@ -12,6 +12,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
12
12
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
13
13
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
14
14
  function ScreenContainer(_ref) {
15
+ var _StyleSheet$flatten;
15
16
  let {
16
17
  scrollable = false,
17
18
  hasSafeArea = false,
@@ -22,7 +23,7 @@ function ScreenContainer(_ref) {
22
23
  children,
23
24
  ...rest
24
25
  } = _ref;
25
- const backgroundColor = theme.colors.background;
26
+ const backgroundColor = ((_StyleSheet$flatten = _reactNative.StyleSheet.flatten(style)) === null || _StyleSheet$flatten === void 0 ? void 0 : _StyleSheet$flatten.backgroundColor) || theme.colors.background;
26
27
  const edges = ["left", "right"];
27
28
  if (hasSafeArea || hasTopSafeArea) {
28
29
  edges.push("top");
@@ -12,4 +12,4 @@ const APPROX_STATUSBAR_HEIGHT = _reactNative.Platform.select({
12
12
  android: DEFAULT_STATUSBAR_HEIGHT_EXPO,
13
13
  ios: _reactNative.Platform.Version < 11 ? DEFAULT_STATUSBAR_HEIGHT_EXPO : 0
14
14
  });
15
- exports.APPROX_STATUSBAR_HEIGHT = APPROX_STATUSBAR_HEIGHT;AR_HEIGHT;
15
+ exports.APPROX_STATUSBAR_HEIGHT = APPROX_STATUSBAR_HEIGHT;
@@ -15,6 +15,7 @@ function overlay(elevation) {
15
15
  let surfaceColor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _DarkTheme.default.colors.surface;
16
16
  if (isAnimatedValue(elevation)) {
17
17
  const inputRange = [0, 1, 2, 3, 8, 24];
18
+
18
19
  // @ts-expect-error: TS doesn't seem to refine the type correctly
19
20
  return elevation.interpolate({
20
21
  inputRange,
@@ -23,6 +24,7 @@ function overlay(elevation) {
23
24
  })
24
25
  });
25
26
  }
27
+
26
28
  // @ts-expect-error: TS doesn't seem to refine the type correctly
27
29
  return calculateColor(surfaceColor, elevation);
28
30
  }
@@ -63,4 +65,4 @@ const elevationOverlayTransparency = {
63
65
  22: 15.72,
64
66
  23: 15.84,
65
67
  24: 16
66
- };};
68
+ };
@@ -10,47 +10,13 @@ const DeckSwiper = _ref => {
10
10
  verticalEnabled = true,
11
11
  horizontalEnabled = true,
12
12
  visibleCardCount = 1,
13
- data,
14
- keyExtractor,
15
- renderItem,
16
13
  style,
17
14
  children
18
15
  } = _ref;
19
- //Both 'renderItem' and 'data' are optional to allow direct children. But if one is included, both need to be included
20
- if (data && !renderItem || renderItem && !data) {
21
- throw new Error("'renderItem' and 'data' need to both be provided to lazily render. Either remove them entirley or include both");
22
- }
23
- if (data && renderItem && children) {
24
- console.warn("'children' of DeckSwiper ignored due to usage of 'data' and 'renderItem'");
25
- }
26
16
  const childrenArray = React.useMemo(() => React.Children.toArray(children), [children]);
27
17
 
28
18
  // an array of indices based on children count
29
19
  const cardsFillerData = React.useMemo(() => Array.from(Array(childrenArray.length).keys()), [childrenArray]);
30
- const cardsData = data || cardsFillerData;
31
- const renderCard = (card, index) => {
32
- if (renderItem) {
33
- return renderItem({
34
- item: card,
35
- index
36
- });
37
- } else {
38
- return /*#__PURE__*/React.createElement(React.Fragment, null, childrenArray[index]);
39
- }
40
- };
41
- const renderFirstCard = () => {
42
- if (cardsData.length) {
43
- return renderCard(cardsData[0], 0);
44
- }
45
- return undefined;
46
- };
47
- const cardKeyExtractor = card => {
48
- if (keyExtractor) {
49
- return keyExtractor(card);
50
- } else {
51
- return card === null || card === void 0 ? void 0 : card.toString();
52
- }
53
- };
54
20
 
55
21
  /**
56
22
  * By default react-native-deck-swiper positions everything with absolute position.
@@ -64,10 +30,10 @@ const DeckSwiper = _ref => {
64
30
 
65
31
  return /*#__PURE__*/React.createElement(View, null, /*#__PURE__*/React.createElement(View, {
66
32
  style: styles.containerHeightFiller
67
- }, renderFirstCard()), /*#__PURE__*/React.createElement(DeckSwiperComponent, {
68
- cards: cardsData,
69
- renderCard: renderCard,
70
- keyExtractor: cardKeyExtractor,
33
+ }, childrenArray.length && childrenArray[0]), /*#__PURE__*/React.createElement(DeckSwiperComponent, {
34
+ cards: cardsFillerData,
35
+ renderCard: (_, i) => /*#__PURE__*/React.createElement(React.Fragment, null, childrenArray[i]),
36
+ keyExtractor: card => card === null || card === void 0 ? void 0 : card.toString(),
71
37
  containerStyle: StyleSheet.flatten([styles.cardsContainer, style]),
72
38
  cardStyle: styles.card,
73
39
  onSwiped: onIndexChanged,
@@ -37,6 +37,9 @@ const isWeb = Platform.OS === "web";
37
37
  const unstyledColor = "rgba(165, 173, 183, 1)";
38
38
  const disabledColor = "rgb(240, 240, 240)";
39
39
  const errorColor = "rgba(255, 69, 100, 1)";
40
+
41
+ //Empty string for 'value' is treated as a non-value
42
+ //reason: Draftbit uses empty string as initial value for string state*/
40
43
  const Picker = _ref => {
41
44
  var _find$label, _find;
42
45
  let {
@@ -67,12 +70,12 @@ const Picker = _ref => {
67
70
  setPickerVisible(!pickerVisible);
68
71
  };
69
72
  React.useEffect(() => {
70
- if (value != null) {
73
+ if (value != null && value !== "") {
71
74
  setInternalValue(value);
72
75
  }
73
76
  }, [value]);
74
77
  React.useEffect(() => {
75
- if (defaultValue != null) {
78
+ if (defaultValue != null && defaultValue !== "") {
76
79
  setInternalValue(defaultValue);
77
80
  }
78
81
  }, [defaultValue]);
@@ -87,11 +90,7 @@ const Picker = _ref => {
87
90
  Keyboard.dismiss();
88
91
  }
89
92
  }, [pickerVisible, autoDismissKeyboard]);
90
- const normalizedOptions = normalizeOptions(options);
91
- const pickerOptions = placeholder ? [{
92
- value: placeholder,
93
- label: placeholder
94
- }, ...normalizedOptions] : normalizedOptions;
93
+ const pickerOptions = normalizeOptions(options);
95
94
  const {
96
95
  viewStyles,
97
96
  textStyles
@@ -191,10 +190,10 @@ const Picker = _ref => {
191
190
  } : {})
192
191
  };
193
192
  const handleValueChange = (newValue, itemIndex) => {
194
- if (!placeholder || itemIndex > 0) {
193
+ if (newValue !== "") {
195
194
  onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(newValue, itemIndex);
195
+ setInternalValue(newValue);
196
196
  }
197
- setInternalValue(newValue);
198
197
  };
199
198
  return (
200
199
  /*#__PURE__*/
@@ -4,6 +4,7 @@ import { StyleSheet, ScrollView, View } from "react-native";
4
4
  import { SafeAreaView } from "react-native-safe-area-context";
5
5
  import { withTheme } from "../theming";
6
6
  function ScreenContainer(_ref) {
7
+ var _StyleSheet$flatten;
7
8
  let {
8
9
  scrollable = false,
9
10
  hasSafeArea = false,
@@ -14,7 +15,7 @@ function ScreenContainer(_ref) {
14
15
  children,
15
16
  ...rest
16
17
  } = _ref;
17
- const backgroundColor = theme.colors.background;
18
+ const backgroundColor = ((_StyleSheet$flatten = StyleSheet.flatten(style)) === null || _StyleSheet$flatten === void 0 ? void 0 : _StyleSheet$flatten.backgroundColor) || theme.colors.background;
18
19
  const edges = ["left", "right"];
19
20
  if (hasSafeArea || hasTopSafeArea) {
20
21
  edges.push("top");
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import { StyleProp, ViewStyle } from "react-native";
3
- export interface DeckSwiperProps<T> {
3
+ export interface DeckSwiperProps {
4
4
  onIndexChanged?: (index: number) => void;
5
5
  onEndReached?: () => void;
6
6
  startCardIndex?: number;
@@ -8,14 +8,8 @@ export interface DeckSwiperProps<T> {
8
8
  verticalEnabled?: boolean;
9
9
  horizontalEnabled?: boolean;
10
10
  visibleCardCount?: number;
11
- data?: Array<T>;
12
- keyExtractor?: (item: T) => string;
13
- renderItem?: ({ item, index }: {
14
- item: T;
15
- index: number;
16
- }) => JSX.Element;
17
11
  style?: StyleProp<ViewStyle>;
18
12
  }
19
- declare const DeckSwiper: <T extends object>({ onIndexChanged, onEndReached, startCardIndex, infiniteSwiping, verticalEnabled, horizontalEnabled, visibleCardCount, data, keyExtractor, renderItem, style, children, }: React.PropsWithChildren<DeckSwiperProps<T>>) => JSX.Element;
13
+ declare const DeckSwiper: React.FC<React.PropsWithChildren<DeckSwiperProps>>;
20
14
  export default DeckSwiper;
21
15
  //# sourceMappingURL=DeckSwiper.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DeckSwiper.d.ts","sourceRoot":"","sources":["../../../../../src/components/DeckSwiper/DeckSwiper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,SAAS,EAAoB,MAAM,cAAc,CAAC;AAGtE,MAAM,WAAW,eAAe,CAAC,CAAC;IAChC,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IAChB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,CAAC;IACnC,UAAU,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;QAAE,IAAI,EAAE,CAAC,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,KAAK,GAAG,CAAC,OAAO,CAAC;IAC1E,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED,QAAA,MAAM,UAAU,2PAoGf,CAAC;AAiBF,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"DeckSwiper.d.ts","sourceRoot":"","sources":["../../../../../src/components/DeckSwiper/DeckSwiper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,SAAS,EAAoB,MAAM,cAAc,CAAC;AAGtE,MAAM,WAAW,eAAe;IAC9B,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,eAAe,CAAC,CA6DlE,CAAC;AAiBF,eAAe,UAAU,CAAC"}
@@ -3,10 +3,11 @@ import { StyleProp, ViewStyle } from "react-native";
3
3
  import type { Theme } from "../../styles/DefaultTheme";
4
4
  export interface DeckSwiperCardProps {
5
5
  style?: StyleProp<ViewStyle>;
6
+ children: React.ReactNode;
6
7
  theme: Theme;
7
8
  }
8
- declare const _default: React.ComponentType<import("@draftbit/react-theme-provider").$Without<React.PropsWithChildren<DeckSwiperCardProps>, "theme"> & {
9
+ declare const _default: React.ComponentType<import("@draftbit/react-theme-provider").$Without<DeckSwiperCardProps, "theme"> & {
9
10
  theme?: import("@draftbit/react-theme-provider").$DeepPartial<any> | undefined;
10
- }> & import("@draftbit/react-theme-provider/typings/hoist-non-react-statics").NonReactStatics<React.ComponentType<React.PropsWithChildren<DeckSwiperCardProps>> & React.FC<React.PropsWithChildren<DeckSwiperCardProps>>, {}>;
11
+ }> & import("@draftbit/react-theme-provider/typings/hoist-non-react-statics").NonReactStatics<React.ComponentType<DeckSwiperCardProps> & React.FC<DeckSwiperCardProps>, {}>;
11
12
  export default _default;
12
13
  //# sourceMappingURL=DeckSwiperCard.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DeckSwiperCard.d.ts","sourceRoot":"","sources":["../../../../../src/components/DeckSwiper/DeckSwiperCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAoB,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAGvD,MAAM,WAAW,mBAAmB;IAClC,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,KAAK,EAAE,KAAK,CAAC;CACd;;;;AA6BD,wBAAyC"}
1
+ {"version":3,"file":"DeckSwiperCard.d.ts","sourceRoot":"","sources":["../../../../../src/components/DeckSwiper/DeckSwiperCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAoB,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAGvD,MAAM,WAAW,mBAAmB;IAClC,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,EAAE,KAAK,CAAC;CACd;;;;AA+BD,wBAAyC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Picker.d.ts","sourceRoot":"","sources":["../../../../../src/components/Picker/Picker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAKL,SAAS,EACT,SAAS,EAGV,MAAM,cAAc,CAAC;AAStB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAQtD,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,oBAAY,WAAW,GAAG;IACxB,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,GAAG;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACnD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,YAAY,EAAE,GAAG,MAAM,EAAE,CAAC;IACnC,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IAClC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,OAAO,GAAG,WAAW,CAAC;IAC7B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,KAAK,EAAE,KAAK,CAAC;IACb,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;CACxB,CAAC;;;;AA2aF,wBAAiC"}
1
+ {"version":3,"file":"Picker.d.ts","sourceRoot":"","sources":["../../../../../src/components/Picker/Picker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAKL,SAAS,EACT,SAAS,EAGV,MAAM,cAAc,CAAC;AAStB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAQtD,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,oBAAY,WAAW,GAAG;IACxB,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,GAAG;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACnD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,YAAY,EAAE,GAAG,MAAM,EAAE,CAAC;IACnC,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IAClC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,OAAO,GAAG,WAAW,CAAC;IAC7B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,KAAK,EAAE,KAAK,CAAC;IACb,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;CACxB,CAAC;;;;AAyaF,wBAAiC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ScreenContainer.d.ts","sourceRoot":"","sources":["../../../../src/components/ScreenContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAGL,SAAS,EACT,SAAS,EAEV,MAAM,cAAc,CAAC;AAItB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAEpD,aAAK,oBAAoB,GAAG;IAC1B,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,OAAO,CAAC;IACrB,cAAc,EAAE,OAAO,CAAC;IACxB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,KAAK,EAAE,KAAK,CAAC;IACb,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,CAAC;AAEF,iBAAS,eAAe,CAAC,EACvB,UAAkB,EAClB,WAAmB,EACnB,iBAAyB,EACzB,cAAsB,EACtB,KAAK,EACL,KAAK,EACL,QAAQ,EACR,GAAG,IAAI,EACR,EAAE,oBAAoB,eAwCtB;;;;AAYD,wBAA0C"}
1
+ {"version":3,"file":"ScreenContainer.d.ts","sourceRoot":"","sources":["../../../../src/components/ScreenContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAGL,SAAS,EACT,SAAS,EAEV,MAAM,cAAc,CAAC;AAItB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAEpD,aAAK,oBAAoB,GAAG;IAC1B,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,OAAO,CAAC;IACrB,cAAc,EAAE,OAAO,CAAC;IACxB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,KAAK,EAAE,KAAK,CAAC;IACb,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,CAAC;AAEF,iBAAS,eAAe,CAAC,EACvB,UAAkB,EAClB,WAAmB,EACnB,iBAAyB,EACzB,cAAsB,EACtB,KAAK,EACL,KAAK,EACL,QAAQ,EACR,GAAG,IAAI,EACR,EAAE,oBAAoB,eAyCtB;;;;AAYD,wBAA0C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@draftbit/core",
3
- "version": "46.8.1-2ae5b7.2+2ae5b77",
3
+ "version": "46.8.1-51e99b.2+51e99b7",
4
4
  "description": "Core (non-native) Components",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -41,7 +41,7 @@
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.8.1-2ae5b7.2+2ae5b77",
44
+ "@draftbit/types": "^46.8.1-51e99b.2+51e99b7",
45
45
  "@material-ui/core": "^4.11.0",
46
46
  "@material-ui/pickers": "^3.2.10",
47
47
  "@react-native-community/slider": "4.2.3",
@@ -92,5 +92,5 @@
92
92
  ]
93
93
  ]
94
94
  },
95
- "gitHead": "2ae5b7790dbc8b74522107d35a88801b9c7a5c89"
95
+ "gitHead": "51e99b7793aa55d2311507fe4fa965c16eab5bd5"
96
96
  }
@@ -1,40 +1,10 @@
1
1
  import React from "react";
2
2
  import { StyleSheet, View } from "react-native";
3
3
  import DeckSwiperComponent from "react-native-deck-swiper";
4
- const DeckSwiper = ({ onIndexChanged, onEndReached, startCardIndex = 0, infiniteSwiping = false, verticalEnabled = true, horizontalEnabled = true, visibleCardCount = 1, data, keyExtractor, renderItem, style, children, }) => {
5
- //Both 'renderItem' and 'data' are optional to allow direct children. But if one is included, both need to be included
6
- if ((data && !renderItem) || (renderItem && !data)) {
7
- throw new Error("'renderItem' and 'data' need to both be provided to lazily render. Either remove them entirley or include both");
8
- }
9
- if (data && renderItem && children) {
10
- console.warn("'children' of DeckSwiper ignored due to usage of 'data' and 'renderItem'");
11
- }
4
+ const DeckSwiper = ({ onIndexChanged, onEndReached, startCardIndex = 0, infiniteSwiping = false, verticalEnabled = true, horizontalEnabled = true, visibleCardCount = 1, style, children, }) => {
12
5
  const childrenArray = React.useMemo(() => React.Children.toArray(children), [children]);
13
6
  // an array of indices based on children count
14
7
  const cardsFillerData = React.useMemo(() => Array.from(Array(childrenArray.length).keys()), [childrenArray]);
15
- const cardsData = data || cardsFillerData;
16
- const renderCard = (card, index) => {
17
- if (renderItem) {
18
- return renderItem({ item: card, index });
19
- }
20
- else {
21
- return React.createElement(React.Fragment, null, childrenArray[index]);
22
- }
23
- };
24
- const renderFirstCard = () => {
25
- if (cardsData.length) {
26
- return renderCard(cardsData[0], 0);
27
- }
28
- return undefined;
29
- };
30
- const cardKeyExtractor = (card) => {
31
- if (keyExtractor) {
32
- return keyExtractor(card);
33
- }
34
- else {
35
- return card === null || card === void 0 ? void 0 : card.toString();
36
- }
37
- };
38
8
  /**
39
9
  * By default react-native-deck-swiper positions everything with absolute position.
40
10
  * To overcome this, it is wrapped in a View to be able to add the component in any layout structure.
@@ -45,8 +15,8 @@ const DeckSwiper = ({ onIndexChanged, onEndReached, startCardIndex = 0, infinite
45
15
  * This effectivley makes the default height of the container be the height of the first card.
46
16
  */
47
17
  return (React.createElement(View, null,
48
- React.createElement(View, { style: styles.containerHeightFiller }, renderFirstCard()),
49
- React.createElement(DeckSwiperComponent, { cards: cardsData, renderCard: renderCard, keyExtractor: cardKeyExtractor, containerStyle: StyleSheet.flatten([styles.cardsContainer, style]), cardStyle: styles.card, onSwiped: onIndexChanged, onSwipedAll: onEndReached, cardIndex: startCardIndex, infinite: infiniteSwiping, verticalSwipe: verticalEnabled, horizontalSwipe: horizontalEnabled, showSecondCard: visibleCardCount > 1, stackSize: visibleCardCount, backgroundColor: "transparent", cardVerticalMargin: 0, cardHorizontalMargin: 0 })));
18
+ React.createElement(View, { style: styles.containerHeightFiller }, childrenArray.length && childrenArray[0]),
19
+ React.createElement(DeckSwiperComponent, { cards: cardsFillerData, renderCard: (_, i) => React.createElement(React.Fragment, null, childrenArray[i]), keyExtractor: (card) => card === null || card === void 0 ? void 0 : card.toString(), containerStyle: StyleSheet.flatten([styles.cardsContainer, style]), cardStyle: styles.card, onSwiped: onIndexChanged, onSwipedAll: onEndReached, cardIndex: startCardIndex, infinite: infiniteSwiping, verticalSwipe: verticalEnabled, horizontalSwipe: horizontalEnabled, showSecondCard: visibleCardCount > 1, stackSize: visibleCardCount, backgroundColor: "transparent", cardVerticalMargin: 0, cardHorizontalMargin: 0 })));
50
20
  };
51
21
  const styles = StyleSheet.create({
52
22
  cardsContainer: {
@@ -2,7 +2,7 @@ import React from "react";
2
2
  import { StyleProp, ViewStyle, StyleSheet, View } from "react-native";
3
3
  import DeckSwiperComponent from "react-native-deck-swiper";
4
4
 
5
- export interface DeckSwiperProps<T> {
5
+ export interface DeckSwiperProps {
6
6
  onIndexChanged?: (index: number) => void;
7
7
  onEndReached?: () => void;
8
8
  startCardIndex?: number;
@@ -10,13 +10,10 @@ export interface DeckSwiperProps<T> {
10
10
  verticalEnabled?: boolean;
11
11
  horizontalEnabled?: boolean;
12
12
  visibleCardCount?: number;
13
- data?: Array<T>;
14
- keyExtractor?: (item: T) => string;
15
- renderItem?: ({ item, index }: { item: T; index: number }) => JSX.Element;
16
13
  style?: StyleProp<ViewStyle>;
17
14
  }
18
15
 
19
- const DeckSwiper = <T extends object>({
16
+ const DeckSwiper: React.FC<React.PropsWithChildren<DeckSwiperProps>> = ({
20
17
  onIndexChanged,
21
18
  onEndReached,
22
19
  startCardIndex = 0,
@@ -24,25 +21,9 @@ const DeckSwiper = <T extends object>({
24
21
  verticalEnabled = true,
25
22
  horizontalEnabled = true,
26
23
  visibleCardCount = 1,
27
- data,
28
- keyExtractor,
29
- renderItem,
30
24
  style,
31
25
  children,
32
- }: React.PropsWithChildren<DeckSwiperProps<T>>) => {
33
- //Both 'renderItem' and 'data' are optional to allow direct children. But if one is included, both need to be included
34
- if ((data && !renderItem) || (renderItem && !data)) {
35
- throw new Error(
36
- "'renderItem' and 'data' need to both be provided to lazily render. Either remove them entirley or include both"
37
- );
38
- }
39
-
40
- if (data && renderItem && children) {
41
- console.warn(
42
- "'children' of DeckSwiper ignored due to usage of 'data' and 'renderItem'"
43
- );
44
- }
45
-
26
+ }) => {
46
27
  const childrenArray = React.useMemo(
47
28
  () => React.Children.toArray(children),
48
29
  [children]
@@ -54,31 +35,6 @@ const DeckSwiper = <T extends object>({
54
35
  [childrenArray]
55
36
  );
56
37
 
57
- const cardsData = data || cardsFillerData;
58
-
59
- const renderCard = (card: any, index: number): JSX.Element => {
60
- if (renderItem) {
61
- return renderItem({ item: card, index });
62
- } else {
63
- return <>{childrenArray[index]}</>;
64
- }
65
- };
66
-
67
- const renderFirstCard = (): JSX.Element | undefined => {
68
- if (cardsData.length) {
69
- return renderCard(cardsData[0], 0);
70
- }
71
- return undefined;
72
- };
73
-
74
- const cardKeyExtractor = (card: any) => {
75
- if (keyExtractor) {
76
- return keyExtractor(card);
77
- } else {
78
- return card?.toString();
79
- }
80
- };
81
-
82
38
  /**
83
39
  * By default react-native-deck-swiper positions everything with absolute position.
84
40
  * To overcome this, it is wrapped in a View to be able to add the component in any layout structure.
@@ -91,11 +47,13 @@ const DeckSwiper = <T extends object>({
91
47
 
92
48
  return (
93
49
  <View>
94
- <View style={styles.containerHeightFiller}>{renderFirstCard()}</View>
50
+ <View style={styles.containerHeightFiller}>
51
+ {childrenArray.length && childrenArray[0]}
52
+ </View>
95
53
  <DeckSwiperComponent
96
- cards={cardsData as any[]}
97
- renderCard={renderCard}
98
- keyExtractor={cardKeyExtractor}
54
+ cards={cardsFillerData}
55
+ renderCard={(_, i) => <>{childrenArray[i]}</>}
56
+ keyExtractor={(card) => card?.toString()}
99
57
  containerStyle={
100
58
  StyleSheet.flatten([styles.cardsContainer, style]) as
101
59
  | object
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { View, StyleSheet } from "react-native";
3
3
  import { withTheme } from "../../theming";
4
- const DeckSwiperCard = ({ style, children, theme }) => (React.createElement(View, { style: [
4
+ const DeckSwiperCard = ({ style, children, theme, }) => (React.createElement(View, { style: [
5
5
  styles.card,
6
6
  {
7
7
  backgroundColor: theme.colors.background,
@@ -5,12 +5,15 @@ import { withTheme } from "../../theming";
5
5
 
6
6
  export interface DeckSwiperCardProps {
7
7
  style?: StyleProp<ViewStyle>;
8
+ children: React.ReactNode;
8
9
  theme: Theme;
9
10
  }
10
11
 
11
- const DeckSwiperCard: React.FC<
12
- React.PropsWithChildren<DeckSwiperCardProps>
13
- > = ({ style, children, theme }) => (
12
+ const DeckSwiperCard: React.FC<DeckSwiperCardProps> = ({
13
+ style,
14
+ children,
15
+ theme,
16
+ }) => (
14
17
  <View
15
18
  style={[
16
19
  styles.card,
@@ -36,6 +36,8 @@ const isWeb = Platform.OS === "web";
36
36
  const unstyledColor = "rgba(165, 173, 183, 1)";
37
37
  const disabledColor = "rgb(240, 240, 240)";
38
38
  const errorColor = "rgba(255, 69, 100, 1)";
39
+ //Empty string for 'value' is treated as a non-value
40
+ //reason: Draftbit uses empty string as initial value for string state*/
39
41
  const Picker = ({ error, options = [], onValueChange, defaultValue, Icon, style, placeholder, value, disabled = false, assistiveText, label, iconColor = unstyledColor, iconSize = 24, leftIconMode = "inset", leftIconName, placeholderTextColor = unstyledColor, rightIconName, type = "solid", autoDismissKeyboard = true, }) => {
40
42
  var _a, _b;
41
43
  const androidPickerRef = React.useRef(undefined);
@@ -45,12 +47,12 @@ const Picker = ({ error, options = [], onValueChange, defaultValue, Icon, style,
45
47
  setPickerVisible(!pickerVisible);
46
48
  };
47
49
  React.useEffect(() => {
48
- if (value != null) {
50
+ if (value != null && value !== "") {
49
51
  setInternalValue(value);
50
52
  }
51
53
  }, [value]);
52
54
  React.useEffect(() => {
53
- if (defaultValue != null) {
55
+ if (defaultValue != null && defaultValue !== "") {
54
56
  setInternalValue(defaultValue);
55
57
  }
56
58
  }, [defaultValue]);
@@ -65,10 +67,7 @@ const Picker = ({ error, options = [], onValueChange, defaultValue, Icon, style,
65
67
  Keyboard.dismiss();
66
68
  }
67
69
  }, [pickerVisible, autoDismissKeyboard]);
68
- const normalizedOptions = normalizeOptions(options);
69
- const pickerOptions = placeholder
70
- ? [{ value: placeholder, label: placeholder }, ...normalizedOptions]
71
- : normalizedOptions;
70
+ const pickerOptions = normalizeOptions(options);
72
71
  const { viewStyles, textStyles } = extractStyles(style);
73
72
  const additionalBorderStyles = ["backgroundColor"];
74
73
  const additionalMarginStyles = [
@@ -163,10 +162,10 @@ const Picker = ({ error, options = [], onValueChange, defaultValue, Icon, style,
163
162
  ...(disabled ? { color: unstyledColor } : {}),
164
163
  };
165
164
  const handleValueChange = (newValue, itemIndex) => {
166
- if (!placeholder || itemIndex > 0) {
165
+ if (newValue !== "") {
167
166
  onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(newValue, itemIndex);
167
+ setInternalValue(newValue);
168
168
  }
169
- setInternalValue(newValue);
170
169
  };
171
170
  return (
172
171
  /* marginsContainer */
@@ -92,6 +92,8 @@ const unstyledColor = "rgba(165, 173, 183, 1)";
92
92
  const disabledColor = "rgb(240, 240, 240)";
93
93
  const errorColor = "rgba(255, 69, 100, 1)";
94
94
 
95
+ //Empty string for 'value' is treated as a non-value
96
+ //reason: Draftbit uses empty string as initial value for string state*/
95
97
  const Picker: React.FC<PickerProps> = ({
96
98
  error,
97
99
  options = [],
@@ -126,13 +128,13 @@ const Picker: React.FC<PickerProps> = ({
126
128
  };
127
129
 
128
130
  React.useEffect(() => {
129
- if (value != null) {
131
+ if (value != null && value !== "") {
130
132
  setInternalValue(value);
131
133
  }
132
134
  }, [value]);
133
135
 
134
136
  React.useEffect(() => {
135
- if (defaultValue != null) {
137
+ if (defaultValue != null && defaultValue !== "") {
136
138
  setInternalValue(defaultValue);
137
139
  }
138
140
  }, [defaultValue]);
@@ -149,11 +151,7 @@ const Picker: React.FC<PickerProps> = ({
149
151
  }
150
152
  }, [pickerVisible, autoDismissKeyboard]);
151
153
 
152
- const normalizedOptions = normalizeOptions(options);
153
-
154
- const pickerOptions = placeholder
155
- ? [{ value: placeholder, label: placeholder }, ...normalizedOptions]
156
- : normalizedOptions;
154
+ const pickerOptions = normalizeOptions(options);
157
155
 
158
156
  const { viewStyles, textStyles } = extractStyles(style);
159
157
 
@@ -304,10 +302,10 @@ const Picker: React.FC<PickerProps> = ({
304
302
  };
305
303
 
306
304
  const handleValueChange = (newValue: string, itemIndex: number) => {
307
- if (!placeholder || itemIndex > 0) {
305
+ if (newValue !== "") {
308
306
  onValueChange?.(newValue, itemIndex);
307
+ setInternalValue(newValue);
309
308
  }
310
- setInternalValue(newValue);
311
309
  };
312
310
 
313
311
  return (
@@ -3,7 +3,8 @@ import { StyleSheet, ScrollView, View, } from "react-native";
3
3
  import { SafeAreaView } from "react-native-safe-area-context";
4
4
  import { withTheme } from "../theming";
5
5
  function ScreenContainer({ scrollable = false, hasSafeArea = false, hasBottomSafeArea = false, hasTopSafeArea = false, theme, style, children, ...rest }) {
6
- const backgroundColor = theme.colors.background;
6
+ var _a;
7
+ const backgroundColor = ((_a = StyleSheet.flatten(style)) === null || _a === void 0 ? void 0 : _a.backgroundColor) || theme.colors.background;
7
8
  const edges = ["left", "right"];
8
9
  if (hasSafeArea || hasTopSafeArea) {
9
10
  edges.push("top");
@@ -31,7 +31,8 @@ function ScreenContainer({
31
31
  children,
32
32
  ...rest
33
33
  }: ScreenContainerProps) {
34
- const backgroundColor = theme.colors.background;
34
+ const backgroundColor =
35
+ StyleSheet.flatten(style)?.backgroundColor || theme.colors.background;
35
36
 
36
37
  const edges: Edge[] = ["left", "right"];
37
38
  if (hasSafeArea || hasTopSafeArea) {