react-native-ui-lib 8.3.4-snapshot.7808 → 8.3.4-snapshot.7813

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/lib/components/HighlighterOverlayView/index.d.ts +2 -2
  2. package/lib/components/HighlighterOverlayView/index.web.d.ts +2 -2
  3. package/lib/components/Keyboard/KeyboardAccessoryView/CustomKeyboardView/CustomKeyboardViewBase.d.ts +1 -1
  4. package/lib/components/Keyboard/KeyboardAccessoryView/KeyboardRegistry/index.js +5 -1
  5. package/lib/components/Keyboard/KeyboardAccessoryView/index.d.ts +2 -2
  6. package/lib/components/Keyboard/KeyboardAccessoryView/index.js +3 -1
  7. package/lib/components/Keyboard/KeyboardTrackingView/KeyboardTrackingView.ios.js +3 -1
  8. package/lib/components/Keyboard/KeyboardTrackingView/index.d.ts +6 -2
  9. package/lib/components/Keyboard/KeyboardTrackingView/index.js +5 -4
  10. package/lib/components/Keyboard/index.d.ts +2 -1
  11. package/lib/package.json +20 -21
  12. package/lib/react-native.config.js +1 -1
  13. package/package.json +161 -163
  14. package/src/commons/asBaseComponent.js +2 -1
  15. package/src/commons/baseComponent.js +0 -8
  16. package/src/commons/forwardRef.js +1 -4
  17. package/src/commons/modifiers.d.ts +0 -6
  18. package/src/commons/modifiers.js +0 -18
  19. package/src/commons/withScrollEnabler.js +0 -4
  20. package/src/commons/withScrollReached.js +0 -4
  21. package/src/components/KeyboardAwareScrollView/KeyboardAwareBase.js +0 -7
  22. package/src/components/KeyboardAwareScrollView/KeyboardAwareFlatList.js +0 -6
  23. package/src/components/KeyboardAwareScrollView/KeyboardAwareScrollView.js +0 -6
  24. package/src/components/WheelPicker/WheelPicker.driver.d.ts +2 -2
  25. package/src/components/WheelPicker/index.d.ts +2 -2
  26. package/src/components/WheelPicker/index.js +1 -1
  27. package/src/components/WheelPicker/usePresenter.d.ts +1 -1
  28. package/src/components/actionSheet/index.d.ts +1 -1
  29. package/src/components/animatedImage/index.d.ts +1 -1
  30. package/src/components/animatedScanner/index.js +0 -37
  31. package/src/components/avatar/index.d.ts +1 -1
  32. package/src/components/badge/index.d.ts +4 -4
  33. package/src/components/baseInput/index.d.ts +0 -1
  34. package/src/components/baseInput/index.js +1 -49
  35. package/src/components/button/index.d.ts +4 -4
  36. package/src/components/button/types.d.ts +2 -2
  37. package/src/components/carousel/index.d.ts +8 -8
  38. package/src/components/carousel/types.d.ts +4 -1
  39. package/src/components/carousel/types.js +0 -2
  40. package/src/components/checkbox/index.d.ts +1 -1
  41. package/src/components/chip/index.d.ts +1 -1
  42. package/src/components/colorPalette/index.d.ts +1 -1
  43. package/src/components/dateTimePicker/index.d.ts +2 -2
  44. package/src/components/dateTimePicker/index.js +2 -2
  45. package/src/components/dialog/types.d.ts +4 -4
  46. package/src/components/dialog/useDialogContent.d.ts +1 -1
  47. package/src/components/drawer/index.d.ts +1 -1
  48. package/src/components/expandableSection/index.d.ts +2 -2
  49. package/src/components/fadedScrollView/index.js +1 -1
  50. package/src/components/featureHighlight/index.js +5 -7
  51. package/src/components/gridListItem/index.d.ts +7 -7
  52. package/src/components/gridView/index.d.ts +1 -1
  53. package/src/components/hint/HintBubble.d.ts +1 -1
  54. package/src/components/hint/HintOld.d.ts +10 -10
  55. package/src/components/hint/hooks/useHintLayout.d.ts +1 -1
  56. package/src/components/hint/index.d.ts +2 -2
  57. package/src/components/hint/types.d.ts +2 -2
  58. package/src/components/icon/index.js +0 -3
  59. package/src/components/image/index.d.ts +1 -1
  60. package/src/components/image/index.js +20 -17
  61. package/src/components/loaderScreen/index.d.ts +1 -1
  62. package/src/components/loaderScreen/types.d.ts +1 -1
  63. package/src/components/maskedInput/index.d.ts +21 -4
  64. package/src/components/maskedInput/index.js +78 -16
  65. package/src/components/maskedInput/maskedInput.api.json +0 -1
  66. package/src/components/modal/index.d.ts +3 -3
  67. package/src/components/numberInput/index.js +2 -2
  68. package/src/components/overlay/index.d.ts +1 -1
  69. package/src/components/picker/PickerDialog.android.js +0 -15
  70. package/src/components/picker/PickerDialog.js +0 -7
  71. package/src/components/picker/helpers/useImperativePickerHandle.d.ts +1 -1
  72. package/src/components/picker/helpers/useImperativePickerHandle.js +1 -1
  73. package/src/components/picker/types.d.ts +9 -9
  74. package/src/components/progressBar/index.d.ts +2 -2
  75. package/src/components/scrollBar/index.d.ts +11 -4
  76. package/src/components/searchInput/index.js +1 -1
  77. package/src/components/searchInput/types.d.ts +2 -2
  78. package/src/components/sectionsWheelPicker/SectionsWheelPicker.driver.d.ts +2 -2
  79. package/src/components/skeletonView/index.d.ts +4 -4
  80. package/src/components/slider/Thumb.d.ts +1 -1
  81. package/src/components/slider/types.d.ts +1 -1
  82. package/src/components/stackAggregator/index.d.ts +1 -1
  83. package/src/components/tabController/TabBarItem.d.ts +2 -2
  84. package/src/components/tabController/TabBarItem.js +1 -1
  85. package/src/components/tabController/TabPage.d.ts +2 -2
  86. package/src/components/tabController/useScrollToItem.d.ts +1 -1
  87. package/src/components/text/Text.driver.d.ts +1 -1
  88. package/src/components/textArea/index.js +0 -6
  89. package/src/components/textField/types.d.ts +4 -4
  90. package/src/components/textField/useImperativeInputHandle.d.ts +1 -1
  91. package/src/components/textField/useImperativeInputHandle.js +1 -1
  92. package/src/components/textField/usePreset.d.ts +36 -36
  93. package/src/components/timeline/index.js +1 -1
  94. package/src/components/toast/index.js +0 -69
  95. package/src/components/wizard/index.d.ts +1 -1
  96. package/src/components/wizard/types.d.ts +1 -1
  97. package/src/components/wizard/wizard.api.json +1 -1
  98. package/src/hooks/useCombinedRefs/index.js +1 -2
  99. package/src/hooks/useDebounce/index.js +1 -1
  100. package/src/hooks/useHiddenLocation/index.js +2 -2
  101. package/src/hooks/useHiddenLocation/index.web.js +2 -2
  102. package/src/hooks/useMeasure/index.d.ts +1 -1
  103. package/src/hooks/useMeasure/index.js +1 -1
  104. package/src/hooks/useScrollTo/index.d.ts +2 -2
  105. package/src/incubator/calendar/index.js +1 -1
  106. package/src/incubator/calendar/types.d.ts +2 -2
  107. package/src/incubator/expandableOverlay/index.d.ts +2 -2
  108. package/src/incubator/slider/Track.d.ts +1 -1
  109. package/src/incubator/slider/index.d.ts +1 -1
  110. package/src/incubator/toast/helpers/useToastTimer.js +1 -1
  111. package/src/incubator/toast/index.js +1 -1
  112. package/src/incubator/toast/types.d.ts +2 -2
  113. package/src/testkit/Component.driver.d.ts +1 -1
  114. package/src/testkit/drivers/TestingLibraryDriver.d.ts +1 -1
  115. package/src/typings/module.d.ts +12 -3
  116. package/ReactNativeUiLib.podspec +0 -22
  117. package/src/components/maskedInput/new.d.ts +0 -22
  118. package/src/components/maskedInput/new.js +0 -85
  119. package/src/components/maskedInput/old.js +0 -95
  120. package/src/components/textFieldOld/index.d.ts +0 -71
  121. package/src/components/textFieldOld/index.js +0 -807
  122. package/src/helpers/DocsGenerator.js +0 -61
  123. package/textFieldOld.d.ts +0 -2
  124. package/textFieldOld.js +0 -1
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  const useCombinedRefs = (...refs) => {
3
- const targetRef = React.useRef();
3
+ const targetRef = React.useRef(undefined);
4
4
  React.useEffect(() => {
5
5
  refs.forEach(ref => {
6
6
  if (!ref) {
@@ -9,7 +9,6 @@ const useCombinedRefs = (...refs) => {
9
9
  if (typeof ref === 'function') {
10
10
  ref(targetRef.current);
11
11
  } else {
12
- // @ts-expect-error
13
12
  ref.current = targetRef.current;
14
13
  }
15
14
  });
@@ -4,7 +4,7 @@ import { useCallback, useRef } from 'react';
4
4
  * This hook is used to debounce a function call
5
5
  */
6
6
  function useDebounce(func, timeout = 300) {
7
- const handler = useRef();
7
+ const handler = useRef(undefined);
8
8
  const debouncedFunction = useCallback(args => {
9
9
  if (handler.current) {
10
10
  clearTimeout(handler.current);
@@ -20,8 +20,8 @@ export default function useHiddenLocation() {
20
20
  };
21
21
  };
22
22
  const [hiddenLocation, setHiddenLocation] = useState(getHiddenLocation({}));
23
- const ref = useRef();
24
- const layoutData = useRef();
23
+ const ref = useRef(undefined);
24
+ const layoutData = useRef(undefined);
25
25
  const wasMeasured = useRef(wasMeasuredDefaultValue);
26
26
  const measure = useCallback(() => {
27
27
  if (ref.current && layoutData.current && layoutData.current.width > 0 && layoutData.current.height > 0) {
@@ -16,8 +16,8 @@ export default function useHiddenLocation() {
16
16
  };
17
17
  };
18
18
  const [hiddenLocation, setHiddenLocation] = useState(getHiddenLocation({}));
19
- const ref = useRef();
20
- const layoutData = useRef();
19
+ const ref = useRef(undefined);
20
+ const layoutData = useRef(undefined);
21
21
  const wasMeasured = useRef(wasMeasuredDefaultValue);
22
22
  const measure = useCallback(() => {
23
23
  if (ref.current) {
@@ -9,7 +9,7 @@ interface Measurements {
9
9
  pageY: number;
10
10
  }
11
11
  declare const _default: () => {
12
- ref: import("react").MutableRefObject<RNView | undefined>;
12
+ ref: import("react").RefObject<RNView | undefined>;
13
13
  measurements: Measurements | undefined;
14
14
  };
15
15
  export default _default;
@@ -1,6 +1,6 @@
1
1
  import { useEffect, useRef, useState } from 'react';
2
2
  export default () => {
3
- const ref = useRef();
3
+ const ref = useRef(undefined);
4
4
  const [measurements, setMeasurements] = useState();
5
5
  const onMeasure = (x, y, width, height, pageX, pageY) => {
6
6
  setMeasurements({
@@ -5,7 +5,7 @@ export type ScrollToProps<T extends ScrollToSupportedViews> = {
5
5
  /**
6
6
  * A reference to the ScrollView (or FlatList) which the items are in
7
7
  */
8
- scrollViewRef?: RefObject<T>;
8
+ scrollViewRef?: RefObject<T | null>;
9
9
  /**
10
10
  * Is the scroll view horizontal (default is true)
11
11
  */
@@ -15,7 +15,7 @@ export type ScrollToResultProps<T extends ScrollToSupportedViews> = {
15
15
  /**
16
16
  * A reference to the ScrollView (or FlatList) which the items are in (from the props or a created one)
17
17
  */
18
- scrollViewRef: RefObject<T>;
18
+ scrollViewRef: RefObject<T | null>;
19
19
  /**
20
20
  * scrollTo callback.
21
21
  * offset - the x or y to scroll to.
@@ -42,7 +42,7 @@ function Calendar(props) {
42
42
  }
43
43
  return -1;
44
44
  }, [monthItems]);
45
- const flashListRef = useRef();
45
+ const flashListRef = useRef(undefined);
46
46
  const current = useSharedValue(new Date(initialDate).setHours(0, 0, 0, 0));
47
47
  const initialMonthIndex = useRef(getItemIndex(current.value));
48
48
  const lastUpdateSource = useSharedValue(UpdateSource.INIT);
@@ -111,8 +111,8 @@ export interface CalendarProps {
111
111
  showExtraDays?: boolean;
112
112
  }
113
113
  export interface AgendaProps {
114
- renderEvent?: (event: Event) => React.ReactElement | null;
115
- renderHeader?: (header: DateSectionHeader) => React.ReactElement | null;
114
+ renderEvent?: (event: Event) => React.ReactElement<any> | null;
115
+ renderHeader?: (header: DateSectionHeader) => React.ReactElement<any> | null;
116
116
  showLoader?: boolean;
117
117
  onEndReached?: (date: number) => void;
118
118
  }
@@ -14,7 +14,7 @@ export type ExpandableOverlayProps = TouchableOpacityProps & PropsWithChildren<{
14
14
  /**
15
15
  * The content to render inside the expandable modal/dialog
16
16
  */
17
- expandableContent?: React.ReactElement;
17
+ expandableContent?: React.ReactElement<any>;
18
18
  /**
19
19
  * Whether to use a dialog as expandable container (by default the container will be a full screen modal)
20
20
  */
@@ -38,7 +38,7 @@ export type ExpandableOverlayProps = TouchableOpacityProps & PropsWithChildren<{
38
38
  /**
39
39
  * A custom overlay to render instead of Modal or Dialog components
40
40
  */
41
- renderCustomOverlay?: (props: RenderCustomOverlayProps) => React.ReactElement | undefined | null;
41
+ renderCustomOverlay?: (props: RenderCustomOverlayProps) => React.ReactElement<any> | undefined | null;
42
42
  /**
43
43
  * Disabled opening expandable overlay
44
44
  */
@@ -6,7 +6,7 @@ export interface Props extends ViewProps {
6
6
  maximumTrackTintColor?: string;
7
7
  minimumTrackTintColor?: string;
8
8
  trackStyle?: StyleProp<ViewStyle>;
9
- renderTrack?: () => ReactElement | ReactElement[];
9
+ renderTrack?: () => ReactElement<any> | ReactElement<any>[];
10
10
  onPress?: ((event: GestureResponderEvent) => void) | undefined;
11
11
  }
12
12
  declare const Track: (props: Props) => React.JSX.Element;
@@ -62,7 +62,7 @@ export interface SliderProps extends AccessibilityProps {
62
62
  /**
63
63
  * Custom render instead of rendering the track
64
64
  */
65
- renderTrack?: () => ReactElement | ReactElement[];
65
+ renderTrack?: () => ReactElement<any> | ReactElement<any>[];
66
66
  /**
67
67
  * The thumb style
68
68
  */
@@ -3,7 +3,7 @@ export default ({
3
3
  autoDismiss,
4
4
  onDismiss
5
5
  }) => {
6
- const timer = useRef();
6
+ const timer = useRef(undefined);
7
7
  const clearTimer = useCallback(() => {
8
8
  if (timer.current) {
9
9
  clearTimeout(timer.current);
@@ -43,7 +43,7 @@ const Toast = props => {
43
43
  testID
44
44
  } = props;
45
45
  const directions = useRef([props.position === 'bottom' ? PanView.directions.DOWN : PanView.directions.UP, PanView.directions.LEFT, PanView.directions.RIGHT]);
46
- const viewRef = useRef();
46
+ const viewRef = useRef(undefined);
47
47
  const [toastHeight, setToastHeight] = useState();
48
48
  const {
49
49
  clearTimer,
@@ -1,4 +1,4 @@
1
- import { ReactElement, ReactNode } from 'react';
1
+ import { ReactElement, ReactNode, type JSX } from 'react';
2
2
  import { ImageSourcePropType, StyleProp, TextStyle, ViewStyle } from 'react-native';
3
3
  import { ButtonProps } from '../../components/button';
4
4
  import { TextProps } from '../../components/text';
@@ -52,7 +52,7 @@ export interface ToastProps {
52
52
  /**
53
53
  * should show a loader
54
54
  */
55
- loaderElement?: ReactElement;
55
+ loaderElement?: ReactElement<any>;
56
56
  /**
57
57
  * callback for dismiss action
58
58
  */
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import type { JSX } from 'react';
2
2
  import { DragData, UniDriver, UniDriverClass } from './UniDriver';
3
3
  export type ComponentDriverArgs = {
4
4
  testID: string;
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import type { JSX } from 'react';
2
2
  import { DragData, UniDriver } from '../UniDriver';
3
3
  import { ReactTestInstance } from 'react-test-renderer';
4
4
  export declare class TestingLibraryDriver<Props> implements UniDriver<Props> {
@@ -3,11 +3,20 @@ declare namespace globalThis {
3
3
  var _UILIB_TESTING: boolean;
4
4
  }
5
5
 
6
+ declare global {
7
+ // eslint-disable-next-line no-var
8
+ var _UILIB_TESTING: boolean;
9
+ }
10
+
6
11
  // This support importing png files, typing wise
7
12
  declare module '*.png';
8
13
 
9
- declare namespace JSX {
10
- interface IntrinsicAttributes {
11
- fsTagName?: string;
14
+ import 'react';
15
+
16
+ declare module 'react' {
17
+ namespace JSX {
18
+ interface IntrinsicAttributes {
19
+ fsTagName?: string;
20
+ }
12
21
  }
13
22
  }
@@ -1,22 +0,0 @@
1
- require 'json'
2
-
3
- package = JSON.parse(File.read(File.join(__dir__, 'lib/package.json')))
4
-
5
- Pod::Spec.new do |s|
6
- s.name = "ReactNativeUiLib"
7
- s.version = package['version']
8
- s.summary = "React Native UI Library"
9
-
10
- s.authors = "Wix.com"
11
- s.homepage = package['homepage']
12
- s.license = package['license']
13
- s.platforms = { :ios => "9.0", :tvos => "9.2" }
14
-
15
- s.module_name = 'ReactNativeUiLib'
16
-
17
- s.source = { :git => "https://github.com/wix/react-native-ui-lib.git", :tag => "#{s.version}" }
18
- s.source_files = "lib/ios/**/*.{h,m}"
19
-
20
- s.dependency 'React'
21
- s.frameworks = 'UIKit'
22
- end
@@ -1,22 +0,0 @@
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;
@@ -1,85 +0,0 @@
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);
@@ -1,95 +0,0 @@
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,71 +0,0 @@
1
- import React from 'react';
2
- import BaseInput from '../baseInput';
3
- /**
4
- * @description: A wrapper for TextInput component with extra functionality like floating placeholder and validations (This is an uncontrolled component)
5
- * @modifiers: Typography
6
- * @extends: TextInput
7
- * @extendsLink: https://reactnative.dev/docs/textinput
8
- * @gif: https://media.giphy.com/media/xULW8su8Cs5Z9Fq4PS/giphy.gif, https://media.giphy.com/media/3ohc1dhDcLS9FvWLJu/giphy.gif, https://media.giphy.com/media/oNUSOxnHdMP5ZnKYsh/giphy.gif
9
- * @example: https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/TextFieldScreen/BasicTextFieldScreen.js
10
- */
11
- export default class TextField extends BaseInput {
12
- static displayName: string;
13
- static propTypes: any;
14
- static defaultProps: {
15
- enableErrors: boolean;
16
- validateOnBlur: boolean;
17
- };
18
- constructor(props: any);
19
- UNSAFE_componentWillReceiveProps(nextProps: any): void;
20
- componentDidUpdate(_prevProps: any, prevState: any): void;
21
- onPlaceholderLayout: (event: any) => void;
22
- /** Actions */
23
- generatePropsWarnings(props: any): void;
24
- generateStyles(): void;
25
- getAccessibilityInfo(): {
26
- accessibilityLabel: any;
27
- accessibilityState: {
28
- disabled: boolean;
29
- } | undefined;
30
- };
31
- toggleExpandableModal: (value: any) => void;
32
- updateFloatingPlaceholderState: (withoutAnimation: any) => void;
33
- getPlaceholderText: (this: any, placeholder: any, helperText: any) => any;
34
- getStateColor(colorProp?: {}): any;
35
- getCharCount(): any;
36
- setCharCountColor(key: any): void;
37
- getCharCountColor(): any;
38
- getTopPaddings(): 25 | undefined;
39
- getTopErrorsPosition(): {
40
- top: number;
41
- } | undefined;
42
- isDisabled(): boolean;
43
- isCounterLimit(): boolean;
44
- hasText(value: any): boolean;
45
- shouldShowHelperText(): any;
46
- shouldFloatOnFocus(): any;
47
- shouldFloatPlaceholder(text: any): any;
48
- shouldFakePlaceholder(): boolean;
49
- shouldShowError(): any;
50
- getErrorMessage(): any;
51
- shouldShowTopError(): any;
52
- shouldDisplayRightButton(): any;
53
- shouldRenderTitle(): any;
54
- onPressRightButton: () => void;
55
- /** Renders */
56
- renderPlaceholder(): React.JSX.Element | undefined;
57
- renderPrefix(): React.JSX.Element | undefined;
58
- renderTitle(): React.JSX.Element | undefined;
59
- renderCharCounter(): React.JSX.Element | undefined;
60
- renderError(visible: any): React.JSX.Element | undefined;
61
- renderExpandableModal(): any;
62
- renderExpandableInput(): any;
63
- renderTextInput(): React.JSX.Element;
64
- renderRightButton(): React.JSX.Element | undefined;
65
- renderRightIcon(): React.JSX.Element | undefined;
66
- render(): React.JSX.Element;
67
- /** Events */
68
- onDoneEditingExpandableInput: () => void;
69
- onKeyPress: (event: any) => void;
70
- onChangeText: (text: any) => void;
71
- }