@jobber/components-native 0.84.4-match-mobi-55ef4ec.7 → 0.84.4-match-mobi-540af48.10
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/dist/package.json +26 -15
- package/dist/src/ActionItem/ActionItemGroup.js +1 -1
- package/dist/src/AutoLink/components/Link/Link.js +1 -1
- package/dist/src/Banner/Banner.js +2 -0
- package/dist/src/Banner/components/BannerIcon/BannerIcon.style.js +3 -0
- package/dist/src/BottomSheet/BottomSheet.js +58 -32
- package/dist/src/BottomSheet/BottomSheet.style.js +8 -9
- package/dist/src/BottomSheet/hooks/useBottomSheetBackHandler.js +26 -0
- package/dist/src/Button/components/InternalButtonLoading/InternalButtonLoading.js +0 -1
- package/dist/src/ButtonGroup/ButtonGroup.js +1 -1
- package/dist/src/Chip/Chip.js +12 -1
- package/dist/src/Chip/Chip.style.js +1 -1
- package/dist/src/Content/ContentHorizontal.style.js +15 -0
- package/dist/src/Content/ContentSpaceAround.style.js +15 -0
- package/dist/src/Content/ContentVertical.style.js +15 -0
- package/dist/src/ContentOverlay/ContentOverlay.js +5 -7
- package/dist/src/ContentOverlay/UNSAFE_WrappedModalize.js +23 -0
- package/dist/src/ErrorMessageWrapper/context/ErrorMessageProvider.js +1 -1
- package/dist/src/Form/Form.js +5 -2
- package/dist/src/Form/components/FormCache/FormCache.js +1 -0
- package/dist/src/Form/components/FormMessageBanner/FormMessageBanner.js +1 -1
- package/dist/src/Form/context/AtlantisFormContext.js +1 -0
- package/dist/src/Form/hooks/useInternalForm.js +6 -3
- package/dist/src/FormatFile/components/MediaView/MediaView.js +22 -5
- package/dist/src/FormatFile/utils/createUseCreateThumbnail.js +1 -1
- package/dist/src/InputCurrency/InputCurrency.js +42 -30
- package/dist/src/InputDate/InputDate.js +2 -2
- package/dist/src/InputEmail/InputEmail.js +12 -4
- package/dist/src/InputFieldWrapper/InputFieldWrapper.js +14 -12
- package/dist/src/InputFieldWrapper/InputFieldWrapper.style.js +1 -1
- package/dist/src/InputFieldWrapper/components/Prefix/Prefix.js +5 -2
- package/dist/src/InputFieldWrapper/components/Suffix/Suffix.js +5 -2
- package/dist/src/InputNumber/InputNumber.js +10 -4
- package/dist/src/InputPressable/InputPressable.js +20 -8
- package/dist/src/InputPressable/InputPressable.style.js +3 -0
- package/dist/src/InputSearch/InputSearch.js +1 -1
- package/dist/src/InputText/InputText.js +24 -13
- package/dist/src/InputText/InputText.style.js +4 -0
- package/dist/src/InputTime/InputTime.js +2 -2
- package/dist/src/Menu/Menu.js +2 -2
- package/dist/src/ProgressBar/ProgressBar.js +10 -6
- package/dist/src/ProgressBar/ProgressBarInner.js +3 -12
- package/dist/src/ProgressBar/ProgressBarStepped.js +7 -2
- package/dist/src/Select/Select.style.js +1 -0
- package/dist/src/Select/components/SelectPressable/SelectPressable.js +1 -1
- package/dist/src/StatusLabel/StatusLabel.style.js +2 -2
- package/dist/src/Switch/components/BaseSwitch/BaseSwitch.js +7 -1
- package/dist/src/Typography/Typography.js +16 -5
- package/dist/src/hooks/useAtlantisI18n/locales/en.json +1 -0
- package/dist/src/hooks/useAtlantisI18n/locales/es.json +1 -0
- package/dist/src/hooks/useFormController.js +6 -15
- package/dist/tsconfig.build.json +7 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/dist/tsconfig.json +4 -6
- package/dist/types/src/ActionItem/ActionItem.d.ts +2 -1
- package/dist/types/src/ActionItem/ActionItemGroup.d.ts +2 -1
- package/dist/types/src/ActionItem/components/ActionItemContainer.d.ts +2 -1
- package/dist/types/src/ActionLabel/ActionLabel.d.ts +4 -3
- package/dist/types/src/ActivityIndicator/ActivityIndicator.d.ts +2 -1
- package/dist/types/src/AutoLink/AutoLink.d.ts +2 -1
- package/dist/types/src/AutoLink/components/ComposeTextWithLinks/ComposeTextWithLinks.d.ts +2 -1
- package/dist/types/src/AutoLink/components/Link/Link.d.ts +2 -1
- package/dist/types/src/Banner/Banner.d.ts +2 -1
- package/dist/types/src/Banner/components/BannerIcon/BannerIcon.d.ts +2 -1
- package/dist/types/src/Banner/components/BannerIcon/BannerIcon.style.d.ts +3 -0
- package/dist/types/src/Banner/types.d.ts +1 -1
- package/dist/types/src/BottomSheet/BottomSheet.d.ts +7 -3
- package/dist/types/src/BottomSheet/BottomSheet.style.d.ts +7 -14
- package/dist/types/src/BottomSheet/components/BottomSheetOption/BottomSheetOption.d.ts +2 -1
- package/dist/types/src/BottomSheet/hooks/useBottomSheetBackHandler.d.ts +8 -0
- package/dist/types/src/Button/Button.d.ts +2 -1
- package/dist/types/src/Button/components/InternalButtonLoading/InternalButtonLoading.d.ts +1 -1
- package/dist/types/src/ButtonGroup/ButtonGroup.d.ts +2 -1
- package/dist/types/src/ButtonGroup/ButtonGroupAction.d.ts +4 -3
- package/dist/types/src/ButtonGroup/components/SecondaryActionSheet/SecondaryActionSheet.d.ts +3 -2
- package/dist/types/src/Card/Card.d.ts +2 -1
- package/dist/types/src/Card/components/InternalCardHeader.d.ts +2 -1
- package/dist/types/src/Checkbox/Checkbox.d.ts +2 -1
- package/dist/types/src/Checkbox/CheckboxGroup.d.ts +2 -1
- package/dist/types/src/Chip/Chip.d.ts +2 -1
- package/dist/types/src/Content/Content.d.ts +3 -2
- package/dist/types/src/Content/ContentHorizontal.style.d.ts +15 -0
- package/dist/types/src/Content/ContentSpaceAround.style.d.ts +15 -0
- package/dist/types/src/Content/ContentVertical.style.d.ts +15 -0
- package/dist/types/src/ContentOverlay/ContentOverlay.d.ts +1 -1
- package/dist/types/src/ContentOverlay/UNSAFE_WrappedModalize.d.ts +3 -0
- package/dist/types/src/Disclosure/Disclosure.d.ts +1 -1
- package/dist/types/src/Divider/Divider.d.ts +2 -1
- package/dist/types/src/EmptyState/EmptyState.d.ts +2 -1
- package/dist/types/src/ErrorMessageWrapper/ErrorMessageWrapper.d.ts +2 -1
- package/dist/types/src/ErrorMessageWrapper/context/ErrorMessageProvider.d.ts +2 -1
- package/dist/types/src/ErrorMessageWrapper/context/types.d.ts +1 -1
- package/dist/types/src/Flex/Flex.d.ts +2 -1
- package/dist/types/src/Form/Form.d.ts +2 -1
- package/dist/types/src/Form/components/FormActionBar/FormActionBar.d.ts +3 -2
- package/dist/types/src/Form/components/FormBody/FormBody.d.ts +3 -2
- package/dist/types/src/Form/components/FormCache/FormCache.d.ts +4 -3
- package/dist/types/src/Form/components/FormErrorBanner/FormErrorBanner.d.ts +2 -1
- package/dist/types/src/Form/components/FormMask/FormMask.d.ts +2 -1
- package/dist/types/src/Form/components/FormMessage/FormMessage.d.ts +2 -1
- package/dist/types/src/Form/components/FormMessage/components/InternalFormMessage/InternalFormMessage.d.ts +2 -1
- package/dist/types/src/Form/components/FormMessageBanner/FormMessageBanner.d.ts +2 -1
- package/dist/types/src/Form/components/FormSaveButton/FormSaveButton.d.ts +2 -1
- package/dist/types/src/Form/context/AtlantisFormContext.d.ts +2 -1
- package/dist/types/src/Form/context/types.d.ts +5 -4
- package/dist/types/src/Form/hooks/useFormViewRefs.d.ts +2 -2
- package/dist/types/src/Form/hooks/useInternalForm.d.ts +7 -7
- package/dist/types/src/Form/types.d.ts +13 -7
- package/dist/types/src/FormField/FormField.d.ts +1 -1
- package/dist/types/src/FormatFile/FormatFile.d.ts +2 -1
- package/dist/types/src/FormatFile/components/ErrorIcon/ErrorIcon.d.ts +2 -1
- package/dist/types/src/FormatFile/components/FileView/FileView.d.ts +2 -1
- package/dist/types/src/FormatFile/components/FormatFileBottomSheet/FormatFileBottomSheet.d.ts +3 -2
- package/dist/types/src/FormatFile/components/MediaView/MediaView.d.ts +2 -1
- package/dist/types/src/FormatFile/components/ProgressBar/ProgressBar.d.ts +2 -1
- package/dist/types/src/Heading/Heading.d.ts +4 -3
- package/dist/types/src/Icon/Icon.d.ts +2 -1
- package/dist/types/src/IconButton/IconButton.d.ts +1 -1
- package/dist/types/src/InputCurrency/InputCurrency.d.ts +2 -1
- package/dist/types/src/InputDate/InputDate.d.ts +4 -2
- package/dist/types/src/InputFieldWrapper/InputFieldWrapper.d.ts +9 -2
- package/dist/types/src/InputFieldWrapper/InputFieldWrapper.style.d.ts +1 -1
- package/dist/types/src/InputFieldWrapper/components/ClearAction/ClearAction.d.ts +2 -1
- package/dist/types/src/InputFieldWrapper/components/Prefix/Prefix.d.ts +4 -4
- package/dist/types/src/InputFieldWrapper/components/Suffix/Suffix.d.ts +4 -4
- package/dist/types/src/InputPressable/InputPressable.d.ts +9 -1
- package/dist/types/src/InputPressable/InputPressable.style.d.ts +3 -0
- package/dist/types/src/InputSearch/InputSearch.d.ts +1 -1
- package/dist/types/src/InputSearch/components/FilterButton.d.ts +2 -1
- package/dist/types/src/InputText/InputText.d.ts +11 -3
- package/dist/types/src/InputText/InputText.style.d.ts +4 -0
- package/dist/types/src/InputText/context/InputAccessoriesProvider.d.ts +2 -1
- package/dist/types/src/InputTime/InputTime.d.ts +4 -2
- package/dist/types/src/Menu/Menu.d.ts +2 -1
- package/dist/types/src/Menu/components/MenuOption/MenuOption.d.ts +2 -1
- package/dist/types/src/Menu/components/Overlay/Overlay.d.ts +2 -1
- package/dist/types/src/Menu/types.d.ts +6 -1
- package/dist/types/src/ProgressBar/ProgressBar.d.ts +2 -1
- package/dist/types/src/ProgressBar/ProgressBarInner.d.ts +5 -1
- package/dist/types/src/ProgressBar/ProgressBarStepped.d.ts +3 -1
- package/dist/types/src/ProgressBar/types.d.ts +20 -0
- package/dist/types/src/Select/Select.d.ts +3 -2
- package/dist/types/src/Select/components/SelectDefaultPicker/SelectDefaultPicker.d.ts +2 -1
- package/dist/types/src/Select/components/SelectDefaultPicker/SelectDefaultPicker.ios.d.ts +2 -1
- package/dist/types/src/Select/components/SelectInternalPicker/SelectInternalPicker.d.ts +2 -1
- package/dist/types/src/Select/components/SelectPressable/SelectPressable.d.ts +2 -1
- package/dist/types/src/StatusLabel/StatusLabel.d.ts +2 -1
- package/dist/types/src/StatusLabel/StatusLabel.style.d.ts +1 -1
- package/dist/types/src/Switch/Switch.d.ts +2 -1
- package/dist/types/src/Switch/components/BaseSwitch/BaseSwitch.d.ts +2 -1
- package/dist/types/src/Text/Text.d.ts +4 -3
- package/dist/types/src/TextList/TextList.d.ts +2 -1
- package/dist/types/src/ThumbnailList/ThumbnailList.d.ts +2 -1
- package/dist/types/src/Toast/Toast.d.ts +2 -1
- package/dist/types/src/Typography/Typography.d.ts +3 -3
- package/dist/types/src/Typography/TypographyGestureDetector.d.ts +2 -1
- package/dist/types/src/utils/test/MockSafeAreaProvider.d.ts +1 -1
- package/package.json +26 -15
- package/src/ActionItem/ActionItem.tsx +1 -1
- package/src/ActionItem/ActionItemGroup.tsx +1 -3
- package/src/ActionItem/components/ActionItemContainer.tsx +1 -1
- package/src/ActionLabel/ActionLabel.test.tsx +12 -0
- package/src/ActionLabel/ActionLabel.tsx +3 -3
- package/src/ActionLabel/__snapshots__/ActionLabel.test.tsx.snap +66 -0
- package/src/ActivityIndicator/ActivityIndicator.tsx +1 -3
- package/src/AtlantisContext/AtlantisContext.test.tsx +1 -1
- package/src/AtlantisThemeContext/AtlantisThemeContext.test.tsx +5 -5
- package/src/AutoLink/AutoLink.test.tsx +2 -4
- package/src/AutoLink/AutoLink.tsx +1 -1
- package/src/AutoLink/components/ComposeTextWithLinks/ComposeTextWithLinks.tsx +1 -1
- package/src/AutoLink/components/Link/Link.tsx +1 -5
- package/src/Banner/Banner.test.tsx +12 -0
- package/src/Banner/Banner.tsx +4 -2
- package/src/Banner/components/BannerIcon/BannerIcon.style.ts +3 -0
- package/src/Banner/components/BannerIcon/BannerIcon.tsx +1 -1
- package/src/Banner/types.ts +1 -1
- package/src/BottomSheet/BottomSheet.stories.tsx +128 -0
- package/src/BottomSheet/BottomSheet.style.ts +7 -14
- package/src/BottomSheet/BottomSheet.test.tsx +34 -39
- package/src/BottomSheet/BottomSheet.tsx +112 -92
- package/src/BottomSheet/components/BottomSheetOption/BottomSheetOption.tsx +1 -1
- package/src/BottomSheet/hooks/useBottomSheetBackHandler.test.ts +90 -0
- package/src/BottomSheet/hooks/useBottomSheetBackHandler.ts +41 -0
- package/src/Button/Button.tsx +1 -1
- package/src/Button/components/InternalButtonLoading/InternalButtonLoading.tsx +1 -2
- package/src/ButtonGroup/ButtonGroup.test.tsx +13 -11
- package/src/ButtonGroup/ButtonGroup.tsx +2 -2
- package/src/ButtonGroup/ButtonGroupAction.tsx +4 -4
- package/src/ButtonGroup/components/SecondaryActionSheet/SecondaryActionSheet.tsx +2 -2
- package/src/Card/Card.tsx +1 -1
- package/src/Card/components/InternalCardHeader.tsx +1 -1
- package/src/Checkbox/Checkbox.test.tsx +118 -1
- package/src/Checkbox/Checkbox.tsx +2 -2
- package/src/Checkbox/CheckboxGroup.test.tsx +3 -7
- package/src/Checkbox/CheckboxGroup.tsx +2 -2
- package/src/Chip/Chip.style.ts +1 -1
- package/src/Chip/Chip.tsx +20 -2
- package/src/Content/Content.tsx +7 -2
- package/src/Content/ContentHorizontal.style.ts +20 -0
- package/src/Content/ContentSpaceAround.style.ts +20 -0
- package/src/Content/ContentVertical.style.ts +20 -0
- package/src/ContentOverlay/ContentOverlay.test.tsx +34 -27
- package/src/ContentOverlay/ContentOverlay.tsx +7 -7
- package/src/ContentOverlay/UNSAFE_WrappedModalize.tsx +41 -0
- package/src/ContentOverlay/hooks/useKeyboardVisibility.test.ts +7 -7
- package/src/ContentOverlay/hooks/useViewLayoutHeight.test.ts +1 -1
- package/src/Disclosure/Disclosure.tsx +1 -1
- package/src/Divider/Divider.tsx +1 -1
- package/src/EmptyState/EmptyState.test.tsx +29 -42
- package/src/EmptyState/EmptyState.tsx +1 -1
- package/src/ErrorMessageWrapper/ErrorMessageWrapper.tsx +1 -1
- package/src/ErrorMessageWrapper/context/ErrorMessageProvider.tsx +3 -5
- package/src/ErrorMessageWrapper/context/types.ts +1 -1
- package/src/Flex/Flex.tsx +2 -2
- package/src/Form/Form.test.tsx +145 -2
- package/src/Form/Form.tsx +8 -1
- package/src/Form/components/FormActionBar/FormActionBar.tsx +3 -3
- package/src/Form/components/FormBody/FormBody.tsx +3 -3
- package/src/Form/components/FormCache/FormCache.tsx +5 -4
- package/src/Form/components/FormErrorBanner/FormErrorBanner.tsx +1 -1
- package/src/Form/components/FormMask/FormMask.tsx +1 -1
- package/src/Form/components/FormMessage/FormMessage.test.tsx +40 -27
- package/src/Form/components/FormMessage/FormMessage.tsx +1 -1
- package/src/Form/components/FormMessage/components/InternalFormMessage/InternalFormMessage.tsx +1 -1
- package/src/Form/components/FormMessageBanner/FormMessageBanner.tsx +1 -3
- package/src/Form/components/FormSaveButton/FormSaveButton.test.tsx +2 -2
- package/src/Form/components/FormSaveButton/FormSaveButton.tsx +1 -1
- package/src/Form/context/AtlantisFormContext.test.tsx +1 -1
- package/src/Form/context/AtlantisFormContext.tsx +1 -0
- package/src/Form/context/types.ts +5 -4
- package/src/Form/hooks/useFormViewRefs.ts +4 -5
- package/src/Form/hooks/useInternalForm.ts +14 -6
- package/src/Form/hooks/useScrollToError/useScrollToError.test.tsx +2 -1
- package/src/Form/types.ts +14 -8
- package/src/FormField/FormField.tsx +1 -1
- package/src/FormatFile/FormatFile.test.tsx +21 -21
- package/src/FormatFile/FormatFile.tsx +3 -3
- package/src/FormatFile/components/ErrorIcon/ErrorIcon.tsx +1 -1
- package/src/FormatFile/components/FileView/FileView.tsx +1 -1
- package/src/FormatFile/components/FormatFileBottomSheet/FormatFileBottomSheet.test.tsx +14 -14
- package/src/FormatFile/components/FormatFileBottomSheet/FormatFileBottomSheet.tsx +2 -2
- package/src/FormatFile/components/MediaView/MediaView.test.tsx +283 -0
- package/src/FormatFile/components/MediaView/MediaView.tsx +28 -7
- package/src/FormatFile/components/ProgressBar/ProgressBar.tsx +1 -1
- package/src/FormatFile/utils/createUseCreateThumbnail.ts +1 -1
- package/src/Glimmer/Glimmer.test.tsx +2 -2
- package/src/Heading/Heading.test.tsx +13 -0
- package/src/Heading/Heading.tsx +3 -3
- package/src/Heading/__snapshots__/Heading.test.tsx.snap +65 -0
- package/src/Icon/Icon.tsx +1 -1
- package/src/Icon/__snapshots__/Icon.test.tsx.snap +7 -0
- package/src/IconButton/IconButton.tsx +1 -1
- package/src/InputCurrency/InputCurrency.tsx +72 -58
- package/src/InputDate/InputDate.tsx +7 -3
- package/src/InputEmail/InputEmail.tsx +15 -8
- package/src/InputFieldWrapper/InputFieldWrapper.style.ts +1 -1
- package/src/InputFieldWrapper/InputFieldWrapper.test.tsx +48 -1
- package/src/InputFieldWrapper/InputFieldWrapper.tsx +39 -29
- package/src/InputFieldWrapper/components/ClearAction/ClearAction.tsx +1 -1
- package/src/InputFieldWrapper/components/Prefix/Prefix.test.tsx +8 -16
- package/src/InputFieldWrapper/components/Prefix/Prefix.tsx +8 -6
- package/src/InputFieldWrapper/components/Suffix/Suffix.test.tsx +2 -4
- package/src/InputFieldWrapper/components/Suffix/Suffix.tsx +8 -6
- package/src/InputNumber/InputNumber.tsx +11 -7
- package/src/InputPassword/InputPassword.tsx +1 -1
- package/src/InputPressable/InputPressable.style.ts +4 -0
- package/src/InputPressable/InputPressable.test.tsx +75 -1
- package/src/InputPressable/InputPressable.tsx +34 -8
- package/src/InputSearch/InputSearch.tsx +2 -1
- package/src/InputSearch/components/FilterButton.tsx +1 -1
- package/src/InputText/InputText.style.ts +5 -0
- package/src/InputText/InputText.test.tsx +190 -1
- package/src/InputText/InputText.tsx +37 -20
- package/src/InputText/context/InputAccessoriesProvider.tsx +1 -1
- package/src/InputTime/InputTime.tsx +7 -3
- package/src/Menu/Menu.tsx +3 -3
- package/src/Menu/components/MenuOption/MenuOption.tsx +1 -1
- package/src/Menu/components/Overlay/Overlay.tsx +1 -1
- package/src/Menu/types.ts +7 -1
- package/src/ProgressBar/ProgressBar.test.tsx +109 -0
- package/src/ProgressBar/ProgressBar.tsx +18 -2
- package/src/ProgressBar/ProgressBarInner.tsx +8 -11
- package/src/ProgressBar/ProgressBarStepped.tsx +12 -1
- package/src/ProgressBar/__snapshots__/ProgressBar.test.tsx.snap +14 -0
- package/src/ProgressBar/types.ts +22 -0
- package/src/Select/Select.style.ts +1 -0
- package/src/Select/Select.tsx +2 -2
- package/src/Select/components/SelectDefaultPicker/SelectDefaultPicker.ios.tsx +1 -1
- package/src/Select/components/SelectDefaultPicker/SelectDefaultPicker.tsx +1 -1
- package/src/Select/components/SelectInternalPicker/SelectInternalPicker.tsx +1 -1
- package/src/Select/components/SelectPressable/SelectPressable.tsx +1 -4
- package/src/StatusLabel/StatusLabel.style.ts +2 -2
- package/src/StatusLabel/StatusLabel.tsx +1 -1
- package/src/StatusLabel/__snapshots__/StatusLabel.test.tsx.snap +14 -14
- package/src/Switch/Switch.tsx +1 -1
- package/src/Switch/components/BaseSwitch/BaseSwitch.tsx +8 -2
- package/src/Text/Text.test.tsx +10 -0
- package/src/Text/Text.tsx +3 -3
- package/src/Text/__snapshots__/Text.test.tsx.snap +66 -0
- package/src/TextList/TextList.tsx +1 -1
- package/src/ThumbnailList/ThumbnailList.test.tsx +5 -5
- package/src/ThumbnailList/ThumbnailList.tsx +1 -1
- package/src/ThumbnailList/__snapshots__/ThumbnailList.test.tsx.snap +199 -1
- package/src/Toast/Toast.tsx +2 -2
- package/src/Typography/Typography.test.tsx +61 -0
- package/src/Typography/Typography.tsx +25 -9
- package/src/Typography/TypographyGestureDetector.tsx +1 -3
- package/src/Typography/__snapshots__/Typography.test.tsx.snap +222 -0
- package/src/hooks/useAtlantisI18n/locales/en.json +1 -0
- package/src/hooks/useAtlantisI18n/locales/es.json +1 -0
- package/src/hooks/useFormController.ts +7 -14
- package/src/utils/test/MockSafeAreaProvider.tsx +1 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
package/src/Banner/Banner.tsx
CHANGED
|
@@ -18,7 +18,7 @@ export function Banner({
|
|
|
18
18
|
type,
|
|
19
19
|
children,
|
|
20
20
|
icon,
|
|
21
|
-
}: BannerProps)
|
|
21
|
+
}: BannerProps) {
|
|
22
22
|
const bannerIcon = icon || getBannerIcon(type);
|
|
23
23
|
|
|
24
24
|
const shouldFlow =
|
|
@@ -60,7 +60,7 @@ export function Banner({
|
|
|
60
60
|
);
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
function BannerChildren({ children }: PropsWithChildren)
|
|
63
|
+
function BannerChildren({ children }: PropsWithChildren) {
|
|
64
64
|
if (!children) return <></>;
|
|
65
65
|
|
|
66
66
|
if (children && typeof children === "string") {
|
|
@@ -97,5 +97,7 @@ function getBannerIcon(type: BannerTypes): IconNames | undefined {
|
|
|
97
97
|
return "help";
|
|
98
98
|
case "error":
|
|
99
99
|
return "alert";
|
|
100
|
+
case "success":
|
|
101
|
+
return "checkmark";
|
|
100
102
|
}
|
|
101
103
|
}
|
|
@@ -10,7 +10,7 @@ export interface BannerIconProps {
|
|
|
10
10
|
readonly type: BannerTypes;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
export function BannerIcon({ icon, type }: BannerIconProps)
|
|
13
|
+
export function BannerIcon({ icon, type }: BannerIconProps) {
|
|
14
14
|
const styles = useStyles();
|
|
15
15
|
|
|
16
16
|
return (
|
package/src/Banner/types.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { IconNames } from "@jobber/design";
|
|
|
2
2
|
import type { ReactElement } from "react";
|
|
3
3
|
import type { StyleProp, ViewStyle } from "react-native";
|
|
4
4
|
|
|
5
|
-
export type BannerTypes = "error" | "warning" | "notice";
|
|
5
|
+
export type BannerTypes = "error" | "warning" | "notice" | "success";
|
|
6
6
|
|
|
7
7
|
export interface BannerStyleProps {
|
|
8
8
|
/**
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import React, { useRef } from "react";
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react-native-web-vite";
|
|
3
|
+
import { View } from "react-native";
|
|
4
|
+
import { SafeAreaProvider } from "react-native-safe-area-context";
|
|
5
|
+
import { Button, Heading, Text } from "@jobber/components-native";
|
|
6
|
+
import { BottomSheet } from "./BottomSheet";
|
|
7
|
+
import type { BottomSheetRef } from "./BottomSheet";
|
|
8
|
+
import { BottomSheetOption } from "./components/BottomSheetOption";
|
|
9
|
+
|
|
10
|
+
const meta = {
|
|
11
|
+
title: "Components/Selections/BottomSheet",
|
|
12
|
+
component: BottomSheet,
|
|
13
|
+
} satisfies Meta<typeof BottomSheet>;
|
|
14
|
+
|
|
15
|
+
export default meta;
|
|
16
|
+
type Story = StoryObj<typeof meta>;
|
|
17
|
+
|
|
18
|
+
const BasicTemplate = () => {
|
|
19
|
+
const bottomSheetRef = useRef<BottomSheetRef>(null);
|
|
20
|
+
|
|
21
|
+
const openBottomSheet = () => {
|
|
22
|
+
bottomSheetRef.current?.open();
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const closeBottomSheet = () => {
|
|
26
|
+
bottomSheetRef.current?.close();
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<SafeAreaProvider>
|
|
31
|
+
<View style={{ display: "flex", flexDirection: "column", gap: 16 }}>
|
|
32
|
+
<Heading>Basic BottomSheet</Heading>
|
|
33
|
+
<Text>
|
|
34
|
+
Note that due to the differences between React Native Web and React
|
|
35
|
+
Native, this does not render 100% properly
|
|
36
|
+
</Text>
|
|
37
|
+
<Button label="Open Bottom Sheet" onPress={openBottomSheet} />
|
|
38
|
+
<Button label="Close Bottom Sheet" onPress={closeBottomSheet} />
|
|
39
|
+
</View>
|
|
40
|
+
<BottomSheet
|
|
41
|
+
ref={bottomSheetRef}
|
|
42
|
+
onClose={() => console.log("closed bottom sheet")}
|
|
43
|
+
onOpen={() => console.log("opened bottom sheet")}
|
|
44
|
+
>
|
|
45
|
+
<BottomSheetOption
|
|
46
|
+
icon="sendMessage"
|
|
47
|
+
iconColor="greyBlue"
|
|
48
|
+
text="Send message"
|
|
49
|
+
onPress={() => alert("send message")}
|
|
50
|
+
/>
|
|
51
|
+
<BottomSheetOption
|
|
52
|
+
icon="phone"
|
|
53
|
+
iconColor="greyBlue"
|
|
54
|
+
text="Call a friend"
|
|
55
|
+
onPress={() => alert("Calling a friend")}
|
|
56
|
+
/>
|
|
57
|
+
<BottomSheetOption
|
|
58
|
+
destructive={true}
|
|
59
|
+
icon="trash"
|
|
60
|
+
text="Remove"
|
|
61
|
+
onPress={() => alert("Removed")}
|
|
62
|
+
/>
|
|
63
|
+
</BottomSheet>
|
|
64
|
+
</SafeAreaProvider>
|
|
65
|
+
);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const HeaderFooterInputTextTemplate = () => {
|
|
69
|
+
const bottomSheetRef = useRef<BottomSheetRef>(null);
|
|
70
|
+
|
|
71
|
+
const openBottomSheet = () => {
|
|
72
|
+
bottomSheetRef.current?.open();
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const closeBottomSheet = () => {
|
|
76
|
+
bottomSheetRef.current?.close();
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<SafeAreaProvider>
|
|
81
|
+
<View style={{ display: "flex", flexDirection: "column", gap: 16 }}>
|
|
82
|
+
<Heading>Basic BottomSheet</Heading>
|
|
83
|
+
<Text>
|
|
84
|
+
Note that due to the differences between React Native Web and React
|
|
85
|
+
Native, this does not render 100% properly
|
|
86
|
+
</Text>
|
|
87
|
+
<Button label="Open Bottom Sheet" onPress={openBottomSheet} />
|
|
88
|
+
<Button label="Close Bottom Sheet" onPress={closeBottomSheet} />
|
|
89
|
+
</View>
|
|
90
|
+
<BottomSheet
|
|
91
|
+
ref={bottomSheetRef}
|
|
92
|
+
showCancel={true}
|
|
93
|
+
heading="BottomSheet Header"
|
|
94
|
+
onClose={() => console.log("closed bottom sheet")}
|
|
95
|
+
onOpen={() => console.log("opened bottom sheet")}
|
|
96
|
+
>
|
|
97
|
+
<BottomSheetOption
|
|
98
|
+
icon="sendMessage"
|
|
99
|
+
iconColor="greyBlue"
|
|
100
|
+
text="Send message"
|
|
101
|
+
onPress={() => alert("send message")}
|
|
102
|
+
/>
|
|
103
|
+
<BottomSheetOption
|
|
104
|
+
icon="phone"
|
|
105
|
+
iconColor="greyBlue"
|
|
106
|
+
text="Call a friend"
|
|
107
|
+
onPress={() => alert("Calling a friend")}
|
|
108
|
+
/>
|
|
109
|
+
<BottomSheetOption
|
|
110
|
+
destructive={true}
|
|
111
|
+
icon="trash"
|
|
112
|
+
text="Remove"
|
|
113
|
+
onPress={() => alert("Removed")}
|
|
114
|
+
/>
|
|
115
|
+
</BottomSheet>
|
|
116
|
+
</SafeAreaProvider>
|
|
117
|
+
);
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
export const Basic: Story = {
|
|
121
|
+
render: BasicTemplate,
|
|
122
|
+
args: {} as Story["args"],
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
export const HeaderFooterInputText: Story = {
|
|
126
|
+
render: HeaderFooterInputTextTemplate,
|
|
127
|
+
args: {} as Story["args"],
|
|
128
|
+
};
|
|
@@ -1,28 +1,18 @@
|
|
|
1
|
-
import { Dimensions, StyleSheet } from "react-native";
|
|
2
1
|
import { buildThemedStyles } from "../AtlantisThemeContext";
|
|
3
2
|
|
|
4
|
-
const { height } = Dimensions.get("window");
|
|
5
|
-
|
|
6
3
|
export const useStyles = buildThemedStyles(tokens => {
|
|
7
4
|
const modalBorderRadius = tokens["radius-larger"];
|
|
8
5
|
|
|
9
6
|
return {
|
|
10
|
-
|
|
11
|
-
backgroundColor: "transparent",
|
|
12
|
-
},
|
|
13
|
-
|
|
14
|
-
overlay: {
|
|
15
|
-
...StyleSheet.absoluteFillObject,
|
|
7
|
+
backdrop: {
|
|
16
8
|
backgroundColor: tokens["color-overlay"],
|
|
17
|
-
height,
|
|
18
9
|
},
|
|
19
|
-
|
|
10
|
+
background: {
|
|
20
11
|
borderTopLeftRadius: modalBorderRadius,
|
|
21
12
|
borderTopRightRadius: modalBorderRadius,
|
|
22
|
-
paddingTop: tokens["space-small"],
|
|
23
13
|
},
|
|
24
|
-
|
|
25
|
-
|
|
14
|
+
footerContainer: {
|
|
15
|
+
backgroundColor: tokens["color-surface"],
|
|
26
16
|
},
|
|
27
17
|
header: {
|
|
28
18
|
paddingHorizontal: tokens["space-base"],
|
|
@@ -34,5 +24,8 @@ export const useStyles = buildThemedStyles(tokens => {
|
|
|
34
24
|
marginTop: tokens["space-small"],
|
|
35
25
|
marginBottom: tokens["space-smaller"],
|
|
36
26
|
},
|
|
27
|
+
handle: {
|
|
28
|
+
display: "none",
|
|
29
|
+
},
|
|
37
30
|
};
|
|
38
31
|
});
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { createRef } from "react";
|
|
2
|
-
import { act,
|
|
2
|
+
import { act, render, userEvent, waitFor } from "@testing-library/react-native";
|
|
3
3
|
import { AccessibilityInfo, View } from "react-native";
|
|
4
|
-
import { Host, Portal } from "react-native-portalize";
|
|
5
4
|
import { BottomSheet } from ".";
|
|
6
5
|
import type { BottomSheetRef } from "./BottomSheet";
|
|
7
6
|
import { waitForUntestableRender } from "../utils/test/wait";
|
|
@@ -23,62 +22,59 @@ function setup({
|
|
|
23
22
|
loading?: boolean;
|
|
24
23
|
}) {
|
|
25
24
|
return render(
|
|
26
|
-
<
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
>
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
</View>
|
|
39
|
-
</BottomSheet>
|
|
40
|
-
</Portal>
|
|
41
|
-
</Host>,
|
|
25
|
+
<BottomSheet
|
|
26
|
+
ref={ref}
|
|
27
|
+
heading={heading}
|
|
28
|
+
showCancel={showCancel}
|
|
29
|
+
loading={loading}
|
|
30
|
+
onClose={mockOnClose}
|
|
31
|
+
onOpen={mockOnOpen}
|
|
32
|
+
>
|
|
33
|
+
<View>
|
|
34
|
+
<Text>BottomSheet</Text>
|
|
35
|
+
</View>
|
|
36
|
+
</BottomSheet>,
|
|
42
37
|
);
|
|
43
38
|
}
|
|
44
39
|
|
|
45
40
|
it("renders a BottomSheet", async () => {
|
|
46
|
-
const {
|
|
41
|
+
const { findByText } = setup({});
|
|
47
42
|
|
|
48
43
|
await waitForUntestableRender(
|
|
49
44
|
"Wait for AccessibilityInfo.isScreenReaderEnabled to resolve",
|
|
50
45
|
);
|
|
51
46
|
|
|
52
|
-
act(() => {
|
|
47
|
+
await act(async () => {
|
|
53
48
|
ref.current?.open();
|
|
54
49
|
});
|
|
55
50
|
|
|
56
|
-
expect(
|
|
51
|
+
expect(await findByText("BottomSheet")).toBeDefined();
|
|
57
52
|
});
|
|
58
53
|
|
|
59
54
|
it("renders a BottomSheet with a header", async () => {
|
|
60
55
|
const header = "Hello this is header";
|
|
61
|
-
const {
|
|
56
|
+
const { findByText } = setup({ heading: header });
|
|
62
57
|
|
|
63
58
|
await waitForUntestableRender(
|
|
64
59
|
"Wait for AccessibilityInfo.isScreenReaderEnabled to resolve",
|
|
65
60
|
);
|
|
66
61
|
|
|
67
|
-
act(() => {
|
|
62
|
+
await act(async () => {
|
|
68
63
|
ref.current?.open();
|
|
69
64
|
});
|
|
70
65
|
|
|
71
|
-
expect(
|
|
66
|
+
expect(await findByText(header)).toBeDefined();
|
|
72
67
|
});
|
|
73
68
|
|
|
74
69
|
it("BottomSheet can be closed with the cancel action", async () => {
|
|
75
|
-
const {
|
|
70
|
+
const { findByLabelText, queryByText } = setup({ showCancel: true });
|
|
76
71
|
|
|
77
|
-
act(() => {
|
|
72
|
+
await act(async () => {
|
|
78
73
|
ref.current?.open();
|
|
79
74
|
});
|
|
80
75
|
|
|
81
|
-
|
|
76
|
+
const cancelButton = await findByLabelText("Cancel");
|
|
77
|
+
await userEvent.press(cancelButton);
|
|
82
78
|
|
|
83
79
|
await waitFor(() => {
|
|
84
80
|
expect(queryByText("BottomSheet")).toBeNull();
|
|
@@ -93,7 +89,7 @@ describe("when loading is provided and true", () => {
|
|
|
93
89
|
"Wait for AccessibilityInfo.isScreenReaderEnabled to resolve",
|
|
94
90
|
);
|
|
95
91
|
|
|
96
|
-
act(() => {
|
|
92
|
+
await act(async () => {
|
|
97
93
|
ref.current?.open();
|
|
98
94
|
});
|
|
99
95
|
|
|
@@ -104,25 +100,25 @@ describe("when loading is provided and true", () => {
|
|
|
104
100
|
it("calls onClose when BottomSheet is closed", async () => {
|
|
105
101
|
setup({});
|
|
106
102
|
|
|
107
|
-
act(() => {
|
|
103
|
+
await act(async () => {
|
|
108
104
|
ref.current?.open();
|
|
109
105
|
ref.current?.close();
|
|
110
106
|
});
|
|
111
107
|
|
|
112
108
|
await waitFor(() => {
|
|
113
|
-
expect(mockOnClose).
|
|
109
|
+
expect(mockOnClose).toHaveBeenCalledTimes(1);
|
|
114
110
|
});
|
|
115
111
|
});
|
|
116
112
|
|
|
117
113
|
it("calls onOpen when BottomSheet is opened", async () => {
|
|
118
114
|
setup({});
|
|
119
115
|
|
|
120
|
-
act(() => {
|
|
116
|
+
await act(async () => {
|
|
121
117
|
ref.current?.open();
|
|
122
118
|
});
|
|
123
119
|
|
|
124
120
|
await waitFor(() => {
|
|
125
|
-
expect(mockOnOpen).
|
|
121
|
+
expect(mockOnOpen).toHaveBeenCalledTimes(1);
|
|
126
122
|
});
|
|
127
123
|
});
|
|
128
124
|
|
|
@@ -132,17 +128,16 @@ describe("when there is a screen reader enabled", () => {
|
|
|
132
128
|
.spyOn(AccessibilityInfo, "isScreenReaderEnabled")
|
|
133
129
|
.mockImplementation(() => Promise.resolve(true));
|
|
134
130
|
|
|
135
|
-
const {
|
|
131
|
+
const { findByLabelText, queryByText } = setup({});
|
|
136
132
|
|
|
137
|
-
await
|
|
138
|
-
"Wait for AccessibilityInfo.isScreenReaderEnabled to resolve",
|
|
139
|
-
);
|
|
140
|
-
|
|
141
|
-
act(() => {
|
|
133
|
+
await act(async () => {
|
|
142
134
|
ref.current?.open();
|
|
143
135
|
});
|
|
144
136
|
|
|
145
|
-
|
|
137
|
+
const cancelButton = await findByLabelText("Cancel");
|
|
138
|
+
expect(cancelButton).toBeDefined();
|
|
139
|
+
|
|
140
|
+
await userEvent.press(cancelButton);
|
|
146
141
|
|
|
147
142
|
await waitFor(() => {
|
|
148
143
|
expect(queryByText("BottomSheet")).toBeNull();
|
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
import type { ReactNode
|
|
2
|
-
import React, {
|
|
3
|
-
import { Modalize } from "react-native-modalize";
|
|
4
|
-
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import React, { useCallback, useImperativeHandle, useRef } from "react";
|
|
5
3
|
import { Keyboard, View } from "react-native";
|
|
6
|
-
import {
|
|
4
|
+
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
5
|
+
import RNBottomSheet, {
|
|
6
|
+
BottomSheetBackdrop,
|
|
7
|
+
BottomSheetView,
|
|
8
|
+
} from "@gorhom/bottom-sheet";
|
|
9
|
+
import type { BottomSheetBackdropProps } from "@gorhom/bottom-sheet";
|
|
10
|
+
import { tokens } from "@jobber/design";
|
|
7
11
|
import { useStyles } from "./BottomSheet.style";
|
|
8
|
-
import {
|
|
12
|
+
import { BottomSheetOption } from "./components/BottomSheetOption";
|
|
13
|
+
import { useBottomSheetBackHandler } from "./hooks/useBottomSheetBackHandler";
|
|
9
14
|
import { Divider } from "../Divider";
|
|
10
15
|
import { Heading } from "../Heading";
|
|
16
|
+
import { useIsScreenReaderEnabled } from "../hooks";
|
|
11
17
|
import { useAtlantisI18n } from "../hooks/useAtlantisI18n";
|
|
12
18
|
|
|
13
19
|
export interface BottomSheetProps {
|
|
@@ -39,71 +45,89 @@ export interface BottomSheetProps {
|
|
|
39
45
|
readonly onClose?: () => void;
|
|
40
46
|
}
|
|
41
47
|
|
|
42
|
-
export
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
) {
|
|
57
|
-
const isScreenReaderEnabled = useIsScreenReaderEnabled();
|
|
58
|
-
const [open, setOpen] = useState<boolean>(false);
|
|
48
|
+
export interface BottomSheetRef {
|
|
49
|
+
open: () => void;
|
|
50
|
+
close: () => void;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function BottomSheet({
|
|
54
|
+
children,
|
|
55
|
+
showCancel,
|
|
56
|
+
loading = false,
|
|
57
|
+
heading,
|
|
58
|
+
onOpen,
|
|
59
|
+
onClose,
|
|
60
|
+
ref,
|
|
61
|
+
}: BottomSheetProps & { readonly ref?: React.Ref<BottomSheetRef> }) {
|
|
59
62
|
const styles = useStyles();
|
|
63
|
+
const isScreenReaderEnabled = useIsScreenReaderEnabled();
|
|
64
|
+
|
|
65
|
+
const cancellable = (showCancel && !loading) || isScreenReaderEnabled;
|
|
66
|
+
|
|
67
|
+
const { t } = useAtlantisI18n();
|
|
68
|
+
const insets = useSafeAreaInsets();
|
|
69
|
+
const previousIndexRef = useRef(-1);
|
|
70
|
+
const bottomSheetRef = useRef<RNBottomSheet>(null);
|
|
71
|
+
const { handleSheetPositionChange } =
|
|
72
|
+
useBottomSheetBackHandler(bottomSheetRef);
|
|
73
|
+
|
|
74
|
+
useImperativeHandle(ref, () => ({
|
|
75
|
+
open: () => {
|
|
76
|
+
bottomSheetRef.current?.expand();
|
|
77
|
+
},
|
|
78
|
+
close: () => {
|
|
79
|
+
close();
|
|
80
|
+
},
|
|
81
|
+
}));
|
|
82
|
+
|
|
83
|
+
const close = useCallback(() => {
|
|
84
|
+
bottomSheetRef.current?.close();
|
|
85
|
+
}, []);
|
|
86
|
+
|
|
87
|
+
const handleChange = (index: number) => {
|
|
88
|
+
// Handle Android back button
|
|
89
|
+
handleSheetPositionChange(index);
|
|
90
|
+
|
|
91
|
+
const previousIndex = previousIndexRef.current;
|
|
92
|
+
|
|
93
|
+
if (previousIndex === -1 && index >= 0) {
|
|
94
|
+
// Transitioned from closed to open
|
|
95
|
+
dismissKeyboard();
|
|
96
|
+
onOpen?.();
|
|
97
|
+
} else if (previousIndex >= 0 && index === -1) {
|
|
98
|
+
// Transitioned from open to closed
|
|
99
|
+
dismissKeyboard();
|
|
100
|
+
onClose?.();
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
previousIndexRef.current = index;
|
|
104
|
+
};
|
|
60
105
|
|
|
61
106
|
return (
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}}
|
|
78
|
-
styles={styles}
|
|
79
|
-
/>
|
|
80
|
-
}
|
|
81
|
-
withHandle={false}
|
|
82
|
-
withReactModal={isScreenReaderEnabled}
|
|
83
|
-
onOpen={openModal}
|
|
84
|
-
onClose={closeModal}
|
|
107
|
+
<RNBottomSheet
|
|
108
|
+
ref={bottomSheetRef}
|
|
109
|
+
index={-1}
|
|
110
|
+
backdropComponent={Backdrop}
|
|
111
|
+
backgroundStyle={styles.background}
|
|
112
|
+
enablePanDownToClose={true}
|
|
113
|
+
onChange={handleChange}
|
|
114
|
+
keyboardBlurBehavior="restore"
|
|
115
|
+
handleStyle={styles.handle}
|
|
116
|
+
>
|
|
117
|
+
<BottomSheetView
|
|
118
|
+
style={{
|
|
119
|
+
paddingBottom: insets.bottom + tokens["space-small"],
|
|
120
|
+
paddingTop: tokens["space-small"],
|
|
121
|
+
}}
|
|
85
122
|
>
|
|
86
|
-
<
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
</Modalize>
|
|
94
|
-
</>
|
|
123
|
+
{heading && <Header heading={heading} styles={styles} />}
|
|
124
|
+
{children}
|
|
125
|
+
{cancellable && (
|
|
126
|
+
<Footer styles={styles} close={close} cancelLabel={t("cancel")} />
|
|
127
|
+
)}
|
|
128
|
+
</BottomSheetView>
|
|
129
|
+
</RNBottomSheet>
|
|
95
130
|
);
|
|
96
|
-
|
|
97
|
-
function openModal() {
|
|
98
|
-
onOpen?.();
|
|
99
|
-
setOpen(true);
|
|
100
|
-
dismissKeyboard();
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
function closeModal() {
|
|
104
|
-
onClose?.();
|
|
105
|
-
setOpen(false);
|
|
106
|
-
}
|
|
107
131
|
}
|
|
108
132
|
|
|
109
133
|
function Header({
|
|
@@ -121,31 +145,21 @@ function Header({
|
|
|
121
145
|
}
|
|
122
146
|
|
|
123
147
|
function Footer({
|
|
124
|
-
cancellable,
|
|
125
|
-
onCancel,
|
|
126
148
|
styles,
|
|
149
|
+
close,
|
|
150
|
+
cancelLabel,
|
|
127
151
|
}: {
|
|
128
|
-
readonly cancellable: boolean;
|
|
129
|
-
readonly onCancel: () => void;
|
|
130
152
|
readonly styles: ReturnType<typeof useStyles>;
|
|
153
|
+
readonly close: () => void;
|
|
154
|
+
readonly cancelLabel: string;
|
|
131
155
|
}) {
|
|
132
|
-
const insets = useSafeAreaInsets();
|
|
133
|
-
const { t } = useAtlantisI18n();
|
|
134
|
-
|
|
135
156
|
return (
|
|
136
|
-
<View
|
|
137
|
-
{
|
|
138
|
-
<
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
<BottomSheetOption
|
|
143
|
-
text={t("cancel")}
|
|
144
|
-
icon={"remove"}
|
|
145
|
-
onPress={onCancel}
|
|
146
|
-
/>
|
|
147
|
-
</View>
|
|
148
|
-
)}
|
|
157
|
+
<View>
|
|
158
|
+
<View style={styles.footerDivider}>
|
|
159
|
+
<Divider />
|
|
160
|
+
</View>
|
|
161
|
+
|
|
162
|
+
<BottomSheetOption text={cancelLabel} icon="remove" onPress={close} />
|
|
149
163
|
</View>
|
|
150
164
|
);
|
|
151
165
|
}
|
|
@@ -156,10 +170,16 @@ function dismissKeyboard() {
|
|
|
156
170
|
Keyboard.dismiss();
|
|
157
171
|
}
|
|
158
172
|
|
|
159
|
-
function
|
|
160
|
-
styles
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
173
|
+
function Backdrop(bottomSheetBackdropProps: BottomSheetBackdropProps) {
|
|
174
|
+
const styles = useStyles();
|
|
175
|
+
|
|
176
|
+
return (
|
|
177
|
+
<BottomSheetBackdrop
|
|
178
|
+
{...bottomSheetBackdropProps}
|
|
179
|
+
appearsOnIndex={0}
|
|
180
|
+
disappearsOnIndex={-1}
|
|
181
|
+
style={styles.backdrop}
|
|
182
|
+
opacity={1}
|
|
183
|
+
/>
|
|
184
|
+
);
|
|
165
185
|
}
|
|
@@ -25,7 +25,7 @@ export function BottomSheetOption({
|
|
|
25
25
|
destructive,
|
|
26
26
|
textTransform = "capitalize",
|
|
27
27
|
onPress,
|
|
28
|
-
}: BottomSheetOptionProps)
|
|
28
|
+
}: BottomSheetOptionProps) {
|
|
29
29
|
const destructiveColor = "destructive";
|
|
30
30
|
const textVariation = destructive ? destructiveColor : "subdued";
|
|
31
31
|
const styles = useStyles();
|