react-native-ui-lib 8.1.8-snapshot.7613 → 8.1.8-snapshot.7626
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/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/index.d.ts +2 -2
- package/lib/components/Keyboard/KeyboardAccessoryView/index.js +3 -1
- package/lib/components/Keyboard/KeyboardTrackingView/KeyboardTrackingView.ios.js +3 -1
- package/lib/components/Keyboard/KeyboardTrackingView/index.d.ts +1 -1
- package/lib/components/Keyboard/index.d.ts +1 -1
- package/lib/package.json +3 -4
- package/package.json +17 -19
- package/src/commons/asBaseComponent.js +2 -1
- package/src/commons/baseComponent.js +0 -8
- package/src/commons/forwardRef.js +0 -5
- package/src/commons/modifiers.d.ts +0 -6
- package/src/commons/modifiers.js +0 -18
- package/src/commons/withScrollEnabler.js +0 -4
- package/src/commons/withScrollReached.js +0 -4
- package/src/components/KeyboardAwareScrollView/KeyboardAwareBase.js +0 -7
- package/src/components/KeyboardAwareScrollView/KeyboardAwareFlatList.js +0 -6
- package/src/components/KeyboardAwareScrollView/KeyboardAwareScrollView.js +0 -6
- 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 +0 -37
- 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 +0 -1
- package/src/components/baseInput/index.js +1 -49
- 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 +4 -1
- package/src/components/carousel/types.js +0 -2
- 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/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 +5 -7
- 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 +0 -3
- package/src/components/image/index.d.ts +1 -1
- package/src/components/image/index.js +20 -17
- 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 +21 -4
- package/src/components/maskedInput/index.js +78 -16
- package/src/components/maskedInput/maskedInput.api.json +0 -1
- 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 +0 -15
- package/src/components/picker/PickerDialog.js +0 -7
- 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 +11 -4
- 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 +0 -6
- package/src/components/textField/index.js +22 -1
- 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 +20 -20
- package/src/components/timeline/index.js +1 -1
- package/src/components/toast/index.js +0 -69
- package/src/components/view/index.js +2 -5
- 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/hooks/useCombinedRefs/index.js +1 -2
- 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 +12 -3
- package/ReactNativeUiLib.podspec +0 -22
- package/src/components/maskedInput/new.d.ts +0 -22
- package/src/components/maskedInput/new.js +0 -85
- package/src/components/maskedInput/old.js +0 -95
- package/src/components/textFieldOld/index.d.ts +0 -71
- package/src/components/textFieldOld/index.js +0 -807
- package/src/helpers/DocsGenerator.js +0 -61
- package/textFieldOld.d.ts +0 -2
- package/textFieldOld.js +0 -1
|
@@ -1,23 +1,85 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
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) {
|
|
7
14
|
const {
|
|
8
|
-
|
|
15
|
+
initialValue,
|
|
16
|
+
formatter = _identity,
|
|
17
|
+
containerStyle,
|
|
18
|
+
renderMaskedText,
|
|
19
|
+
onChangeText,
|
|
9
20
|
...others
|
|
10
21
|
} = props;
|
|
22
|
+
const [value, setValue] = useState(initialValue);
|
|
23
|
+
const inputRef = useRef(undefined);
|
|
24
|
+
const keyboardDidHideListener = useRef(undefined);
|
|
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
|
+
});
|
|
11
38
|
useEffect(() => {
|
|
12
|
-
if (
|
|
13
|
-
|
|
39
|
+
if (initialValue !== value) {
|
|
40
|
+
setValue(initialValue);
|
|
14
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();
|
|
15
50
|
}, []);
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
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>;
|
|
21
71
|
}
|
|
22
|
-
|
|
23
|
-
|
|
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);
|
|
@@ -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():
|
|
61
|
-
render():
|
|
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
|
|
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.
|
|
4
|
+
declare const useImperativePickerHandle: (ref: React.Ref<any>, expandableRef: React.MutableRefObject<ExpandableOverlayMethods | null>) => React.RefObject<TextFieldMethods | undefined>;
|
|
5
5
|
export default useImperativePickerHandle;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PropsWithChildren, ReactNode } from 'react';
|
|
1
|
+
import { PropsWithChildren, ReactNode, type JSX } from 'react';
|
|
2
2
|
import { FlatListProps, StyleProp, ViewStyle, TextStyle } from 'react-native';
|
|
3
3
|
import { ExpandableOverlayProps, ExpandableOverlayMethods } from '../../incubator/expandableOverlay';
|
|
4
4
|
import { ModalTopBarProps } from '../modal/TopBar';
|
|
@@ -19,7 +19,7 @@ export type PickerSingleValue = string | number;
|
|
|
19
19
|
export type PickerMultiValue = PickerSingleValue[];
|
|
20
20
|
export type PickerValue = PickerSingleValue | PickerMultiValue | undefined;
|
|
21
21
|
type PickerFilteredItems = ReactNode | Pick<PickerItemProps, 'label' | 'value' | 'disabled'>[] | undefined;
|
|
22
|
-
type RenderPickerOverloads<ValueType> = ValueType extends PickerValue ? (value?: ValueType, label?: string) => React.ReactElement : never;
|
|
22
|
+
type RenderPickerOverloads<ValueType> = ValueType extends PickerValue ? (value?: ValueType, label?: string) => React.ReactElement<any> : never;
|
|
23
23
|
type RenderPicker = RenderPickerOverloads<PickerValue>;
|
|
24
24
|
export type RenderCustomModalProps = {
|
|
25
25
|
visible: boolean;
|
|
@@ -55,7 +55,7 @@ type PickerPropsDeprecation = {
|
|
|
55
55
|
renderCustomDialogHeader?: (callbacks: {
|
|
56
56
|
onDone?: () => void;
|
|
57
57
|
onCancel?: () => void;
|
|
58
|
-
}) => React.ReactElement
|
|
58
|
+
}) => React.ReactElement<any>;
|
|
59
59
|
/**
|
|
60
60
|
* @deprecated
|
|
61
61
|
* Render custom picker input (the value will be passed)
|
|
@@ -69,7 +69,7 @@ type PickerPropsDeprecation = {
|
|
|
69
69
|
* Render custom picker overlay (e.g ({visible, children, toggleModal}) => {...})
|
|
70
70
|
* instead use renderOverlay
|
|
71
71
|
*/
|
|
72
|
-
renderCustomModal?: (modalProps: RenderCustomModalProps) => React.ReactElement
|
|
72
|
+
renderCustomModal?: (modalProps: RenderCustomModalProps) => React.ReactElement<any>;
|
|
73
73
|
/**
|
|
74
74
|
* @deprecated
|
|
75
75
|
* Pass props to the picker modal
|
|
@@ -97,7 +97,7 @@ type PickerSearchProps = {
|
|
|
97
97
|
/**
|
|
98
98
|
* Render custom search input (only when passing showSearch)
|
|
99
99
|
*/
|
|
100
|
-
renderCustomSearch?: (props: PickerItemsListProps) => React.ReactElement
|
|
100
|
+
renderCustomSearch?: (props: PickerItemsListProps) => React.ReactElement<any>;
|
|
101
101
|
};
|
|
102
102
|
type PickerListProps = PickerSearchProps & {
|
|
103
103
|
/**
|
|
@@ -106,7 +106,7 @@ type PickerListProps = PickerSearchProps & {
|
|
|
106
106
|
renderHeader?: (callbacks: {
|
|
107
107
|
onDone?: () => void;
|
|
108
108
|
onCancel?: () => void;
|
|
109
|
-
}) => React.ReactElement
|
|
109
|
+
}) => React.ReactElement<any>;
|
|
110
110
|
/**
|
|
111
111
|
* Pass props to the list component that wraps the picker items (allows to control FlatList behavior)
|
|
112
112
|
*/
|
|
@@ -128,7 +128,7 @@ type PickerExpandableOverlayProps = {
|
|
|
128
128
|
/**
|
|
129
129
|
* Render custom picker overlay (e.g ({visible, children, toggleModal}) => {...})
|
|
130
130
|
*/
|
|
131
|
-
renderOverlay?: (modalProps: RenderCustomModalProps) => React.ReactElement
|
|
131
|
+
renderOverlay?: (modalProps: RenderCustomModalProps) => React.ReactElement<any>;
|
|
132
132
|
/**
|
|
133
133
|
* Add blur effect to picker modal (iOS only)
|
|
134
134
|
*/
|
|
@@ -213,11 +213,11 @@ export type PickerBaseProps = Omit<TextFieldProps, 'value' | 'onChange'> & Picke
|
|
|
213
213
|
renderItem?: (value: PickerValue, itemProps: PickerItemProps & {
|
|
214
214
|
isSelected: boolean;
|
|
215
215
|
isItemDisabled: boolean;
|
|
216
|
-
}, label?: string) => React.ReactElement
|
|
216
|
+
}, label?: string) => React.ReactElement<any>;
|
|
217
217
|
/**
|
|
218
218
|
* Render custom top element
|
|
219
219
|
*/
|
|
220
|
-
renderCustomTopElement?: (value?: PickerValue) => React.ReactElement
|
|
220
|
+
renderCustomTopElement?: (value?: PickerValue) => React.ReactElement<any>;
|
|
221
221
|
/**
|
|
222
222
|
* Selection status bar props
|
|
223
223
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { PureComponent } from 'react';
|
|
1
|
+
import React, { PureComponent, type JSX } from 'react';
|
|
2
2
|
import { Animated, StyleProp, ViewStyle, LayoutChangeEvent } from 'react-native';
|
|
3
3
|
/**
|
|
4
4
|
* @description: Progress bar
|
|
@@ -58,7 +58,7 @@ declare class ProgressBar extends PureComponent<Props, State> {
|
|
|
58
58
|
borderTopRightRadius: number;
|
|
59
59
|
};
|
|
60
60
|
renderCustomElement(): React.FunctionComponentElement<any> | undefined;
|
|
61
|
-
render():
|
|
61
|
+
render(): JSX.Element;
|
|
62
62
|
}
|
|
63
63
|
export { ProgressBar };
|
|
64
64
|
declare const _default: React.ForwardRefExoticComponent<Props & React.RefAttributes<any>> & typeof ProgressBar;
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import React, { Component } from 'react';
|
|
2
|
-
import { Animated, FlatListProps, ImageSourcePropType, NativeSyntheticEvent, NativeScrollEvent, LayoutChangeEvent } from 'react-native';
|
|
2
|
+
import { Animated, FlatListProps, ScrollViewProps, ImageSourcePropType, NativeSyntheticEvent, NativeScrollEvent, LayoutChangeEvent } from 'react-native';
|
|
3
3
|
import { ForwardRefInjectedProps } from '../../commons/new';
|
|
4
4
|
import { ComponentStatics } from '../../typings/common';
|
|
5
|
-
export
|
|
5
|
+
export type ListProps = (FlatListProps<any> & {
|
|
6
6
|
/**
|
|
7
7
|
* Whether to use a FlatList. NOTE: you must pass 'data' and 'renderItem' props as well
|
|
8
8
|
*/
|
|
9
|
-
useList
|
|
9
|
+
useList: true;
|
|
10
|
+
}) | (ScrollViewProps & {
|
|
11
|
+
/**
|
|
12
|
+
* Whether to use a ScrollView. NOTE: you must pass 'contentContainerStyle' prop as well
|
|
13
|
+
*/
|
|
14
|
+
useList?: false;
|
|
15
|
+
});
|
|
16
|
+
export type ScrollBarProps = ListProps & {
|
|
10
17
|
/**
|
|
11
18
|
* The element to use as a container, instead of a View
|
|
12
19
|
*/
|
|
@@ -44,7 +51,7 @@ export interface ScrollBarProps extends FlatListProps<any> {
|
|
|
44
51
|
* The index to currently focus on
|
|
45
52
|
*/
|
|
46
53
|
focusIndex?: number;
|
|
47
|
-
}
|
|
54
|
+
};
|
|
48
55
|
type Props = ScrollBarProps & ForwardRefInjectedProps;
|
|
49
56
|
type State = {
|
|
50
57
|
gradientOpacity: Animated.Value;
|
|
@@ -32,7 +32,7 @@ const SearchInput = forwardRef((props, ref) => {
|
|
|
32
32
|
style,
|
|
33
33
|
inaccessible
|
|
34
34
|
} = props;
|
|
35
|
-
const currentAnimatedValue = useRef();
|
|
35
|
+
const currentAnimatedValue = useRef(undefined);
|
|
36
36
|
const searchInputRef = useRef(null);
|
|
37
37
|
const [hasValue, setHasValue] = useState(Boolean(controlledValue));
|
|
38
38
|
const [value, setValue] = useState(controlledValue);
|
|
@@ -26,7 +26,7 @@ export type SearchInputProps = TextInputProps & {
|
|
|
26
26
|
/**
|
|
27
27
|
* Custom right element
|
|
28
28
|
*/
|
|
29
|
-
customRightElement?: React.ReactElement
|
|
29
|
+
customRightElement?: React.ReactElement<any>;
|
|
30
30
|
/**
|
|
31
31
|
* Whether to show a loader instead of the left search icon
|
|
32
32
|
*/
|
|
@@ -38,7 +38,7 @@ export type SearchInputProps = TextInputProps & {
|
|
|
38
38
|
/**
|
|
39
39
|
* custom loader element
|
|
40
40
|
*/
|
|
41
|
-
customLoader?: React.ReactElement
|
|
41
|
+
customLoader?: React.ReactElement<any>;
|
|
42
42
|
/**
|
|
43
43
|
* converts the colors of the search's input elements, icons and button to white
|
|
44
44
|
*/
|
|
@@ -7,11 +7,11 @@ export declare const SectionsWheelPickerDriver: (props: ComponentProps) => {
|
|
|
7
7
|
moveToItem: (index: number, itemHeight?: number, numberOfRows?: number) => void;
|
|
8
8
|
getLabel: () => string | (string | ReactTestInstance)[];
|
|
9
9
|
scroll: (contentOffset: Partial<import("react-native/types").NativeScrollPoint>, options?: {
|
|
10
|
-
contentInset: import("react-native/types").NativeScrollRectangle;
|
|
11
|
-
zoomScale: number;
|
|
12
10
|
layoutMeasurement: import("react-native/types").NativeScrollSize;
|
|
13
11
|
contentSize: import("react-native/types").NativeScrollSize;
|
|
14
12
|
velocity?: import("react-native/types").NativeScrollVelocity | undefined;
|
|
13
|
+
contentInset: import("react-native/types").NativeScrollRectangle;
|
|
14
|
+
zoomScale: number;
|
|
15
15
|
targetContentOffset?: import("react-native/types").NativeScrollPoint | undefined;
|
|
16
16
|
} | undefined) => void;
|
|
17
17
|
triggerEvent: (eventName?: string | undefined, event?: Partial<import("react-native/types").NativeScrollEvent> | undefined) => void;
|
|
@@ -35,7 +35,7 @@ export interface SkeletonListProps {
|
|
|
35
35
|
/**
|
|
36
36
|
* Extra content to be rendered on the end of the list item
|
|
37
37
|
*/
|
|
38
|
-
renderEndContent?: () => React.ReactElement | undefined;
|
|
38
|
+
renderEndContent?: () => React.ReactElement<any> | undefined;
|
|
39
39
|
}
|
|
40
40
|
export interface SkeletonViewProps extends AccessibilityProps, AlignmentModifiers, PaddingModifiers, MarginModifiers {
|
|
41
41
|
/**
|
|
@@ -155,9 +155,9 @@ declare class SkeletonView extends Component<SkeletonViewProps, SkeletonState> {
|
|
|
155
155
|
renderTextContentTemplate: () => React.JSX.Element;
|
|
156
156
|
renderTemplate: () => React.JSX.Element;
|
|
157
157
|
renderAdvanced: () => React.JSX.Element;
|
|
158
|
-
renderWithFading: (skeleton: any) => string | number | boolean | React.JSX.Element | Iterable<React.ReactNode> | null | undefined;
|
|
159
|
-
renderSkeleton(): string | number | boolean | React.JSX.Element | Iterable<React.ReactNode> | null | undefined;
|
|
158
|
+
renderWithFading: (skeleton: any) => string | number | bigint | boolean | 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 | undefined;
|
|
159
|
+
renderSkeleton(): string | number | bigint | boolean | 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 | undefined;
|
|
160
160
|
renderNothing: () => null;
|
|
161
|
-
render(): string | number | boolean | React.JSX.Element | Iterable<React.ReactNode> | null | undefined;
|
|
161
|
+
render(): string | number | bigint | boolean | 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 | undefined;
|
|
162
162
|
}
|
|
163
163
|
export default SkeletonView;
|
|
@@ -26,7 +26,7 @@ export interface ThumbProps extends ViewProps {
|
|
|
26
26
|
*/
|
|
27
27
|
disabled?: boolean;
|
|
28
28
|
/** ref to thumb component */
|
|
29
|
-
ref?: React.RefObject<RNView>;
|
|
29
|
+
ref?: React.RefObject<RNView | null>;
|
|
30
30
|
}
|
|
31
31
|
declare const Thumb: React.ForwardRefExoticComponent<Omit<ThumbProps, "ref"> & React.RefAttributes<unknown>>;
|
|
32
32
|
export default Thumb;
|
|
@@ -44,7 +44,7 @@ export type SliderProps = Omit<ThumbProps, 'ref'> & {
|
|
|
44
44
|
/**
|
|
45
45
|
* Custom render instead of rendering the track
|
|
46
46
|
*/
|
|
47
|
-
renderTrack?: () => ReactElement | ReactElement[];
|
|
47
|
+
renderTrack?: () => ReactElement<any> | ReactElement<any>[];
|
|
48
48
|
/**
|
|
49
49
|
* Callback for onValueChange
|
|
50
50
|
*/
|
|
@@ -47,11 +47,11 @@ export interface TabControllerItemProps extends Pick<TabControllerBarProps, 'spr
|
|
|
47
47
|
/**
|
|
48
48
|
* Pass to render a leading element
|
|
49
49
|
*/
|
|
50
|
-
leadingAccessory?: ReactElement
|
|
50
|
+
leadingAccessory?: ReactElement<any>;
|
|
51
51
|
/**
|
|
52
52
|
* Pass to render a trailing element
|
|
53
53
|
*/
|
|
54
|
-
trailingAccessory?: ReactElement
|
|
54
|
+
trailingAccessory?: ReactElement<any>;
|
|
55
55
|
/**
|
|
56
56
|
* A fixed width for the item
|
|
57
57
|
*/
|
|
@@ -46,7 +46,7 @@ export default function TabBarItem({
|
|
|
46
46
|
currentPage,
|
|
47
47
|
setCurrentIndex
|
|
48
48
|
} = useContext(TabBarContext);
|
|
49
|
-
const itemRef = useRef();
|
|
49
|
+
const itemRef = useRef(undefined);
|
|
50
50
|
const itemWidth = useRef(props.width);
|
|
51
51
|
const isPressed = useSharedValue(false);
|
|
52
52
|
// JSON.parse(JSON.stringify is due to an issue with reanimated
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { PropsWithChildren, type JSX } from 'react';
|
|
2
2
|
import { type StyleProp, type ViewStyle } from 'react-native';
|
|
3
3
|
export interface TabControllerPageProps {
|
|
4
4
|
/**
|
|
@@ -30,4 +30,4 @@ export interface TabControllerPageProps {
|
|
|
30
30
|
* @description: TabController's TabPage
|
|
31
31
|
* @example: https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/TabControllerScreen/index.tsx
|
|
32
32
|
*/
|
|
33
|
-
export default function TabPage({ testID, index, lazy, renderLoading, style, lazyLoadTime, ...props }: PropsWithChildren<TabControllerPageProps>):
|
|
33
|
+
export default function TabPage({ testID, index, lazy, renderLoading, style, lazyLoadTime, ...props }: PropsWithChildren<TabControllerPageProps>): JSX.Element;
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
import { TextProps } from './index';
|
|
3
3
|
import { ComponentDriver } from '../../testkit/Component.driver';
|
|
4
4
|
export declare class TextDriver extends ComponentDriver<TextProps> {
|
|
5
|
-
getTextContent: () => Promise<import("react").ReactNode>;
|
|
5
|
+
getTextContent: () => Promise<string | number | bigint | boolean | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined>;
|
|
6
6
|
isPressable: () => Promise<boolean | null>;
|
|
7
7
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import {View, TextInput as RNTextInput, StyleSheet} from 'react-native';
|
|
3
|
-
import {TextInputPropTypes} from 'deprecated-react-native-prop-types';
|
|
4
3
|
import BaseInput from '../baseInput';
|
|
5
4
|
import {Colors} from '../../style';
|
|
6
5
|
|
|
@@ -15,11 +14,6 @@ import {Colors} from '../../style';
|
|
|
15
14
|
export default class TextArea extends BaseInput {
|
|
16
15
|
static displayName = 'TextArea';
|
|
17
16
|
|
|
18
|
-
static propTypes = {
|
|
19
|
-
...TextInputPropTypes,
|
|
20
|
-
...BaseInput.propTypes
|
|
21
|
-
};
|
|
22
|
-
|
|
23
17
|
generateStyles() {
|
|
24
18
|
this.styles = createStyles(this.props);
|
|
25
19
|
}
|
|
@@ -78,6 +78,7 @@ const TextField = props => {
|
|
|
78
78
|
readonly = false,
|
|
79
79
|
showMandatoryIndication,
|
|
80
80
|
clearButtonStyle,
|
|
81
|
+
accessibilityLabel: accessibilityLabelProp,
|
|
81
82
|
...others
|
|
82
83
|
} = usePreset(props);
|
|
83
84
|
const {
|
|
@@ -135,8 +136,28 @@ const TextField = props => {
|
|
|
135
136
|
const hasValue = fieldState.value !== undefined; // NOTE: not pressable if centered without a value (so can't center placeholder)
|
|
136
137
|
const inputStyle = useMemo(() => [typographyStyle, colorStyle, others.style, hasValue && centeredTextStyle], [typographyStyle, colorStyle, others.style, centeredTextStyle, hasValue]);
|
|
137
138
|
const dummyPlaceholderStyle = useMemo(() => [inputStyle, styles.dummyPlaceholder], [inputStyle]);
|
|
139
|
+
const defaultAccessibilityLabel = useMemo(() => {
|
|
140
|
+
const parts = [];
|
|
141
|
+
if (label) {
|
|
142
|
+
parts.push(label);
|
|
143
|
+
}
|
|
144
|
+
if (context.isMandatory) {
|
|
145
|
+
parts.push('required');
|
|
146
|
+
}
|
|
147
|
+
parts.push('textField');
|
|
148
|
+
if (helperText) {
|
|
149
|
+
parts.push(helperText);
|
|
150
|
+
} else if (placeholder) {
|
|
151
|
+
parts.push(placeholder);
|
|
152
|
+
}
|
|
153
|
+
if (showCharCounter && others.maxLength) {
|
|
154
|
+
parts.push(`you can enter up to ${others.maxLength} characters`);
|
|
155
|
+
}
|
|
156
|
+
return parts.join(', ');
|
|
157
|
+
}, [label, context.isMandatory, helperText, placeholder, showCharCounter, others.maxLength]);
|
|
158
|
+
const accessibilityLabel = accessibilityLabelProp ?? defaultAccessibilityLabel;
|
|
138
159
|
return <FieldContext.Provider value={context}>
|
|
139
|
-
<View {...containerProps} style={[margins, positionStyle, containerStyle, centeredContainerStyle]}>
|
|
160
|
+
<View {...containerProps} accessible accessibilityLabel={accessibilityLabel} style={[margins, positionStyle, containerStyle, centeredContainerStyle]}>
|
|
140
161
|
<View row spread style={centeredContainerStyle}>
|
|
141
162
|
<Label label={label} labelColor={labelColor} labelStyle={_labelStyle} labelProps={labelProps} floatingPlaceholder={floatingPlaceholder} validationMessagePosition={validationMessagePosition} testID={`${props.testID}.label`} showMandatoryIndication={showMandatoryIndication} enableErrors={enableErrors} />
|
|
142
163
|
{validationMessagePosition === ValidationMessagePosition.TOP && <ValidationMessage enableErrors={enableErrors} validate={others.validate} validationMessage={others.validationMessage} validationMessageStyle={_validationMessageStyle} retainValidationSpace={retainValidationSpace && retainTopMessageSpace} testID={`${props.testID}.validationMessage`} />}
|
|
@@ -171,19 +171,19 @@ export type TextFieldProps = MarginModifiers & PaddingModifiers & TypographyModi
|
|
|
171
171
|
/**
|
|
172
172
|
* Pass to render a leading element
|
|
173
173
|
*/
|
|
174
|
-
leadingAccessory?: ReactElement
|
|
174
|
+
leadingAccessory?: ReactElement<any>;
|
|
175
175
|
/**
|
|
176
176
|
* Pass to render a trailing element
|
|
177
177
|
*/
|
|
178
|
-
trailingAccessory?: ReactElement
|
|
178
|
+
trailingAccessory?: ReactElement<any>;
|
|
179
179
|
/**
|
|
180
180
|
* Pass to render a top trailing element
|
|
181
181
|
*/
|
|
182
|
-
topTrailingAccessory?: ReactElement
|
|
182
|
+
topTrailingAccessory?: ReactElement<any>;
|
|
183
183
|
/**
|
|
184
184
|
* Pass to render a bottom element below the input
|
|
185
185
|
*/
|
|
186
|
-
bottomAccessory?: ReactElement
|
|
186
|
+
bottomAccessory?: ReactElement<any>;
|
|
187
187
|
/**
|
|
188
188
|
* Should show a clear button when there is a value
|
|
189
189
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { TextInput, TextInputProps } from 'react-native';
|
|
3
|
-
declare const useImperativeInputHandle: (ref: React.Ref<any>, props: Pick<TextInputProps, 'onChangeText'>) => React.
|
|
3
|
+
declare const useImperativeInputHandle: (ref: React.Ref<any>, props: Pick<TextInputProps, 'onChangeText'>) => React.RefObject<TextInput | undefined>;
|
|
4
4
|
export default useImperativeInputHandle;
|
|
@@ -2,7 +2,7 @@ import { useContext, useImperativeHandle, useRef } from 'react';
|
|
|
2
2
|
import { findNodeHandle } from 'react-native';
|
|
3
3
|
import FieldContext from "./FieldContext";
|
|
4
4
|
const useImperativeInputHandle = (ref, props) => {
|
|
5
|
-
const inputRef = useRef();
|
|
5
|
+
const inputRef = useRef(undefined);
|
|
6
6
|
const context = useContext(FieldContext);
|
|
7
7
|
useImperativeHandle(ref, () => {
|
|
8
8
|
return {
|