react-native-ui-lib 8.3.3 → 8.3.4-snapshot.7783

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/lib/android/build.gradle +3 -3
  2. package/lib/components/HighlighterOverlayView/index.d.ts +2 -2
  3. package/lib/components/HighlighterOverlayView/index.web.d.ts +2 -2
  4. package/lib/components/Keyboard/KeyboardAccessoryView/CustomKeyboardView/CustomKeyboardViewBase.d.ts +1 -1
  5. package/lib/components/Keyboard/KeyboardAccessoryView/KeyboardRegistry/index.js +5 -1
  6. package/lib/components/Keyboard/KeyboardAccessoryView/index.d.ts +2 -2
  7. package/lib/components/Keyboard/KeyboardAccessoryView/index.js +3 -1
  8. package/lib/components/Keyboard/KeyboardTrackingView/KeyboardTrackingView.ios.js +3 -1
  9. package/lib/components/Keyboard/KeyboardTrackingView/index.d.ts +6 -2
  10. package/lib/components/Keyboard/KeyboardTrackingView/index.js +5 -4
  11. package/lib/components/Keyboard/index.d.ts +2 -1
  12. package/lib/package.json +20 -21
  13. package/lib/react-native.config.js +1 -1
  14. package/package.json +161 -164
  15. package/screenFooter.d.ts +2 -0
  16. package/screenFooter.js +1 -0
  17. package/scripts/release/prReleaseNotesCommon.js +2 -1
  18. package/src/assets/internal/images/bottomGradient.png +0 -0
  19. package/src/assets/internal/images/bottomGradient@1.5x.png +0 -0
  20. package/src/assets/internal/images/bottomGradient@2x.png +0 -0
  21. package/src/assets/internal/images/bottomGradient@3x.png +0 -0
  22. package/src/assets/internal/images/bottomGradient@4x.png +0 -0
  23. package/src/assets/internal/images/index.js +3 -0
  24. package/src/commons/asBaseComponent.js +2 -1
  25. package/src/commons/baseComponent.js +0 -8
  26. package/src/commons/forwardRef.js +1 -4
  27. package/src/commons/modifiers.d.ts +0 -6
  28. package/src/commons/modifiers.js +0 -18
  29. package/src/commons/withScrollEnabler.js +0 -4
  30. package/src/commons/withScrollReached.js +0 -4
  31. package/src/components/KeyboardAwareScrollView/KeyboardAwareBase.js +0 -7
  32. package/src/components/KeyboardAwareScrollView/KeyboardAwareFlatList.js +0 -6
  33. package/src/components/KeyboardAwareScrollView/KeyboardAwareScrollView.js +0 -6
  34. package/src/components/WheelPicker/WheelPicker.driver.d.ts +2 -2
  35. package/src/components/WheelPicker/index.d.ts +2 -2
  36. package/src/components/WheelPicker/index.js +1 -1
  37. package/src/components/WheelPicker/usePresenter.d.ts +1 -1
  38. package/src/components/actionSheet/index.d.ts +1 -1
  39. package/src/components/animatedImage/index.d.ts +1 -1
  40. package/src/components/animatedScanner/index.js +0 -37
  41. package/src/components/avatar/index.d.ts +1 -1
  42. package/src/components/badge/index.d.ts +4 -4
  43. package/src/components/baseInput/index.d.ts +0 -1
  44. package/src/components/baseInput/index.js +1 -49
  45. package/src/components/button/index.d.ts +4 -4
  46. package/src/components/button/types.d.ts +2 -2
  47. package/src/components/carousel/index.d.ts +8 -8
  48. package/src/components/carousel/types.d.ts +4 -1
  49. package/src/components/carousel/types.js +0 -2
  50. package/src/components/checkbox/index.d.ts +1 -1
  51. package/src/components/chip/index.d.ts +1 -1
  52. package/src/components/colorPalette/index.d.ts +1 -1
  53. package/src/components/dateTimePicker/index.d.ts +2 -2
  54. package/src/components/dateTimePicker/index.js +2 -2
  55. package/src/components/dialog/types.d.ts +4 -4
  56. package/src/components/dialog/useDialogContent.d.ts +1 -1
  57. package/src/components/drawer/index.d.ts +1 -1
  58. package/src/components/expandableSection/index.d.ts +2 -2
  59. package/src/components/fadedScrollView/index.js +1 -1
  60. package/src/components/featureHighlight/index.js +5 -7
  61. package/src/components/gridListItem/index.d.ts +7 -7
  62. package/src/components/gridView/index.d.ts +1 -1
  63. package/src/components/hint/HintBubble.d.ts +1 -1
  64. package/src/components/hint/HintOld.d.ts +10 -10
  65. package/src/components/hint/hooks/useHintLayout.d.ts +1 -1
  66. package/src/components/hint/index.d.ts +2 -2
  67. package/src/components/hint/types.d.ts +2 -2
  68. package/src/components/icon/index.js +0 -3
  69. package/src/components/image/index.d.ts +1 -1
  70. package/src/components/image/index.js +20 -17
  71. package/src/components/loaderScreen/index.d.ts +1 -1
  72. package/src/components/loaderScreen/types.d.ts +1 -1
  73. package/src/components/maskedInput/index.d.ts +21 -4
  74. package/src/components/maskedInput/index.js +78 -16
  75. package/src/components/maskedInput/maskedInput.api.json +0 -1
  76. package/src/components/modal/index.d.ts +3 -3
  77. package/src/components/numberInput/index.js +2 -2
  78. package/src/components/overlay/index.d.ts +1 -1
  79. package/src/components/picker/PickerDialog.android.js +0 -15
  80. package/src/components/picker/PickerDialog.js +0 -7
  81. package/src/components/picker/helpers/useImperativePickerHandle.d.ts +1 -1
  82. package/src/components/picker/helpers/useImperativePickerHandle.js +1 -1
  83. package/src/components/picker/types.d.ts +9 -9
  84. package/src/components/progressBar/index.d.ts +2 -2
  85. package/src/components/screenFooter/index.d.ts +8 -0
  86. package/src/components/screenFooter/index.js +211 -0
  87. package/src/components/screenFooter/screenFooter.api.json +262 -0
  88. package/src/components/screenFooter/types.d.ts +100 -0
  89. package/src/components/screenFooter/types.js +39 -0
  90. package/src/components/scrollBar/index.d.ts +11 -4
  91. package/src/components/searchInput/index.js +1 -1
  92. package/src/components/searchInput/types.d.ts +2 -2
  93. package/src/components/sectionsWheelPicker/SectionsWheelPicker.driver.d.ts +2 -2
  94. package/src/components/skeletonView/index.d.ts +4 -4
  95. package/src/components/slider/Thumb.d.ts +1 -1
  96. package/src/components/slider/types.d.ts +1 -1
  97. package/src/components/stackAggregator/index.d.ts +1 -1
  98. package/src/components/tabController/TabBarItem.d.ts +2 -2
  99. package/src/components/tabController/TabBarItem.js +1 -1
  100. package/src/components/tabController/TabPage.d.ts +2 -2
  101. package/src/components/tabController/useScrollToItem.d.ts +1 -1
  102. package/src/components/text/Text.driver.d.ts +1 -1
  103. package/src/components/textArea/index.js +0 -6
  104. package/src/components/textField/types.d.ts +4 -4
  105. package/src/components/textField/useImperativeInputHandle.d.ts +1 -1
  106. package/src/components/textField/useImperativeInputHandle.js +1 -1
  107. package/src/components/textField/usePreset.d.ts +36 -36
  108. package/src/components/timeline/index.js +1 -1
  109. package/src/components/toast/index.js +0 -69
  110. package/src/components/view/index.js +9 -6
  111. package/src/components/wizard/index.d.ts +1 -1
  112. package/src/components/wizard/types.d.ts +1 -1
  113. package/src/components/wizard/wizard.api.json +1 -1
  114. package/src/hooks/index.d.ts +1 -0
  115. package/src/hooks/index.js +1 -0
  116. package/src/hooks/useCombinedRefs/index.js +1 -2
  117. package/src/hooks/useDebounce/index.js +1 -1
  118. package/src/hooks/useHiddenLocation/index.js +2 -2
  119. package/src/hooks/useHiddenLocation/index.web.js +2 -2
  120. package/src/hooks/useMeasure/index.d.ts +1 -1
  121. package/src/hooks/useMeasure/index.js +1 -1
  122. package/src/hooks/useScrollTo/index.d.ts +2 -2
  123. package/src/hooks/useScrollToHide/index.d.ts +24 -0
  124. package/src/hooks/useScrollToHide/index.js +48 -0
  125. package/src/incubator/calendar/index.js +1 -1
  126. package/src/incubator/calendar/types.d.ts +2 -2
  127. package/src/incubator/expandableOverlay/index.d.ts +2 -2
  128. package/src/incubator/expandableOverlay/index.js +7 -3
  129. package/src/incubator/slider/Track.d.ts +1 -1
  130. package/src/incubator/slider/index.d.ts +1 -1
  131. package/src/incubator/toast/helpers/useToastTimer.js +1 -1
  132. package/src/incubator/toast/index.js +1 -1
  133. package/src/incubator/toast/types.d.ts +2 -2
  134. package/src/index.d.ts +1 -0
  135. package/src/index.js +70 -0
  136. package/src/testkit/Component.driver.d.ts +1 -1
  137. package/src/testkit/drivers/TestingLibraryDriver.d.ts +1 -1
  138. package/src/typings/module.d.ts +12 -3
  139. package/ReactNativeUiLib.podspec +0 -22
  140. package/src/components/maskedInput/new.d.ts +0 -22
  141. package/src/components/maskedInput/new.js +0 -85
  142. package/src/components/maskedInput/old.js +0 -95
  143. package/src/components/textFieldOld/index.d.ts +0 -71
  144. package/src/components/textFieldOld/index.js +0 -807
  145. package/src/helpers/DocsGenerator.js +0 -61
  146. package/textFieldOld.d.ts +0 -2
  147. package/textFieldOld.js +0 -1
