react-native-ui-lib 8.3.4-snapshot.7813 → 8.3.4-snapshot.7814
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/ReactNativeUiLib.podspec +22 -0
- package/lib/components/HighlighterOverlayView/index.d.ts +2 -2
- package/lib/components/HighlighterOverlayView/index.web.d.ts +2 -2
- package/lib/components/Keyboard/KeyboardAccessoryView/CustomKeyboardView/CustomKeyboardViewBase.d.ts +1 -1
- package/lib/components/Keyboard/KeyboardAccessoryView/KeyboardRegistry/index.js +1 -5
- package/lib/components/Keyboard/KeyboardAccessoryView/index.d.ts +2 -2
- package/lib/components/Keyboard/KeyboardAccessoryView/index.js +1 -3
- package/lib/components/Keyboard/KeyboardTrackingView/KeyboardTrackingView.ios.js +1 -3
- package/lib/components/Keyboard/KeyboardTrackingView/index.d.ts +2 -6
- package/lib/components/Keyboard/KeyboardTrackingView/index.js +4 -5
- package/lib/components/Keyboard/index.d.ts +1 -2
- package/lib/package.json +21 -20
- package/lib/react-native.config.js +1 -1
- package/package.json +163 -161
- package/src/commons/asBaseComponent.js +1 -2
- package/src/commons/baseComponent.js +8 -0
- package/src/commons/forwardRef.js +4 -1
- package/src/commons/modifiers.d.ts +6 -0
- package/src/commons/modifiers.js +18 -0
- package/src/commons/withScrollEnabler.js +4 -0
- package/src/commons/withScrollReached.js +4 -0
- package/src/components/KeyboardAwareScrollView/KeyboardAwareBase.js +7 -0
- package/src/components/KeyboardAwareScrollView/KeyboardAwareFlatList.js +6 -0
- package/src/components/KeyboardAwareScrollView/KeyboardAwareScrollView.js +6 -0
- package/src/components/WheelPicker/WheelPicker.driver.d.ts +2 -2
- package/src/components/WheelPicker/index.d.ts +2 -2
- package/src/components/WheelPicker/index.js +1 -1
- package/src/components/WheelPicker/usePresenter.d.ts +1 -1
- package/src/components/actionSheet/index.d.ts +1 -1
- package/src/components/animatedImage/index.d.ts +1 -1
- package/src/components/animatedScanner/index.js +37 -0
- package/src/components/avatar/index.d.ts +1 -1
- package/src/components/badge/index.d.ts +4 -4
- package/src/components/baseInput/index.d.ts +1 -0
- package/src/components/baseInput/index.js +49 -1
- package/src/components/button/index.d.ts +4 -4
- package/src/components/button/types.d.ts +2 -2
- package/src/components/carousel/index.d.ts +8 -8
- package/src/components/carousel/types.d.ts +1 -4
- package/src/components/carousel/types.js +2 -0
- package/src/components/checkbox/index.d.ts +1 -1
- package/src/components/chip/index.d.ts +1 -1
- package/src/components/colorPalette/index.d.ts +1 -1
- package/src/components/dateTimePicker/index.d.ts +2 -2
- package/src/components/dateTimePicker/index.js +2 -2
- package/src/components/dialog/types.d.ts +4 -4
- package/src/components/dialog/useDialogContent.d.ts +1 -1
- package/src/components/drawer/index.d.ts +1 -1
- package/src/components/expandableSection/index.d.ts +2 -2
- package/src/components/fadedScrollView/index.js +1 -1
- package/src/components/featureHighlight/index.js +7 -5
- package/src/components/gridListItem/index.d.ts +7 -7
- package/src/components/gridView/index.d.ts +1 -1
- package/src/components/hint/HintBubble.d.ts +1 -1
- package/src/components/hint/HintOld.d.ts +10 -10
- package/src/components/hint/hooks/useHintLayout.d.ts +1 -1
- package/src/components/hint/index.d.ts +2 -2
- package/src/components/hint/types.d.ts +2 -2
- package/src/components/icon/index.js +3 -0
- package/src/components/image/index.d.ts +1 -1
- package/src/components/image/index.js +17 -20
- package/src/components/loaderScreen/index.d.ts +1 -1
- package/src/components/loaderScreen/types.d.ts +1 -1
- package/src/components/maskedInput/index.d.ts +4 -21
- package/src/components/maskedInput/index.js +16 -78
- package/src/components/maskedInput/maskedInput.api.json +1 -0
- package/src/components/maskedInput/new.d.ts +22 -0
- package/src/components/maskedInput/new.js +85 -0
- package/src/components/maskedInput/old.js +95 -0
- package/src/components/modal/index.d.ts +3 -3
- package/src/components/numberInput/index.js +2 -2
- package/src/components/overlay/index.d.ts +1 -1
- package/src/components/picker/PickerDialog.android.js +15 -0
- package/src/components/picker/PickerDialog.js +7 -0
- package/src/components/picker/helpers/useImperativePickerHandle.d.ts +1 -1
- package/src/components/picker/helpers/useImperativePickerHandle.js +1 -1
- package/src/components/picker/types.d.ts +9 -9
- package/src/components/progressBar/index.d.ts +2 -2
- package/src/components/scrollBar/index.d.ts +4 -11
- package/src/components/searchInput/index.js +1 -1
- package/src/components/searchInput/types.d.ts +2 -2
- package/src/components/sectionsWheelPicker/SectionsWheelPicker.driver.d.ts +2 -2
- package/src/components/skeletonView/index.d.ts +4 -4
- package/src/components/slider/Thumb.d.ts +1 -1
- package/src/components/slider/types.d.ts +1 -1
- package/src/components/stackAggregator/index.d.ts +1 -1
- package/src/components/tabController/TabBarItem.d.ts +2 -2
- package/src/components/tabController/TabBarItem.js +1 -1
- package/src/components/tabController/TabPage.d.ts +2 -2
- package/src/components/tabController/useScrollToItem.d.ts +1 -1
- package/src/components/text/Text.driver.d.ts +1 -1
- package/src/components/textArea/index.js +6 -0
- package/src/components/textField/types.d.ts +4 -4
- package/src/components/textField/useImperativeInputHandle.d.ts +1 -1
- package/src/components/textField/useImperativeInputHandle.js +1 -1
- package/src/components/textField/usePreset.d.ts +36 -36
- package/src/components/textFieldOld/index.d.ts +71 -0
- package/src/components/textFieldOld/index.js +807 -0
- package/src/components/timeline/index.js +1 -1
- package/src/components/toast/index.js +69 -0
- package/src/components/wizard/index.d.ts +1 -1
- package/src/components/wizard/types.d.ts +1 -1
- package/src/components/wizard/wizard.api.json +1 -1
- package/src/helpers/DocsGenerator.js +61 -0
- package/src/hooks/useCombinedRefs/index.js +2 -1
- package/src/hooks/useDebounce/index.js +1 -1
- package/src/hooks/useHiddenLocation/index.js +2 -2
- package/src/hooks/useHiddenLocation/index.web.js +2 -2
- package/src/hooks/useMeasure/index.d.ts +1 -1
- package/src/hooks/useMeasure/index.js +1 -1
- package/src/hooks/useScrollTo/index.d.ts +2 -2
- package/src/incubator/calendar/index.js +1 -1
- package/src/incubator/calendar/types.d.ts +2 -2
- package/src/incubator/expandableOverlay/index.d.ts +2 -2
- package/src/incubator/slider/Track.d.ts +1 -1
- package/src/incubator/slider/index.d.ts +1 -1
- package/src/incubator/toast/helpers/useToastTimer.js +1 -1
- package/src/incubator/toast/index.js +1 -1
- package/src/incubator/toast/types.d.ts +2 -2
- package/src/testkit/Component.driver.d.ts +1 -1
- package/src/testkit/drivers/TestingLibraryDriver.d.ts +1 -1
- package/src/typings/module.d.ts +3 -12
- package/textFieldOld.d.ts +2 -0
- package/textFieldOld.js +1 -0
|
@@ -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" | "
|
|
11
|
+
containerProps: Omit<import("../../components/view").ViewProps, "style" | "testID" | "ref" | "onLayout" | "animated" | "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>;
|
|
130
130
|
animationOptions: SwipeableProps['animationOptions'];
|
|
131
131
|
leftActionX: Animated.Value;
|
|
132
132
|
constructor(props: DrawerProps);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React 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): JSX.Element;
|
|
39
|
+
declare function ExpandableSection(props: ExpandableSectionProps): React.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();
|
|
24
24
|
const horizontal = propsHorizontal ?? false;
|
|
25
25
|
const {
|
|
26
26
|
onContentSizeChange,
|
|
@@ -200,12 +200,16 @@ 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}
|
|
203
|
+
}, titleStyle]} numberOfLines={titleNumberOfLines}
|
|
204
|
+
// @ts-expect-error
|
|
205
|
+
pointerEvents={'none'}>
|
|
204
206
|
{title}
|
|
205
207
|
</Text>}
|
|
206
208
|
{message && <Text text70 style={[styles.message, {
|
|
207
209
|
color
|
|
208
|
-
}, messageStyle]} numberOfLines={messageNumberOfLines}
|
|
210
|
+
}, messageStyle]} numberOfLines={messageNumberOfLines}
|
|
211
|
+
// @ts-expect-error
|
|
212
|
+
pointerEvents={'none'}>
|
|
209
213
|
{message}
|
|
210
214
|
</Text>}
|
|
211
215
|
<Button label={defaultButtonLabel} size={ButtonSize.medium} labelStyle={{
|
|
@@ -240,9 +244,7 @@ class FeatureHighlight extends Component {
|
|
|
240
244
|
{pageControlProps ? <View flex bottom>
|
|
241
245
|
<PageControl {...pageControlProps} containerStyle={{
|
|
242
246
|
marginBottom: 24
|
|
243
|
-
}} ref={r =>
|
|
244
|
-
this.viewRef = r;
|
|
245
|
-
}} />
|
|
247
|
+
}} ref={r => this.viewRef = r} />
|
|
246
248
|
<View accessible accessibilityLabel={'dismiss button'} />
|
|
247
249
|
</View> : <View flex accessible accessibilityLabel={'dismiss'} accessibilityRole={'button'} />}
|
|
248
250
|
</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;
|
|
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;
|
|
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;
|
|
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;
|
|
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;
|
|
105
105
|
/**
|
|
106
106
|
* Test ID for component
|
|
107
107
|
*/
|
|
108
108
|
testID?: string;
|
|
109
|
-
children?: React.ReactElement
|
|
109
|
+
children?: React.ReactElement | React.ReactElement[];
|
|
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
|
|
125
|
+
renderContent(text: string | React.ReactElement | 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;
|
|
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>;
|
|
6
6
|
setHintLayout: (layoutChangeEvent: LayoutChangeEvent) => void;
|
|
7
7
|
hintPositionStyle: {
|
|
8
8
|
left: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { Component, ReactElement, ElementRef
|
|
1
|
+
import React, { Component, ReactElement, ElementRef } 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;
|
|
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>;
|
|
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(): 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;
|
|
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;
|
|
192
192
|
renderChildren(): React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
|
|
193
|
-
render(): string | number |
|
|
193
|
+
render(): string | number | true | React.JSX.Element | Iterable<React.ReactNode> | 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").
|
|
9
|
+
targetRef: import("react").MutableRefObject<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 |
|
|
4
|
+
(props: HintProps): string | number | true | React.JSX.Element | Iterable<React.ReactNode> | 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 |
|
|
10
|
+
(props: HintProps): string | number | true | React.JSX.Element | Iterable<React.ReactNode> | null;
|
|
11
11
|
displayName: string;
|
|
12
12
|
positions: typeof HintPositions;
|
|
13
13
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { ReactElement
|
|
1
|
+
import type { ReactElement } 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;
|
|
7
7
|
export declare enum TargetAlignments {
|
|
8
8
|
LEFT = "left",
|
|
9
9
|
RIGHT = "right",
|
|
@@ -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
|
|
53
|
+
customOverlayContent?: React.ReactElement | React.ReactElement[];
|
|
54
54
|
/**
|
|
55
55
|
* Default image source in case of an error
|
|
56
56
|
*/
|
|
@@ -158,27 +158,24 @@ class Image extends PureComponent {
|
|
|
158
158
|
const {
|
|
159
159
|
margins
|
|
160
160
|
} = modifiers;
|
|
161
|
-
return
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
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}>
|
|
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}>
|
|
180
176
|
{(overlayType || customOverlayContent) && <Overlay type={overlayType} intensity={overlayIntensity} color={overlayColor} customContent={customOverlayContent} borderRadius={borderRadius} />}
|
|
181
|
-
</ImageView
|
|
177
|
+
</ImageView>
|
|
178
|
+
);
|
|
182
179
|
};
|
|
183
180
|
renderRegularImage() {
|
|
184
181
|
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?:
|
|
6
|
+
customLoader?: React.ReactChild | 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.
|
|
11
|
+
customLoader?: React.ReactChild;
|
|
12
12
|
/**
|
|
13
13
|
* Color of the loader background (only when passing 'overlay')
|
|
14
14
|
*/
|
|
@@ -1,22 +1,5 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import {
|
|
3
|
-
export
|
|
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>>;
|
|
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>>;
|
|
22
5
|
export default _default;
|
|
@@ -1,86 +1,24 @@
|
|
|
1
|
-
import
|
|
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';
|
|
1
|
+
import React, { forwardRef, useEffect } from 'react';
|
|
5
2
|
import { useThemeProps } from "../../hooks";
|
|
6
|
-
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
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) {
|
|
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) {
|
|
15
8
|
const {
|
|
16
|
-
|
|
17
|
-
formatter = _identity,
|
|
18
|
-
containerStyle,
|
|
19
|
-
renderMaskedText,
|
|
20
|
-
onChangeText,
|
|
9
|
+
migrate,
|
|
21
10
|
...others
|
|
22
11
|
} = 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
|
-
});
|
|
39
12
|
useEffect(() => {
|
|
40
|
-
if (
|
|
41
|
-
|
|
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.`);
|
|
42
15
|
}
|
|
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();
|
|
51
|
-
}, []);
|
|
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
16
|
}, []);
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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>;
|
|
72
|
-
}
|
|
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
|
|
17
|
+
if (migrate) {
|
|
18
|
+
return <MaskedInputNew {...others} ref={refToForward} />;
|
|
19
|
+
} else {
|
|
20
|
+
return <MaskedInputOld {...others} ref={refToForward} />;
|
|
83
21
|
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export default forwardRef(
|
|
22
|
+
}
|
|
23
|
+
export { MaskedInputProps };
|
|
24
|
+
export default forwardRef(MaskedInputMigrator);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React 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>>;
|
|
22
|
+
export default _default;
|
|
@@ -0,0 +1,85 @@
|
|
|
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';
|
|
5
|
+
import View from "../view";
|
|
6
|
+
import Text from "../text";
|
|
7
|
+
import TouchableOpacity from "../touchableOpacity";
|
|
8
|
+
/**
|
|
9
|
+
* @description: Mask Input to create custom looking inputs with custom formats
|
|
10
|
+
* @gif: https://camo.githubusercontent.com/61eedb65e968845d5eac713dcd21a69691571fb1/68747470733a2f2f6d656469612e67697068792e636f6d2f6d656469612f4b5a5a7446666f486f454b334b2f67697068792e676966
|
|
11
|
+
* @example: https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/MaskedInputScreen.tsx
|
|
12
|
+
*/
|
|
13
|
+
function MaskedInput(props, ref) {
|
|
14
|
+
const {
|
|
15
|
+
initialValue,
|
|
16
|
+
formatter = _identity,
|
|
17
|
+
containerStyle,
|
|
18
|
+
renderMaskedText,
|
|
19
|
+
onChangeText,
|
|
20
|
+
...others
|
|
21
|
+
} = props;
|
|
22
|
+
const [value, setValue] = useState(initialValue);
|
|
23
|
+
const inputRef = useRef();
|
|
24
|
+
const keyboardDidHideListener = useRef();
|
|
25
|
+
useImperativeHandle(ref, () => {
|
|
26
|
+
return {
|
|
27
|
+
isFocused: () => inputRef.current?.isFocused(),
|
|
28
|
+
focus,
|
|
29
|
+
blur: () => inputRef.current?.blur(),
|
|
30
|
+
clear: () => {
|
|
31
|
+
inputRef.current?.clear();
|
|
32
|
+
setValue('');
|
|
33
|
+
// NOTE: This fixes an RN issue - when triggering imperative clear method, it doesn't call onChangeText
|
|
34
|
+
onChangeText?.('');
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
if (initialValue !== value) {
|
|
40
|
+
setValue(initialValue);
|
|
41
|
+
}
|
|
42
|
+
}, [initialValue]);
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
keyboardDidHideListener.current = Keyboard.addListener('keyboardDidHide', () => {
|
|
45
|
+
if (inputRef.current?.isFocused()) {
|
|
46
|
+
inputRef.current?.blur();
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
return () => keyboardDidHideListener.current.remove();
|
|
50
|
+
}, []);
|
|
51
|
+
const _onChangeText = useCallback(value => {
|
|
52
|
+
const formattedValue = formatter(value) ?? '';
|
|
53
|
+
setValue(formattedValue);
|
|
54
|
+
onChangeText?.(formattedValue);
|
|
55
|
+
}, [onChangeText, formatter]);
|
|
56
|
+
const focus = useCallback(() => {
|
|
57
|
+
inputRef.current?.focus();
|
|
58
|
+
}, []);
|
|
59
|
+
const _renderMaskedText = () => {
|
|
60
|
+
if (_isFunction(renderMaskedText)) {
|
|
61
|
+
return renderMaskedText(value);
|
|
62
|
+
}
|
|
63
|
+
return <Text>{value}</Text>;
|
|
64
|
+
};
|
|
65
|
+
return <TouchableOpacity style={containerStyle} activeOpacity={1} onPress={focus}>
|
|
66
|
+
<TextInput {...others} value={value}
|
|
67
|
+
// @ts-expect-error
|
|
68
|
+
ref={inputRef} style={styles.hiddenInput} enableErrors={false} hideUnderline placeholder="" caretHidden multiline={false} onChangeText={_onChangeText} />
|
|
69
|
+
<View style={styles.maskedInputWrapper}>{_renderMaskedText()}</View>
|
|
70
|
+
</TouchableOpacity>;
|
|
71
|
+
}
|
|
72
|
+
const styles = StyleSheet.create({
|
|
73
|
+
hiddenInput: {
|
|
74
|
+
...StyleSheet.absoluteFillObject,
|
|
75
|
+
zIndex: 1,
|
|
76
|
+
color: 'transparent',
|
|
77
|
+
backgroundColor: 'transparent',
|
|
78
|
+
height: undefined
|
|
79
|
+
},
|
|
80
|
+
maskedInputWrapper: {
|
|
81
|
+
zIndex: 0
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
MaskedInput.displayName = 'MaskedInput';
|
|
85
|
+
export default forwardRef(MaskedInput);
|