react-native-ui-lib 7.46.2-snapshot.7314 → 7.46.2-snapshot.7316

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 (199) hide show
  1. package/babel.config.js +0 -12
  2. package/index.js +0 -1
  3. package/lib/android/build.gradle +5 -5
  4. package/lib/android/src/main/java/com/wix/reactnativeuilib/UiLibPackageList.java +2 -0
  5. package/lib/android/src/main/java/com/wix/reactnativeuilib/highlighterview/HighlighterViewManager.java +23 -31
  6. package/lib/android/src/main/java/com/wix/reactnativeuilib/highlighterview/ReactHacks.java +30 -0
  7. package/lib/android/src/main/java/com/wix/reactnativeuilib/highlighterview/ReflectionUtils.java +34 -0
  8. package/lib/android/src/main/java/com/wix/reactnativeuilib/keyboardinput/utils/RuntimeUtils.java +1 -1
  9. package/lib/android/src/main/java/com/wix/reactnativeuilib/textinput/DefaultKeyListener.java +33 -0
  10. package/lib/android/src/main/java/com/wix/reactnativeuilib/textinput/KeyListenerProxy.java +53 -0
  11. package/lib/android/src/main/java/com/wix/reactnativeuilib/textinput/TextInputDelKeyHandlerModule.java +54 -0
  12. package/lib/android/src/main/java/com/wix/reactnativeuilib/textinput/TextInputDelKeyHandlerPackage.java +28 -0
  13. package/lib/android/src/main/java/com/wix/reactnativeuilib/textinput/ViewUtils.java +36 -0
  14. package/lib/components/{HighlighterOverlayView/index.d.ts → HighlighterOverlayView.d.ts} +1 -1
  15. package/lib/components/HighlighterOverlayView.js +40 -0
  16. package/lib/components/{HighlighterOverlayView/index.web.d.ts → HighlighterOverlayView.web.d.ts} +1 -1
  17. package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/CustomKeyboardView/CustomKeyboardView.android.d.ts +2 -5
  18. package/lib/components/Keyboard/KeyboardInput/CustomKeyboardView/CustomKeyboardView.android.js +28 -0
  19. package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/CustomKeyboardView/CustomKeyboardView.ios.d.ts +1 -1
  20. package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/CustomKeyboardView/CustomKeyboardView.ios.js +3 -3
  21. package/lib/components/Keyboard/{KeyboardAccessoryView/CustomKeyboardView → KeyboardInput}/CustomKeyboardViewBase.d.ts +0 -3
  22. package/lib/components/Keyboard/{KeyboardAccessoryView/CustomKeyboardView → KeyboardInput}/CustomKeyboardViewBase.js +1 -1
  23. package/lib/components/Keyboard/{KeyboardAccessoryView/index.d.ts → KeyboardInput/KeyboardAccessoryView.d.ts} +1 -11
  24. package/lib/components/Keyboard/{KeyboardAccessoryView/index.js → KeyboardInput/KeyboardAccessoryView.js} +5 -31
  25. package/lib/components/Keyboard/{KeyboardAccessoryView/KeyboardRegistry/index.d.ts → KeyboardInput/KeyboardRegistry.d.ts} +1 -1
  26. package/lib/components/Keyboard/{KeyboardAccessoryView/KeyboardRegistry/index.js → KeyboardInput/KeyboardRegistry.js} +1 -1
  27. package/lib/components/Keyboard/{KeyboardAccessoryView/KeyboardRegistry → KeyboardInput}/__tests__/KeyboardRegistry.spec.js +1 -1
  28. package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/keyboardAccessoryView.api.json +5 -5
  29. package/lib/components/Keyboard/{KeyboardAccessoryView/KeyboardRegistry → KeyboardInput}/keyboardRegistry.api.json +9 -9
  30. package/lib/components/Keyboard/KeyboardInput/utils/KeyboardUtils.d.ts +11 -0
  31. package/lib/components/Keyboard/KeyboardInput/utils/KeyboardUtils.js +17 -0
  32. package/lib/components/Keyboard/{KeyboardAccessoryView/KeyboardRegistry/EventEmitterManager → KeyboardInput/utils}/__tests__/EventEmitterManager.spec.js +1 -1
  33. package/lib/components/Keyboard/{KeyboardAwareInsetsView/index.d.ts → KeyboardTracking/KeyboardAwareInsetsView.d.ts} +1 -1
  34. package/lib/components/Keyboard/{KeyboardAwareInsetsView/index.js → KeyboardTracking/KeyboardAwareInsetsView.js} +1 -1
  35. package/lib/components/Keyboard/{KeyboardTrackingView → KeyboardTracking/KeyboardTrackingView}/KeyboardTrackingView.ios.d.ts +4 -1
  36. package/lib/components/Keyboard/{KeyboardTrackingView → KeyboardTracking/KeyboardTrackingView}/KeyboardTrackingView.ios.js +8 -5
  37. package/lib/components/Keyboard/{KeyboardTrackingView → KeyboardTracking/KeyboardTrackingView}/index.d.ts +2 -2
  38. package/lib/components/Keyboard/{KeyboardTrackingView → KeyboardTracking/KeyboardTrackingView}/keyboardTrackingView.api.json +20 -11
  39. package/lib/components/Keyboard/index.d.ts +6 -6
  40. package/lib/components/Keyboard/index.js +6 -6
  41. package/lib/components/SafeArea/SafeAreaInsetsManager.d.ts +7 -21
  42. package/lib/components/SafeArea/SafeAreaInsetsManager.js +31 -95
  43. package/lib/components/SafeArea/SafeAreaSpacerView.d.ts +2 -2
  44. package/lib/components/SafeArea/SafeAreaSpacerView.js +9 -63
  45. package/lib/components/index.d.ts +1 -1
  46. package/lib/components/index.js +1 -1
  47. package/lib/ios/reactnativeuilib/keyboardinput/rctcustomInputcontroller/RCTCustomInputControllerTemp.m +8 -52
  48. package/lib/ios/reactnativeuilib/keyboardinput/rctcustomInputcontroller/RCTCustomKeyboardViewControllerTemp.h +7 -1
  49. package/lib/ios/reactnativeuilib/keyboardinput/rctcustomInputcontroller/RCTCustomKeyboardViewControllerTemp.m +1 -1
  50. package/lib/ios/reactnativeuilib/keyboardtrackingview/KeyboardTrackingViewTempManager.m +41 -109
  51. package/lib/package.json +1 -1
  52. package/lib/react-native.config.js +3 -1
  53. package/metro.config.js +2 -2
  54. package/package.json +24 -24
  55. package/panningViews.d.ts +2 -0
  56. package/panningViews.js +1 -0
  57. package/react-native.config.js +3 -1
  58. package/sharedTransition.d.ts +2 -0
  59. package/sharedTransition.js +1 -0
  60. package/src/commons/Constants.js +5 -2
  61. package/src/components/KeyboardAwareScrollView/KeyboardAwareBase.js +1 -5
  62. package/src/components/actionSheet/index.d.ts +12 -2
  63. package/src/components/actionSheet/index.js +42 -3
  64. package/src/components/badge/index.d.ts +47 -107
  65. package/src/components/button/button.api.json +6 -1
  66. package/src/components/button/index.d.ts +31 -53
  67. package/src/components/button/index.js +18 -1
  68. package/src/components/button/types.d.ts +5 -0
  69. package/src/components/colorPicker/ColorPickerDialog.d.ts +1 -1
  70. package/src/components/colorPicker/ColorPickerDialog.js +1 -1
  71. package/src/components/dateTimePicker/index.d.ts +5 -186
  72. package/src/components/dateTimePicker/index.js +4 -3
  73. package/src/components/dialog/DialogDismissibleView.d.ts +34 -0
  74. package/src/components/dialog/DialogDismissibleView.js +184 -0
  75. package/src/components/dialog/OverlayFadingBackground.d.ts +14 -0
  76. package/src/components/dialog/OverlayFadingBackground.js +45 -0
  77. package/src/components/dialog/dialog.api.json +37 -31
  78. package/src/components/dialog/index.d.ts +105 -13
  79. package/src/components/dialog/index.js +212 -204
  80. package/src/components/drawer/Swipeable.js +2 -1
  81. package/src/components/drawer/index.js +25 -31
  82. package/src/components/fadedScrollView/index.js +2 -7
  83. package/src/components/featureHighlight/index.d.ts +1 -1
  84. package/src/components/index.js +19 -0
  85. package/src/components/modal/index.d.ts +0 -5
  86. package/src/components/modal/index.js +10 -14
  87. package/src/components/modal/modal.api.json +0 -5
  88. package/src/components/panningViews/asPanViewConsumer.d.ts +3 -0
  89. package/src/components/panningViews/asPanViewConsumer.js +16 -0
  90. package/src/components/panningViews/panDismissibleView.d.ts +51 -0
  91. package/src/components/panningViews/panDismissibleView.js +350 -0
  92. package/src/components/panningViews/panGestureView.d.ts +23 -0
  93. package/src/components/panningViews/panGestureView.js +156 -0
  94. package/src/components/panningViews/panListenerView.d.ts +66 -0
  95. package/src/components/panningViews/panListenerView.js +155 -0
  96. package/src/components/panningViews/panResponderView.d.ts +19 -0
  97. package/src/components/panningViews/panResponderView.js +79 -0
  98. package/src/components/panningViews/panningContext.d.ts +3 -0
  99. package/src/components/panningViews/panningContext.js +4 -0
  100. package/src/components/panningViews/panningProvider.d.ts +73 -0
  101. package/src/components/panningViews/panningProvider.js +101 -0
  102. package/src/components/picker/Picker.driver.new.d.ts +2 -2
  103. package/src/components/picker/Picker.driver.new.js +3 -3
  104. package/src/components/picker/PickerItem.js +20 -6
  105. package/src/components/picker/PickerPresenter.d.ts +1 -0
  106. package/src/components/picker/PickerPresenter.js +23 -1
  107. package/src/components/picker/api/picker.api.json +1 -0
  108. package/src/components/picker/api/pickerItem.api.json +5 -0
  109. package/src/components/picker/helpers/useFieldType.d.ts +23 -53
  110. package/src/components/picker/helpers/usePickerLabel.d.ts +1 -1
  111. package/src/components/picker/helpers/usePickerLabel.js +3 -2
  112. package/src/components/picker/helpers/usePickerMigrationWarnings.d.ts +1 -1
  113. package/src/components/picker/helpers/usePickerMigrationWarnings.js +12 -0
  114. package/src/components/picker/helpers/usePickerSearch.d.ts +1 -1
  115. package/src/components/picker/helpers/usePickerSearch.js +8 -4
  116. package/src/components/picker/helpers/usePickerSelection.d.ts +1 -1
  117. package/src/components/picker/helpers/usePickerSelection.js +10 -2
  118. package/src/components/picker/index.js +22 -4
  119. package/src/components/picker/types.d.ts +24 -1
  120. package/src/components/segmentedControl/index.js +3 -3
  121. package/src/components/sharedTransition/ShareTransitionContext.js +3 -0
  122. package/src/components/sharedTransition/SharedArea.js +153 -0
  123. package/src/components/sharedTransition/SourceElement.js +44 -0
  124. package/src/components/sharedTransition/TargetElement.js +38 -0
  125. package/src/components/sharedTransition/index.js +9 -0
  126. package/src/components/slider/GradientSlider.d.ts +1 -1
  127. package/src/components/sortableGridList/SortableItem.js +4 -13
  128. package/src/components/sortableList/SortableListItem.js +4 -13
  129. package/src/components/stackAggregator/index.js +11 -16
  130. package/src/components/text/Text.driver.new.d.ts +2 -2
  131. package/src/components/text/Text.driver.new.js +2 -2
  132. package/src/components/textField/Input.js +1 -0
  133. package/src/components/textField/TextField.driver.new.d.ts +2 -2
  134. package/src/components/textField/TextField.driver.new.js +2 -2
  135. package/src/components/textField/presets/outline.d.ts +46 -106
  136. package/src/components/textField/presets/underline.d.ts +46 -106
  137. package/src/components/textField/usePreset.d.ts +44 -72
  138. package/src/incubator/dialog/dialog.api.json +54 -0
  139. package/src/{components → incubator}/dialog/dialogHeader.api.json +2 -2
  140. package/src/incubator/dialog/index.d.ts +15 -0
  141. package/src/incubator/dialog/index.js +218 -0
  142. package/src/{components → incubator}/dialog/types.d.ts +19 -0
  143. package/src/{components → incubator}/dialog/types.js +3 -1
  144. package/src/{components → incubator}/dialog/useDialogContent.d.ts +1 -1
  145. package/src/incubator/expandableOverlay/ExpandableOverlay.driver.js +1 -1
  146. package/src/incubator/expandableOverlay/index.d.ts +3 -42
  147. package/src/incubator/expandableOverlay/index.js +4 -1
  148. package/src/{hooks/useHiddenLocation/index.d.ts → incubator/hooks/useHiddenLocation.d.ts} +1 -1
  149. package/src/{hooks/useHiddenLocation/index.web.d.ts → incubator/hooks/useHiddenLocation.web.d.ts} +1 -1
  150. package/src/incubator/index.d.ts +2 -0
  151. package/src/incubator/index.js +2 -0
  152. package/src/{components → incubator}/panView/index.d.ts +3 -3
  153. package/src/{components → incubator}/panView/index.js +4 -4
  154. package/src/{components → incubator}/panView/usePanGesture.d.ts +1 -1
  155. package/src/incubator/toast/index.js +1 -1
  156. package/src/index.d.ts +10 -3
  157. package/src/index.js +160 -41
  158. package/src/testkit/index.d.ts +1 -1
  159. package/src/testkit/index.js +1 -1
  160. package/src/testkit/new/Component.driver.d.ts +1 -4
  161. package/src/testkit/new/Component.driver.js +3 -3
  162. package/lib/components/HighlighterOverlayView/index.js +0 -49
  163. package/lib/components/Keyboard/KeyboardAccessoryView/CustomKeyboardView/CustomKeyboardView.android.js +0 -51
  164. package/lib/components/Keyboard/KeyboardAccessoryView/KeyboardUtils/index.d.ts +0 -26
  165. package/lib/components/Keyboard/KeyboardAccessoryView/KeyboardUtils/index.js +0 -91
  166. package/lib/components/SafeArea/__tests__/SafeAreaInsetsManager.spec.js +0 -274
  167. package/lib/components/SafeArea/index.d.ts +0 -10
  168. package/lib/components/SafeArea/index.js +0 -11
  169. package/panView.d.ts +0 -2
  170. package/panView.js +0 -1
  171. /package/lib/components/{HighlighterOverlayView/index.web.js → HighlighterOverlayView.web.js} +0 -0
  172. /package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/CustomKeyboardView/index.d.ts +0 -0
  173. /package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/CustomKeyboardView/index.js +0 -0
  174. /package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/CustomKeyboardView/index.web.d.ts +0 -0
  175. /package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/CustomKeyboardView/index.web.js +0 -0
  176. /package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/TextInputKeyboardManager/TextInputKeyboardManager.android.d.ts +0 -0
  177. /package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/TextInputKeyboardManager/TextInputKeyboardManager.android.js +0 -0
  178. /package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/TextInputKeyboardManager/TextInputKeyboardManager.ios.d.ts +0 -0
  179. /package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/TextInputKeyboardManager/TextInputKeyboardManager.ios.js +0 -0
  180. /package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/TextInputKeyboardManager/index.d.ts +0 -0
  181. /package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/TextInputKeyboardManager/index.js +0 -0
  182. /package/lib/components/Keyboard/{KeyboardAccessoryView/KeyboardRegistry/EventEmitterManager/index.d.ts → KeyboardInput/utils/EventEmitterManager.d.ts} +0 -0
  183. /package/lib/components/Keyboard/{KeyboardAccessoryView/KeyboardRegistry/EventEmitterManager/index.js → KeyboardInput/utils/EventEmitterManager.js} +0 -0
  184. /package/lib/components/Keyboard/{KeyboardTrackingView → KeyboardTracking/KeyboardTrackingView}/KeyboardTrackingView.android.d.ts +0 -0
  185. /package/lib/components/Keyboard/{KeyboardTrackingView → KeyboardTracking/KeyboardTrackingView}/KeyboardTrackingView.android.js +0 -0
  186. /package/lib/components/Keyboard/{KeyboardTrackingView → KeyboardTracking/KeyboardTrackingView}/index.js +0 -0
  187. /package/lib/components/Keyboard/{KeyboardTrackingView → KeyboardTracking/KeyboardTrackingView}/index.web.d.ts +0 -0
  188. /package/lib/components/Keyboard/{KeyboardTrackingView → KeyboardTracking/KeyboardTrackingView}/index.web.js +0 -0
  189. /package/lib/components/Keyboard/{KeyboardAwareInsetsView → KeyboardTracking}/keyboardAwareInsetsView.api.json +0 -0
  190. /package/src/{components → incubator}/dialog/Dialog.driver.new.d.ts +0 -0
  191. /package/src/{components → incubator}/dialog/Dialog.driver.new.js +0 -0
  192. /package/src/{components → incubator}/dialog/DialogHeader.d.ts +0 -0
  193. /package/src/{components → incubator}/dialog/DialogHeader.js +0 -0
  194. /package/src/{components → incubator}/dialog/useDialogContent.js +0 -0
  195. /package/src/{hooks/useHiddenLocation/index.js → incubator/hooks/useHiddenLocation.js} +0 -0
  196. /package/src/{hooks/useHiddenLocation/index.web.js → incubator/hooks/useHiddenLocation.web.js} +0 -0
  197. /package/src/{components → incubator}/panView/panningUtil.d.ts +0 -0
  198. /package/src/{components → incubator}/panView/panningUtil.js +0 -0
  199. /package/src/{components → incubator}/panView/usePanGesture.js +0 -0
