@jobber/components-native 0.89.5-JOB-140604-cab60b8.43 → 0.89.5-JOB-140604-8777ec5.52
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 +7 -7
- package/dist/src/ActionItem/ActionItemGroup.js +1 -1
- package/dist/src/AutoLink/components/Link/Link.js +1 -1
- package/dist/src/BottomSheet/BottomSheet.js +4 -2
- package/dist/src/BottomSheet/hooks/useBottomSheetBackHandler.js +26 -0
- package/dist/src/Chip/Chip.js +12 -1
- package/dist/src/Chip/Chip.style.js +1 -1
- package/dist/src/ContentOverlay/ContentOverlay.js +3 -5
- package/dist/src/ErrorMessageWrapper/context/ErrorMessageProvider.js +1 -1
- package/dist/src/Form/Form.js +2 -1
- package/dist/src/Form/components/FormMessageBanner/FormMessageBanner.js +1 -1
- package/dist/src/Form/hooks/useInternalForm.js +6 -3
- package/dist/src/FormatFile/components/MediaView/MediaView.js +22 -5
- package/dist/src/InputDate/InputDate.js +2 -2
- package/dist/src/InputFieldWrapper/InputFieldWrapper.js +14 -12
- package/dist/src/InputFieldWrapper/components/Prefix/Prefix.js +5 -2
- package/dist/src/InputFieldWrapper/components/Suffix/Suffix.js +5 -2
- package/dist/src/InputPressable/InputPressable.js +20 -8
- package/dist/src/InputPressable/InputPressable.style.js +3 -0
- package/dist/src/InputText/InputText.js +22 -11
- 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/Select/components/SelectPressable/SelectPressable.js +1 -1
- package/dist/src/utils/meta/meta.json +0 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- 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 +1 -1
- 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/BottomSheet/BottomSheet.d.ts +4 -9
- 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 +2 -1
- package/dist/types/src/ContentOverlay/UNSAFE_WrappedModalize.d.ts +1 -1
- 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 +2 -1
- 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 +1 -1
- package/dist/types/src/Form/context/types.d.ts +2 -2
- package/dist/types/src/Form/hooks/useFormViewRefs.d.ts +2 -2
- package/dist/types/src/Form/hooks/useInternalForm.d.ts +5 -5
- package/dist/types/src/Form/types.d.ts +10 -4
- 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 +1 -1
- 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/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 +8 -0
- 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 +2 -1
- 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/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 +1 -1
- 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 +1 -1
- package/dist/types/src/Typography/TypographyGestureDetector.d.ts +2 -1
- package/dist/types/src/utils/test/MockSafeAreaProvider.d.ts +1 -1
- package/package.json +7 -7
- 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.tsx +1 -1
- package/src/ActivityIndicator/ActivityIndicator.tsx +1 -3
- 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.tsx +2 -2
- package/src/Banner/components/BannerIcon/BannerIcon.tsx +1 -1
- package/src/BottomSheet/BottomSheet.stories.tsx +0 -1
- package/src/BottomSheet/BottomSheet.tsx +9 -10
- 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 -1
- package/src/ButtonGroup/ButtonGroup.tsx +1 -1
- 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.tsx +2 -2
- package/src/Checkbox/CheckboxGroup.test.tsx +1 -1
- 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 +1 -1
- package/src/ContentOverlay/ContentOverlay.tsx +3 -4
- package/src/Disclosure/Disclosure.tsx +1 -1
- package/src/Divider/Divider.tsx +1 -1
- 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 +3 -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 +1 -1
- package/src/Form/components/FormErrorBanner/FormErrorBanner.tsx +1 -1
- package/src/Form/components/FormMask/FormMask.tsx +1 -1
- 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.tsx +1 -1
- package/src/Form/context/types.ts +2 -2
- package/src/Form/hooks/useFormViewRefs.ts +4 -5
- package/src/Form/hooks/useInternalForm.ts +12 -5
- package/src/Form/types.ts +11 -4
- package/src/FormField/FormField.tsx +1 -1
- 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.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/Heading/Heading.tsx +1 -1
- package/src/Icon/Icon.tsx +1 -1
- package/src/IconButton/IconButton.tsx +1 -1
- package/src/InputCurrency/InputCurrency.tsx +1 -1
- package/src/InputDate/InputDate.tsx +7 -3
- 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 +3 -5
- 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/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 +1 -0
- package/src/InputSearch/components/FilterButton.tsx +1 -1
- package/src/InputText/InputText.style.ts +5 -0
- package/src/InputText/InputText.test.tsx +75 -0
- package/src/InputText/InputText.tsx +32 -12
- 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.tsx +1 -1
- package/src/ProgressBar/ProgressBarInner.tsx +1 -1
- 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.tsx +1 -1
- package/src/Switch/Switch.tsx +1 -1
- package/src/Switch/components/BaseSwitch/BaseSwitch.tsx +1 -1
- package/src/Text/Text.tsx +1 -1
- package/src/TextList/TextList.tsx +1 -1
- package/src/ThumbnailList/ThumbnailList.tsx +1 -1
- package/src/Toast/Toast.tsx +2 -2
- package/src/Typography/Typography.tsx +1 -1
- package/src/Typography/TypographyGestureDetector.tsx +1 -3
- package/src/utils/meta/meta.json +0 -1
- package/src/utils/test/MockSafeAreaProvider.tsx +1 -1
- package/dist/src/BottomSheet/components/BottomSheetInputText/BottomSheetInputText.js +0 -45
- package/dist/src/BottomSheet/components/BottomSheetInputText/BottomSheetInputText.styles.js +0 -8
- package/dist/types/src/BottomSheet/components/BottomSheetInputText/BottomSheetInputText.d.ts +0 -9
- package/dist/types/src/BottomSheet/components/BottomSheetInputText/BottomSheetInputText.styles.d.ts +0 -5
- package/src/BottomSheet/components/BottomSheetInputText/BottomSheetInputText.styles.ts +0 -9
- package/src/BottomSheet/components/BottomSheetInputText/BottomSheetInputText.tsx +0 -89
package/src/Menu/types.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ReactElement } from "react";
|
|
1
2
|
import type { IconColorNames, IconNames } from "@jobber/design";
|
|
2
3
|
import type { TextAlign } from "../Typography";
|
|
3
4
|
|
|
@@ -15,9 +16,14 @@ export interface MenuOptionInternalProps extends MenuOptionProps {
|
|
|
15
16
|
setOpen: (bool: boolean) => void;
|
|
16
17
|
}
|
|
17
18
|
|
|
19
|
+
export interface CustomActivatorProps {
|
|
20
|
+
readonly onPress?: () => void;
|
|
21
|
+
readonly onLongPress?: () => void;
|
|
22
|
+
}
|
|
23
|
+
|
|
18
24
|
export interface MenuProps {
|
|
19
25
|
readonly menuOptions?: MenuOptionProps[];
|
|
20
|
-
readonly customActivator?:
|
|
26
|
+
readonly customActivator?: ReactElement<CustomActivatorProps>;
|
|
21
27
|
}
|
|
22
28
|
|
|
23
29
|
export interface OverlayProp {
|
|
@@ -14,7 +14,7 @@ export function ProgressBarInner({
|
|
|
14
14
|
width,
|
|
15
15
|
// animationDuration = 0,
|
|
16
16
|
color,
|
|
17
|
-
}: ProgressBarInnerProps)
|
|
17
|
+
}: ProgressBarInnerProps) {
|
|
18
18
|
// Animation breaking on Android
|
|
19
19
|
// const [animatedOpacity] = useTiming({
|
|
20
20
|
// duration: animationDuration,
|
package/src/Select/Select.tsx
CHANGED
|
@@ -110,7 +110,7 @@ export function Select({
|
|
|
110
110
|
accessibilityLabel,
|
|
111
111
|
name,
|
|
112
112
|
testID,
|
|
113
|
-
}: SelectProps)
|
|
113
|
+
}: SelectProps) {
|
|
114
114
|
const { field, error } = useFormController({
|
|
115
115
|
name,
|
|
116
116
|
validations,
|
|
@@ -243,6 +243,6 @@ function getTestID(testID?: string): string {
|
|
|
243
243
|
return "ATL-Select";
|
|
244
244
|
}
|
|
245
245
|
|
|
246
|
-
export function Option({ children }: SelectOption)
|
|
246
|
+
export function Option({ children }: SelectOption) {
|
|
247
247
|
return <>{children}</>;
|
|
248
248
|
}
|
|
@@ -19,7 +19,7 @@ export function SelectDefaultPicker({
|
|
|
19
19
|
children,
|
|
20
20
|
options,
|
|
21
21
|
onChange,
|
|
22
|
-
}: SelectDefaultPickerProps)
|
|
22
|
+
}: SelectDefaultPickerProps) {
|
|
23
23
|
const [show, setShow] = useState(false);
|
|
24
24
|
const { t } = useAtlantisI18n();
|
|
25
25
|
const selectedLanguage = options.find(option => option.isActive);
|
|
@@ -12,7 +12,7 @@ export function SelectDefaultPicker({
|
|
|
12
12
|
options,
|
|
13
13
|
disabled,
|
|
14
14
|
onChange,
|
|
15
|
-
}: SelectDefaultPickerProps)
|
|
15
|
+
}: SelectDefaultPickerProps) {
|
|
16
16
|
const selectedItem = options.find(option => option.isActive);
|
|
17
17
|
const pickerRef = useRef<Picker<string>>(null);
|
|
18
18
|
const { tokens } = useAtlantisTheme();
|
|
@@ -13,10 +13,7 @@ type SelectPressableProps = Pick<SelectInternalPickerProps, "children"> &
|
|
|
13
13
|
* screen-reader is being used to avoid screen-readers from ignoring the press
|
|
14
14
|
* on the MenuView
|
|
15
15
|
*/
|
|
16
|
-
export function SelectPressable({
|
|
17
|
-
children,
|
|
18
|
-
onPress,
|
|
19
|
-
}: SelectPressableProps): JSX.Element {
|
|
16
|
+
export function SelectPressable({ children, onPress }: SelectPressableProps) {
|
|
20
17
|
const isScreenReaderEnabled = useIsScreenReaderEnabled();
|
|
21
18
|
const styles = useStyles();
|
|
22
19
|
if (isScreenReaderEnabled) return <>{children}</>;
|
package/src/Switch/Switch.tsx
CHANGED
|
@@ -20,7 +20,7 @@ interface WithLabelProps extends BaseSwitchProps {
|
|
|
20
20
|
|
|
21
21
|
export type SwitchProps = XOR<BaseSwitchProps, WithLabelProps>;
|
|
22
22
|
|
|
23
|
-
export function Switch(props: SwitchProps)
|
|
23
|
+
export function Switch(props: SwitchProps) {
|
|
24
24
|
const switchProps: SwitchProps = {
|
|
25
25
|
...props,
|
|
26
26
|
accessibilityLabel: props.accessibilityLabel || props.label,
|
package/src/Text/Text.tsx
CHANGED
package/src/Toast/Toast.tsx
CHANGED
|
@@ -17,7 +17,7 @@ import { tokens as staticTokens } from "../utils/design";
|
|
|
17
17
|
const MAX_TOAST_MESSAGE_LENGTH = 60;
|
|
18
18
|
const ANNOUNCEMENT_DELAY = 100;
|
|
19
19
|
|
|
20
|
-
function DefaultToast({ text1 }: ToastConfigParams<string>)
|
|
20
|
+
function DefaultToast({ text1 }: ToastConfigParams<string>) {
|
|
21
21
|
const { bottom } = useSafeAreaInsets();
|
|
22
22
|
const { t } = useAtlantisI18n();
|
|
23
23
|
const styles = useStyles();
|
|
@@ -56,7 +56,7 @@ export interface JobberToastProps {
|
|
|
56
56
|
readonly bottomOffset?: number;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
export function JobberToast({ bottomOffset }: JobberToastProps)
|
|
59
|
+
export function JobberToast({ bottomOffset }: JobberToastProps) {
|
|
60
60
|
return <Toast bottomOffset={bottomOffset} config={toastConfig} />;
|
|
61
61
|
}
|
|
62
62
|
|
|
@@ -174,7 +174,7 @@ function InternalTypography<T extends FontFamily = "base">({
|
|
|
174
174
|
UNSAFE_style,
|
|
175
175
|
selectable = true,
|
|
176
176
|
onTextLayout,
|
|
177
|
-
}: TypographyProps<T>)
|
|
177
|
+
}: TypographyProps<T>) {
|
|
178
178
|
const styles = useTypographyStyles();
|
|
179
179
|
const sizeAndHeight = getSizeAndHeightStyle(size, styles, lineHeight);
|
|
180
180
|
const style: StyleProp<ViewStyle>[] = [
|
|
@@ -7,8 +7,6 @@ import { Gesture, GestureDetector } from "react-native-gesture-handler";
|
|
|
7
7
|
* accidental highlighting of text in Android devices
|
|
8
8
|
* https://github.com/software-mansion/react-native-gesture-handler/issues/1372
|
|
9
9
|
*/
|
|
10
|
-
export function TypographyGestureDetector(
|
|
11
|
-
props: PropsWithChildren<unknown>,
|
|
12
|
-
): JSX.Element {
|
|
10
|
+
export function TypographyGestureDetector(props: PropsWithChildren<unknown>) {
|
|
13
11
|
return <GestureDetector {...props} gesture={Gesture.Native()} />;
|
|
14
12
|
}
|
package/src/utils/meta/meta.json
CHANGED
|
@@ -12,7 +12,7 @@ export function MockSafeAreaProvider({
|
|
|
12
12
|
frame,
|
|
13
13
|
insets,
|
|
14
14
|
children,
|
|
15
|
-
}: MockSafeAreaProviderProps)
|
|
15
|
+
}: MockSafeAreaProviderProps) {
|
|
16
16
|
const initialFrame: Rect = { x: 0, y: 0, width: 0, height: 0 };
|
|
17
17
|
const initialInsets: EdgeInsets = { bottom: 50, top: 50, left: 0, right: 0 };
|
|
18
18
|
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef, useCallback } from "react";
|
|
2
|
-
import { TextInput, View, findNodeHandle } from "react-native";
|
|
3
|
-
import { useBottomSheetInternal } from "@gorhom/bottom-sheet";
|
|
4
|
-
import { useStyles } from "./BottomSheetInputText.styles";
|
|
5
|
-
import { InputText } from "../../../InputText/InputText";
|
|
6
|
-
/**
|
|
7
|
-
* BottomSheetInputText is a wrapper around InputText that provides
|
|
8
|
-
* bottom sheet keyboard handling. It implements the handleOnFocus and
|
|
9
|
-
* handleOnBlur logic from BottomSheetTextInput to ensure proper keyboard
|
|
10
|
-
* positioning within bottom sheets.
|
|
11
|
-
*/
|
|
12
|
-
export const BottomSheetInputText = forwardRef(function BottomSheetInputText(props, ref) {
|
|
13
|
-
const styles = useStyles();
|
|
14
|
-
const { onFocus, onBlur } = props;
|
|
15
|
-
const { animatedKeyboardState, textInputNodesRef } = useBottomSheetInternal();
|
|
16
|
-
const handleOnFocus = useCallback((event) => {
|
|
17
|
-
animatedKeyboardState.set((state) => (Object.assign(Object.assign({}, state), { target: event === null || event === void 0 ? void 0 : event.nativeEvent.target })));
|
|
18
|
-
onFocus === null || onFocus === void 0 ? void 0 : onFocus(event);
|
|
19
|
-
}, [animatedKeyboardState, onFocus]);
|
|
20
|
-
const handleOnBlur = useCallback((event) => {
|
|
21
|
-
const keyboardState = animatedKeyboardState.get();
|
|
22
|
-
const currentlyFocusedInput = TextInput.State.currentlyFocusedInput();
|
|
23
|
-
const currentFocusedInput = currentlyFocusedInput !== null
|
|
24
|
-
? findNodeHandle(
|
|
25
|
-
// @ts-expect-error - TextInput.State.currentlyFocusedInput() returns NativeMethods
|
|
26
|
-
// which is not directly assignable to findNodeHandle's expected type,
|
|
27
|
-
// but it works at runtime. This is a known type limitation in React Native.
|
|
28
|
-
currentlyFocusedInput)
|
|
29
|
-
: null;
|
|
30
|
-
/**
|
|
31
|
-
* we need to make sure that we only remove the target
|
|
32
|
-
* if the target belong to the current component and
|
|
33
|
-
* if the currently focused input is not in the targets set.
|
|
34
|
-
*/
|
|
35
|
-
const shouldRemoveCurrentTarget = keyboardState.target === (event === null || event === void 0 ? void 0 : event.nativeEvent.target);
|
|
36
|
-
const shouldIgnoreBlurEvent = currentFocusedInput &&
|
|
37
|
-
textInputNodesRef.current.has(currentFocusedInput);
|
|
38
|
-
if (shouldRemoveCurrentTarget && !shouldIgnoreBlurEvent) {
|
|
39
|
-
animatedKeyboardState.set((state) => (Object.assign(Object.assign({}, state), { target: undefined })));
|
|
40
|
-
}
|
|
41
|
-
onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
|
|
42
|
-
}, [animatedKeyboardState, textInputNodesRef, onBlur]);
|
|
43
|
-
return (React.createElement(View, { style: styles.inputText },
|
|
44
|
-
React.createElement(InputText, Object.assign({}, props, { ref: ref, onFocus: handleOnFocus, onBlur: handleOnBlur }))));
|
|
45
|
-
});
|
package/dist/types/src/BottomSheet/components/BottomSheetInputText/BottomSheetInputText.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import type { InputTextProps, InputTextRef } from "../../../InputText/InputText";
|
|
3
|
-
/**
|
|
4
|
-
* BottomSheetInputText is a wrapper around InputText that provides
|
|
5
|
-
* bottom sheet keyboard handling. It implements the handleOnFocus and
|
|
6
|
-
* handleOnBlur logic from BottomSheetTextInput to ensure proper keyboard
|
|
7
|
-
* positioning within bottom sheets.
|
|
8
|
-
*/
|
|
9
|
-
export declare const BottomSheetInputText: React.ForwardRefExoticComponent<InputTextProps & React.RefAttributes<InputTextRef>>;
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef, useCallback } from "react";
|
|
2
|
-
import type { FocusEvent } from "react-native";
|
|
3
|
-
import { TextInput, View, findNodeHandle } from "react-native";
|
|
4
|
-
import { useBottomSheetInternal } from "@gorhom/bottom-sheet";
|
|
5
|
-
import { useStyles } from "./BottomSheetInputText.styles";
|
|
6
|
-
import type {
|
|
7
|
-
InputTextProps,
|
|
8
|
-
InputTextRef,
|
|
9
|
-
} from "../../../InputText/InputText";
|
|
10
|
-
import { InputText } from "../../../InputText/InputText";
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* BottomSheetInputText is a wrapper around InputText that provides
|
|
14
|
-
* bottom sheet keyboard handling. It implements the handleOnFocus and
|
|
15
|
-
* handleOnBlur logic from BottomSheetTextInput to ensure proper keyboard
|
|
16
|
-
* positioning within bottom sheets.
|
|
17
|
-
*/
|
|
18
|
-
export const BottomSheetInputText = forwardRef<InputTextRef, InputTextProps>(
|
|
19
|
-
function BottomSheetInputText(props, ref) {
|
|
20
|
-
const styles = useStyles();
|
|
21
|
-
const { onFocus, onBlur } = props;
|
|
22
|
-
const { animatedKeyboardState, textInputNodesRef } =
|
|
23
|
-
useBottomSheetInternal();
|
|
24
|
-
|
|
25
|
-
const handleOnFocus = useCallback(
|
|
26
|
-
(event?: FocusEvent) => {
|
|
27
|
-
animatedKeyboardState.set(
|
|
28
|
-
(state: ReturnType<typeof animatedKeyboardState.get>) => ({
|
|
29
|
-
...state,
|
|
30
|
-
target: event?.nativeEvent.target,
|
|
31
|
-
}),
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
onFocus?.(event);
|
|
35
|
-
},
|
|
36
|
-
[animatedKeyboardState, onFocus],
|
|
37
|
-
);
|
|
38
|
-
|
|
39
|
-
const handleOnBlur = useCallback(
|
|
40
|
-
(event?: FocusEvent) => {
|
|
41
|
-
const keyboardState = animatedKeyboardState.get();
|
|
42
|
-
const currentlyFocusedInput = TextInput.State.currentlyFocusedInput();
|
|
43
|
-
const currentFocusedInput =
|
|
44
|
-
currentlyFocusedInput !== null
|
|
45
|
-
? findNodeHandle(
|
|
46
|
-
// @ts-expect-error - TextInput.State.currentlyFocusedInput() returns NativeMethods
|
|
47
|
-
// which is not directly assignable to findNodeHandle's expected type,
|
|
48
|
-
// but it works at runtime. This is a known type limitation in React Native.
|
|
49
|
-
currentlyFocusedInput,
|
|
50
|
-
)
|
|
51
|
-
: null;
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* we need to make sure that we only remove the target
|
|
55
|
-
* if the target belong to the current component and
|
|
56
|
-
* if the currently focused input is not in the targets set.
|
|
57
|
-
*/
|
|
58
|
-
const shouldRemoveCurrentTarget =
|
|
59
|
-
keyboardState.target === event?.nativeEvent.target;
|
|
60
|
-
const shouldIgnoreBlurEvent =
|
|
61
|
-
currentFocusedInput &&
|
|
62
|
-
textInputNodesRef.current.has(currentFocusedInput);
|
|
63
|
-
|
|
64
|
-
if (shouldRemoveCurrentTarget && !shouldIgnoreBlurEvent) {
|
|
65
|
-
animatedKeyboardState.set(
|
|
66
|
-
(state: ReturnType<typeof animatedKeyboardState.get>) => ({
|
|
67
|
-
...state,
|
|
68
|
-
target: undefined,
|
|
69
|
-
}),
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
onBlur?.(event);
|
|
74
|
-
},
|
|
75
|
-
[animatedKeyboardState, textInputNodesRef, onBlur],
|
|
76
|
-
);
|
|
77
|
-
|
|
78
|
-
return (
|
|
79
|
-
<View style={styles.inputText}>
|
|
80
|
-
<InputText
|
|
81
|
-
{...props}
|
|
82
|
-
ref={ref}
|
|
83
|
-
onFocus={handleOnFocus}
|
|
84
|
-
onBlur={handleOnBlur}
|
|
85
|
-
/>
|
|
86
|
-
</View>
|
|
87
|
-
);
|
|
88
|
-
},
|
|
89
|
-
);
|