react-native-ui-lib 8.4.3 → 8.5.0-snapshot.7948

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 (146) 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 -164
  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/chipsInput/index.d.ts +2 -0
  43. package/src/components/colorPalette/index.d.ts +1 -1
  44. package/src/components/dateTimePicker/index.d.ts +2 -2
  45. package/src/components/dateTimePicker/index.js +2 -2
  46. package/src/components/dialog/types.d.ts +4 -4
  47. package/src/components/dialog/useDialogContent.d.ts +1 -1
  48. package/src/components/drawer/index.d.ts +1 -1
  49. package/src/components/expandableSection/index.d.ts +2 -2
  50. package/src/components/fadedScrollView/index.js +1 -1
  51. package/src/components/featureHighlight/index.js +5 -7
  52. package/src/components/floatingButton/index.d.ts +1 -1
  53. package/src/components/floatingButton/index.js +10 -6
  54. package/src/components/gridListItem/index.d.ts +7 -7
  55. package/src/components/gridView/index.d.ts +1 -1
  56. package/src/components/hint/HintBubble.d.ts +1 -1
  57. package/src/components/hint/HintOld.d.ts +10 -10
  58. package/src/components/hint/hooks/useHintLayout.d.ts +1 -1
  59. package/src/components/hint/index.d.ts +2 -2
  60. package/src/components/hint/types.d.ts +2 -2
  61. package/src/components/icon/index.js +0 -3
  62. package/src/components/image/index.d.ts +1 -1
  63. package/src/components/image/index.js +20 -17
  64. package/src/components/loaderScreen/index.d.ts +1 -1
  65. package/src/components/loaderScreen/types.d.ts +1 -1
  66. package/src/components/maskedInput/index.d.ts +21 -4
  67. package/src/components/maskedInput/index.js +78 -16
  68. package/src/components/maskedInput/maskedInput.api.json +0 -1
  69. package/src/components/modal/index.d.ts +3 -3
  70. package/src/components/numberInput/index.js +2 -2
  71. package/src/components/overlay/index.d.ts +1 -1
  72. package/src/components/picker/PickerDialog.android.js +0 -15
  73. package/src/components/picker/PickerDialog.js +0 -7
  74. package/src/components/picker/helpers/useImperativePickerHandle.d.ts +1 -1
  75. package/src/components/picker/helpers/useImperativePickerHandle.js +1 -1
  76. package/src/components/picker/types.d.ts +9 -9
  77. package/src/components/progressBar/index.d.ts +2 -2
  78. package/src/components/screenFooter/index.d.ts +2 -2
  79. package/src/components/screenFooter/index.js +32 -63
  80. package/src/components/screenFooter/screenFooter.api.json +13 -2
  81. package/src/components/screenFooter/types.d.ts +23 -6
  82. package/src/components/screenFooter/types.js +6 -0
  83. package/src/components/screenFooter/useAnimatedFooterStyle.d.ts +14 -0
  84. package/src/components/screenFooter/useAnimatedFooterStyle.js +72 -0
  85. package/src/components/scrollBar/index.d.ts +11 -4
  86. package/src/components/searchInput/index.js +1 -1
  87. package/src/components/searchInput/types.d.ts +2 -2
  88. package/src/components/sectionsWheelPicker/SectionsWheelPicker.driver.d.ts +2 -2
  89. package/src/components/skeletonView/index.d.ts +4 -4
  90. package/src/components/slider/Thumb.d.ts +1 -1
  91. package/src/components/slider/types.d.ts +1 -1
  92. package/src/components/stackAggregator/index.d.ts +1 -1
  93. package/src/components/tabController/TabBarItem.d.ts +2 -2
  94. package/src/components/tabController/TabBarItem.js +1 -1
  95. package/src/components/tabController/TabPage.d.ts +2 -2
  96. package/src/components/tabController/useScrollToItem.d.ts +1 -1
  97. package/src/components/text/Text.driver.d.ts +1 -1
  98. package/src/components/textArea/index.js +0 -6
  99. package/src/components/textField/types.d.ts +4 -4
  100. package/src/components/textField/useImperativeInputHandle.d.ts +1 -1
  101. package/src/components/textField/useImperativeInputHandle.js +1 -1
  102. package/src/components/textField/usePreset.d.ts +36 -36
  103. package/src/components/timeline/index.js +1 -1
  104. package/src/components/toast/index.js +0 -69
  105. package/src/components/wizard/index.d.ts +1 -1
  106. package/src/components/wizard/types.d.ts +1 -1
  107. package/src/components/wizard/wizard.api.json +1 -1
  108. package/src/hooks/useCombinedRefs/index.js +1 -2
  109. package/src/hooks/useDebounce/index.js +1 -1
  110. package/src/hooks/useHiddenLocation/index.js +2 -2
  111. package/src/hooks/useHiddenLocation/index.web.js +2 -2
  112. package/src/hooks/useMeasure/index.d.ts +1 -1
  113. package/src/hooks/useMeasure/index.js +1 -1
  114. package/src/hooks/useScrollTo/index.d.ts +2 -2
  115. package/src/incubator/calendar/index.js +1 -1
  116. package/src/incubator/calendar/types.d.ts +2 -2
  117. package/src/incubator/expandableOverlay/index.d.ts +2 -2
  118. package/src/incubator/index.d.ts +1 -0
  119. package/src/incubator/index.js +2 -1
  120. package/src/{components → incubator}/marquee/index.js +2 -2
  121. package/src/{components → incubator}/marquee/marquee.api.json +1 -1
  122. package/src/{components → incubator}/marquee/types.d.ts +2 -2
  123. package/src/incubator/slider/Thumb.js +1 -1
  124. package/src/incubator/slider/Track.d.ts +1 -1
  125. package/src/incubator/slider/index.d.ts +1 -1
  126. package/src/incubator/toast/helpers/useToastTimer.js +1 -1
  127. package/src/incubator/toast/index.js +1 -1
  128. package/src/incubator/toast/types.d.ts +2 -2
  129. package/src/index.d.ts +3 -4
  130. package/src/index.js +25 -18
  131. package/src/testkit/Component.driver.d.ts +1 -1
  132. package/src/testkit/drivers/TestingLibraryDriver.d.ts +1 -1
  133. package/src/typings/module.d.ts +12 -3
  134. package/ReactNativeUiLib.podspec +0 -22
  135. package/marquee.d.ts +0 -2
  136. package/marquee.js +0 -1
  137. package/src/components/maskedInput/new.d.ts +0 -22
  138. package/src/components/maskedInput/new.js +0 -85
  139. package/src/components/maskedInput/old.js +0 -95
  140. package/src/components/textFieldOld/index.d.ts +0 -71
  141. package/src/components/textFieldOld/index.js +0 -807
  142. package/src/helpers/DocsGenerator.js +0 -61
  143. package/textFieldOld.d.ts +0 -2
  144. package/textFieldOld.js +0 -1
  145. /package/src/{components → incubator}/marquee/index.d.ts +0 -0
  146. /package/src/{components → incubator}/marquee/types.js +0 -0
