@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.
- package/lib/commonjs/components/DeckSwiper/DeckSwiper.js +1 -1
- package/lib/commonjs/components/MediaPlayer/MediaPlaybackWrapper.js +1 -1
- package/lib/commonjs/components/MediaPlayer/VideoPlayer/VideoPlayer.js +1 -1
- package/lib/commonjs/components/SectionList/SectionList.js +1 -1
- package/lib/commonjs/components/SwipeableItem/SwipeableItem.js +1 -1
- package/lib/commonjs/components/Swiper/Swiper.js +1 -1
- package/lib/commonjs/components/TabView/TabView.js +1 -1
- package/lib/commonjs/components/Table/Table.js +1 -1
- package/lib/commonjs/utilities.js +1 -1
- package/lib/typescript/src/components/DeckSwiper/DeckSwiper.js +1 -1
- package/lib/typescript/src/components/DeckSwiper/DeckSwiper.js.map +1 -1
- package/lib/typescript/src/components/MediaPlayer/MediaPlaybackWrapper.js +11 -1
- package/lib/typescript/src/components/MediaPlayer/MediaPlaybackWrapper.js.map +1 -1
- package/lib/typescript/src/components/MediaPlayer/MediaPlayerCommon.d.ts +2 -0
- package/lib/typescript/src/components/MediaPlayer/MediaPlayerCommon.js.map +1 -1
- package/lib/typescript/src/components/MediaPlayer/VideoPlayer/VideoPlayer.js +3 -1
- package/lib/typescript/src/components/MediaPlayer/VideoPlayer/VideoPlayer.js.map +1 -1
- package/lib/typescript/src/components/SectionList/SectionList.js +3 -2
- package/lib/typescript/src/components/SectionList/SectionList.js.map +1 -1
- package/lib/typescript/src/components/SwipeableItem/SwipeableItem.js +5 -4
- package/lib/typescript/src/components/SwipeableItem/SwipeableItem.js.map +1 -1
- package/lib/typescript/src/components/Swiper/Swiper.js +1 -1
- package/lib/typescript/src/components/Swiper/Swiper.js.map +1 -1
- package/lib/typescript/src/components/TabView/TabView.d.ts +1 -0
- package/lib/typescript/src/components/TabView/TabView.js +5 -4
- package/lib/typescript/src/components/TabView/TabView.js.map +1 -1
- package/lib/typescript/src/components/Table/Table.js +1 -1
- package/lib/typescript/src/components/Table/Table.js.map +1 -1
- package/lib/typescript/src/utilities.d.ts +2 -0
- package/lib/typescript/src/utilities.js +13 -0
- package/lib/typescript/src/utilities.js.map +1 -1
- package/lib/typescript/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/components/DeckSwiper/DeckSwiper.js +1 -1
- package/src/components/DeckSwiper/DeckSwiper.js.map +1 -1
- package/src/components/DeckSwiper/DeckSwiper.tsx +1 -1
- package/src/components/MediaPlayer/MediaPlaybackWrapper.js +11 -1
- package/src/components/MediaPlayer/MediaPlaybackWrapper.js.map +1 -1
- package/src/components/MediaPlayer/MediaPlaybackWrapper.tsx +13 -1
- package/src/components/MediaPlayer/MediaPlayerCommon.js.map +1 -1
- package/src/components/MediaPlayer/MediaPlayerCommon.ts +2 -0
- package/src/components/MediaPlayer/VideoPlayer/VideoPlayer.js +3 -1
- package/src/components/MediaPlayer/VideoPlayer/VideoPlayer.js.map +1 -1
- package/src/components/MediaPlayer/VideoPlayer/VideoPlayer.tsx +2 -0
- package/src/components/SectionList/SectionList.js +3 -2
- package/src/components/SectionList/SectionList.js.map +1 -1
- package/src/components/SectionList/SectionList.tsx +8 -3
- package/src/components/SwipeableItem/SwipeableItem.js +5 -4
- package/src/components/SwipeableItem/SwipeableItem.js.map +1 -1
- package/src/components/SwipeableItem/SwipeableItem.tsx +13 -3
- package/src/components/Swiper/Swiper.js +1 -1
- package/src/components/Swiper/Swiper.js.map +1 -1
- package/src/components/Swiper/Swiper.tsx +1 -1
- package/src/components/TabView/TabView.js +5 -4
- package/src/components/TabView/TabView.js.map +1 -1
- package/src/components/TabView/TabView.tsx +14 -4
- package/src/components/Table/Table.js +1 -1
- package/src/components/Table/Table.js.map +1 -1
- package/src/components/Table/Table.tsx +1 -1
- package/src/utilities.js +13 -0
- package/src/utilities.js.map +1 -1
- 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
|
+
}
|