react-native-ui-lib 8.1.8-snapshot.7635 → 8.1.8-snapshot.7643
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/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 +5 -4
- package/package.json +19 -17
- package/src/commons/asBaseComponent.js +1 -2
- package/src/commons/baseComponent.js +8 -0
- package/src/commons/forwardRef.js +5 -0
- 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/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 +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 +11 -2
- package/src/components/progressBar/index.js +10 -7
- package/src/components/progressBar/progressBar.api.json +6 -1
- 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 +20 -20
- 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/view/index.js +5 -2
- 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
|
@@ -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,85 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
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) {
|
|
1
|
+
import React, { forwardRef, useEffect } from 'react';
|
|
2
|
+
// @ts-expect-error
|
|
3
|
+
import MaskedInputOld from "./old";
|
|
4
|
+
import MaskedInputNew, { MaskedInputProps } from "./new";
|
|
5
|
+
import { LogService } from "../../services";
|
|
6
|
+
function MaskedInputMigrator(props, refToForward) {
|
|
14
7
|
const {
|
|
15
|
-
|
|
16
|
-
formatter = _identity,
|
|
17
|
-
containerStyle,
|
|
18
|
-
renderMaskedText,
|
|
19
|
-
onChangeText,
|
|
8
|
+
migrate,
|
|
20
9
|
...others
|
|
21
10
|
} = 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
|
-
});
|
|
38
11
|
useEffect(() => {
|
|
39
|
-
if (
|
|
40
|
-
|
|
12
|
+
if (!migrate) {
|
|
13
|
+
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.`);
|
|
41
14
|
}
|
|
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
15
|
}, []);
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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
|
|
16
|
+
if (migrate) {
|
|
17
|
+
return <MaskedInputNew {...others} ref={refToForward} />;
|
|
18
|
+
} else {
|
|
19
|
+
return <MaskedInputOld {...others} ref={refToForward} />;
|
|
82
20
|
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export default forwardRef(
|
|
21
|
+
}
|
|
22
|
+
export { MaskedInputProps };
|
|
23
|
+
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);
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import _ from 'lodash';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import {StyleSheet, Keyboard} from 'react-native';
|
|
5
|
+
import {ViewPropTypes} from 'deprecated-react-native-prop-types';
|
|
6
|
+
import BaseInput from '../baseInput';
|
|
7
|
+
import TextField from '../textFieldOld';
|
|
8
|
+
import View from '../view';
|
|
9
|
+
import Text from '../text';
|
|
10
|
+
import TouchableOpacity from '../touchableOpacity';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @description: Mask Input to create custom looking inputs with custom formats
|
|
14
|
+
* @gif: https://camo.githubusercontent.com/61eedb65e968845d5eac713dcd21a69691571fb1/68747470733a2f2f6d656469612e67697068792e636f6d2f6d656469612f4b5a5a7446666f486f454b334b2f67697068792e676966
|
|
15
|
+
* @example: https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/MaskedInputScreen.tsx
|
|
16
|
+
*/
|
|
17
|
+
export default class MaskedInput extends BaseInput {
|
|
18
|
+
static displayName = 'MaskedInput';
|
|
19
|
+
static propTypes = {
|
|
20
|
+
...TextField.propTypes,
|
|
21
|
+
/**
|
|
22
|
+
* callback for rendering the custom input out of the value returns from the actual input
|
|
23
|
+
*/
|
|
24
|
+
renderMaskedText: PropTypes.elementType.isRequired,
|
|
25
|
+
/**
|
|
26
|
+
* container style for the masked input container
|
|
27
|
+
*/
|
|
28
|
+
containerStyle: ViewPropTypes.style
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
componentDidMount() {
|
|
32
|
+
this.keyboardDidHideListener = Keyboard.addListener('keyboardDidHide', () => {
|
|
33
|
+
if (_.invoke(this, 'isFocused')) {
|
|
34
|
+
_.invoke(this, 'blur');
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
componentWillUnmount() {
|
|
40
|
+
this.keyboardDidHideListener.remove();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
clear() {
|
|
44
|
+
this.setState({value: ''});
|
|
45
|
+
this.input.clear();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
renderMaskedText() {
|
|
49
|
+
const {renderMaskedText} = this.props;
|
|
50
|
+
const {value} = this.state;
|
|
51
|
+
|
|
52
|
+
if (_.isFunction(renderMaskedText)) {
|
|
53
|
+
return renderMaskedText(value);
|
|
54
|
+
}
|
|
55
|
+
return <Text>{value}</Text>;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
render() {
|
|
59
|
+
// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
|
|
60
|
+
const {containerStyle, style} = this.props;
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<TouchableOpacity style={containerStyle} activeOpacity={1} onPress={() => this.input.focus()}>
|
|
64
|
+
<TextField
|
|
65
|
+
ref={r => (this.input = r)}
|
|
66
|
+
containerStyle={styles.hiddenInputContainer}
|
|
67
|
+
style={styles.hiddenInput}
|
|
68
|
+
enableErrors={false}
|
|
69
|
+
hideUnderline
|
|
70
|
+
placeholder=""
|
|
71
|
+
{...this.props}
|
|
72
|
+
caretHidden
|
|
73
|
+
multiline={false}
|
|
74
|
+
onChangeText={this.onChangeText}
|
|
75
|
+
/>
|
|
76
|
+
<View style={styles.maskedInputWrapper}>{this.renderMaskedText()}</View>
|
|
77
|
+
</TouchableOpacity>
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const styles = StyleSheet.create({
|
|
83
|
+
hiddenInputContainer: {
|
|
84
|
+
...StyleSheet.absoluteFillObject,
|
|
85
|
+
zIndex: 1
|
|
86
|
+
},
|
|
87
|
+
hiddenInput: {
|
|
88
|
+
color: 'transparent',
|
|
89
|
+
backgroundColor: 'transparent',
|
|
90
|
+
height: undefined
|
|
91
|
+
},
|
|
92
|
+
maskedInputWrapper: {
|
|
93
|
+
zIndex: 0
|
|
94
|
+
}
|
|
95
|
+
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { Component
|
|
1
|
+
import React, { Component } 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(): JSX.Element | undefined;
|
|
61
|
-
render(): JSX.Element;
|
|
60
|
+
renderTouchableOverlay(): React.JSX.Element | undefined;
|
|
61
|
+
render(): React.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/new";
|
|
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();
|
|
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
|
|
31
|
+
customContent?: React.ReactElement | React.ReactElement[];
|
|
32
32
|
};
|
|
33
33
|
/**
|
|
34
34
|
* @description: Overlay view with types (default, top, bottom, solid)
|
|
@@ -1,5 +1,7 @@
|
|
|
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';
|
|
3
5
|
import _ from 'lodash';
|
|
4
6
|
|
|
5
7
|
import Dialog from '../dialog';
|
|
@@ -9,6 +11,19 @@ import {Colors, BorderRadiuses} from '../../style';
|
|
|
9
11
|
|
|
10
12
|
class PickerDialog extends Component {
|
|
11
13
|
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
|
+
};
|
|
12
27
|
|
|
13
28
|
state = {};
|
|
14
29
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, {Component} from 'react';
|
|
2
2
|
import {StyleSheet} from 'react-native';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
3
4
|
import _ from 'lodash';
|
|
4
5
|
|
|
5
6
|
import Dialog from '../dialog';
|
|
@@ -9,6 +10,12 @@ import {Colors} from '../../style';
|
|
|
9
10
|
|
|
10
11
|
class PickerDialog extends Component {
|
|
11
12
|
static displayName = 'PickerDialog';
|
|
13
|
+
static propTypes = {
|
|
14
|
+
onDone: PropTypes.func,
|
|
15
|
+
onCancel: PropTypes.func,
|
|
16
|
+
topBarProps: PropTypes.object,
|
|
17
|
+
children: PropTypes.array
|
|
18
|
+
};
|
|
12
19
|
|
|
13
20
|
state = {};
|
|
14
21
|
|
|
@@ -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.MutableRefObject<TextFieldMethods | undefined>;
|
|
5
5
|
export default useImperativePickerHandle;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PropsWithChildren, ReactNode
|
|
1
|
+
import { PropsWithChildren, ReactNode } 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
|
|
22
|
+
type RenderPickerOverloads<ValueType> = ValueType extends PickerValue ? (value?: ValueType, label?: string) => React.ReactElement : 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;
|
|
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;
|
|
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;
|
|
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;
|
|
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;
|
|
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;
|
|
217
217
|
/**
|
|
218
218
|
* Render custom top element
|
|
219
219
|
*/
|
|
220
|
-
renderCustomTopElement?: (value?: PickerValue) => React.ReactElement
|
|
220
|
+
renderCustomTopElement?: (value?: PickerValue) => React.ReactElement;
|
|
221
221
|
/**
|
|
222
222
|
* Selection status bar props
|
|
223
223
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { PureComponent
|
|
1
|
+
import React, { PureComponent } from 'react';
|
|
2
2
|
import { Animated, StyleProp, ViewStyle, LayoutChangeEvent } from 'react-native';
|
|
3
3
|
/**
|
|
4
4
|
* @description: Progress bar
|
|
@@ -15,8 +15,17 @@ interface Props {
|
|
|
15
15
|
fullWidth?: boolean;
|
|
16
16
|
/**
|
|
17
17
|
* Override container style
|
|
18
|
+
* @deprecated Use containerStyle instead
|
|
18
19
|
*/
|
|
19
20
|
style?: StyleProp<ViewStyle>;
|
|
21
|
+
/**
|
|
22
|
+
* Override container style
|
|
23
|
+
*/
|
|
24
|
+
containerStyle?: StyleProp<ViewStyle>;
|
|
25
|
+
/**
|
|
26
|
+
* Override progress style
|
|
27
|
+
*/
|
|
28
|
+
progressStyle?: StyleProp<ViewStyle>;
|
|
20
29
|
/**
|
|
21
30
|
* Progress color
|
|
22
31
|
*/
|
|
@@ -58,7 +67,7 @@ declare class ProgressBar extends PureComponent<Props, State> {
|
|
|
58
67
|
borderTopRightRadius: number;
|
|
59
68
|
};
|
|
60
69
|
renderCustomElement(): React.FunctionComponentElement<any> | undefined;
|
|
61
|
-
render(): JSX.Element;
|
|
70
|
+
render(): React.JSX.Element;
|
|
62
71
|
}
|
|
63
72
|
export { ProgressBar };
|
|
64
73
|
declare const _default: React.ForwardRefExoticComponent<Props & React.RefAttributes<any>> & typeof ProgressBar;
|
|
@@ -105,7 +105,9 @@ class ProgressBar extends PureComponent {
|
|
|
105
105
|
render() {
|
|
106
106
|
const {
|
|
107
107
|
style,
|
|
108
|
-
|
|
108
|
+
containerStyle,
|
|
109
|
+
testID,
|
|
110
|
+
progressStyle
|
|
109
111
|
} = this.props;
|
|
110
112
|
const {
|
|
111
113
|
containerWidth = 0
|
|
@@ -115,12 +117,13 @@ class ProgressBar extends PureComponent {
|
|
|
115
117
|
inputRange: [0, 100],
|
|
116
118
|
outputRange
|
|
117
119
|
});
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
120
|
+
const animatedStyle = {
|
|
121
|
+
transform: [{
|
|
122
|
+
translateX: newProgress
|
|
123
|
+
}]
|
|
124
|
+
};
|
|
125
|
+
return <View onLayout={this.getContainerWidth} style={[styles.container, this.getContainerStyle(), style, containerStyle]} {...this.getAccessibilityProps()} testID={testID}>
|
|
126
|
+
{!!containerWidth && <Animated.View style={[styles.progress, this.getProgressStyle(), progressStyle, animatedStyle]}>
|
|
124
127
|
{this.renderCustomElement()}
|
|
125
128
|
</Animated.View>}
|
|
126
129
|
</View>;
|
|
@@ -16,10 +16,15 @@
|
|
|
16
16
|
"description": "FullWidth Ui preset"
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
|
-
"name": "
|
|
19
|
+
"name": "containerStyle",
|
|
20
20
|
"type": "ViewStyle",
|
|
21
21
|
"description": "Override container style"
|
|
22
22
|
},
|
|
23
|
+
{
|
|
24
|
+
"name": "progressStyle",
|
|
25
|
+
"type": "ViewStyle",
|
|
26
|
+
"description": "Override progress style"
|
|
27
|
+
},
|
|
23
28
|
{
|
|
24
29
|
"name": "progressColor",
|
|
25
30
|
"type": "string",
|
|
@@ -1,19 +1,12 @@
|
|
|
1
1
|
import React, { Component } from 'react';
|
|
2
|
-
import { Animated, FlatListProps,
|
|
2
|
+
import { Animated, FlatListProps, 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 interface ScrollBarProps extends 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
|
|
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 & {
|
|
9
|
+
useList?: boolean;
|
|
17
10
|
/**
|
|
18
11
|
* The element to use as a container, instead of a View
|
|
19
12
|
*/
|
|
@@ -51,7 +44,7 @@ export type ScrollBarProps = ListProps & {
|
|
|
51
44
|
* The index to currently focus on
|
|
52
45
|
*/
|
|
53
46
|
focusIndex?: number;
|
|
54
|
-
}
|
|
47
|
+
}
|
|
55
48
|
type Props = ScrollBarProps & ForwardRefInjectedProps;
|
|
56
49
|
type State = {
|
|
57
50
|
gradientOpacity: Animated.Value;
|