@@ -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
  */
package/src/index.d.ts CHANGED
@@ -6,7 +6,7 @@ export * from 'uilib-native';
6
6
  export { asBaseComponent, Config, Constants, forwardRef, withScrollEnabler, WithScrollEnablerProps, withScrollReached, WithScrollReachedProps, UIComponent, BaseComponentInjectedProps, ForwardRefInjectedProps, ContainerModifiers, MarginModifiers, PaddingModifiers, TypographyModifiers, ColorsModifiers, BackgroundColorModifier } from './commons/new';
7
7
  export { BaseComponent, PureBaseComponent } from './commons';
8
8
  import * as Incubator from './incubator';
9
- export { ExpandableOverlayProps, ExpandableOverlayMethods, ToastProps, ToastPresets } from './incubator';
9
+ export { ExpandableOverlayProps, ExpandableOverlayMethods, ToastProps, ToastPresets, MarqueeDirections, MarqueeProps } from './incubator';
10
10
  import * as Hooks from './hooks';
11
11
  import * as Modifiers from './commons/modifiers';
12
12
  export { default as LogService } from './services/LogService';
@@ -23,7 +23,7 @@ export { default as Button, ButtonProps, ButtonSize, ButtonAnimationDirection }
23
23
  export { default as Card, CardProps, CardSectionProps, CardSelectionOptions } from './components/card';