@@ -53,8 +53,8 @@ const DateTimePicker = forwardRef((props, ref) => {
53
53
  } = props;
54
54
  const [value, setValue] = useState(propsValue);
55
55
  const chosenDate = useRef(propsValue);
56
- const expandable = useRef();
57
- const textField = useRef();
56
+ const expandable = useRef(undefined);
57
+ const textField = useRef(undefined);
58
58
  useImperativeHandle(ref, () => {
59
59
  return {
60
60
  isValid: () => textField.current?.isValid(),
@@ -45,19 +45,19 @@ export interface DialogHeaderProps extends ViewProps {
45
45
  /**
46
46
  * Pass to render a leading element
47
47
  */
48
- leadingAccessory?: ReactElement;
48
+ leadingAccessory?: ReactElement<any>;
49
49
  /**
50
50
  * Pass to render a trailing element
51
51
  */
52
- trailingAccessory?: ReactElement;
52
+ trailingAccessory?: ReactElement<any>;
53
53
  /**
54
54
  * Pass to render a top element above the title
55
55
  */
56
- topAccessory?: ReactElement;
56
+ topAccessory?: ReactElement<any>;
57
57
  /**
58
58
  * Pass to render a bottom element below the subtitle
59
59
  */
60
- bottomAccessory?: ReactElement;
60
+ bottomAccessory?: ReactElement<any>;
61
61
  /**
62
62
  * Style for the leading + content + trailing components (without the topAccessory\bottomAccessory)
63
63
  */
@@ -8,6 +8,6 @@ declare const useDialogContent: (props: InternalDialogCloseButtonProps) => {
8
8
  containerStyle: false | "" | import("react-native").ViewStyle | import("react-native").RegisteredStyle<import("react-native").ViewStyle> | import("react-native").RecursiveArray<import("react-native").ViewStyle | import("react-native").Falsy | import("react-native").RegisteredStyle<import("react-native").ViewStyle>> | (import("react-native").StyleProp<import("react-native").ViewStyle> | {
9
9
  backgroundColor: string;
10
10
  })[] | null | undefined;
11
- containerProps: Omit<import("../../components/view").ViewProps, "style" | "testID" | "ref" | "onLayout" | "animated" | "reanimated"> | undefined;
11
+ containerProps: Omit<import("../../components/view").ViewProps, "style" | "ref" | "animated" | "onLayout" | "testID" | "reanimated"> | undefined;
12
12
  };
13
13
  export default useDialogContent;
@@ -126,7 +126,7 @@ declare class Drawer extends PureComponent<DrawerProps> {
126
126
  };
127
127
  leftRender: SwipeableProps['renderLeftActions'];
128
128
  rightRender: SwipeableProps['renderLeftActions'];
129
- _swipeableRow: RefObject<Swipeable>;
129
+ _swipeableRow: RefObject<Swipeable | null>;
130
130
  animationOptions: SwipeableProps['animationOptions'];
131
131
  leftActionX: Animated.Value;
132
132
  constructor(props: DrawerProps);
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { type JSX } from 'react';
2
2
  export type ExpandableSectionProps = {
3
3
  /**
4
4
  * expandableSection header element
@@ -36,5 +36,5 @@ export type ExpandableSectionProps = {
36
36
  * @example: https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/ExpandableSectionScreen.tsx
37
37
  * @gif: https://github.com/wix/react-native-ui-lib/blob/master/demo/showcase/ExpandableSection/ExpandableSection.gif?raw=true
38
38
  */
39
- declare function ExpandableSection(props: ExpandableSectionProps): React.JSX.Element;
39
+ declare function ExpandableSection(props: ExpandableSectionProps): JSX.Element;
40
40
  export default ExpandableSection;
@@ -20,7 +20,7 @@ const FadedScrollView = props => {
20
20
  ...others
21
21
  } = props;
22
22
  const ScrollView = useGesture ? GestureScrollView : RNScrollView;
23
- const scrollViewRef = useRef();
23
+ const scrollViewRef = useRef(undefined);
24
24
  const horizontal = propsHorizontal ?? false;
25
25
  const {
26
26
  onContentSizeChange,
@@ -200,16 +200,12 @@ class FeatureHighlight extends Component {
200
200
  {title && <Text text60 style={[styles.title, {
201
201
  color,
202
202
  marginBottom: message ? titleBottomMargin : messageBottomMargin
203
- }, titleStyle]} numberOfLines={titleNumberOfLines}
204
- // @ts-expect-error
205
- pointerEvents={'none'}>
203
+ }, titleStyle]} numberOfLines={titleNumberOfLines} pointerEvents={'none'}>
206
204
  {title}
207
205
  </Text>}
208
206
  {message && <Text text70 style={[styles.message, {
209
207
  color
210
- }, messageStyle]} numberOfLines={messageNumberOfLines}
211
- // @ts-expect-error
212
- pointerEvents={'none'}>
208
+ }, messageStyle]} numberOfLines={messageNumberOfLines} pointerEvents={'none'}>
213
209
  {message}
214
210
  </Text>}
215
211
  <Button label={defaultButtonLabel} size={ButtonSize.medium} labelStyle={{
@@ -244,7 +240,9 @@ class FeatureHighlight extends Component {
244
240
  {pageControlProps ? <View flex bottom>
245
241
  <PageControl {...pageControlProps} containerStyle={{
246
242
  marginBottom: 24
247
- }} ref={r => this.viewRef = r} />
243
+ }} ref={r => {
244
+ this.viewRef = r;
245
+ }} />
248
246
  <View accessible accessibilityLabel={'dismiss button'} />
249
247
  </View> : <View flex accessible accessibilityLabel={'dismiss'} accessibilityRole={'button'} />}
250
248
  </TouchableWithoutFeedback>
@@ -21,7 +21,7 @@ export interface GridListItemProps {
21
21
  /**
22
22
  * Custom GridListItem to be rendered in the GridView
23
23
  */
24
- renderCustomItem?: () => React.ReactElement;
24
+ renderCustomItem?: () => React.ReactElement<any>;
25
25
  /**
26
26
  * The item size
27
27
  */
@@ -29,7 +29,7 @@ export interface GridListItemProps {
29
29
  /**
30
30
  * Title content text
31
31
  */
32
- title?: string | React.ReactElement;
32
+ title?: string | React.ReactElement<any>;
33
33
  /**
34
34
  * Title content typography
35
35
  */
@@ -45,7 +45,7 @@ export interface GridListItemProps {
45
45
  /**
46
46
  * Subtitle content text
47
47
  */
48
- subtitle?: string | React.ReactElement;
48
+ subtitle?: string | React.ReactElement<any>;
49
49
  /**
50
50
  * Subtitle content typography
51
51
  */
@@ -61,7 +61,7 @@ export interface GridListItemProps {
61
61
  /**
62
62
  * Description content text
63
63
  */
64
- description?: string | React.ReactElement;
64
+ description?: string | React.ReactElement<any>;
65
65
  /**
66
66
  * Description content typography
67
67
  */
@@ -101,12 +101,12 @@ export interface GridListItemProps {
101
101
  /**
102
102
  * Renders an overlay on top of the image
103
103
  */
104
- renderOverlay?: () => React.ReactElement;
104
+ renderOverlay?: () => React.ReactElement<any>;
105
105
  /**
106
106
  * Test ID for component
107
107
  */
108
108
  testID?: string;
109
- children?: React.ReactElement | React.ReactElement[];
109
+ children?: React.ReactElement<any> | React.ReactElement<any>[];
110
110
  }
111
111
  /**
112
112
  * @description: A single grid view/list item component
@@ -122,7 +122,7 @@ declare class GridListItem extends Component<GridListItemProps> {
122
122
  onItemPress: () => void;
123
123
  getItemSizeObj(): ImageSize;
124
124
  getContainerHorizontalAlignment: (this: any, horizontalAlignment: any) => "center" | "flex-start" | "flex-end" | undefined;
125
- renderContent(text: string | React.ReactElement | undefined, textProps: Partial<TextProps>): React.JSX.Element | undefined;
125
+ renderContent(text: string | React.ReactElement<any> | undefined, textProps: Partial<TextProps>): React.JSX.Element | undefined;
126
126
  render(): React.JSX.Element;
127
127
  }
128
128
  export default GridListItem;
@@ -39,7 +39,7 @@ export interface GridViewProps {
39
39
  /**
40
40
  * Pass to render a custom item
41
41
  */
42
- renderCustomItem?: (item: GridListItemProps) => React.ReactElement;
42
+ renderCustomItem?: (item: GridListItemProps) => React.ReactElement<any>;
43
43
  }
44
44
  interface GridViewState {
45
45
  viewWidth: number;
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { View as RNView, LayoutChangeEvent } from 'react-native';
3
3
  import { HintProps } from './types';
4
4
  interface HintBubbleProps extends Pick<HintProps, 'testID' | 'visible' | 'message' | 'messageStyle' | 'color' | 'removePaddings' | 'enableShadow' | 'borderRadius' | 'iconStyle' | 'icon' | 'customContent'> {
5
- hintRef: React.RefObject<RNView>;
5
+ hintRef: React.RefObject<RNView | null>;
6
6
  setHintLayout: (layoutChangeEvent: LayoutChangeEvent) => void;
7
7
  hintPositionStyle: {
8
8
  left: number;
@@ -1,4 +1,4 @@
1
- import React, { Component, ReactElement, ElementRef } from 'react';
1
+ import React, { Component, ReactElement, ElementRef, type JSX } from 'react';
2
2
  import { Animated, GestureResponderEvent, ImageSourcePropType, ImageStyle, StyleProp, TextStyle, ViewStyle, LayoutChangeEvent, View as RNView } from 'react-native';
3
3
  declare enum TARGET_POSITIONS {
4
4
  LEFT = "left",
@@ -18,7 +18,7 @@ interface HintTargetFrame {
18
18
  type Position = Pick<ViewStyle, 'top' | 'bottom' | 'left' | 'right'>;
19
19
  type HintPositionStyle = Position & Pick<ViewStyle, 'alignItems'>;
20
20
  type Paddings = Pick<ViewStyle, 'paddingLeft' | 'paddingRight' | 'paddingVertical' | 'paddingHorizontal'>;
21
- type ContentType = string | ReactElement;
21
+ type ContentType = string | ReactElement<any>;
22
22
  export interface HintProps {
23
23
  /**
24
24
  * Control the visibility of the hint
@@ -130,7 +130,7 @@ declare class Hint extends Component<HintProps, HintState> {
130
130
  };
131
131
  static positions: typeof HintPositions;
132
132
  targetRef: ElementRef<typeof RNView> | null;
133
- hintRef: React.RefObject<RNView>;
133
+ hintRef: React.RefObject<RNView | null>;
134
134
  animationDuration: number;
135
135
  state: {
136
136
  targetLayoutInWindow: {
@@ -183,14 +183,14 @@ declare class Hint extends Component<HintProps, HintState> {
183
183
  getTipPosition(): Position;
184
184
  getHintOffsetForShortMessage: () => number;
185
185
  isUsingModal: () => boolean | undefined;
186
- renderOverlay(): React.JSX.Element | undefined;
187
- renderHintTip(): React.JSX.Element;
188
- renderHint(): React.JSX.Element;
189
- renderHintContainer(): React.JSX.Element | undefined;
190
- renderHintAnchor(): React.JSX.Element;
191
- renderMockChildren(): React.JSX.Element | undefined;
186
+ renderOverlay(): JSX.Element | undefined;
187
+ renderHintTip(): JSX.Element;
188
+ renderHint(): JSX.Element;
189
+ renderHintContainer(): JSX.Element | undefined;
190
+ renderHintAnchor(): JSX.Element;
191
+ renderMockChildren(): JSX.Element | undefined;
192
192
  renderChildren(): React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
193
- render(): string | number | true | React.JSX.Element | Iterable<React.ReactNode> | null;
193
+ render(): string | number | bigint | true | JSX.Element | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | null;
194
194
  }
195
195
  declare const _default: React.ForwardRefExoticComponent<HintProps & React.RefAttributes<any>> & typeof Hint;
196
196
  export default _default;
@@ -6,7 +6,7 @@ export default function useHintLayout({ onBackgroundPress, targetFrame }: UseHin
6
6
  targetLayoutState: LayoutRectangle | undefined;
7
7
  targetLayoutInWindowState: LayoutRectangle | undefined;
8
8
  hintMessageWidth: number | undefined;
9
- targetRef: import("react").MutableRefObject<RNView | null>;
9
+ targetRef: import("react").RefObject<RNView | null>;
10
10
  onTargetLayout: ({ nativeEvent: { layout } }: LayoutChangeEvent) => void;
11
11
  setHintLayout: ({ nativeEvent: { layout } }: LayoutChangeEvent) => void;
12
12
  };
@@ -1,13 +1,13 @@
1
1
  import React from 'react';
2
2
  import { HintPositions, HintProps } from './types';
3
3
  declare const Hint: {
4
- (props: HintProps): string | number | true | React.JSX.Element | Iterable<React.ReactNode> | null;
4
+ (props: HintProps): string | number | bigint | true | React.JSX.Element | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | null;
5
5
  displayName: string;
6
6
  positions: typeof HintPositions;
7
7
  };
8
8
  export { HintProps, Hint };
9
9
  declare const _default: React.ForwardRefExoticComponent<HintProps & React.RefAttributes<any>> & {
10
- (props: HintProps): string | number | true | React.JSX.Element | Iterable<React.ReactNode> | null;
10
+ (props: HintProps): string | number | bigint | true | React.JSX.Element | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | null;
11
11
  displayName: string;
12
12
  positions: typeof HintPositions;
13
13
  };
@@ -1,9 +1,9 @@
1
- import type { ReactElement } from 'react';
1
+ import type { ReactElement, JSX } from 'react';
2
2
  import type { GestureResponderEvent, ImageSourcePropType, ImageStyle, LayoutRectangle, StyleProp, TextStyle, ViewStyle } from 'react-native';
3
3
  export type PositionStyle = Pick<ViewStyle, 'top' | 'bottom' | 'left' | 'right'>;
4
4
  export type LayoutStyle = PositionStyle & Pick<ViewStyle, 'alignItems'>;
5
5
  export type PaddingsStyle = Pick<ViewStyle, 'paddingLeft' | 'paddingRight' | 'paddingVertical' | 'paddingHorizontal'>;
6
- export type ContentType = string | ReactElement;
6
+ export type ContentType = string | ReactElement<any>;
7
7
  export declare enum TargetAlignments {
8
8
  LEFT = "left",
9
9
  RIGHT = "right",
@@ -74,9 +74,6 @@ const Icon = forwardRef((props, ref) => {
74
74
  </>;
75
75
  });
76
76
  Icon.displayName = 'Icon';
77
- Icon.defaultProps = {
78
- assetGroup: 'icons'
79
- };
80
77
  export default asBaseComponent(Icon, {
81
78
  modifiersOptions: {
82
79
  margins: true
@@ -50,7 +50,7 @@ export type ImageProps = Omit<RNImageProps, 'source'> & Pick<ImageBackgroundProp
50
50
  /**
51
51
  * Render an overlay with custom content
52
52
  */
53
- customOverlayContent?: React.ReactElement | React.ReactElement[];
53
+ customOverlayContent?: React.ReactElement<any> | React.ReactElement<any>[];
54
54
  /**
55
55
  * Default image source in case of an error
56
56
  */
@@ -158,24 +158,27 @@ class Image extends PureComponent {
158
158
  const {
159
159
  margins
160
160
  } = modifiers;
161
- return (
162
- // @ts-ignore
163
- <ImageView style={[tintColor && {
164
- tintColor
165
- }, shouldFlipRTL && styles.rtlFlipped, width && {
166
- width
167
- }, height && {
168
- height
169
- }, borderRadius && {
170
- borderRadius
171
- }, cover && styles.coverImage, this.isGif() && styles.gifImage, aspectRatio && {
172
- aspectRatio
173
- }, !useImageInsideContainer && margins, useImageInsideContainer && styles.containImage, style, useImageInsideContainer && styles.shrink]} accessible={false} accessibilityRole={'image'} fsTagName={recorderTag} {...others}
174
- // NOTE: imageStyle prop is only relevant for when rendering ImageBackground component
175
- imageStyle={this.getImageStyle()} onError={this.onError} source={source}>
161
+ return <ImageView
162
+ // @ts-expect-error TODO: this error emanates from the fact that
163
+ // RNImage does not support `resizeMode` inside styles.containImage
164
+ // I think this is too complex for TS to handle as using inline style
165
+ // solves it. It is probably possible to refactor and solve it, but
166
+ // I feel it is not worth the risk ATM.
167
+ style={[tintColor && {
168
+ tintColor
169
+ }, shouldFlipRTL && styles.rtlFlipped, width ? {
170
+ width
171
+ } : undefined, height ? {
172
+ height
173
+ } : undefined, borderRadius ? {
174
+ borderRadius
175
+ } : undefined, cover && styles.coverImage, this.isGif() && styles.gifImage, aspectRatio ? {
176
+ aspectRatio
177
+ } : undefined, !useImageInsideContainer && margins, useImageInsideContainer && styles.containImage, style, useImageInsideContainer && styles.shrink]} accessible={false} accessibilityRole={'image'} fsTagName={recorderTag} {...others}
178
+ // NOTE: imageStyle prop is only relevant for when rendering ImageBackground component
179
+ imageStyle={this.getImageStyle()} onError={this.onError} source={source}>
176
180
  {(overlayType || customOverlayContent) && <Overlay type={overlayType} intensity={overlayIntensity} color={overlayColor} customContent={customOverlayContent} borderRadius={borderRadius} />}
177
- </ImageView>
178
- );
181
+ </ImageView>;
179
182
  };
180
183
  renderRegularImage() {
181
184
  const {
@@ -3,7 +3,7 @@ import { LoaderScreenProps } from './types';
3
3
  export { LoaderScreenProps };
4
4
  declare const _default: React.ForwardRefExoticComponent<import("react-native").ActivityIndicatorProps & {
5
5
  loaderColor?: string | undefined;
6
- customLoader?: React.ReactChild | undefined;
6
+ customLoader?: string | number | React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
7
7
  backgroundColor?: string | undefined;
8
8
  message?: string | undefined;
9
9
  messageStyle?: import("react-native").TextStyle | undefined;
@@ -8,7 +8,7 @@ export type LoaderScreenProps = ActivityIndicatorProps & {
8
8
  /**
9
9
  * Custom loader
10
10
  */
11
- customLoader?: React.ReactChild;
11
+ customLoader?: React.ReactElement<any> | number | string;
12
12
  /**
13
13
  * Color of the loader background (only when passing 'overlay')
14
14
  */
@@ -1,5 +1,22 @@
1
- import React from 'react';
2
- import { MaskedInputProps } from './new';
3
- export { MaskedInputProps };
4
- declare const _default: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
1
+ import React, { type JSX } from 'react';
2
+ import { TextInputProps, StyleProp, ViewStyle } from 'react-native';
3
+ export interface MaskedInputProps extends Omit<TextInputProps, 'value'> {
4
+ /**
5
+ * Initial value to pass to masked input
6
+ */
7
+ initialValue?: string;
8
+ /**
9
+ * callback for rendering the custom input out of the value returns from the actual input
10
+ */
11
+ renderMaskedText?: (value?: string) => JSX.Element | undefined;
12
+ /**
13
+ * Custom formatter for the input value
14
+ */
15
+ formatter?: (value?: string) => string | undefined;
16
+ /**
17
+ * container style for the masked input container
18
+ */
19
+ containerStyle?: StyleProp<ViewStyle>;
20
+ }
21
+ declare const _default: React.ForwardRefExoticComponent<MaskedInputProps & React.RefAttributes<any>>;
5
22
  export default _default;
@@ -1,24 +1,86 @@
1
- import React, { forwardRef, useEffect } from 'react';
1
+ import _isFunction from "lodash/isFunction";
2
+ import _identity from "lodash/identity";
3
+ import React, { useCallback, useEffect, useRef, useState, useImperativeHandle, forwardRef } from 'react';
4
+ import { StyleSheet, Keyboard, TextInput } from 'react-native';
2
5
  import { useThemeProps } from "../../hooks";
3
- // @ts-expect-error
4
- import MaskedInputOld from "./old";
5
- import MaskedInputNew, { MaskedInputProps } from "./new";
6
- import { LogService } from "../../services";
7
- function MaskedInputMigrator(props, refToForward) {
6
+ import View from "../view";
7
+ import Text from "../text";
8
+ import TouchableOpacity from "../touchableOpacity";
9
+ /**
10
+ * @description: Mask Input to create custom looking inputs with custom formats
11
+ * @gif: https://camo.githubusercontent.com/61eedb65e968845d5eac713dcd21a69691571fb1/68747470733a2f2f6d656469612e67697068792e636f6d2f6d656469612f4b5a5a7446666f486f454b334b2f67697068792e676966
12
+ * @example: https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/MaskedInputScreen.tsx
13
+ */
14
+ function MaskedInput(props, ref) {
8
15
  const {
9
- migrate,
16
+ initialValue,
17
+ formatter = _identity,
18
+ containerStyle,
19
+ renderMaskedText,
20
+ onChangeText,
10
21
  ...others
11
22
  } = useThemeProps(props, 'MaskedInput');
23
+ const [value, setValue] = useState(initialValue);
24
+ const inputRef = useRef(undefined);
25
+ const keyboardDidHideListener = useRef(undefined);
26
+ useImperativeHandle(ref, () => {
27
+ return {
28
+ isFocused: () => inputRef.current?.isFocused(),
29
+ focus,
30
+ blur: () => inputRef.current?.blur(),
31
+ clear: () => {
32
+ inputRef.current?.clear();
33
+ setValue('');
34
+ // NOTE: This fixes an RN issue - when triggering imperative clear method, it doesn't call onChangeText
35
+ onChangeText?.('');
36
+ }
37
+ };
38
+ });
12
39
  useEffect(() => {
13
- if (!migrate) {
14
- LogService.warn(`UILib MaskedInput implementation has been updated and now requires manual migration. To proceed, pass the "migrate" prop and check if the functionality works as expected.`);
40
+ if (initialValue !== value) {
41
+ setValue(initialValue);
15
42
  }
43
+ }, [initialValue]);
44
+ useEffect(() => {
45
+ keyboardDidHideListener.current = Keyboard.addListener('keyboardDidHide', () => {
46
+ if (inputRef.current?.isFocused()) {
47
+ inputRef.current?.blur();
48
+ }
49
+ });
50
+ return () => keyboardDidHideListener.current.remove();
16
51
  }, []);
17
- if (migrate) {
18
- return <MaskedInputNew {...others} ref={refToForward} />;
19
- } else {
20
- return <MaskedInputOld {...others} ref={refToForward} />;
21
- }
52
+ const _onChangeText = useCallback(value => {
53
+ const formattedValue = formatter(value) ?? '';
54
+ setValue(formattedValue);
55
+ onChangeText?.(formattedValue);
56
+ }, [onChangeText, formatter]);
57
+ const focus = useCallback(() => {
58
+ inputRef.current?.focus();
59
+ }, []);
60
+ const _renderMaskedText = () => {
61
+ if (_isFunction(renderMaskedText)) {
62
+ return renderMaskedText(value);
63
+ }
64
+ return <Text>{value}</Text>;
65
+ };
66
+ return <TouchableOpacity style={containerStyle} activeOpacity={1} onPress={focus}>
67
+ <TextInput {...others} value={value}
68
+ // @ts-expect-error
69
+ ref={inputRef} style={styles.hiddenInput} enableErrors={false} hideUnderline placeholder="" caretHidden multiline={false} onChangeText={_onChangeText} />
70
+ <View style={styles.maskedInputWrapper}>{_renderMaskedText()}</View>
71
+ </TouchableOpacity>;
22
72
  }
23
- export { MaskedInputProps };
24
- export default forwardRef(MaskedInputMigrator);
73
+ const styles = StyleSheet.create({
74
+ hiddenInput: {
75
+ ...StyleSheet.absoluteFillObject,
76
+ zIndex: 1,
77
+ color: 'transparent',
78
+ backgroundColor: 'transparent',
79
+ height: undefined
80
+ },
81
+ maskedInputWrapper: {
82
+ zIndex: 0
83
+ }
84
+ });
85
+ MaskedInput.displayName = 'MaskedInput';
86
+ export default forwardRef(MaskedInput);
@@ -44,7 +44,6 @@
44
44
  " return (",
45
45
  " <div>",
46
46
  " <MaskedInput",
47
- " migrate",
48
47
  " renderMaskedText={renderTimeText}",
49
48
  " formatter={formatter}",
50
49
  " keyboardType={'numeric'}",
@@ -1,4 +1,4 @@
1
- import React, { Component } from 'react';
1
+ import React, { Component, type JSX } from 'react';
2
2
  import { ModalProps as RNModalProps, GestureResponderEvent, KeyboardAvoidingViewProps } from 'react-native';
3
3
  import TopBar, { ModalTopBarProps } from './TopBar';
4
4
  export { ModalTopBarProps };
@@ -57,8 +57,8 @@ declare class Modal extends Component<ModalProps> {
57
57
  static displayName: string;
58
58
  static TopBar: typeof TopBar;
59
59
  constructor(props: ModalProps);
60
- renderTouchableOverlay(): React.JSX.Element | undefined;
61
- render(): React.JSX.Element;
60
+ renderTouchableOverlay(): JSX.Element | undefined;
61
+ render(): JSX.Element;
62
62
  }
63
63
  declare const _default: React.ForwardRefExoticComponent<ModalProps & React.RefAttributes<any>> & typeof Modal;
64
64
  export default _default;
@@ -3,7 +3,7 @@ import React, { useMemo, useCallback, useState, useRef } from 'react';
3
3
  import { StyleSheet } from 'react-native';
4
4
  import { useDidUpdate, useThemeProps } from "../../hooks";
5
5
  import { Colors } from "../../style";
6
- import MaskedInput from "../maskedInput/new";
6
+ import MaskedInput from "../maskedInput";
7
7
  import TextField from "../textField";
8
8
  import View from "../view";
9
9
  import Text from "../text";
@@ -29,7 +29,7 @@ function NumberInput(props, ref) {
29
29
  const [options, setOptions] = useState(generateOptions(locale, fractionDigits));
30
30
  const initialNumber = getInitialNumber(propsInitialNumber, options);
31
31
  const [data, setData] = useState(parseInput(`${initialNumber}`, options, propsInitialNumber));
32
- const textField = useRef();
32
+ const textField = useRef(undefined);
33
33
  const [isFocused, setIsFocused] = useState(textFieldProps?.autoFocus ?? false);
34
34
  useDidUpdate(() => {
35
35
  setOptions(generateOptions(locale, fractionDigits));
@@ -28,7 +28,7 @@ export type OverlayTypes = Pick<ImageProps, 'borderRadius'> & {
28
28
  /**
29
29
  * Custom overlay content to be rendered on top of the image
30
30
  */
31
- customContent?: React.ReactElement | React.ReactElement[];
31
+ customContent?: React.ReactElement<any> | React.ReactElement<any>[];
32
32
  };
33
33
  /**
34
34
  * @description: Overlay view with types (default, top, bottom, solid)
@@ -1,7 +1,5 @@
1
1
  import React, {Component} from 'react';
2
2
  import {StyleSheet} from 'react-native';
3
- import {TextPropTypes} from 'deprecated-react-native-prop-types';
4
- import PropTypes from 'prop-types';
5
3
  import _ from 'lodash';
6
4
 
7
5
  import Dialog from '../dialog';
@@ -11,19 +9,6 @@ import {Colors, BorderRadiuses} from '../../style';
11
9
 
12
10
  class PickerDialog extends Component {
13
11
  static displayName = 'PickerDialog';
14
- static propTypes = {
15
- onDone: PropTypes.func,
16
- onCancel: PropTypes.func,
17
- children: PropTypes.array,
18
- /**
19
- * select label style
20
- */
21
- selectLabelStyle: TextPropTypes.style,
22
- /**
23
- * cancel label style
24
- */
25
- cancelLabelStyle: TextPropTypes.style
26
- };
27
12
 
28
13
  state = {};
29
14
 
@@ -1,6 +1,5 @@
1
1
  import React, {Component} from 'react';
2
2
  import {StyleSheet} from 'react-native';
3
- import PropTypes from 'prop-types';
4
3
  import _ from 'lodash';
5
4
 
6
5
  import Dialog from '../dialog';
@@ -10,12 +9,6 @@ import {Colors} from '../../style';
10
9
 
11
10
  class PickerDialog extends Component {
12
11
  static displayName = 'PickerDialog';
13
- static propTypes = {
14
- onDone: PropTypes.func,
15
- onCancel: PropTypes.func,
16
- topBarProps: PropTypes.object,
17
- children: PropTypes.array
18
- };
19
12
 
20
13
  state = {};
21
14
 
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
2
  import { ExpandableOverlayMethods } from '../../../incubator/expandableOverlay';
3
3
  import { TextFieldMethods } from '../../textField';
4
- declare const useImperativePickerHandle: (ref: React.Ref<any>, expandableRef: React.MutableRefObject<ExpandableOverlayMethods | null>) => React.MutableRefObject<TextFieldMethods | undefined>;
4
+ declare const useImperativePickerHandle: (ref: React.Ref<any>, expandableRef: React.MutableRefObject<ExpandableOverlayMethods | null>) => React.RefObject<TextFieldMethods | undefined>;
5
5
  export default useImperativePickerHandle;
@@ -1,6 +1,6 @@
1
1
  import { useImperativeHandle, useRef } from 'react';
2
2
  const useImperativePickerHandle = (ref, expandableRef) => {
3
- const pickerRef = useRef();
3
+ const pickerRef = useRef(undefined);
4
4
  useImperativeHandle(ref, () => {
5
5
  const {
6
6
  isFocused,