@draftbit/core 48.3.1-264395.2 → 48.3.2-fab3b7.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 (62) hide show
  1. package/lib/commonjs/components/DeckSwiper/DeckSwiper.js +1 -1
  2. package/lib/commonjs/components/MediaPlayer/MediaPlaybackWrapper.js +1 -1
  3. package/lib/commonjs/components/MediaPlayer/VideoPlayer/VideoPlayer.js +1 -1
  4. package/lib/commonjs/components/SectionList/SectionList.js +1 -1
  5. package/lib/commonjs/components/SwipeableItem/SwipeableItem.js +1 -1
  6. package/lib/commonjs/components/Swiper/Swiper.js +1 -1
  7. package/lib/commonjs/components/TabView/TabView.js +1 -1
  8. package/lib/commonjs/components/Table/Table.js +1 -1
  9. package/lib/commonjs/utilities.js +1 -1
  10. package/lib/typescript/src/components/DeckSwiper/DeckSwiper.js +1 -1
  11. package/lib/typescript/src/components/DeckSwiper/DeckSwiper.js.map +1 -1
  12. package/lib/typescript/src/components/MediaPlayer/MediaPlaybackWrapper.js +11 -1
  13. package/lib/typescript/src/components/MediaPlayer/MediaPlaybackWrapper.js.map +1 -1
  14. package/lib/typescript/src/components/MediaPlayer/MediaPlayerCommon.d.ts +2 -0
  15. package/lib/typescript/src/components/MediaPlayer/MediaPlayerCommon.js.map +1 -1
  16. package/lib/typescript/src/components/MediaPlayer/VideoPlayer/VideoPlayer.js +3 -1
  17. package/lib/typescript/src/components/MediaPlayer/VideoPlayer/VideoPlayer.js.map +1 -1
  18. package/lib/typescript/src/components/SectionList/SectionList.js +3 -2
  19. package/lib/typescript/src/components/SectionList/SectionList.js.map +1 -1
  20. package/lib/typescript/src/components/SwipeableItem/SwipeableItem.js +5 -4
  21. package/lib/typescript/src/components/SwipeableItem/SwipeableItem.js.map +1 -1
  22. package/lib/typescript/src/components/Swiper/Swiper.js +1 -1
  23. package/lib/typescript/src/components/Swiper/Swiper.js.map +1 -1
  24. package/lib/typescript/src/components/TabView/TabView.d.ts +1 -0
  25. package/lib/typescript/src/components/TabView/TabView.js +5 -4
  26. package/lib/typescript/src/components/TabView/TabView.js.map +1 -1
  27. package/lib/typescript/src/components/Table/Table.js +1 -1
  28. package/lib/typescript/src/components/Table/Table.js.map +1 -1
  29. package/lib/typescript/src/utilities.d.ts +2 -0
  30. package/lib/typescript/src/utilities.js +13 -0
  31. package/lib/typescript/src/utilities.js.map +1 -1
  32. package/lib/typescript/tsconfig.tsbuildinfo +1 -1
  33. package/package.json +3 -3
  34. package/src/components/DeckSwiper/DeckSwiper.js +1 -1
  35. package/src/components/DeckSwiper/DeckSwiper.js.map +1 -1
  36. package/src/components/DeckSwiper/DeckSwiper.tsx +1 -1
  37. package/src/components/MediaPlayer/MediaPlaybackWrapper.js +11 -1
  38. package/src/components/MediaPlayer/MediaPlaybackWrapper.js.map +1 -1
  39. package/src/components/MediaPlayer/MediaPlaybackWrapper.tsx +13 -1
  40. package/src/components/MediaPlayer/MediaPlayerCommon.js.map +1 -1
  41. package/src/components/MediaPlayer/MediaPlayerCommon.ts +2 -0
  42. package/src/components/MediaPlayer/VideoPlayer/VideoPlayer.js +3 -1
  43. package/src/components/MediaPlayer/VideoPlayer/VideoPlayer.js.map +1 -1
  44. package/src/components/MediaPlayer/VideoPlayer/VideoPlayer.tsx +2 -0
  45. package/src/components/SectionList/SectionList.js +3 -2
  46. package/src/components/SectionList/SectionList.js.map +1 -1
  47. package/src/components/SectionList/SectionList.tsx +8 -3
  48. package/src/components/SwipeableItem/SwipeableItem.js +5 -4
  49. package/src/components/SwipeableItem/SwipeableItem.js.map +1 -1
  50. package/src/components/SwipeableItem/SwipeableItem.tsx +13 -3
  51. package/src/components/Swiper/Swiper.js +1 -1
  52. package/src/components/Swiper/Swiper.js.map +1 -1
  53. package/src/components/Swiper/Swiper.tsx +1 -1
  54. package/src/components/TabView/TabView.js +5 -4
  55. package/src/components/TabView/TabView.js.map +1 -1
  56. package/src/components/TabView/TabView.tsx +14 -4
  57. package/src/components/Table/Table.js +1 -1
  58. package/src/components/Table/Table.js.map +1 -1
  59. package/src/components/Table/Table.tsx +1 -1
  60. package/src/utilities.js +13 -0
  61. package/src/utilities.js.map +1 -1
  62. package/src/utilities.ts +19 -0
package/src/utilities.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import React from "react";
1
2
  import { StyleSheet, StyleProp, TextStyle } from "react-native";
2
3
  import { isString, isNumber, pick, pickBy, identity } from "lodash";
3
4
 
@@ -228,3 +229,21 @@ export function getValueForRadioButton(value: string | number) {
228
229
  throw new Error(`Invalid value: ${value}`);
229
230
  }
230
231
  }
232
+
233
+ // This is done to ensure that operations that depend on a particular child type still work even when wrapped in a react fragment (ex: .type checks or prop extraction of child)
234
+ // Wrapping in a fragment can happen in Draftbit when a component is wrapped in a conditional for example or inside a Fetch component
235
+ export function extractIfNestedInFragment(
236
+ component: React.ReactElement
237
+ ): React.ReactElement {
238
+ if (component.type === React.Fragment) {
239
+ const children = React.Children.toArray(
240
+ (component.props as any)?.children
241
+ ) as React.ReactElement[];
242
+
243
+ if (children.length === 1) {
244
+ return children[0];
245
+ }
246
+ }
247
+
248
+ return component;
249
+ }