24
24
  export { default as Carousel, CarouselProps, PageControlPosition } from './components/carousel';
25
25
  export { default as Checkbox, CheckboxProps, CheckboxRef } from './components/checkbox';
26
- export { default as ChipsInput, ChipsInputProps, ChipsInputChipProps } from './components/chipsInput';
26
+ export { default as ChipsInput, ChipsInputProps, ChipsInputChipProps, ChipsInputChangeReason, ChipsInputChangeReasonProps } from './components/chipsInput';
27
27
  export { default as Chip, ChipProps } from './components/chip';
28
28
  export { default as ColorPicker, ColorPickerProps } from './components/colorPicker';
29
29
  export { default as ColorPalette, ColorPaletteProps } from './components/colorPalette';
@@ -38,7 +38,7 @@ export { default as ExpandableSection, ExpandableSectionProps } from './componen
38
38
  export { default as Fader, FaderProps, FaderPosition } from './components/fader';
39
39
  export { default as FeatureHighlight, FeatureHighlightProps } from './components/featureHighlight';
40
40
  export { default as FloatingButton, FloatingButtonProps, FloatingButtonLayouts } from './components/floatingButton';
41
- export { default as ScreenFooter, ScreenFooterProps, ScreenFooterLayouts, ScreenFooterBackgrounds, FooterAlignment, HorizontalItemsDistribution, ItemsFit, KeyboardBehavior, ScreenFooterShadow } from './components/screenFooter';
41
+ export { default as ScreenFooter, ScreenFooterProps, ScreenFooterLayouts, ScreenFooterBackgrounds, FooterAlignment, HorizontalItemsDistribution, ItemsFit, KeyboardBehavior, ScreenFooterAnimationTypeProp, ScreenFooterShadow } from './components/screenFooter';
42
42
  export { default as Gradient, GradientProps, GradientTypes } from './components/gradient';
43
43
  export { default as Slider } from './components/slider';
44
44
  export { default as GradientSlider } from './components/slider/GradientSlider';
@@ -56,7 +56,6 @@ export { default as KeyboardAwareFlatList } from './components/KeyboardAwareScro
56
56
  export { default as ListItem, ListItemProps } from './components/listItem';
57
57
  export { default as LoaderScreen, LoaderScreenProps } from './components/loaderScreen';
58
58
  export { default as MaskedInput, MaskedInputProps } from './components/maskedInput';
59
- export { default as Marquee, MarqueeDirections, MarqueeProps } from './components/marquee';
60
59
  export { default as Modal, ModalProps, ModalTopBarProps } from './components/modal';
61
60
  export { default as NumberInput, NumberInputProps, NumberInputData } from './components/numberInput';
62
61
  export { default as Overlay, OverlayTypes } from './components/overlay';
