@draftbit/core 54.0.3 → 54.0.4-6c949a.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/typescript/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -4
- package/src/Provider.js +0 -10
- package/src/Provider.js.map +0 -1
- package/src/components/AccordionGroup.js +0 -51
- package/src/components/AccordionGroup.js.map +0 -1
- package/src/components/ActionSheet/ActionSheet.js +0 -46
- package/src/components/ActionSheet/ActionSheet.js.map +0 -1
- package/src/components/ActionSheet/ActionSheetCancel.js +0 -7
- package/src/components/ActionSheet/ActionSheetCancel.js.map +0 -1
- package/src/components/ActionSheet/ActionSheetItem.js +0 -31
- package/src/components/ActionSheet/ActionSheetItem.js.map +0 -1
- package/src/components/ActionSheet/index.js +0 -4
- package/src/components/ActionSheet/index.js.map +0 -1
- package/src/components/AspectRatio.js +0 -19
- package/src/components/AspectRatio.js.map +0 -1
- package/src/components/BottomSheet/BottomSheet.js +0 -76
- package/src/components/BottomSheet/BottomSheet.js.map +0 -1
- package/src/components/BottomSheet/index.js +0 -2
- package/src/components/BottomSheet/index.js.map +0 -1
- package/src/components/Button.js +0 -119
- package/src/components/Button.js.map +0 -1
- package/src/components/Checkbox/Checkbox.js +0 -63
- package/src/components/Checkbox/Checkbox.js.map +0 -1
- package/src/components/Checkbox/CheckboxGroupRow.js +0 -77
- package/src/components/Checkbox/CheckboxGroupRow.js.map +0 -1
- package/src/components/Checkbox/CheckboxRow.js +0 -79
- package/src/components/Checkbox/CheckboxRow.js.map +0 -1
- package/src/components/Checkbox/context.js +0 -15
- package/src/components/Checkbox/context.js.map +0 -1
- package/src/components/Checkbox/index.js +0 -3
- package/src/components/Checkbox/index.js.map +0 -1
- package/src/components/Config.js +0 -65
- package/src/components/Config.js.map +0 -1
- package/src/components/DatePicker/DatePicker.js +0 -418
- package/src/components/DatePicker/DatePicker.js.map +0 -1
- package/src/components/DatePicker/DatePickerComponent.js +0 -17
- package/src/components/DatePicker/DatePickerComponent.js.map +0 -1
- package/src/components/DatePicker/DatePickerComponent.web.js +0 -57
- package/src/components/DatePicker/DatePickerComponent.web.js.map +0 -1
- package/src/components/DatePicker/DatePickerComponentType.js +0 -2
- package/src/components/DatePicker/DatePickerComponentType.js.map +0 -1
- package/src/components/DatePicker/parseDate.js +0 -12
- package/src/components/DatePicker/parseDate.js.map +0 -1
- package/src/components/DeckSwiper/DeckSwiper.js +0 -116
- package/src/components/DeckSwiper/DeckSwiper.js.map +0 -1
- package/src/components/DeckSwiper/DeckSwiperCard.js +0 -21
- package/src/components/DeckSwiper/DeckSwiperCard.js.map +0 -1
- package/src/components/DeckSwiper/index.js +0 -3
- package/src/components/DeckSwiper/index.js.map +0 -1
- package/src/components/Divider.js +0 -14
- package/src/components/Divider.js.map +0 -1
- package/src/components/Elevation.js +0 -20
- package/src/components/Elevation.js.map +0 -1
- package/src/components/ExpoImage.js +0 -44
- package/src/components/ExpoImage.js.map +0 -1
- package/src/components/FlatList.js +0 -7
- package/src/components/FlatList.js.map +0 -1
- package/src/components/FormRow.js +0 -20
- package/src/components/FormRow.js.map +0 -1
- package/src/components/IconButton.js +0 -36
- package/src/components/IconButton.js.map +0 -1
- package/src/components/Image.js +0 -48
- package/src/components/Image.js.map +0 -1
- package/src/components/KeyboardAvoidingView.js +0 -29
- package/src/components/KeyboardAvoidingView.js.map +0 -1
- package/src/components/Layout/AspectRatio.js +0 -7
- package/src/components/Layout/AspectRatio.js.map +0 -1
- package/src/components/Layout/Center.js +0 -15
- package/src/components/Layout/Center.js.map +0 -1
- package/src/components/Layout/Circle.js +0 -16
- package/src/components/Layout/Circle.js.map +0 -1
- package/src/components/Layout/HStack.js +0 -12
- package/src/components/Layout/HStack.js.map +0 -1
- package/src/components/Layout/LayoutCommon.js +0 -8
- package/src/components/Layout/LayoutCommon.js.map +0 -1
- package/src/components/Layout/Spacer.js +0 -15
- package/src/components/Layout/Spacer.js.map +0 -1
- package/src/components/Layout/Square.js +0 -25
- package/src/components/Layout/Square.js.map +0 -1
- package/src/components/Layout/VStack.js +0 -12
- package/src/components/Layout/VStack.js.map +0 -1
- package/src/components/Layout/ZStack.js +0 -58
- package/src/components/Layout/ZStack.js.map +0 -1
- package/src/components/Layout/index.js +0 -9
- package/src/components/Layout/index.js.map +0 -1
- package/src/components/LoadingIndicator.js +0 -38
- package/src/components/LoadingIndicator.js.map +0 -1
- package/src/components/LottieAnimation.js +0 -12
- package/src/components/LottieAnimation.js.map +0 -1
- package/src/components/Markdown.js +0 -33
- package/src/components/Markdown.js.map +0 -1
- package/src/components/MediaPlayer/AudioPlayer/AudioPlayerCommon.js +0 -2
- package/src/components/MediaPlayer/AudioPlayer/AudioPlayerCommon.js.map +0 -1
- package/src/components/MediaPlayer/AudioPlayer/AudioPlayerWithInterface.js +0 -123
- package/src/components/MediaPlayer/AudioPlayer/AudioPlayerWithInterface.js.map +0 -1
- package/src/components/MediaPlayer/AudioPlayer/HeadlessAudioPlayer.js +0 -90
- package/src/components/MediaPlayer/AudioPlayer/HeadlessAudioPlayer.js.map +0 -1
- package/src/components/MediaPlayer/AudioPlayer/index.js +0 -13
- package/src/components/MediaPlayer/AudioPlayer/index.js.map +0 -1
- package/src/components/MediaPlayer/MediaPlaybackWrapper.js +0 -42
- package/src/components/MediaPlayer/MediaPlaybackWrapper.js.map +0 -1
- package/src/components/MediaPlayer/MediaPlayerCommon.js +0 -71
- package/src/components/MediaPlayer/MediaPlayerCommon.js.map +0 -1
- package/src/components/MediaPlayer/VideoPlayer/VideoPlayer.js +0 -109
- package/src/components/MediaPlayer/VideoPlayer/VideoPlayer.js.map +0 -1
- package/src/components/MediaPlayer/VideoPlayer/index.js +0 -2
- package/src/components/MediaPlayer/VideoPlayer/index.js.map +0 -1
- package/src/components/NumberInput.js +0 -63
- package/src/components/NumberInput.js.map +0 -1
- package/src/components/Picker/NativePicker.ios.js +0 -77
- package/src/components/Picker/NativePicker.ios.js.map +0 -1
- package/src/components/Picker/NativePicker.js +0 -73
- package/src/components/Picker/NativePicker.js.map +0 -1
- package/src/components/Picker/PickerCommon.js +0 -36
- package/src/components/Picker/PickerCommon.js.map +0 -1
- package/src/components/Picker/PickerInputContainer.js +0 -36
- package/src/components/Picker/PickerInputContainer.js.map +0 -1
- package/src/components/Picker/dropdown/DropDownModalPicker.js +0 -70
- package/src/components/Picker/dropdown/DropDownModalPicker.js.map +0 -1
- package/src/components/Picker/dropdown/DropDownPicker.js +0 -61
- package/src/components/Picker/dropdown/DropDownPicker.js.map +0 -1
- package/src/components/Picker/dropdown/MultiSelectPicker.js +0 -9
- package/src/components/Picker/dropdown/MultiSelectPicker.js.map +0 -1
- package/src/components/Picker/dropdown/PickerItem.js +0 -9
- package/src/components/Picker/dropdown/PickerItem.js.map +0 -1
- package/src/components/Picker/index.js +0 -22
- package/src/components/Picker/index.js.map +0 -1
- package/src/components/PinInput/CustomPinInputCell.js +0 -11
- package/src/components/PinInput/CustomPinInputCell.js.map +0 -1
- package/src/components/PinInput/PinInput.js +0 -89
- package/src/components/PinInput/PinInput.js.map +0 -1
- package/src/components/PinInput/PinInputText.js +0 -14
- package/src/components/PinInput/PinInputText.js.map +0 -1
- package/src/components/PinInput/index.js +0 -4
- package/src/components/PinInput/index.js.map +0 -1
- package/src/components/Portal/Portal.js +0 -34
- package/src/components/Portal/Portal.js.map +0 -1
- package/src/components/Portal/PortalConsumer.js +0 -28
- package/src/components/Portal/PortalConsumer.js.map +0 -1
- package/src/components/Portal/PortalHost.js +0 -109
- package/src/components/Portal/PortalHost.js.map +0 -1
- package/src/components/Portal/PortalManager.js +0 -33
- package/src/components/Portal/PortalManager.js.map +0 -1
- package/src/components/Pressable.js +0 -23
- package/src/components/Pressable.js.map +0 -1
- package/src/components/Progress/CircularProgress/CircularProgress.js +0 -103
- package/src/components/Progress/CircularProgress/CircularProgress.js.map +0 -1
- package/src/components/Progress/CircularProgress/index.js +0 -14
- package/src/components/Progress/CircularProgress/index.js.map +0 -1
- package/src/components/Progress/IndeterminateProgress.js +0 -39
- package/src/components/Progress/IndeterminateProgress.js.map +0 -1
- package/src/components/Progress/LinearProgress/LinearProgress.js +0 -57
- package/src/components/Progress/LinearProgress/LinearProgress.js.map +0 -1
- package/src/components/Progress/LinearProgress/index.js +0 -14
- package/src/components/Progress/LinearProgress/index.js.map +0 -1
- package/src/components/Progress/ProgressCommon.js +0 -2
- package/src/components/Progress/ProgressCommon.js.map +0 -1
- package/src/components/ProgressIndicator.js +0 -28
- package/src/components/ProgressIndicator.js.map +0 -1
- package/src/components/RadioButton/RadioButton.js +0 -18
- package/src/components/RadioButton/RadioButton.js.map +0 -1
- package/src/components/RadioButton/RadioButtonGroup.js +0 -44
- package/src/components/RadioButton/RadioButtonGroup.js.map +0 -1
- package/src/components/RadioButton/RadioButtonRow.js +0 -79
- package/src/components/RadioButton/RadioButtonRow.js.map +0 -1
- package/src/components/RadioButton/context.js +0 -15
- package/src/components/RadioButton/context.js.map +0 -1
- package/src/components/RadioButton/index.js +0 -4
- package/src/components/RadioButton/index.js.map +0 -1
- package/src/components/Row.js +0 -49
- package/src/components/Row.js.map +0 -1
- package/src/components/SVG.js +0 -8
- package/src/components/SVG.js.map +0 -1
- package/src/components/SVG.native.js +0 -10
- package/src/components/SVG.native.js.map +0 -1
- package/src/components/ScreenContainer.js +0 -42
- package/src/components/ScreenContainer.js.map +0 -1
- package/src/components/SectionList/SectionHeader.js +0 -14
- package/src/components/SectionList/SectionHeader.js.map +0 -1
- package/src/components/SectionList/SectionList.js +0 -111
- package/src/components/SectionList/SectionList.js.map +0 -1
- package/src/components/SectionList/index.js +0 -3
- package/src/components/SectionList/index.js.map +0 -1
- package/src/components/Shadow.js +0 -26
- package/src/components/Shadow.js.map +0 -1
- package/src/components/SimpleStyleScrollables/SimpleStyleFlashList.js +0 -13
- package/src/components/SimpleStyleScrollables/SimpleStyleFlashList.js.map +0 -1
- package/src/components/SimpleStyleScrollables/SimpleStyleFlatList.js +0 -13
- package/src/components/SimpleStyleScrollables/SimpleStyleFlatList.js.map +0 -1
- package/src/components/SimpleStyleScrollables/SimpleStyleKeyboardAwareScrollView.js +0 -13
- package/src/components/SimpleStyleScrollables/SimpleStyleKeyboardAwareScrollView.js.map +0 -1
- package/src/components/SimpleStyleScrollables/SimpleStyleMasonryFlashList.js +0 -13
- package/src/components/SimpleStyleScrollables/SimpleStyleMasonryFlashList.js.map +0 -1
- package/src/components/SimpleStyleScrollables/SimpleStyleScrollView.js +0 -13
- package/src/components/SimpleStyleScrollables/SimpleStyleScrollView.js.map +0 -1
- package/src/components/SimpleStyleScrollables/SimpleStyleSectionList.js +0 -15
- package/src/components/SimpleStyleScrollables/SimpleStyleSectionList.js.map +0 -1
- package/src/components/SimpleStyleScrollables/SimpleStyleSwipeableList.js +0 -15
- package/src/components/SimpleStyleScrollables/SimpleStyleSwipeableList.js.map +0 -1
- package/src/components/SimpleStyleScrollables/useSplitContentContainerStyles.js +0 -91
- package/src/components/SimpleStyleScrollables/useSplitContentContainerStyles.js.map +0 -1
- package/src/components/Slider.js +0 -84
- package/src/components/Slider.js.map +0 -1
- package/src/components/StarRating.js +0 -51
- package/src/components/StarRating.js.map +0 -1
- package/src/components/StepIndicator.js +0 -347
- package/src/components/StepIndicator.js.map +0 -1
- package/src/components/Stepper.js +0 -43
- package/src/components/Stepper.js.map +0 -1
- package/src/components/Surface.js +0 -55
- package/src/components/Surface.js.map +0 -1
- package/src/components/SwipeableItem/SwipeableItem.js +0 -124
- package/src/components/SwipeableItem/SwipeableItem.js.map +0 -1
- package/src/components/SwipeableItem/SwipeableItemButton.js +0 -6
- package/src/components/SwipeableItem/SwipeableItemButton.js.map +0 -1
- package/src/components/SwipeableItem/SwipeableItemCommon.js +0 -44
- package/src/components/SwipeableItem/SwipeableItemCommon.js.map +0 -1
- package/src/components/SwipeableItem/SwipeableList.js +0 -29
- package/src/components/SwipeableItem/SwipeableList.js.map +0 -1
- package/src/components/SwipeableItem/index.js +0 -4
- package/src/components/SwipeableItem/index.js.map +0 -1
- package/src/components/Swiper/Swiper.js +0 -99
- package/src/components/Swiper/Swiper.js.map +0 -1
- package/src/components/Swiper/SwiperItem.js +0 -10
- package/src/components/Swiper/SwiperItem.js.map +0 -1
- package/src/components/Swiper/index.js +0 -3
- package/src/components/Swiper/index.js.map +0 -1
- package/src/components/Switch.js +0 -56
- package/src/components/Switch.js.map +0 -1
- package/src/components/TabView/TabView.js +0 -65
- package/src/components/TabView/TabView.js.map +0 -1
- package/src/components/TabView/TabViewItem.js +0 -12
- package/src/components/TabView/TabViewItem.js.map +0 -1
- package/src/components/TabView/index.js +0 -3
- package/src/components/TabView/index.js.map +0 -1
- package/src/components/Table/Table.js +0 -94
- package/src/components/Table/Table.js.map +0 -1
- package/src/components/Table/TableCell.js +0 -34
- package/src/components/Table/TableCell.js.map +0 -1
- package/src/components/Table/TableCommon.js +0 -13
- package/src/components/Table/TableCommon.js.map +0 -1
- package/src/components/Table/TableRow.js +0 -42
- package/src/components/Table/TableRow.js.map +0 -1
- package/src/components/Table/index.js +0 -4
- package/src/components/Table/index.js.map +0 -1
- package/src/components/Text.js +0 -25
- package/src/components/Text.js.map +0 -1
- package/src/components/TextField.js +0 -411
- package/src/components/TextField.js.map +0 -1
- package/src/components/TextInput.js +0 -25
- package/src/components/TextInput.js.map +0 -1
- package/src/components/Timer.js +0 -87
- package/src/components/Timer.js.map +0 -1
- package/src/components/Touchable.js +0 -13
- package/src/components/Touchable.js.map +0 -1
- package/src/components/Touchable.web.js +0 -3
- package/src/components/Touchable.web.js.map +0 -1
- package/src/components/Typography.js +0 -37
- package/src/components/Typography.js.map +0 -1
- package/src/components/YoutubePlayer/YoutubePlayer.js +0 -21
- package/src/components/YoutubePlayer/YoutubePlayer.js.map +0 -1
- package/src/components/YoutubePlayer/YoutubePlayer.native.js +0 -36
- package/src/components/YoutubePlayer/YoutubePlayer.native.js.map +0 -1
- package/src/components/YoutubePlayer/YoutubePlayerProps.js +0 -2
- package/src/components/YoutubePlayer/YoutubePlayerProps.js.map +0 -1
- package/src/components/YoutubePlayer/index.js +0 -2
- package/src/components/YoutubePlayer/index.js.map +0 -1
- package/src/components/useAuthState.js +0 -35
- package/src/components/useAuthState.js.map +0 -1
- package/src/constants.js +0 -11
- package/src/constants.js.map +0 -1
- package/src/deprecated-components/AccordionItem.js +0 -36
- package/src/deprecated-components/AccordionItem.js.map +0 -1
- package/src/deprecated-components/AnimatedCircularProgress.js +0 -47
- package/src/deprecated-components/AnimatedCircularProgress.js.map +0 -1
- package/src/deprecated-components/AvatarEdit.js +0 -34
- package/src/deprecated-components/AvatarEdit.js.map +0 -1
- package/src/deprecated-components/AvoidKeyboardView.js +0 -36
- package/src/deprecated-components/AvoidKeyboardView.js.map +0 -1
- package/src/deprecated-components/Banner.js +0 -112
- package/src/deprecated-components/Banner.js.map +0 -1
- package/src/deprecated-components/Card.js +0 -61
- package/src/deprecated-components/Card.js.map +0 -1
- package/src/deprecated-components/CheckboxGroup.js +0 -25
- package/src/deprecated-components/CheckboxGroup.js.map +0 -1
- package/src/deprecated-components/CircleImage.js +0 -12
- package/src/deprecated-components/CircleImage.js.map +0 -1
- package/src/deprecated-components/CircularProgress.js +0 -85
- package/src/deprecated-components/CircularProgress.js.map +0 -1
- package/src/deprecated-components/Container.js +0 -46
- package/src/deprecated-components/Container.js.map +0 -1
- package/src/deprecated-components/DeprecatedButton.js +0 -87
- package/src/deprecated-components/DeprecatedButton.js.map +0 -1
- package/src/deprecated-components/DeprecatedCardWrapper.js +0 -22
- package/src/deprecated-components/DeprecatedCardWrapper.js.map +0 -1
- package/src/deprecated-components/DeprecatedFAB.js +0 -111
- package/src/deprecated-components/DeprecatedFAB.js.map +0 -1
- package/src/deprecated-components/FAB.js +0 -50
- package/src/deprecated-components/FAB.js.map +0 -1
- package/src/deprecated-components/FieldSearchBarFull.js +0 -57
- package/src/deprecated-components/FieldSearchBarFull.js.map +0 -1
- package/src/deprecated-components/Layout.js +0 -69
- package/src/deprecated-components/Layout.js.map +0 -1
- package/src/deprecated-components/ProgressBar.js +0 -122
- package/src/deprecated-components/ProgressBar.js.map +0 -1
- package/src/deprecated-components/ProgressCircle.js +0 -17
- package/src/deprecated-components/ProgressCircle.js.map +0 -1
- package/src/deprecated-components/RadioButtonFieldGroup.js +0 -21
- package/src/deprecated-components/RadioButtonFieldGroup.js.map +0 -1
- package/src/deprecated-components/RowBodyIcon.js +0 -12
- package/src/deprecated-components/RowBodyIcon.js.map +0 -1
- package/src/deprecated-components/RowHeadlineImageCaption.js +0 -16
- package/src/deprecated-components/RowHeadlineImageCaption.js.map +0 -1
- package/src/deprecated-components/RowHeadlineImageIcon.js +0 -18
- package/src/deprecated-components/RowHeadlineImageIcon.js.map +0 -1
- package/src/deprecated-components/ToggleButton.js +0 -43
- package/src/deprecated-components/ToggleButton.js.map +0 -1
- package/src/hooks.js +0 -35
- package/src/hooks.js.map +0 -1
- package/src/index.js +0 -77
- package/src/index.js.map +0 -1
- package/src/interfaces/Icon.js +0 -9
- package/src/interfaces/Icon.js.map +0 -1
- package/src/utilities.js +0 -223
- package/src/utilities.js.map +0 -1
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import Center from "./Center";
|
|
3
|
-
import { pick } from "lodash";
|
|
4
|
-
import { convertBackwardCompatiblePropsToStyle } from "./LayoutCommon";
|
|
5
|
-
const Square = ({ size, style, onLayout, ...rest }) => {
|
|
6
|
-
const [calculatedSize, setCalculatedSize] = React.useState(0);
|
|
7
|
-
const backwardsCompatibleStyle = pick(convertBackwardCompatiblePropsToStyle(rest), "backgroundColor");
|
|
8
|
-
return (React.createElement(Center, { onLayout: (e) => {
|
|
9
|
-
const layout = e.nativeEvent.layout;
|
|
10
|
-
setCalculatedSize(Math.max(layout.width, layout.height));
|
|
11
|
-
onLayout === null || onLayout === void 0 ? void 0 : onLayout(e);
|
|
12
|
-
}, ...rest, style: [
|
|
13
|
-
backwardsCompatibleStyle,
|
|
14
|
-
style,
|
|
15
|
-
size != undefined ? { width: size, height: size } : {},
|
|
16
|
-
calculatedSize > 0
|
|
17
|
-
? {
|
|
18
|
-
width: calculatedSize,
|
|
19
|
-
height: calculatedSize,
|
|
20
|
-
}
|
|
21
|
-
: {},
|
|
22
|
-
] }));
|
|
23
|
-
};
|
|
24
|
-
export default Square;
|
|
25
|
-
//# sourceMappingURL=Square.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Square.js","sourceRoot":"","sources":["Square.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,qCAAqC,EAAE,MAAM,gBAAgB,CAAC;AAMvE,MAAM,MAAM,GAA0B,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,EAAE,EAAE;IAC3E,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC9D,MAAM,wBAAwB,GAAG,IAAI,CACnC,qCAAqC,CAAC,IAAI,CAAC,EAC3C,iBAAiB,CAClB,CAAC;IAEF,OAAO,CACL,oBAAC,MAAM,IACL,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE;YACd,MAAM,MAAM,GAAG,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC;YACpC,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;YACzD,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAG,CAAC,CAAC,CAAC;QAChB,CAAC,KACG,IAAI,EACR,KAAK,EAAE;YACL,wBAAwB;YACxB,KAAK;YACL,IAAI,IAAI,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE;YACtD,cAAc,GAAG,CAAC;gBAChB,CAAC,CAAC;oBACE,KAAK,EAAE,cAAc;oBACrB,MAAM,EAAE,cAAc;iBACvB;gBACH,CAAC,CAAC,EAAE;SACP,GACD,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { View, StyleSheet } from "react-native";
|
|
3
|
-
const VStack = ({ style, ...rest }) => {
|
|
4
|
-
return React.createElement(View, { ...rest, style: [styles.vStack, style] });
|
|
5
|
-
};
|
|
6
|
-
const styles = StyleSheet.create({
|
|
7
|
-
vStack: {
|
|
8
|
-
flexDirection: "column",
|
|
9
|
-
},
|
|
10
|
-
});
|
|
11
|
-
export default VStack;
|
|
12
|
-
//# sourceMappingURL=VStack.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"VStack.js","sourceRoot":"","sources":["VStack.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAa,UAAU,EAAE,MAAM,cAAc,CAAC;AAE3D,MAAM,MAAM,GAAwB,CAAC,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,EAAE,EAAE;IACzD,OAAO,oBAAC,IAAI,OAAK,IAAI,EAAE,KAAK,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GAAI,CAAC;AAC3D,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,MAAM,EAAE;QACN,aAAa,EAAE,QAAQ;KACxB;CACF,CAAC,CAAC;AAEH,eAAe,MAAM,CAAC"}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { View } from "react-native";
|
|
3
|
-
const ZStack = ({ reversed, children, style, ...rest }) => {
|
|
4
|
-
const childSizes = React.useRef(new Map());
|
|
5
|
-
const [maxChildWidth, setMaxChildWidth] = React.useState();
|
|
6
|
-
const [maxChildHeight, setMaxChildHeight] = React.useState();
|
|
7
|
-
const onChildLayout = React.useCallback((index, width, height) => {
|
|
8
|
-
childSizes.current.set(index, {
|
|
9
|
-
width,
|
|
10
|
-
height,
|
|
11
|
-
});
|
|
12
|
-
let maxWidth = 0;
|
|
13
|
-
let maxHeight = 0;
|
|
14
|
-
for (const { width, height } of childSizes.current.values()) {
|
|
15
|
-
if (width > maxWidth) {
|
|
16
|
-
maxWidth = width;
|
|
17
|
-
}
|
|
18
|
-
if (height > maxHeight) {
|
|
19
|
-
maxHeight = height;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
setMaxChildWidth(maxWidth);
|
|
23
|
-
setMaxChildHeight(maxHeight);
|
|
24
|
-
}, [setMaxChildWidth, setMaxChildHeight]);
|
|
25
|
-
const absoluteChildren = React.useMemo(() => {
|
|
26
|
-
let childrenArray = React.Children.toArray(children);
|
|
27
|
-
if (reversed) {
|
|
28
|
-
childrenArray = childrenArray.reverse();
|
|
29
|
-
}
|
|
30
|
-
return childrenArray.map((child, index) => {
|
|
31
|
-
const props = child.props || {};
|
|
32
|
-
return React.cloneElement(child, {
|
|
33
|
-
...props,
|
|
34
|
-
onLayout: (event) => {
|
|
35
|
-
var _a;
|
|
36
|
-
const layout = event.nativeEvent.layout;
|
|
37
|
-
const fullWidth = layout.x + layout.width;
|
|
38
|
-
const fullHeight = layout.y + layout.height;
|
|
39
|
-
onChildLayout(index, fullWidth, fullHeight);
|
|
40
|
-
(_a = props.onLayout) === null || _a === void 0 ? void 0 : _a.call(props, event);
|
|
41
|
-
},
|
|
42
|
-
key: index,
|
|
43
|
-
style: { position: "absolute", zIndex: index + 1, ...props.style },
|
|
44
|
-
}, props.children);
|
|
45
|
-
});
|
|
46
|
-
}, [children, reversed, onChildLayout]);
|
|
47
|
-
React.useEffect(() => {
|
|
48
|
-
childSizes.current.clear();
|
|
49
|
-
}, [absoluteChildren.length]);
|
|
50
|
-
return (React.createElement(View, { style: [
|
|
51
|
-
maxChildWidth && maxChildHeight
|
|
52
|
-
? { width: maxChildWidth, height: maxChildHeight }
|
|
53
|
-
: {},
|
|
54
|
-
style,
|
|
55
|
-
], ...rest }, absoluteChildren));
|
|
56
|
-
};
|
|
57
|
-
export default ZStack;
|
|
58
|
-
//# sourceMappingURL=ZStack.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ZStack.js","sourceRoot":"","sources":["ZStack.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAgC,MAAM,cAAc,CAAC;AAWlE,MAAM,MAAM,GAA0B,CAAC,EACrC,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,GAAG,IAAI,EACR,EAAE,EAAE;IACH,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,GAAG,EAAqB,CAAC,CAAC;IAC9D,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAU,CAAC;IACnE,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAU,CAAC;IAErE,MAAM,aAAa,GAAG,KAAK,CAAC,WAAW,CACrC,CAAC,KAAa,EAAE,KAAa,EAAE,MAAc,EAAE,EAAE;QAC/C,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE;YAC5B,KAAK;YACL,MAAM;SACP,CAAC,CAAC;QAEH,IAAI,QAAQ,GAAG,CAAC,CAAC;QACjB,IAAI,SAAS,GAAG,CAAC,CAAC;QAElB,KAAK,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,UAAU,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;YAC5D,IAAI,KAAK,GAAG,QAAQ,EAAE,CAAC;gBACrB,QAAQ,GAAG,KAAK,CAAC;YAC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C,QAAQ,CACf,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC;IAExC,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IAC7B,CAAC,EAAE,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC;IAE9B,OAAO,CACL,oBAAC,IAAI,IACH,KAAK,EAAE;YACL,aAAa,IAAI,cAAc;gBAC7B,CAAC,CAAC,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,cAAc,EAAE;gBAClD,CAAC,CAAC,EAAE;YACN,KAAK;SACN,KACG,IAAI,IAEP,gBAAgB,CACZ,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export { default as AspectRatio } from "./AspectRatio";
|
|
2
|
-
export { default as Circle } from "./Circle";
|
|
3
|
-
export { default as Center } from "./Center";
|
|
4
|
-
export { default as HStack } from "./HStack";
|
|
5
|
-
export { default as VStack } from "./VStack";
|
|
6
|
-
export { default as ZStack } from "./ZStack";
|
|
7
|
-
export { default as Spacer } from "./Spacer";
|
|
8
|
-
export { default as Square } from "./Square";
|
|
9
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { withTheme } from "@draftbit/theme";
|
|
3
|
-
import { Bounce, Chase, Circle, CircleFade, Flow, Fold, Grid, Plane, Pulse, Swing, Wander, Wave, } from "react-native-animated-spinkit";
|
|
4
|
-
export var LoadingIndicatorType;
|
|
5
|
-
(function (LoadingIndicatorType) {
|
|
6
|
-
LoadingIndicatorType["plane"] = "plane";
|
|
7
|
-
LoadingIndicatorType["chase"] = "chase";
|
|
8
|
-
LoadingIndicatorType["bounce"] = "bounce";
|
|
9
|
-
LoadingIndicatorType["wave"] = "wave";
|
|
10
|
-
LoadingIndicatorType["pulse"] = "pulse";
|
|
11
|
-
LoadingIndicatorType["flow"] = "flow";
|
|
12
|
-
LoadingIndicatorType["swing"] = "swing";
|
|
13
|
-
LoadingIndicatorType["circle"] = "circle";
|
|
14
|
-
LoadingIndicatorType["circleFade"] = "circleFade";
|
|
15
|
-
LoadingIndicatorType["grid"] = "grid";
|
|
16
|
-
LoadingIndicatorType["fold"] = "fold";
|
|
17
|
-
LoadingIndicatorType["wander"] = "wander";
|
|
18
|
-
})(LoadingIndicatorType || (LoadingIndicatorType = {}));
|
|
19
|
-
const SPINNER_COMPONENTS = {
|
|
20
|
-
[LoadingIndicatorType.plane]: Plane,
|
|
21
|
-
[LoadingIndicatorType.chase]: Chase,
|
|
22
|
-
[LoadingIndicatorType.bounce]: Bounce,
|
|
23
|
-
[LoadingIndicatorType.wave]: Wave,
|
|
24
|
-
[LoadingIndicatorType.pulse]: Pulse,
|
|
25
|
-
[LoadingIndicatorType.flow]: Flow,
|
|
26
|
-
[LoadingIndicatorType.swing]: Swing,
|
|
27
|
-
[LoadingIndicatorType.circle]: Circle,
|
|
28
|
-
[LoadingIndicatorType.circleFade]: CircleFade,
|
|
29
|
-
[LoadingIndicatorType.grid]: Grid,
|
|
30
|
-
[LoadingIndicatorType.fold]: Fold,
|
|
31
|
-
[LoadingIndicatorType.wander]: Wander,
|
|
32
|
-
};
|
|
33
|
-
const LoadingIndicator = ({ theme, color = theme.colors.branding.primary, type = LoadingIndicatorType.plane, size, style, ...rest }) => {
|
|
34
|
-
const SpinnerComponent = SPINNER_COMPONENTS[type];
|
|
35
|
-
return React.createElement(SpinnerComponent, { size: size, color: color, style: style, ...rest });
|
|
36
|
-
};
|
|
37
|
-
export default withTheme(LoadingIndicator);
|
|
38
|
-
//# sourceMappingURL=LoadingIndicator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LoadingIndicator.js","sourceRoot":"","sources":["LoadingIndicator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EACL,MAAM,EACN,KAAK,EACL,MAAM,EACN,UAAU,EACV,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,KAAK,EACL,KAAK,EACL,MAAM,EACN,IAAI,GACL,MAAM,+BAA+B,CAAC;AAEvC,MAAM,CAAN,IAAY,oBAaX;AAbD,WAAY,oBAAoB;IAC9B,uCAAe,CAAA;IACf,uCAAe,CAAA;IACf,yCAAiB,CAAA;IACjB,qCAAa,CAAA;IACb,uCAAe,CAAA;IACf,qCAAa,CAAA;IACb,uCAAe,CAAA;IACf,yCAAiB,CAAA;IACjB,iDAAyB,CAAA;IACzB,qCAAa,CAAA;IACb,qCAAa,CAAA;IACb,yCAAiB,CAAA;AACnB,CAAC,EAbW,oBAAoB,KAApB,oBAAoB,QAa/B;AAUD,MAAM,kBAAkB,GAAG;IACzB,CAAC,oBAAoB,CAAC,KAAK,CAAC,EAAE,KAAK;IACnC,CAAC,oBAAoB,CAAC,KAAK,CAAC,EAAE,KAAK;IACnC,CAAC,oBAAoB,CAAC,MAAM,CAAC,EAAE,MAAM;IACrC,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,IAAI;IACjC,CAAC,oBAAoB,CAAC,KAAK,CAAC,EAAE,KAAK;IACnC,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,IAAI;IACjC,CAAC,oBAAoB,CAAC,KAAK,CAAC,EAAE,KAAK;IACnC,CAAC,oBAAoB,CAAC,MAAM,CAAC,EAAE,MAAM;IACrC,CAAC,oBAAoB,CAAC,UAAU,CAAC,EAAE,UAAU;IAC7C,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,IAAI;IACjC,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,IAAI;IACjC,CAAC,oBAAoB,CAAC,MAAM,CAAC,EAAE,MAAM;CACtC,CAAC;AAEF,MAAM,gBAAgB,GAA6C,CAAC,EAClE,KAAK,EACL,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,EACrC,IAAI,GAAG,oBAAoB,CAAC,KAAK,EACjC,IAAI,EACJ,KAAK,EACL,GAAG,IAAI,EACR,EAAE,EAAE;IACH,MAAM,gBAAgB,GAAG,kBAAkB,CAAC,IAAI,CAAC,CAAC;IAClD,OAAO,oBAAC,gBAAgB,IAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,KAAM,IAAI,GAAI,CAAC;AAChF,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC,gBAAgB,CAAC,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef } from "react";
|
|
2
|
-
import { View } from "react-native";
|
|
3
|
-
import LottieView from "lottie-react-native";
|
|
4
|
-
const LottieAnimation = forwardRef(({ style, source, autoPlay = true, loop = true, resizeMode = "cover", speed = 1, ...rest }, ref) => {
|
|
5
|
-
return (React.createElement(View, { style: style },
|
|
6
|
-
React.createElement(LottieView, { ref: ref, source: source, autoPlay: autoPlay, loop: loop, resizeMode: resizeMode, speed: speed,
|
|
7
|
-
// A specific size is required on mobile, but not on web.
|
|
8
|
-
// This ensures consistent behavior across platforms during preview.
|
|
9
|
-
style: { width: "100%", height: "100%" }, ...rest })));
|
|
10
|
-
});
|
|
11
|
-
export default LottieAnimation;
|
|
12
|
-
//# sourceMappingURL=LottieAnimation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LottieAnimation.js","sourceRoot":"","sources":["LottieAnimation.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAwB,MAAM,cAAc,CAAC;AAC1D,OAAO,UAA+B,MAAM,qBAAqB,CAAC;AAWlE,MAAM,eAAe,GAAG,UAAU,CAChC,CACE,EACE,KAAK,EACL,MAAM,EACN,QAAQ,GAAG,IAAI,EACf,IAAI,GAAG,IAAI,EACX,UAAU,GAAG,OAAO,EACpB,KAAK,GAAG,CAAC,EACT,GAAG,IAAI,EACR,EACD,GAAG,EACH,EAAE;IACF,OAAO,CACL,oBAAC,IAAI,IAAC,KAAK,EAAE,KAAK;QAChB,oBAAC,UAAU,IACT,GAAG,EAAE,GAAG,EACR,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,UAAU,EACtB,KAAK,EAAE,KAAK;YACZ,yDAAyD;YACzD,oEAAoE;YACpE,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KACpC,IAAI,GACR,CACG,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { Text, StyleSheet, } from "react-native";
|
|
3
|
-
import MarkdownComponent from "react-native-markdown-display";
|
|
4
|
-
import { extractStyles } from "../utilities";
|
|
5
|
-
const childToString = (child) => {
|
|
6
|
-
if (typeof child === "undefined" ||
|
|
7
|
-
child === null ||
|
|
8
|
-
typeof child === "boolean") {
|
|
9
|
-
return "";
|
|
10
|
-
}
|
|
11
|
-
if (JSON.stringify(child) === "{}") {
|
|
12
|
-
return "";
|
|
13
|
-
}
|
|
14
|
-
return child.toString();
|
|
15
|
-
};
|
|
16
|
-
const Markdown = ({ children: childrenProp, style, }) => {
|
|
17
|
-
const children = React.Children.toArray(childrenProp);
|
|
18
|
-
const text = children.map(childToString).join("");
|
|
19
|
-
const bodyStyle = StyleSheet.flatten(style);
|
|
20
|
-
const { textStyles } = extractStyles(bodyStyle);
|
|
21
|
-
return (
|
|
22
|
-
//'body' style applies to all markdown components
|
|
23
|
-
//@ts-ignore TS does not like the type of this named style for some reason
|
|
24
|
-
React.createElement(MarkdownComponent, { style: { body: bodyStyle }, rules: {
|
|
25
|
-
// By default, strong does not work with custom fonts on iOS. This addresses the issue
|
|
26
|
-
strong: (node) => (React.createElement(Text, { key: node.key, style: {
|
|
27
|
-
...textStyles,
|
|
28
|
-
fontWeight: "bold",
|
|
29
|
-
} }, node.children[0].content)),
|
|
30
|
-
} }, text));
|
|
31
|
-
};
|
|
32
|
-
export default Markdown;
|
|
33
|
-
//# sourceMappingURL=Markdown.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Markdown.js","sourceRoot":"","sources":["Markdown.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,IAAI,EAIJ,UAAU,GACX,MAAM,cAAc,CAAC;AACtB,OAAO,iBAAiB,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAM7C,MAAM,aAAa,G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version":3,"file":"AudioPlayerCommon.js","sourceRoot":"","sources":["AudioPlayerCommon.ts"],"names":[],"mappings":""}
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { Text, View, StyleSheet } from "react-native";
|
|
3
|
-
import { AntDesign } from "@expo/vector-icons";
|
|
4
|
-
import { useTheme } from "@draftbit/theme";
|
|
5
|
-
import Slider from "@react-native-community/slider";
|
|
6
|
-
import HeadlessAudioPlayer from "./HeadlessAudioPlayer";
|
|
7
|
-
import Pressable from "../../Pressable";
|
|
8
|
-
/**
|
|
9
|
-
* Built on top of HeadlessAudioPlayer to provide a simple interface for playing audio
|
|
10
|
-
*/
|
|
11
|
-
const AudioPlayerWithInterface = React.forwardRef(({ style, thumbColor, completedTrackColor, remainingTrackColor, togglePlaybackIconSize = 24, togglePlaybackIconColor, onPlaybackStatusUpdate: onPlaybackStatusUpdateProp, onPlaybackFinish: onPlaybackFinishProp, hidePlaybackIcon = false, hideDuration = false, hideSlider = false, ...rest }, ref) => {
|
|
12
|
-
const [isPlaying, setIsPlaying] = React.useState(false);
|
|
13
|
-
const [isLoading, setIsLoading] = React.useState(false);
|
|
14
|
-
const [durationMillis, setDurationMillis] = React.useState(1);
|
|
15
|
-
const [isDraggingSlider, setIsDraggingSlider] = React.useState(false);
|
|
16
|
-
const [sliderPositionMillis, setSliderPositionMillis] = React.useState(0);
|
|
17
|
-
const newHeadlessAudioPlayerRef = React.useRef(null);
|
|
18
|
-
const theme = useTheme();
|
|
19
|
-
// Use the provided ref or default to new ref when not provided
|
|
20
|
-
const headlessAudioPlayerRef = ref
|
|
21
|
-
? ref
|
|
22
|
-
: newHeadlessAudioPlayerRef;
|
|
23
|
-
const { color = theme.colors.text.strong, fontFamily, fontWeight, fontSize, lineHeight, letterSpacing, textTransform, textAlign, textDecorationLine, textDecorationColor, textDecorationStyle, ...viewStyles } = StyleSheet.flatten(style || {});
|
|
24
|
-
const textStyles = {
|
|
25
|
-
color,
|
|
26
|
-
fontFamily,
|
|
27
|
-
fontWeight,
|
|
28
|
-
fontSize,
|
|
29
|
-
lineHeight,
|
|
30
|
-
letterSpacing,
|
|
31
|
-
textTransform,
|
|
32
|
-
textAlign,
|
|
33
|
-
textDecorationLine,
|
|
34
|
-
textDecorationColor,
|
|
35
|
-
textDecorationStyle,
|
|
36
|
-
};
|
|
37
|
-
const onPlaybackStatusUpdate = (status) => {
|
|
38
|
-
setIsLoading(status.isLoading);
|
|
39
|
-
setDurationMillis(status.durationMillis);
|
|
40
|
-
setSliderPositionMillis(status.currentPositionMillis);
|
|
41
|
-
setIsPlaying(status.isPlaying);
|
|
42
|
-
onPlaybackStatusUpdateProp === null || onPlaybackStatusUpdateProp === void 0 ? void 0 : onPlaybackStatusUpdateProp(status);
|
|
43
|
-
};
|
|
44
|
-
const onPlaybackFinish = () => {
|
|
45
|
-
var _a, _b;
|
|
46
|
-
setIsPlaying(false);
|
|
47
|
-
setSliderPositionMillis(0);
|
|
48
|
-
(_a = headlessAudioPlayerRef.current) === null || _a === void 0 ? void 0 : _a.togglePlayback();
|
|
49
|
-
(_b = headlessAudioPlayerRef.current) === null || _b === void 0 ? void 0 : _b.seekToPosition(0);
|
|
50
|
-
onPlaybackFinishProp === null || onPlaybackFinishProp === void 0 ? void 0 : onPlaybackFinishProp();
|
|
51
|
-
};
|
|
52
|
-
const onSlidingComplete = (sliderValue) => {
|
|
53
|
-
var _a;
|
|
54
|
-
if (isDraggingSlider) {
|
|
55
|
-
setIsDraggingSlider(false);
|
|
56
|
-
}
|
|
57
|
-
(_a = headlessAudioPlayerRef.current) === null || _a === void 0 ? void 0 : _a.seekToPosition(sliderValue);
|
|
58
|
-
};
|
|
59
|
-
const onSliderChange = () => {
|
|
60
|
-
if (!isDraggingSlider) {
|
|
61
|
-
setIsDraggingSlider(true);
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
let iconName;
|
|
65
|
-
if (isLoading) {
|
|
66
|
-
iconName = "loading";
|
|
67
|
-
}
|
|
68
|
-
else if (isPlaying) {
|
|
69
|
-
iconName = "pause";
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
iconName = "caret-right";
|
|
73
|
-
}
|
|
74
|
-
return (React.createElement(React.Fragment, null,
|
|
75
|
-
React.createElement(HeadlessAudioPlayer, { ...rest, ref: headlessAudioPlayerRef, onPlaybackStatusUpdate: onPlaybackStatusUpdate, onPlaybackFinish: onPlaybackFinish }),
|
|
76
|
-
React.createElement(View, { testID: "audio-player-interface", style: [
|
|
77
|
-
{
|
|
78
|
-
backgroundColor: theme.colors.background.base,
|
|
79
|
-
borderColor: theme.colors.border.base,
|
|
80
|
-
},
|
|
81
|
-
styles.container,
|
|
82
|
-
viewStyles,
|
|
83
|
-
] },
|
|
84
|
-
!hidePlaybackIcon && (React.createElement(Pressable, { testID: "audio-player-playback-icon", onPress: () => { var _a; return (_a = headlessAudioPlayerRef.current) === null || _a === void 0 ? void 0 : _a.togglePlayback(); }, style: styles.spacingEnd },
|
|
85
|
-
React.createElement(AntDesign, { name: iconName, size: togglePlaybackIconSize, color: togglePlaybackIconColor !== null && togglePlaybackIconColor !== void 0 ? togglePlaybackIconColor : theme.colors.branding.primary }))),
|
|
86
|
-
!hideDuration && (React.createElement(Text, { testID: "audio-player-duration", style: [styles.spacingEnd, textStyles] },
|
|
87
|
-
formatDuration(sliderPositionMillis !== null && sliderPositionMillis !== void 0 ? sliderPositionMillis : 0),
|
|
88
|
-
" /",
|
|
89
|
-
" ",
|
|
90
|
-
formatDuration(durationMillis || 0))),
|
|
91
|
-
!hideSlider && (React.createElement(Slider, { testID: "audio-player-slider", style: styles.slider, minimumTrackTintColor: completedTrackColor !== null && completedTrackColor !== void 0 ? completedTrackColor : theme.colors.branding.primary, maximumTrackTintColor: remainingTrackColor !== null && remainingTrackColor !== void 0 ? remainingTrackColor : theme.colors.border.base, thumbTintColor: thumbColor !== null && thumbColor !== void 0 ? thumbColor : theme.colors.branding.primary, minimumValue: 0, value: sliderPositionMillis, maximumValue: durationMillis, onValueChange: onSliderChange, onSlidingComplete: onSlidingComplete })))));
|
|
92
|
-
});
|
|
93
|
-
const styles = StyleSheet.create({
|
|
94
|
-
container: {
|
|
95
|
-
padding: 8,
|
|
96
|
-
flexDirection: "row",
|
|
97
|
-
alignItems: "center",
|
|
98
|
-
borderRadius: 8,
|
|
99
|
-
borderWidth: 1,
|
|
100
|
-
},
|
|
101
|
-
spacingEnd: {
|
|
102
|
-
marginEnd: 8,
|
|
103
|
-
},
|
|
104
|
-
slider: {
|
|
105
|
-
flex: 1,
|
|
106
|
-
},
|
|
107
|
-
});
|
|
108
|
-
function formatDuration(duration) {
|
|
109
|
-
if (duration === 0)
|
|
110
|
-
return "00:00";
|
|
111
|
-
const seconds = Math.floor((duration / 1000) % 60);
|
|
112
|
-
const minutes = Math.floor((duration / (1000 * 60)) % 60);
|
|
113
|
-
const hours = Math.floor((duration / (1000 * 60 * 60)) % 24);
|
|
114
|
-
const renderedHours = hours < 10 ? "0" + hours : hours;
|
|
115
|
-
const renderedMinutes = minutes < 10 ? "0" + minutes : minutes;
|
|
116
|
-
const renderedSeconds = seconds < 10 ? "0" + seconds : seconds;
|
|
117
|
-
if (hours > 0) {
|
|
118
|
-
return renderedHours + ":" + renderedMinutes + ":" + renderedSeconds;
|
|
119
|
-
}
|
|
120
|
-
return renderedMinutes + ":" + renderedSeconds;
|
|
121
|
-
}
|
|
122
|
-
export default AudioPlayerWithInterface;
|
|
123
|
-
//# sourceMappingURL=AudioPlayerWithInterface.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AudioPlayerWithInterface.js","sourceRoot":"","sources":["AudioPlayerWithInterface.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,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AO,OAAO,CAAC;IAEnC,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;IACnD,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,GAAG,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;IAC1D,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,GAAG,CAAC,IAAI,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;IAE7D,MAAM,aAAa,GAAG,KAAK,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;IACvD,MAAM,eAAe,GAAG,OAAO,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;IAC/D,MAAM,eAAe,GAAG,OAAO,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;IAE/D,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;QACd,OAAO,aAAa,GAAG,GAAG,GAAG,eAAe,GAAG,GAAG,GAAG,eAAe,CAAC;IACvE,CAAC;IAED,OAAO,eAAe,GAAG,GAAG,GAAG,eAAe,CAAC;AACjD,CAAC;AAED,eAAe,wBAAwB,CAAC"}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { Audio, InterruptionModeIOS, InterruptionModeAndroid, } from "expo-av";
|
|
3
|
-
import { mapToMediaPlayerStatus, normalizeBase64Source, useSourceDeepCompareEffect, } from "../MediaPlayerCommon";
|
|
4
|
-
import MediaPlaybackWrapper from "../MediaPlaybackWrapper";
|
|
5
|
-
/**
|
|
6
|
-
* Audio Player component without an interface (UI).
|
|
7
|
-
* Only handles playing of the audio and provides callbacks and ref functions
|
|
8
|
-
*/
|
|
9
|
-
const HeadlessAudioPlayer = React.forwardRef(({ source, interruptionMode = "lower volume", playsInBackground = false, playsInSilentModeIOS = false, playThroughEarpieceAndroid = false, onPlaybackStatusUpdate: onPlaybackStatusUpdateProp, onPlaybackFinish, isLooping = false, volume = 1.0, }, ref) => {
|
|
10
|
-
const [currentSound, setCurrentSound] = React.useState();
|
|
11
|
-
const [isPlaying, setIsPlaying] = React.useState(false);
|
|
12
|
-
React.useEffect(() => {
|
|
13
|
-
if (currentSound &&
|
|
14
|
-
typeof (currentSound === null || currentSound === void 0 ? void 0 : currentSound.setIsLoopingAsync) === "function") {
|
|
15
|
-
currentSound.setIsLoopingAsync(isLooping);
|
|
16
|
-
}
|
|
17
|
-
}, [currentSound, isLooping]);
|
|
18
|
-
React.useEffect(() => {
|
|
19
|
-
if (currentSound && typeof (currentSound === null || currentSound === void 0 ? void 0 : currentSound.setVolumeAsync) === "function") {
|
|
20
|
-
currentSound.setVolumeAsync(volume);
|
|
21
|
-
}
|
|
22
|
-
}, [currentSound, volume]);
|
|
23
|
-
const updateAudioMode = React.useCallback(async () => {
|
|
24
|
-
try {
|
|
25
|
-
await Audio.setAudioModeAsync({
|
|
26
|
-
staysActiveInBackground: playsInBackground,
|
|
27
|
-
interruptionModeIOS: interruptionMode === "lower volume"
|
|
28
|
-
? InterruptionModeIOS.DuckOthers
|
|
29
|
-
: InterruptionModeIOS.DoNotMix,
|
|
30
|
-
interruptionModeAndroid: interruptionMode === "lower volume"
|
|
31
|
-
? InterruptionModeAndroid.DuckOthers
|
|
32
|
-
: InterruptionModeAndroid.DoNotMix,
|
|
33
|
-
playsInSilentModeIOS,
|
|
34
|
-
playThroughEarpieceAndroid,
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
catch (e) {
|
|
38
|
-
if ((e === null || e === void 0 ? void 0 : e.code) === "E_AUDIO_AUDIOMODE") {
|
|
39
|
-
console.warn("Background audio playback only works in published apps, not in preview mode. For iOS apps, add 'audio' under UI Background Modes in Project Settings > Apple App Store.");
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
console.error("Failed to set audio mode. interruptionMode, playsInBackground, playsInSilentModeIOS, playThroughEarpieceAndroid might not be set. Failed with", e);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}, [
|
|
46
|
-
interruptionMode,
|
|
47
|
-
playsInBackground,
|
|
48
|
-
playsInSilentModeIOS,
|
|
49
|
-
playThroughEarpieceAndroid,
|
|
50
|
-
]);
|
|
51
|
-
const onPlaybackStatusUpdate = (status) => {
|
|
52
|
-
const mappedStatus = mapToMediaPlayerStatus(status);
|
|
53
|
-
onPlaybackStatusUpdateProp === null || onPlaybackStatusUpdateProp === void 0 ? void 0 : onPlaybackStatusUpdateProp(mappedStatus);
|
|
54
|
-
if (status.isLoaded) {
|
|
55
|
-
if (status.didJustFinish) {
|
|
56
|
-
if (isLooping) {
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
onPlaybackFinish === null || onPlaybackFinish === void 0 ? void 0 : onPlaybackFinish();
|
|
60
|
-
}
|
|
61
|
-
setIsPlaying(status.isPlaying);
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
const onTogglePlayback = () => {
|
|
65
|
-
//Has to be called everytime a player is played to reconfigure the global Audio config based on each player's configuration
|
|
66
|
-
updateAudioMode();
|
|
67
|
-
};
|
|
68
|
-
const loadAudio = async () => {
|
|
69
|
-
onPlaybackStatusUpdateProp === null || onPlaybackStatusUpdateProp === void 0 ? void 0 : onPlaybackStatusUpdateProp({
|
|
70
|
-
isPlaying: false,
|
|
71
|
-
isLoading: true,
|
|
72
|
-
isBuffering: false,
|
|
73
|
-
currentPositionMillis: 0,
|
|
74
|
-
durationMillis: 0,
|
|
75
|
-
bufferedDurationMillis: 0,
|
|
76
|
-
isError: false,
|
|
77
|
-
});
|
|
78
|
-
const finalSource = await normalizeBase64Source(source, "audio");
|
|
79
|
-
const { sound } = await Audio.Sound.createAsync(finalSource);
|
|
80
|
-
setCurrentSound(sound);
|
|
81
|
-
sound.setOnPlaybackStatusUpdate(onPlaybackStatusUpdate);
|
|
82
|
-
};
|
|
83
|
-
useSourceDeepCompareEffect(() => {
|
|
84
|
-
loadAudio();
|
|
85
|
-
// Ignore dependency of loadAudio
|
|
86
|
-
}, [source]);
|
|
87
|
-
return (React.createElement(MediaPlaybackWrapper, { ref: ref, isPlaying: isPlaying, media: currentSound, onTogglePlayback: onTogglePlayback }));
|
|
88
|
-
});
|
|
89
|
-
export default HeadlessAudioPlayer;
|
|
90
|
-
//# sourceMappingURL=HeadlessAudioPlayer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HeadlessAudioPlayer.js","sourceRoot":"","sources":["HeadlessAudioPlayer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,KAAK,EAEL,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,0BAA0B,GAC3B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,oBAAoB,MAAM,yBAAyB,CAAC;AAE3D;;;GAGG;AACH,MAAM,mBAAmB,GAAG,KAAK,CAAC,UAAU,CAI1C,CACE,EACE,MAAM,EACN,gBAAgB,GAAG,cAAc,EACjC,iBAAiB,GAAG,KAAK,EACzB,oBAAoB,GAAG,KAAK,EAC5B,0BAA0B,GAAG,KAAK,EAClC,sBAAsB,EAAE,0BAA0B,EAClD,gBAAgB,EAChB,SAAS,GAAG,KAAK,EACjB,MAAM,GAAG,GAAG,GACb,EACD,GAAG,EACH,EAAE;IACF,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAe,CAAC;IACtE,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,C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vB,KAAK,CAAC,yBAAyB,CAAC,sBAAsB,CAAC,CAAC;IAC1D,CAAC,CAAC;IAEF,0BAA0B,CAAC,GAAG,EAAE;QAC9B,SAAS,EAAE,CAAC;QAEZ,iCAAiC;IACnC,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAEb,OAAO,CACL,oBAAC,oBAAoB,IACnB,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,YAAY,EACnB,gBAAgB,EAAE,gBAAgB,GAClC,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import HeadlessAudioPlayer from "./HeadlessAudioPlayer";
|
|
3
|
-
import AudioPlayerWithInterface from "./AudioPlayerWithInterface";
|
|
4
|
-
const AudioPlayer = React.forwardRef(({ mode = "interface", ...rest }, ref) => {
|
|
5
|
-
switch (mode) {
|
|
6
|
-
case "headless":
|
|
7
|
-
return React.createElement(HeadlessAudioPlayer, { ref: ref, ...rest });
|
|
8
|
-
case "interface":
|
|
9
|
-
return React.createElement(AudioPlayerWithInterface, { ref: ref, ...rest });
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
export default AudioPlayer;
|
|
13
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,mBAAmB,MAAM,uBAAuB,CAAC;AACxD,OAAO,wBAAwB,MAAM,4BAA4B,CAAC;AAOlE,MAAM,WAAW,GAAG,KAAK,CAAC,UAAU,CAGlC,CAAC,EAAE,IAAI,GAAG,WAAW,EAAE,GAAG,IAAI,EAAE,EAAE,GAAG,EAAE,EAAE;IACzC,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,UAAU;YACb,OAAO,oBAAC,mBAAmB,IAAC,GAAG,EAAE,GAAG,KAAM,IAAI,GAAI,CAAC;QACrD,KAAK,WAAW;YACd,OAAO,oBAAC,wBAAwB,IAAC,GAAG,EAAE,GAAG,KAAM,IAAI,GAAI,CAAC;IAC5D,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
/**
|
|
3
|
-
* Wrapper component that handles common media playback operations that is reusable with audio and video players
|
|
4
|
-
*/
|
|
5
|
-
const MediaPlaybackWrapper = React.forwardRef(({ media, isPlaying, onTogglePlayback, children }, ref) => {
|
|
6
|
-
const togglePlayback = React.useCallback(async () => {
|
|
7
|
-
onTogglePlayback === null || onTogglePlayback === void 0 ? void 0 : onTogglePlayback();
|
|
8
|
-
if (isPlaying) {
|
|
9
|
-
await (media === null || media === void 0 ? void 0 : media.pauseAsync());
|
|
10
|
-
}
|
|
11
|
-
else {
|
|
12
|
-
await (media === null || media === void 0 ? void 0 : media.playAsync());
|
|
13
|
-
}
|
|
14
|
-
}, [media, isPlaying, onTogglePlayback]);
|
|
15
|
-
const pause = React.useCallback(async () => {
|
|
16
|
-
onTogglePlayback === null || onTogglePlayback === void 0 ? void 0 : onTogglePlayback();
|
|
17
|
-
await (media === null || media === void 0 ? void 0 : media.pauseAsync());
|
|
18
|
-
}, [media, onTogglePlayback]);
|
|
19
|
-
const play = React.useCallback(async () => {
|
|
20
|
-
onTogglePlayback === null || onTogglePlayback === void 0 ? void 0 : onTogglePlayback();
|
|
21
|
-
await (media === null || media === void 0 ? void 0 : media.playAsync());
|
|
22
|
-
}, [media, onTogglePlayback]);
|
|
23
|
-
const seekToPosition = React.useCallback(async (positionMillis) => {
|
|
24
|
-
await (media === null || media === void 0 ? void 0 : media.setPositionAsync(positionMillis));
|
|
25
|
-
}, [media]);
|
|
26
|
-
React.useEffect(() => {
|
|
27
|
-
return media
|
|
28
|
-
? () => {
|
|
29
|
-
media.unloadAsync();
|
|
30
|
-
}
|
|
31
|
-
: undefined;
|
|
32
|
-
}, [media]);
|
|
33
|
-
React.useImperativeHandle(ref, () => ({
|
|
34
|
-
seekToPosition,
|
|
35
|
-
togglePlayback,
|
|
36
|
-
pause,
|
|
37
|
-
play,
|
|
38
|
-
}), [seekToPosition, togglePlayback, pause, play]);
|
|
39
|
-
return React.createElement(React.Fragment, null, children);
|
|
40
|
-
});
|
|
41
|
-
export default MediaPlaybackWrapper;
|
|
42
|
-
//# sourceMappingURL=MediaPlaybackWrapper.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MediaPlaybackWrapper.js","sourceRoot":"","sources":["MediaPlaybackWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAW/B;;GAEG;AACH,MAAM,oBAAoB,GAAG,KAAK,CAAC,UAAU,CAG3C,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,QAAQ,EAAE,EAAE,GAAG,EAAE,EAAE;IAC1D,MAAM,cAAc,GAAG,KAAK,CAAC,WAAW,CAAC,KAAK,IAAI,EAAE;QAClD,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,EAAI,CAAC;QAErB,IAAI,SAAS,EAAE,CAAC;YACd,MAAM,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,UAAU,EAAE,CAAA,CAAC;QAC5B,CAAC;aAAM,CAAC;YACN,MAAM,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,SAAS,EAAE,CAAA,CAAC;QAC3B,CAAC;IACH,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,gBAAgB,CAAC,CAAC,CAAC;IAEzC,MAAM,KAAK,GAAG,KAAK,CAAC,WAAW,CAAC,KAAK,IAAI,EAAE;QACzC,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,EAAI,CAAC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-
import React from "react";
|
|
4
|
-
export function mapToMediaPlayerStatus(status) {
|
|
5
|
-
if (status.isLoaded) {
|
|
6
|
-
return {
|
|
7
|
-
isPlaying: status.isPlaying,
|
|
8
|
-
isLoading: false,
|
|
9
|
-
isBuffering: status.isBuffering,
|
|
10
|
-
currentPositionMillis: status.positionMillis || 0,
|
|
11
|
-
durationMillis: status.durationMillis || 0,
|
|
12
|
-
bufferedDurationMillis: status.playableDurationMillis || 0,
|
|
13
|
-
isError: false,
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
return {
|
|
17
|
-
isPlaying: false,
|
|
18
|
-
isLoading: false,
|
|
19
|
-
isBuffering: false,
|
|
20
|
-
currentPositionMillis: 0,
|
|
21
|
-
durationMillis: 0,
|
|
22
|
-
bufferedDurationMillis: 0,
|
|
23
|
-
isError: true,
|
|
24
|
-
error: status.error,
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
const URL_REGEX = /[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/;
|
|
28
|
-
/**
|
|
29
|
-
* Base64 strings are not playable on iOS and needs to be saved to a file before playing
|
|
30
|
-
*/
|
|
31
|
-
export async function normalizeBase64Source(source, type) {
|
|
32
|
-
const uri = source === null || source === void 0 ? void 0 : source.uri;
|
|
33
|
-
if (Platform.OS === "ios" && uri && !uri.match(URL_REGEX)) {
|
|
34
|
-
const { File, Paths } = await import("expo-file-system");
|
|
35
|
-
const defaultMimeType = type === "audio" ? "wav" : "mp4";
|
|
36
|
-
const mimeType = uri.startsWith(`data:${type}/`)
|
|
37
|
-
? uri.substring(`data:${type}/`.length, uri.indexOf(";")) //Ex: extract 'mp4' from 'data:video/mp4;base64,....'
|
|
38
|
-
: defaultMimeType;
|
|
39
|
-
const file = new File(Paths.cache, `${uuid()}.${mimeType.toLowerCase()}`);
|
|
40
|
-
const base64Content = uri.includes("base64,")
|
|
41
|
-
? uri.substring(uri.indexOf("base64,") + "base64,".length) // skip header portion of base64 string
|
|
42
|
-
: uri;
|
|
43
|
-
file.write(base64Content, { encoding: "base64" });
|
|
44
|
-
return { uri: file.uri };
|
|
45
|
-
}
|
|
46
|
-
return source;
|
|
47
|
-
}
|
|
48
|
-
// The source provided into the AudioPlayer can be of type {uri: "some uri"}
|
|
49
|
-
// In the case that this object is created inline, each rerender provides a new source object because a new object is initialized everytime
|
|
50
|
-
// This creates an issue with being a useEffect dependency
|
|
51
|
-
//
|
|
52
|
-
// This creates variants of useEffect that checks deep equality of 'uri' to determine if dependency changed or not
|
|
53
|
-
// Follows: https://stackoverflow.com/a/54096391
|
|
54
|
-
function sourceDeepCompareEquals(a, b) {
|
|
55
|
-
if ((a === null || a === void 0 ? void 0 : a.uri) && (b === null || b === void 0 ? void 0 : b.uri)) {
|
|
56
|
-
return a.uri === b.uri;
|
|
57
|
-
}
|
|
58
|
-
return a === b;
|
|
59
|
-
}
|
|
60
|
-
function useSourceDeepCompareMemoize(value) {
|
|
61
|
-
const ref = React.useRef(undefined);
|
|
62
|
-
if (!sourceDeepCompareEquals(value, ref.current)) {
|
|
63
|
-
ref.current = value;
|
|
64
|
-
}
|
|
65
|
-
return ref.current;
|
|
66
|
-
}
|
|
67
|
-
export function useSourceDeepCompareEffect(callback, dependencies) {
|
|
68
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
69
|
-
React.useEffect(callback, dependencies.map(useSourceDeepCompareMemoize));
|
|
70
|
-
}
|
|
71
|
-
//# sourceMappingURL=MediaPlayerCommon.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MediaPlayerCommon.js","sourceRoot":"","sources":["MediaPlayerCommon.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,MAAM,OAAO,CAAC;AA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