@@ -13,7 +13,7 @@ declare const useFieldType: (props: UseFieldTypeProps) => {
13
13
  fontFamily?: string | undefined;
14
14
  fontSize?: number | undefined;
15
15
  fontStyle?: "normal" | "italic" | undefined;
16
- fontWeight?: "black" | 900 | 600 | "light" | 100 | "normal" | "bold" | "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900" | 200 | 300 | 400 | 500 | 700 | 800 | "ultralight" | "thin" | "medium" | "regular" | "semibold" | "condensedBold" | "condensed" | "heavy" | undefined;
16
+ fontWeight?: "normal" | "bold" | "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900" | undefined;
17
17
  letterSpacing?: number | undefined;
18
18
  lineHeight?: number | undefined;
19
19
  textAlign?: "auto" | "left" | "right" | "center" | "justify" | undefined;
@@ -36,41 +36,31 @@ declare const useFieldType: (props: UseFieldTypeProps) => {
36
36
  borderBlockEndColor?: import("react-native/types").ColorValue | undefined;
37
37
  borderBlockStartColor?: import("react-native/types").ColorValue | undefined;
38
38
  borderBottomColor?: import("react-native/types").ColorValue | undefined;
39
- borderBottomEndRadius?: string | import("react-native/types").AnimatableNumericValue | undefined;
40
- borderBottomLeftRadius?: string | import("react-native/types").AnimatableNumericValue | undefined;
41
- borderBottomRightRadius?: string | import("react-native/types").AnimatableNumericValue | undefined;
42
- borderBottomStartRadius?: string | import("react-native/types").AnimatableNumericValue | undefined;
39
+ borderBottomEndRadius?: import("react-native/types").AnimatableNumericValue | undefined;
40
+ borderBottomLeftRadius?: import("react-native/types").AnimatableNumericValue | undefined;
41
+ borderBottomRightRadius?: import("react-native/types").AnimatableNumericValue | undefined;
42
+ borderBottomStartRadius?: import("react-native/types").AnimatableNumericValue | undefined;
43
43
  borderColor?: import("react-native/types").ColorValue | undefined;
44
44
  borderCurve?: "circular" | "continuous" | undefined;
45
45
  borderEndColor?: import("react-native/types").ColorValue | undefined;
46
- borderEndEndRadius?: string | import("react-native/types").AnimatableNumericValue | undefined;
47
- borderEndStartRadius?: string | import("react-native/types").AnimatableNumericValue | undefined;
46
+ borderEndEndRadius?: import("react-native/types").AnimatableNumericValue | undefined;
47
+ borderEndStartRadius?: import("react-native/types").AnimatableNumericValue | undefined;
48
48
  borderLeftColor?: import("react-native/types").ColorValue | undefined;
49
- borderRadius?: string | import("react-native/types").AnimatableNumericValue | undefined;
49
+ borderRadius?: import("react-native/types").AnimatableNumericValue | undefined;
50
50
  borderRightColor?: import("react-native/types").ColorValue | undefined;
51
51
  borderStartColor?: import("react-native/types").ColorValue | undefined;
52
- borderStartEndRadius?: string | import("react-native/types").AnimatableNumericValue | undefined;
53
- borderStartStartRadius?: string | import("react-native/types").AnimatableNumericValue | undefined;
52
+ borderStartEndRadius?: import("react-native/types").AnimatableNumericValue | undefined;
53
+ borderStartStartRadius?: import("react-native/types").AnimatableNumericValue | undefined;
54
54
  borderStyle?: "solid" | "dotted" | "dashed" | undefined;
55
55
  borderTopColor?: import("react-native/types").ColorValue | undefined;
56
- borderTopEndRadius?: string | import("react-native/types").AnimatableNumericValue | undefined;
57
- borderTopLeftRadius?: string | import("react-native/types").AnimatableNumericValue | undefined;
58
- borderTopRightRadius?: string | import("react-native/types").AnimatableNumericValue | undefined;
59
- borderTopStartRadius?: string | import("react-native/types").AnimatableNumericValue | undefined;
60
- outlineColor?: import("react-native/types").ColorValue | undefined;
61
- outlineOffset?: import("react-native/types").AnimatableNumericValue | undefined;
62
- outlineStyle?: "solid" | "dotted" | "dashed" | undefined;
63
- outlineWidth?: import("react-native/types").AnimatableNumericValue | undefined;
56
+ borderTopEndRadius?: import("react-native/types").AnimatableNumericValue | undefined;
57
+ borderTopLeftRadius?: import("react-native/types").AnimatableNumericValue | undefined;
58
+ borderTopRightRadius?: import("react-native/types").AnimatableNumericValue | undefined;
59
+ borderTopStartRadius?: import("react-native/types").AnimatableNumericValue | undefined;
64
60
  opacity?: import("react-native/types").AnimatableNumericValue | undefined;
65
61
  elevation?: number | undefined;
66
62
  pointerEvents?: "auto" | "none" | "box-none" | "box-only" | undefined;
67
- isolation?: "auto" | "isolate" | undefined;
68
- cursor?: import("react-native/types").CursorValue | undefined;
69
- boxShadow?: string | readonly import("react-native/types").BoxShadowValue[] | undefined;
70
- filter?: string | readonly import("react-native/types").FilterFunction[] | undefined;
71
- mixBlendMode?: import("react-native/types").BlendMode | undefined;
72
- experimental_backgroundImage?: string | readonly import("react-native/types").GradientValue[] | undefined;
73
- alignContent?: "center" | "flex-start" | "flex-end" | "stretch" | "space-between" | "space-around" | "space-evenly" | undefined;
63
+ alignContent?: "center" | "flex-start" | "flex-end" | "stretch" | "space-between" | "space-around" | undefined;
74
64
  alignItems?: import("react-native/types").FlexAlignType | undefined;
75
65
  alignSelf?: "auto" | import("react-native/types").FlexAlignType | undefined;
76
66
  aspectRatio?: string | number | undefined;
@@ -82,15 +72,14 @@ declare const useFieldType: (props: UseFieldTypeProps) => {
82
72
  borderTopWidth?: number | undefined;
83
73
  borderWidth?: number | undefined;
84
74
  bottom?: import("react-native/types").DimensionValue | undefined;
85
- boxSizing?: "border-box" | "content-box" | undefined;
86
- display?: "none" | "flex" | "contents" | undefined;
75
+ display?: "none" | "flex" | undefined;
87
76
  end?: import("react-native/types").DimensionValue | undefined;
88
77
  flex?: number | undefined;
89
78
  flexBasis?: import("react-native/types").DimensionValue | undefined;
90
79
  flexDirection?: "row" | "column" | "row-reverse" | "column-reverse" | undefined;
91
- rowGap?: string | number | undefined;
92
- gap?: string | number | undefined;
93
- columnGap?: string | number | undefined;
80
+ rowGap?: number | undefined;
81
+ gap?: number | undefined;
82
+ columnGap?: number | undefined;
94
83
  flexGrow?: number | undefined;
95
84
  flexShrink?: number | undefined;
96
85
  flexWrap?: "wrap" | "nowrap" | "wrap-reverse" | undefined;
@@ -120,32 +109,13 @@ declare const useFieldType: (props: UseFieldTypeProps) => {
120
109
  paddingStart?: import("react-native/types").DimensionValue | undefined;
121
110
  paddingTop?: import("react-native/types").DimensionValue | undefined;
122
111
  paddingVertical?: import("react-native/types").DimensionValue | undefined;
123
- position?: "absolute" | "relative" | "static" | undefined;
112
+ position?: "absolute" | "relative" | undefined;
124
113
  right?: import("react-native/types").DimensionValue | undefined;
125
114
  start?: import("react-native/types").DimensionValue | undefined;
126
115
  top?: import("react-native/types").DimensionValue | undefined;
127
116
  width?: import("react-native/types").DimensionValue | undefined;
128
117
  zIndex?: number | undefined;
129
118
  direction?: "ltr" | "rtl" | "inherit" | undefined;
130
- inset?: import("react-native/types").DimensionValue | undefined;
131
- insetBlock?: import("react-native/types").DimensionValue | undefined;
132
- insetBlockEnd?: import("react-native/types").DimensionValue | undefined;
133
- insetBlockStart?: import("react-native/types").DimensionValue | undefined;
134
- insetInline?: import("react-native/types").DimensionValue | undefined;
135
- insetInlineEnd?: import("react-native/types").DimensionValue | undefined;
136
- insetInlineStart?: import("react-native/types").DimensionValue | undefined;
137
- marginBlock?: import("react-native/types").DimensionValue | undefined;
138
- marginBlockEnd?: import("react-native/types").DimensionValue | undefined;
139
- marginBlockStart?: import("react-native/types").DimensionValue | undefined;
140
- marginInline?: import("react-native/types").DimensionValue | undefined;
141
- marginInlineEnd?: import("react-native/types").DimensionValue | undefined;
142
- marginInlineStart?: import("react-native/types").DimensionValue | undefined;
143
- paddingBlock?: import("react-native/types").DimensionValue | undefined;
144
- paddingBlockEnd?: import("react-native/types").DimensionValue | undefined;
145
- paddingBlockStart?: import("react-native/types").DimensionValue | undefined;
146
- paddingInline?: import("react-native/types").DimensionValue | undefined;
147
- paddingInlineEnd?: import("react-native/types").DimensionValue | undefined;
148
- paddingInlineStart?: import("react-native/types").DimensionValue | undefined;
149
119
  shadowColor?: import("react-native/types").ColorValue | undefined;
150
120
  shadowOffset?: Readonly<{
151
121
  width: number;
@@ -153,7 +123,7 @@ declare const useFieldType: (props: UseFieldTypeProps) => {
153
123
  }> | undefined;
154
124
  shadowOpacity?: import("react-native/types").AnimatableNumericValue | undefined;
155
125
  shadowRadius?: number | undefined;
156
- transform?: string | readonly (({
126
+ transform?: string | (({
157
127
  perspective: import("react-native/types").AnimatableNumericValue;
158
128
  } & {
159
129
  rotate?: undefined;
@@ -274,7 +244,7 @@ declare const useFieldType: (props: UseFieldTypeProps) => {
274
244
  skewY?: undefined;
275
245
  matrix?: undefined;
276
246
  }) | ({
277
- translateX: import("react-native/types").AnimatableNumericValue | `${number}%`;
247
+ translateX: import("react-native/types").AnimatableNumericValue;
278
248
  } & {
279
249
  perspective?: undefined;
280
250
  rotate?: undefined;
@@ -289,7 +259,7 @@ declare const useFieldType: (props: UseFieldTypeProps) => {
289
259
  skewY?: undefined;
290
260
  matrix?: undefined;
291
261
  }) | ({
292
- translateY: import("react-native/types").AnimatableNumericValue | `${number}%`;
262
+ translateY: import("react-native/types").AnimatableNumericValue;
293
263
  } & {
294
264
  perspective?: undefined;
295
265
  rotate?: undefined;
@@ -1,5 +1,5 @@
1
1
  import { PickerProps, PickerValue } from '../types';
2
- interface UsePickerLabelProps extends Pick<PickerProps, 'value' | 'getLabel' | 'placeholder' | 'accessibilityLabel' | 'accessibilityHint'> {
2
+ interface UsePickerLabelProps extends Pick<PickerProps, 'value' | 'getLabel' | 'getItemLabel' | 'placeholder' | 'accessibilityLabel' | 'accessibilityHint'> {
3
3
  items: {
4
4
  value: string | number;
5
5
  label: string;
@@ -14,14 +14,15 @@ const usePickerLabel = props => {
14
14
  value,
15
15
  items,
16
16
  getLabel,
17
+ getItemLabel,
17
18
  placeholder,
18
19
  accessibilityLabel,
19
20
  accessibilityHint
20
21
  } = props;
21
22
  const getLabelsFromArray = useCallback(value => {
22
23
  const itemsByValue = _keyBy(items, 'value');
23
- return _flow(arr => _map(arr, item => _isPlainObject(item) ? item?.label : itemsByValue[item]?.label), arr => _join(arr, ', '))(value);
24
- }, [items]);
24
+ return _flow(arr => _map(arr, item => _isPlainObject(item) ? getItemLabel?.(item) || item?.label : itemsByValue[item]?.label), arr => _join(arr, ', '))(value);
25
+ }, [getItemLabel, items]);
25
26
  const _getLabel = useCallback(value => {
26
27
  if (_isFunction(getLabel) && !_isUndefined(getLabel(value))) {
27
28
  return getLabel(value);
@@ -1,4 +1,4 @@
1
1
  import { PickerProps } from '../types';
2
- type UsePickerMigrationWarnings = Pick<PickerProps, 'children' | 'onShow'>;
2
+ type UsePickerMigrationWarnings = Pick<PickerProps, 'children' | 'migrate' | 'getItemLabel' | 'getItemValue' | 'onShow'>;
3
3
  declare const usePickerMigrationWarnings: (props: UsePickerMigrationWarnings) => void;
4
4
  export default usePickerMigrationWarnings;
@@ -6,12 +6,24 @@ import { LogService } from "../../../services";
6
6
  const usePickerMigrationWarnings = props => {
7
7
  const {
8
8
  children,
9
+ migrate,
10
+ getItemLabel,
11
+ getItemValue,
9
12
  onShow
10
13
  } = props;
11
14
  useEffect(() => {
12
15
  if (children) {
13
16
  LogService.warn(`UILib Picker will stop supporting the 'children' prop in the next major version, please pass 'items' prop instead`);
14
17
  }
18
+ if (migrate) {
19
+ LogService.warn(`UILib Picker will stop supporting the 'migrate' prop in the next major version, please stop using it. The picker uses the new implementation by default.`);
20
+ }
21
+ if (getItemLabel) {
22
+ LogService.warn(`UILib Picker will stop supporting the 'getItemLabel' prop in the next major version, please pass the 'getItemLabel' prop to the specific item instead`);
23
+ }
24
+ if (getItemValue) {
25
+ LogService.warn(`UILib Picker will stop supporting the 'getItemValue' prop in the next major version, please stop using it. The value will be extract from 'items' prop instead`);
26
+ }
15
27
  if (onShow) {
16
28
  LogService.warn(`UILib Picker will stop supporting the 'onShow' prop in the next major version, please pass the 'onShow' prop from the 'pickerModalProps' instead`);
17
29
  }
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { PickerProps } from '../types';
3
- type UsePickerSearchProps = Pick<PickerProps, 'showSearch' | 'onSearchChange' | 'children' | 'items'>;
3
+ type UsePickerSearchProps = Pick<PickerProps, 'showSearch' | 'onSearchChange' | 'children' | 'getItemLabel' | 'items'>;
4
4
  declare const usePickerSearch: (props: UsePickerSearchProps) => {
5
5
  setSearchValue: import("react").Dispatch<import("react").SetStateAction<string>>;
6
6
  onSearchChange: (searchValue: string) => void;
@@ -1,12 +1,13 @@
1
1
  import _filter from "lodash/filter";
2
2
  import _isEmpty from "lodash/isEmpty";
3
3
  import { useCallback, useState, useMemo } from 'react';
4
- import { shouldFilterOut } from "../PickerPresenter";
4
+ import { getItemLabel as getItemLabelPresenter, shouldFilterOut } from "../PickerPresenter";
5
5
  const usePickerSearch = props => {
6
6
  const {
7
7
  showSearch,
8
8
  onSearchChange,
9
9
  children,
10
+ getItemLabel,
10
11
  items
11
12
  } = props;
12
13
  const [searchValue, setSearchValue] = useState('');
@@ -14,13 +15,16 @@ const usePickerSearch = props => {
14
15
  if (showSearch && !_isEmpty(searchValue)) {
15
16
  return _filter(items, item => {
16
17
  const {
17
- label
18
+ label,
19
+ value,
20
+ getItemLabel: childGetItemLabel
18
21
  } = item.props || item;
19
- return !shouldFilterOut(searchValue, label);
22
+ const itemLabel = getItemLabelPresenter(label, value, childGetItemLabel || getItemLabel);
23
+ return !shouldFilterOut(searchValue, itemLabel);
20
24
  });
21
25
  }
22
26
  return items;
23
- }, [showSearch, searchValue]);
27
+ }, [showSearch, searchValue, getItemLabel]);
24
28
  const filteredItems = useMemo(() => {
25
29
  return filterItems(children || items);
26
30
  }, [filterItems, items, children]);
@@ -1,6 +1,6 @@
1
1
  import { RefObject } from 'react';
2
2
  import { PickerProps, PickerValue, PickerSingleValue, PickerMultiValue } from '../types';
3
- interface UsePickerSelectionProps extends Pick<PickerProps, 'value' | 'onChange' | 'topBarProps' | 'mode' | 'items'> {
3
+ interface UsePickerSelectionProps extends Pick<PickerProps, 'migrate' | 'value' | 'onChange' | 'getItemValue' | 'topBarProps' | 'mode' | 'items'> {
4
4
  pickerExpandableRef: RefObject<any>;
5
5
  setSearchValue: (searchValue: string) => void;
6
6
  }
@@ -1,12 +1,15 @@
1
1
  import _xor from "lodash/xor";
2
+ import _xorBy from "lodash/xorBy";
2
3
  import { useCallback, useState, useEffect, useMemo } from 'react';
3
4
  import { PickerModes } from "../types";
4
5
  const usePickerSelection = props => {
5
6
  const {
7
+ migrate,
6
8
  value,
7
9
  onChange,
8
10
  topBarProps,
9
11
  pickerExpandableRef,
12
+ getItemValue,
10
13
  setSearchValue,
11
14
  mode,
12
15
  items
@@ -26,10 +29,15 @@ const usePickerSelection = props => {
26
29
  onChange?.(item);
27
30
  }, [onChange]);
28
31
  const toggleItemSelection = useCallback(item => {
32
+ let newValue;
29
33
  const itemAsArray = [item];
30
- const newValue = _xor(multiDraftValue, itemAsArray);
34
+ if (!migrate) {
35
+ newValue = _xorBy(multiDraftValue, itemAsArray, getItemValue || 'value');
36
+ } else {
37
+ newValue = _xor(multiDraftValue, itemAsArray);
38
+ }
31
39
  setMultiDraftValue(newValue);
32
- }, [multiDraftValue]);
40
+ }, [multiDraftValue, getItemValue]);
33
41
  const cancelSelect = useCallback(() => {
34
42
  setSearchValue('');
35
43
  setMultiDraftValue(multiFinalValue);
@@ -1,4 +1,5 @@
1
- import _map from "lodash/map"; // TODO: deprecate all places where we check if _.isPlainObject
1
+ import _map from "lodash/map";
2
+ import _isArray from "lodash/isArray"; // TODO: deprecate all places where we check if _.isPlainObject
2
3
  // TODO: Add initialValue prop
3
4
  // TODO: consider deprecating renderCustomModal prop
4
5
  import React, { useMemo, useState, useRef, useCallback, useEffect } from 'react';
@@ -44,9 +45,13 @@ const Picker = React.forwardRef((props, ref) => {
44
45
  listProps,
45
46
  value,
46
47
  getLabel,
48
+ getItemLabel,
49
+ getItemValue,
47
50
  renderItem,
48
51
  children,
49
52
  useSafeArea,
53
+ // TODO: Remove migrate props and migrate code
54
+ migrate = true,
50
55
  accessibilityLabel,
51
56
  accessibilityHint,
52
57
  items: propItems,
@@ -73,6 +78,10 @@ const Picker = React.forwardRef((props, ref) => {
73
78
  const [items, setItems] = useState(propItems || extractPickerItems(themeProps));
74
79
  const pickerExpandable = useRef(null);
75
80
  const pickerRef = useImperativePickerHandle(ref, pickerExpandable);
81
+
82
+ // TODO: Remove this when migration is completed, starting of v8
83
+ // usePickerMigrationWarnings({children, migrate, getItemLabel, getItemValue});
84
+
76
85
  useEffect(() => {
77
86
  if (propItems) {
78
87
  setItems(propItems);
@@ -85,6 +94,7 @@ const Picker = React.forwardRef((props, ref) => {
85
94
  } = usePickerSearch({
86
95
  showSearch,
87
96
  onSearchChange,
97
+ getItemLabel,
88
98
  children,
89
99
  items
90
100
  });
@@ -97,9 +107,11 @@ const Picker = React.forwardRef((props, ref) => {
97
107
  selectedCount,
98
108
  toggleAllItemsSelection
99
109
  } = usePickerSelection({
110
+ migrate,
100
111
  value,
101
112
  onChange,
102
113
  pickerExpandableRef: pickerExpandable,
114
+ getItemValue,
103
115
  topBarProps,
104
116
  setSearchValue,
105
117
  mode,
@@ -120,6 +132,7 @@ const Picker = React.forwardRef((props, ref) => {
120
132
  } = usePickerLabel({
121
133
  value,
122
134
  items,
135
+ getItemLabel,
123
136
  getLabel,
124
137
  accessibilityLabel,
125
138
  accessibilityHint,
@@ -144,10 +157,15 @@ const Picker = React.forwardRef((props, ref) => {
144
157
  setSelectedItemPosition(y);
145
158
  }, []);
146
159
  const contextValue = useMemo(() => {
160
+ // @ts-expect-error cleanup after removing migrate prop
161
+ const pickerValue = !migrate && typeof value === 'object' && !_isArray(value) ? value?.value : value;
147
162
  return {
148
- value: mode === PickerModes.MULTI ? multiDraftValue : value,
163
+ migrate,
164
+ value: mode === PickerModes.MULTI ? multiDraftValue : pickerValue,
149
165
  onPress: mode === PickerModes.MULTI ? toggleItemSelection : onDoneSelecting,
150
166
  isMultiMode: mode === PickerModes.MULTI,
167
+ getItemValue,
168
+ getItemLabel,
151
169
  onSelectedLayout: onSelectedItemLayout,
152
170
  renderItem,
153
171
  selectionLimit,
@@ -155,7 +173,7 @@ const Picker = React.forwardRef((props, ref) => {
155
173
  selectedCount,
156
174
  toggleAllItemsSelection
157
175
  };
158
- }, [mode, value, multiDraftValue, renderItem, selectionLimit, onSelectedItemLayout, toggleItemSelection, onDoneSelecting, areAllItemsSelected, selectedCount, toggleAllItemsSelection]);
176
+ }, [migrate, mode, value, multiDraftValue, renderItem, getItemValue, getItemLabel, selectionLimit, onSelectedItemLayout, toggleItemSelection, onDoneSelecting, areAllItemsSelected, selectedCount, toggleAllItemsSelection]);
159
177
  const renderPickerItem = useCallback((item, index) => {
160
178
  return <PickerItem key={`${index}-${item.value}`} {...item} />;
161
179
  }, []);
@@ -205,7 +223,7 @@ const Picker = React.forwardRef((props, ref) => {
205
223
  </PickerItemsList>;
206
224
  }, [testID, mode, useDialog, selectedItemPosition, topBarProps, cancelSelect, onDoneSelecting, multiDraftValue, showSearch, searchStyle, searchPlaceholder, _onSearchChange, renderCustomSearch, renderHeader, listProps, accessibleFilteredItems, useSafeArea, useWheelPicker, items, showLoader]);
207
225
  return <PickerContext.Provider value={contextValue}>
208
- {<ExpandableOverlay ref={pickerExpandable} useDialog={useDialog || useWheelPicker} dialogProps={DEFAULT_DIALOG_PROPS} expandableContent={expandableModalContent} renderCustomOverlay={renderOverlay ? _renderOverlay : undefined} onPress={onPress} testID={testID} {...customPickerProps} disabled={themeProps.editable === false}>
226
+ {<ExpandableOverlay ref={pickerExpandable} useDialog={useDialog || useWheelPicker} dialogProps={DEFAULT_DIALOG_PROPS} migrateDialog expandableContent={expandableModalContent} renderCustomOverlay={renderOverlay ? _renderOverlay : undefined} onPress={onPress} testID={testID} {...customPickerProps} disabled={themeProps.editable === false}>
209
227
  {renderTextField()}
210
228
  </ExpandableOverlay>}
211
229
  </PickerContext.Provider>;
@@ -36,6 +36,21 @@ export interface PickerSearchStyle {
36
36
  selectionColor?: string;
37
37
  }
38
38
  type PickerPropsDeprecation = {
39
+ /**
40
+ * @deprecated
41
+ * Temporary prop required for migration to Picker's new API
42
+ */
43
+ migrate?: boolean;
44
+ /**
45
+ * @deprecated
46
+ * A function that extract the unique value out of the value prop in case value has a custom structure (e.g. {myValue, myLabel})
47
+ */
48
+ getItemValue?: (value: PickerValue) => any;
49
+ /**
50
+ * @deprecated
51
+ * A function that extract the label out of the value prop in case value has a custom structure (e.g. {myValue, myLabel})
52
+ */
53
+ getItemLabel?: (value: PickerValue) => string;
39
54
  /**
40
55
  * @deprecated
41
56
  * Callback for modal onShow event
@@ -275,6 +290,14 @@ export interface PickerItemProps extends Pick<TouchableOpacityProps, 'customValu
275
290
  * Item's label style
276
291
  */
277
292
  labelStyle?: StyleProp<TextStyle>;
293
+ /**
294
+ * Custom function for the item label (e.g (value) => customLabel)
295
+ */
296
+ getItemLabel?: (value: PickerValue) => string;
297
+ /**
298
+ * @deprecated Function to return the value out of the item value prop when value is custom shaped.
299
+ */
300
+ getItemValue?: PickerProps['getItemValue'];
278
301
  /**
279
302
  * Render custom item
280
303
  */
@@ -302,7 +325,7 @@ export interface PickerItemProps extends Pick<TouchableOpacityProps, 'customValu
302
325
  */
303
326
  testID?: string;
304
327
  }
305
- export interface PickerContextProps extends Pick<PickerProps, 'value' | 'renderItem' | 'selectionLimit'> {
328
+ export interface PickerContextProps extends Pick<PickerProps, 'migrate' | 'value' | 'getItemValue' | 'getItemLabel' | 'renderItem' | 'selectionLimit'> {
306
329
  onPress: (value: PickerSingleValue) => void;
307
330
  isMultiMode: boolean;
308
331
  onSelectedLayout: (event: any) => any;
@@ -20,7 +20,7 @@ export let SegmentedControlPreset = /*#__PURE__*/function (SegmentedControlPrese
20
20
  return SegmentedControlPreset;
21
21
  }({});
22
22
  export { SegmentedControlItemProps };
23
- const noneAreUndefined = array => {
23
+ const nonAreUndefined = array => {
24
24
  'worklet';
25
25
 
26
26
  for (const item of array) {
@@ -99,7 +99,7 @@ const SegmentedControl = props => {
99
99
  x,
100
100
  width
101
101
  };
102
- if (segmentsDimensions.current.length === segments.length && noneAreUndefined(segmentsDimensions.current)) {
102
+ if (segmentsDimensions.current.length === segments.length && nonAreUndefined(segmentsDimensions.current)) {
103
103
  segmentsStyle.value = [...segmentsDimensions.current];
104
104
  // shouldResetOnDimensionsOnNextLayout.current = true;// in case onLayout will be called again (orientation change etc.)
105
105
  }
@@ -122,7 +122,7 @@ const SegmentedControl = props => {
122
122
  const {
123
123
  value: height
124
124
  } = containerHeight;
125
- if (height !== 0 && value.length === segments.length && noneAreUndefined(value)) {
125
+ if (height !== 0 && value.length === segments.length && nonAreUndefined(value)) {
126
126
  const isFirstElementSelected = animatedSelectedIndex.value === 0;
127
127
  const isLastElementSelected = animatedSelectedIndex.value === value.length - 1;
128
128
  const isMiddleSelected = !isFirstElementSelected && !isLastElementSelected;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+
3
+ export default React.createContext({});
@@ -0,0 +1,153 @@
1
+ import React, {Component} from 'react';
2
+ import {StyleSheet} from 'react-native';
3
+ import Animated, {Easing as _Easing, EasingNode} from 'react-native-reanimated';
4
+ import PropTypes from 'prop-types';
5
+ import _ from 'lodash';
6
+ import TouchableOpacity from '../touchableOpacity';
7
+ import {Colors} from '../../style';
8
+ import ShareTransitionContext from './ShareTransitionContext';
9
+
10
+ const {interpolate: _interpolate, interpolateNode} = Animated;
11
+ const Easing = EasingNode || _Easing;
12
+ const interpolate = interpolateNode || _interpolate;
13
+
14
+ // TODO: 2.17 breaks Android (at list the screen, the image is not shown) - move to incubator?
15
+ class SharedArea extends Component {
16
+ displayName = 'IGNORE';
17
+ static propTypes = {
18
+ /**
19
+ * render details screen
20
+ */
21
+ renderDetails: PropTypes.elementType
22
+ };
23
+
24
+ static defaultProps = {
25
+ renderDetails: _.noop
26
+ };
27
+
28
+ state = {};
29
+ transition = new Animated.Value(0);
30
+
31
+ getProviderContextValue() {
32
+ const {showDetails} = this.state;
33
+ return {
34
+ setSharedData: this.setSharedData,
35
+ setSource: this.setSource,
36
+ setTarget: this.setTarget,
37
+ showDetails
38
+ };
39
+ }
40
+
41
+ getOverlayStyle() {
42
+ return {
43
+ ...StyleSheet.absoluteFillObject,
44
+ backgroundColor: Colors.white,
45
+ opacity: interpolate(this.transition, {inputRange: [0, 1], outputRange: [0, 1]})
46
+ };
47
+ }
48
+
49
+ getDetailsStyle() {
50
+ return {
51
+ ...StyleSheet.absoluteFillObject,
52
+ opacity: interpolate(this.transition, {inputRange: [90, 100], outputRange: [0, 1]})
53
+ };
54
+ }
55
+
56
+ getElementStyle() {
57
+ const {sourceLayout, targetLayout} = this.state;
58
+ if (sourceLayout && this.transition) {
59
+ return {
60
+ position: 'absolute',
61
+ width: interpolate(this.transition, {
62
+ inputRange: [0, 100],
63
+ outputRange: [sourceLayout.width, targetLayout.width]
64
+ }),
65
+ height: interpolate(this.transition, {
66
+ inputRange: [0, 100],
67
+ outputRange: [sourceLayout.height, targetLayout.height]
68
+ }),
69
+ top: interpolate(this.transition, {
70
+ inputRange: [0, 100],
71
+ outputRange: [sourceLayout.y, targetLayout.y]
72
+ }),
73
+ left: interpolate(this.transition, {
74
+ inputRange: [0, 100],
75
+ outputRange: [sourceLayout.x, targetLayout.x]
76
+ })
77
+ };
78
+ }
79
+ }
80
+
81
+ setSharedData = data => {
82
+ this.setState({
83
+ data
84
+ });
85
+ };
86
+
87
+ setSource = (sourceLayout, element) => {
88
+ this.setState({
89
+ sourceLayout,
90
+ element,
91
+ showDetails: true
92
+ },
93
+ () => {
94
+ this.startTransition(true);
95
+ });
96
+ };
97
+
98
+ setTarget = targetLayout => {
99
+ this.setState({
100
+ targetLayout
101
+ });
102
+ };
103
+
104
+ clearSource = () => {
105
+ this.startTransition(false, () => {
106
+ this.setState({
107
+ showDetails: false,
108
+ data: undefined,
109
+ sourceLayout: undefined,
110
+ element: undefined
111
+ });
112
+ });
113
+ };
114
+
115
+ startTransition(show, onAnimationEnd) {
116
+ Animated.timing(this.transition, {
117
+ toValue: show ? 100 : 0,
118
+ duration: 600,
119
+ easing: Easing.bezier(0.19, 1, 0.22, 1),
120
+ useNativeDriver: false
121
+ }).start(onAnimationEnd);
122
+ }
123
+
124
+ renderDetailsOverlay() {
125
+ const {renderDetails} = this.props;
126
+ const {data, element} = this.state;
127
+
128
+ return (
129
+ <Animated.View pointerEvents={data ? 'auto' : 'none'} style={this.getOverlayStyle()}>
130
+ <Animated.View pointerEvents="box-none" style={this.getDetailsStyle()}>
131
+ {renderDetails(data)}
132
+ </Animated.View>
133
+
134
+ <Animated.View style={this.getElementStyle()}>
135
+ <TouchableOpacity activeOpacity={1} onPress={this.clearSource} /* _style={[style]} */ style={{flex: 1}}>
136
+ {element}
137
+ </TouchableOpacity>
138
+ </Animated.View>
139
+ </Animated.View>
140
+ );
141
+ }
142
+
143
+ render() {
144
+ return (
145
+ <ShareTransitionContext.Provider value={this.getProviderContextValue()}>
146
+ {this.props.children}
147
+ {this.renderDetailsOverlay()}
148
+ </ShareTransitionContext.Provider>
149
+ );
150
+ }
151
+ }
152
+
153
+ export default SharedArea;