package/src/index.js CHANGED
@@ -28,6 +28,8 @@ var _exportNames = {
28
28
  ExpandableOverlayMethods: true,
29
29
  ToastProps: true,
30
30
  ToastPresets: true,
31
+ MarqueeDirections: true,
32
+ MarqueeProps: true,
31
33
  Incubator: true,
32
34
  Hooks: true,
33
35
  Modifiers: true,
@@ -61,6 +63,8 @@ var _exportNames = {
61
63
  ChipsInput: true,
62
64
  ChipsInputProps: true,
63
65
  ChipsInputChipProps: true,
66
+ ChipsInputChangeReason: true,
67
+ ChipsInputChangeReasonProps: true,
64
68
  Chip: true,
65
69
  ChipProps: true,
66
70
  ColorPicker: true,
@@ -107,6 +111,7 @@ var _exportNames = {
107
111
  HorizontalItemsDistribution: true,
108
112
  ItemsFit: true,
109
113
  KeyboardBehavior: true,
114
+ ScreenFooterAnimationTypeProp: true,
110
115
  ScreenFooterShadow: true,
111
116
  Gradient: true,
112
117
  GradientProps: true,
@@ -136,9 +141,6 @@ var _exportNames = {
136
141
  LoaderScreenProps: true,
137
142
  MaskedInput: true,
138
143
  MaskedInputProps: true,
139
- Marquee: true,
140
- MarqueeDirections: true,
141
- MarqueeProps: true,
142
144
  Modal: true,
143
145
  ModalProps: true,
144
146
  ModalTopBarProps: true,
@@ -432,6 +434,18 @@ Object.defineProperty(exports, "ChipsInput", {
432
434
  return _chipsInput().default;
433
435
  }
434
436
  });
437
+ Object.defineProperty(exports, "ChipsInputChangeReason", {
438
+ enumerable: true,
439
+ get: function () {
440
+ return _chipsInput().ChipsInputChangeReason;
441
+ }
442
+ });
443
+ Object.defineProperty(exports, "ChipsInputChangeReasonProps", {
444
+ enumerable: true,
445
+ get: function () {
446
+ return _chipsInput().ChipsInputChangeReasonProps;
447
+ }
448
+ });
435
449
  Object.defineProperty(exports, "ChipsInputChipProps", {
436
450
  enumerable: true,
437
451
  get: function () {
@@ -896,22 +910,16 @@ Object.defineProperty(exports, "MarginModifiers", {
896
910
  return _new().MarginModifiers;
897
911
  }
898
912
  });
899
- Object.defineProperty(exports, "Marquee", {
900
- enumerable: true,
901
- get: function () {
902
- return _marquee().default;
903
- }
904
- });
905
913
  Object.defineProperty(exports, "MarqueeDirections", {
906
914
  enumerable: true,
907
915
  get: function () {
908
- return _marquee().MarqueeDirections;
916
+ return Incubator().MarqueeDirections;
909
917
  }
910
918
  });
911
919
  Object.defineProperty(exports, "MarqueeProps", {
912
920
  enumerable: true,
913
921
  get: function () {
914
- return _marquee().MarqueeProps;
922
+ return Incubator().MarqueeProps;
915
923
  }
916
924
  });
917
925
  Object.defineProperty(exports, "MaskedInput", {
@@ -1185,6 +1193,12 @@ Object.defineProperty(exports, "ScreenFooter", {
1185
1193
  return _screenFooter().default;
1186
1194
  }
1187
1195
  });
1196
+ Object.defineProperty(exports, "ScreenFooterAnimationTypeProp", {
1197
+ enumerable: true,
1198
+ get: function () {
1199
+ return _screenFooter().ScreenFooterAnimationTypeProp;
1200
+ }
1201
+ });
1188
1202
  Object.defineProperty(exports, "ScreenFooterBackgrounds", {
1189
1203
  enumerable: true,
1190
1204
  get: function () {
@@ -2088,13 +2102,6 @@ function _maskedInput() {
2088
2102
  };
2089
2103
  return data;
2090
2104
  }
2091
- function _marquee() {
2092
- const data = _interopRequireWildcard(require("./components/marquee"));
2093
- _marquee = function () {
2094
- return data;
2095
- };
2096
- return data;
2097
- }
2098
2105
  function _modal() {
2099
2106
  const data = _interopRequireWildcard(require("./components/modal"));
2100
2107
  _modal = function () {
@@ -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
package/marquee.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import {Marquee} from './src';
2
- export default Marquee;
package/marquee.js DELETED
@@ -1 +0,0 @@
1
- module.exports = require('./src/components/marquee').default;
@@ -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
- }