react-native-ui-lib 7.46.3-snapshot.7342 → 7.46.3-snapshot.7356
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/babel.config.js +12 -0
- package/index.js +1 -0
- package/lib/android/build.gradle +5 -5
- package/lib/android/src/main/java/com/wix/reactnativeuilib/UiLibPackageList.java +0 -2
- package/lib/android/src/main/java/com/wix/reactnativeuilib/highlighterview/HighlighterViewManager.java +31 -23
- package/lib/android/src/main/java/com/wix/reactnativeuilib/keyboardinput/utils/RuntimeUtils.java +1 -1
- package/lib/components/{HighlighterOverlayView.d.ts → HighlighterOverlayView/index.d.ts} +1 -1
- package/lib/components/HighlighterOverlayView/index.js +49 -0
- package/lib/components/{HighlighterOverlayView.web.d.ts → HighlighterOverlayView/index.web.d.ts} +1 -1
- package/lib/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/CustomKeyboardView/CustomKeyboardView.android.d.ts +5 -2
- package/lib/components/Keyboard/KeyboardAccessoryView/CustomKeyboardView/CustomKeyboardView.android.js +51 -0
- package/lib/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/CustomKeyboardView/CustomKeyboardView.ios.d.ts +1 -1
- package/lib/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/CustomKeyboardView/CustomKeyboardView.ios.js +3 -3
- package/lib/components/Keyboard/{KeyboardInput → KeyboardAccessoryView/CustomKeyboardView}/CustomKeyboardViewBase.d.ts +3 -0
- package/lib/components/Keyboard/{KeyboardInput → KeyboardAccessoryView/CustomKeyboardView}/CustomKeyboardViewBase.js +1 -1
- package/lib/components/Keyboard/{KeyboardInput/utils → KeyboardAccessoryView/KeyboardRegistry/EventEmitterManager}/__tests__/EventEmitterManager.spec.js +1 -1
- package/lib/components/Keyboard/{KeyboardInput → KeyboardAccessoryView/KeyboardRegistry}/__tests__/KeyboardRegistry.spec.js +1 -1
- package/lib/components/Keyboard/{KeyboardInput/KeyboardRegistry.d.ts → KeyboardAccessoryView/KeyboardRegistry/index.d.ts} +1 -1
- package/lib/components/Keyboard/{KeyboardInput/KeyboardRegistry.js → KeyboardAccessoryView/KeyboardRegistry/index.js} +1 -1
- package/lib/components/Keyboard/{KeyboardInput → KeyboardAccessoryView/KeyboardRegistry}/keyboardRegistry.api.json +9 -9
- package/lib/components/Keyboard/KeyboardAccessoryView/KeyboardUtils/index.d.ts +26 -0
- package/lib/components/Keyboard/KeyboardAccessoryView/KeyboardUtils/index.js +91 -0
- package/lib/components/Keyboard/{KeyboardInput/KeyboardAccessoryView.d.ts → KeyboardAccessoryView/index.d.ts} +11 -1
- package/lib/components/Keyboard/{KeyboardInput/KeyboardAccessoryView.js → KeyboardAccessoryView/index.js} +31 -5
- package/lib/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/keyboardAccessoryView.api.json +5 -5
- package/lib/components/Keyboard/{KeyboardTracking/KeyboardAwareInsetsView.d.ts → KeyboardAwareInsetsView/index.d.ts} +1 -1
- package/lib/components/Keyboard/{KeyboardTracking/KeyboardAwareInsetsView.js → KeyboardAwareInsetsView/index.js} +1 -1
- package/lib/components/Keyboard/{KeyboardTracking/KeyboardTrackingView → KeyboardTrackingView}/KeyboardTrackingView.ios.d.ts +1 -4
- package/lib/components/Keyboard/{KeyboardTracking/KeyboardTrackingView → KeyboardTrackingView}/KeyboardTrackingView.ios.js +5 -8
- package/lib/components/Keyboard/{KeyboardTracking/KeyboardTrackingView → KeyboardTrackingView}/index.d.ts +2 -2
- package/lib/components/Keyboard/{KeyboardTracking/KeyboardTrackingView → KeyboardTrackingView}/keyboardTrackingView.api.json +11 -20
- package/lib/components/Keyboard/index.d.ts +6 -6
- package/lib/components/Keyboard/index.js +6 -6
- package/lib/components/SafeArea/SafeAreaInsetsManager.d.ts +21 -7
- package/lib/components/SafeArea/SafeAreaInsetsManager.js +95 -31
- package/lib/components/SafeArea/SafeAreaSpacerView.d.ts +2 -2
- package/lib/components/SafeArea/SafeAreaSpacerView.js +63 -9
- package/lib/components/SafeArea/__tests__/SafeAreaInsetsManager.spec.js +274 -0
- package/lib/components/SafeArea/index.d.ts +10 -0
- package/lib/components/SafeArea/index.js +11 -0
- package/lib/components/index.d.ts +1 -1
- package/lib/components/index.js +1 -1
- package/lib/ios/reactnativeuilib/keyboardinput/rctcustomInputcontroller/RCTCustomInputControllerTemp.m +52 -8
- package/lib/ios/reactnativeuilib/keyboardinput/rctcustomInputcontroller/RCTCustomKeyboardViewControllerTemp.h +1 -7
- package/lib/ios/reactnativeuilib/keyboardinput/rctcustomInputcontroller/RCTCustomKeyboardViewControllerTemp.m +1 -1
- package/lib/ios/reactnativeuilib/keyboardtrackingview/KeyboardTrackingViewTempManager.m +109 -41
- package/lib/package.json +3 -3
- package/lib/react-native.config.js +1 -3
- package/metro.config.js +2 -2
- package/package.json +29 -29
- package/panView.d.ts +2 -0
- package/panView.js +1 -0
- package/react-native.config.js +1 -3
- package/src/commons/Constants.js +2 -5
- package/src/components/KeyboardAwareScrollView/KeyboardAwareBase.js +5 -1
- package/src/components/actionSheet/index.d.ts +2 -12
- package/src/components/actionSheet/index.js +3 -42
- package/src/components/animatedImage/index.js +16 -6
- package/src/components/badge/index.d.ts +107 -47
- package/src/components/button/button.api.json +1 -1
- package/src/components/button/index.d.ts +53 -23
- package/src/components/button/types.d.ts +0 -1
- package/src/components/colorPicker/ColorPickerDialog.d.ts +1 -1
- package/src/components/colorPicker/ColorPickerDialog.js +1 -1
- package/src/components/dateTimePicker/index.d.ts +186 -5
- package/src/components/dateTimePicker/index.js +3 -4
- package/src/components/dialog/dialog.api.json +31 -37
- package/src/{incubator → components}/dialog/dialogHeader.api.json +2 -2
- package/src/components/dialog/index.d.ts +13 -105
- package/src/components/dialog/index.js +204 -212
- package/src/{incubator → components}/dialog/types.d.ts +0 -19
- package/src/{incubator → components}/dialog/types.js +1 -3
- package/src/{incubator → components}/dialog/useDialogContent.d.ts +1 -1
- package/src/components/drawer/Swipeable.js +1 -2
- package/src/components/drawer/index.js +31 -25
- package/src/components/fadedScrollView/index.js +7 -2
- package/src/components/featureHighlight/index.d.ts +1 -1
- package/src/components/index.js +0 -19
- package/src/components/marquee/types.js +4 -1
- package/src/components/modal/index.d.ts +5 -0
- package/src/components/modal/index.js +14 -10
- package/src/components/modal/modal.api.json +5 -0
- package/src/{incubator → components}/panView/index.d.ts +3 -3
- package/src/{incubator → components}/panView/index.js +4 -4
- package/src/{incubator → components}/panView/usePanGesture.d.ts +1 -1
- package/src/components/picker/Picker.driver.new.d.ts +2 -2
- package/src/components/picker/Picker.driver.new.js +3 -3
- package/src/components/picker/PickerItem.js +6 -20
- package/src/components/picker/PickerPresenter.d.ts +0 -1
- package/src/components/picker/PickerPresenter.js +1 -23
- package/src/components/picker/api/picker.api.json +0 -1
- package/src/components/picker/api/pickerItem.api.json +0 -5
- package/src/components/picker/helpers/useFieldType.d.ts +53 -23
- package/src/components/picker/helpers/usePickerLabel.d.ts +1 -1
- package/src/components/picker/helpers/usePickerLabel.js +2 -3
- package/src/components/picker/helpers/usePickerMigrationWarnings.d.ts +1 -1
- package/src/components/picker/helpers/usePickerMigrationWarnings.js +0 -12
- package/src/components/picker/helpers/usePickerSearch.d.ts +1 -1
- package/src/components/picker/helpers/usePickerSearch.js +4 -8
- package/src/components/picker/helpers/usePickerSelection.d.ts +1 -1
- package/src/components/picker/helpers/usePickerSelection.js +2 -10
- package/src/components/picker/index.js +4 -22
- package/src/components/picker/types.d.ts +1 -24
- package/src/components/segmentedControl/index.js +3 -3
- package/src/components/slider/GradientSlider.d.ts +1 -1
- package/src/components/sortableGridList/SortableItem.js +13 -4
- package/src/components/sortableList/SortableListItem.js +13 -4
- package/src/components/stackAggregator/index.js +16 -11
- package/src/components/tabController/TabBar.js +1 -2
- package/src/components/text/Text.driver.new.d.ts +2 -2
- package/src/components/text/Text.driver.new.js +2 -2
- package/src/components/textField/Input.js +0 -1
- package/src/components/textField/TextField.driver.new.d.ts +2 -2
- package/src/components/textField/TextField.driver.new.js +2 -2
- package/src/components/textField/presets/outline.d.ts +106 -46
- package/src/components/textField/presets/underline.d.ts +106 -46
- package/src/components/textField/types.js +1 -0
- package/src/components/textField/usePreset.d.ts +72 -44
- package/src/components/timeline/types.js +3 -0
- package/src/{incubator/hooks/useHiddenLocation.web.d.ts → hooks/useHiddenLocation/index.d.ts} +1 -1
- package/src/{incubator/hooks/useHiddenLocation.d.ts → hooks/useHiddenLocation/index.web.d.ts} +1 -1
- package/src/hooks/useScrollToItem/index.d.ts +18 -4
- package/src/hooks/useScrollToItem/index.js +56 -17
- package/src/incubator/expandableOverlay/ExpandableOverlay.driver.js +1 -1
- package/src/incubator/expandableOverlay/index.d.ts +42 -3
- package/src/incubator/expandableOverlay/index.js +1 -4
- package/src/incubator/index.d.ts +0 -2
- package/src/incubator/index.js +0 -2
- package/src/incubator/toast/index.js +1 -1
- package/src/index.d.ts +3 -10
- package/src/index.js +42 -162
- package/src/testkit/index.d.ts +1 -1
- package/src/testkit/index.js +1 -1
- package/src/testkit/new/Component.driver.d.ts +4 -1
- package/src/testkit/new/Component.driver.js +3 -3
- package/lib/android/src/main/java/com/wix/reactnativeuilib/highlighterview/ReactHacks.java +0 -30
- package/lib/android/src/main/java/com/wix/reactnativeuilib/highlighterview/ReflectionUtils.java +0 -34
- package/lib/android/src/main/java/com/wix/reactnativeuilib/textinput/DefaultKeyListener.java +0 -33
- package/lib/android/src/main/java/com/wix/reactnativeuilib/textinput/KeyListenerProxy.java +0 -53
- package/lib/android/src/main/java/com/wix/reactnativeuilib/textinput/TextInputDelKeyHandlerModule.java +0 -54
- package/lib/android/src/main/java/com/wix/reactnativeuilib/textinput/TextInputDelKeyHandlerPackage.java +0 -28
- package/lib/android/src/main/java/com/wix/reactnativeuilib/textinput/ViewUtils.java +0 -36
- package/lib/components/HighlighterOverlayView.js +0 -40
- package/lib/components/Keyboard/KeyboardInput/CustomKeyboardView/CustomKeyboardView.android.js +0 -28
- package/lib/components/Keyboard/KeyboardInput/utils/KeyboardUtils.d.ts +0 -11
- package/lib/components/Keyboard/KeyboardInput/utils/KeyboardUtils.js +0 -17
- package/panningViews.d.ts +0 -2
- package/panningViews.js +0 -1
- package/sharedTransition.d.ts +0 -2
- package/sharedTransition.js +0 -1
- package/src/components/dialog/DialogDismissibleView.d.ts +0 -34
- package/src/components/dialog/DialogDismissibleView.js +0 -184
- package/src/components/dialog/OverlayFadingBackground.d.ts +0 -14
- package/src/components/dialog/OverlayFadingBackground.js +0 -45
- package/src/components/panningViews/asPanViewConsumer.d.ts +0 -3
- package/src/components/panningViews/asPanViewConsumer.js +0 -16
- package/src/components/panningViews/panDismissibleView.d.ts +0 -51
- package/src/components/panningViews/panDismissibleView.js +0 -350
- package/src/components/panningViews/panGestureView.d.ts +0 -23
- package/src/components/panningViews/panGestureView.js +0 -156
- package/src/components/panningViews/panListenerView.d.ts +0 -66
- package/src/components/panningViews/panListenerView.js +0 -155
- package/src/components/panningViews/panResponderView.d.ts +0 -19
- package/src/components/panningViews/panResponderView.js +0 -79
- package/src/components/panningViews/panningContext.d.ts +0 -3
- package/src/components/panningViews/panningContext.js +0 -4
- package/src/components/panningViews/panningProvider.d.ts +0 -73
- package/src/components/panningViews/panningProvider.js +0 -101
- package/src/components/sharedTransition/ShareTransitionContext.js +0 -3
- package/src/components/sharedTransition/SharedArea.js +0 -153
- package/src/components/sharedTransition/SourceElement.js +0 -44
- package/src/components/sharedTransition/TargetElement.js +0 -38
- package/src/components/sharedTransition/index.js +0 -9
- package/src/components/tabController/useScrollToItem.d.ts +0 -79
- package/src/components/tabController/useScrollToItem.js +0 -159
- package/src/incubator/dialog/dialog.api.json +0 -54
- package/src/incubator/dialog/index.d.ts +0 -15
- package/src/incubator/dialog/index.js +0 -218
- /package/lib/components/{HighlighterOverlayView.web.js → HighlighterOverlayView/index.web.js} +0 -0
- /package/lib/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/CustomKeyboardView/index.d.ts +0 -0
- /package/lib/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/CustomKeyboardView/index.js +0 -0
- /package/lib/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/CustomKeyboardView/index.web.d.ts +0 -0
- /package/lib/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/CustomKeyboardView/index.web.js +0 -0
- /package/lib/components/Keyboard/{KeyboardInput/utils/EventEmitterManager.d.ts → KeyboardAccessoryView/KeyboardRegistry/EventEmitterManager/index.d.ts} +0 -0
- /package/lib/components/Keyboard/{KeyboardInput/utils/EventEmitterManager.js → KeyboardAccessoryView/KeyboardRegistry/EventEmitterManager/index.js} +0 -0
- /package/lib/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/TextInputKeyboardManager/TextInputKeyboardManager.android.d.ts +0 -0
- /package/lib/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/TextInputKeyboardManager/TextInputKeyboardManager.android.js +0 -0
- /package/lib/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/TextInputKeyboardManager/TextInputKeyboardManager.ios.d.ts +0 -0
- /package/lib/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/TextInputKeyboardManager/TextInputKeyboardManager.ios.js +0 -0
- /package/lib/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/TextInputKeyboardManager/index.d.ts +0 -0
- /package/lib/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/TextInputKeyboardManager/index.js +0 -0
- /package/lib/components/Keyboard/{KeyboardTracking → KeyboardAwareInsetsView}/keyboardAwareInsetsView.api.json +0 -0
- /package/lib/components/Keyboard/{KeyboardTracking/KeyboardTrackingView → KeyboardTrackingView}/KeyboardTrackingView.android.d.ts +0 -0
- /package/lib/components/Keyboard/{KeyboardTracking/KeyboardTrackingView → KeyboardTrackingView}/KeyboardTrackingView.android.js +0 -0
- /package/lib/components/Keyboard/{KeyboardTracking/KeyboardTrackingView → KeyboardTrackingView}/index.js +0 -0
- /package/lib/components/Keyboard/{KeyboardTracking/KeyboardTrackingView → KeyboardTrackingView}/index.web.d.ts +0 -0
- /package/lib/components/Keyboard/{KeyboardTracking/KeyboardTrackingView → KeyboardTrackingView}/index.web.js +0 -0
- /package/src/{incubator → components}/dialog/Dialog.driver.new.d.ts +0 -0
- /package/src/{incubator → components}/dialog/Dialog.driver.new.js +0 -0
- /package/src/{incubator → components}/dialog/DialogHeader.d.ts +0 -0
- /package/src/{incubator → components}/dialog/DialogHeader.js +0 -0
- /package/src/{incubator → components}/dialog/useDialogContent.js +0 -0
- /package/src/{incubator → components}/panView/panningUtil.d.ts +0 -0
- /package/src/{incubator → components}/panView/panningUtil.js +0 -0
- /package/src/{incubator → components}/panView/usePanGesture.js +0 -0
- /package/src/{incubator/hooks/useHiddenLocation.js → hooks/useHiddenLocation/index.js} +0 -0
- /package/src/{incubator/hooks/useHiddenLocation.web.js → hooks/useHiddenLocation/index.web.js} +0 -0
|
@@ -9,5 +9,8 @@ export interface ComponentDriverResult {
|
|
|
9
9
|
queryElement: () => ReactTestInstance | undefined;
|
|
10
10
|
exists: () => boolean;
|
|
11
11
|
}
|
|
12
|
-
export
|
|
12
|
+
export type ComponentDriverOptions = {
|
|
13
|
+
includeHiddenElements?: boolean;
|
|
14
|
+
};
|
|
15
|
+
export declare const useComponentDriver: (props: ComponentProps, options?: ComponentDriverOptions) => ComponentDriverResult;
|
|
13
16
|
export declare const ComponentDriver: (props: ComponentProps) => ComponentDriverResult;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export const useComponentDriver = props => {
|
|
1
|
+
export const useComponentDriver = (props, options) => {
|
|
2
2
|
const {
|
|
3
3
|
renderTree,
|
|
4
4
|
testID
|
|
5
5
|
} = props;
|
|
6
6
|
const getElement = () => {
|
|
7
|
-
const elements = renderTree.queryAllByTestId(testID);
|
|
7
|
+
const elements = renderTree.queryAllByTestId(testID, options);
|
|
8
8
|
if (elements.length > 1) {
|
|
9
9
|
throw new Error(`Found more than one element with testID: ${testID}`);
|
|
10
10
|
}
|
|
@@ -16,7 +16,7 @@ export const useComponentDriver = props => {
|
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
18
|
const queryElement = () => {
|
|
19
|
-
const elements = renderTree.queryAllByTestId(testID);
|
|
19
|
+
const elements = renderTree.queryAllByTestId(testID, options);
|
|
20
20
|
if (elements.length > 1) {
|
|
21
21
|
console.warn(`Found more than one element with testID: ${testID}`);
|
|
22
22
|
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
package com.wix.reactnativeuilib.highlighterview;
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import androidx.annotation.Nullable;
|
|
5
|
-
|
|
6
|
-
import com.facebook.react.uimanager.NativeViewHierarchyManager;
|
|
7
|
-
import com.facebook.react.uimanager.UIBlock;
|
|
8
|
-
import com.facebook.react.uimanager.UIManagerModule;
|
|
9
|
-
import com.facebook.react.uimanager.UIViewOperationQueue;
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* ¯\_(ツ)_/¯
|
|
13
|
-
*/
|
|
14
|
-
public class ReactHacks {
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* {@link NativeViewHierarchyManager} is used to resolve a native view by RN tag ({@link NativeViewHierarchyManager#resolveView}). The only way of obtaining it is by
|
|
18
|
-
* posting {@link UIBlock} which can take a noticeable amount of time to execute.
|
|
19
|
-
*/
|
|
20
|
-
@Nullable
|
|
21
|
-
public static NativeViewHierarchyManager getNativeViewHierarchyManager(UIManagerModule uiManager) {
|
|
22
|
-
try {
|
|
23
|
-
UIViewOperationQueue mOperationsQueue = (UIViewOperationQueue) ReflectionUtils.getDeclaredField(uiManager.getUIImplementation(), "mOperationsQueue");
|
|
24
|
-
return (NativeViewHierarchyManager) ReflectionUtils.getDeclaredField(mOperationsQueue, "mNativeViewHierarchyManager");
|
|
25
|
-
} catch (Exception e) {
|
|
26
|
-
e.printStackTrace();
|
|
27
|
-
return null;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
package/lib/android/src/main/java/com/wix/reactnativeuilib/highlighterview/ReflectionUtils.java
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
package com.wix.reactnativeuilib.highlighterview;
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import androidx.annotation.Nullable;
|
|
5
|
-
|
|
6
|
-
import java.lang.reflect.Field;
|
|
7
|
-
|
|
8
|
-
class ReflectionUtils {
|
|
9
|
-
|
|
10
|
-
@Nullable
|
|
11
|
-
static Object getDeclaredField(Object obj, String fieldName) {
|
|
12
|
-
try {
|
|
13
|
-
Field f = getField(obj.getClass(), fieldName);
|
|
14
|
-
if (f == null) {
|
|
15
|
-
return null;
|
|
16
|
-
}
|
|
17
|
-
f.setAccessible(true);
|
|
18
|
-
return f.get(obj);
|
|
19
|
-
} catch (Exception e) {
|
|
20
|
-
e.printStackTrace();
|
|
21
|
-
}
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
private static Field getField(Class clazz, String name) {
|
|
26
|
-
try {
|
|
27
|
-
return clazz.getDeclaredField(name);
|
|
28
|
-
} catch (NoSuchFieldException nsfe) {
|
|
29
|
-
return getField(clazz.getSuperclass(), name);
|
|
30
|
-
} catch (Exception e) {
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
package/lib/android/src/main/java/com/wix/reactnativeuilib/textinput/DefaultKeyListener.java
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
package com.wix.reactnativeuilib.textinput;
|
|
2
|
-
|
|
3
|
-
import android.text.Editable;
|
|
4
|
-
import android.text.InputType;
|
|
5
|
-
import android.text.method.KeyListener;
|
|
6
|
-
import android.view.KeyEvent;
|
|
7
|
-
import android.view.View;
|
|
8
|
-
|
|
9
|
-
class DefaultKeyListener implements KeyListener {
|
|
10
|
-
@Override
|
|
11
|
-
public int getInputType() {
|
|
12
|
-
return InputType.TYPE_NULL;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
@Override
|
|
16
|
-
public boolean onKeyDown(View view, Editable text, int keyCode, KeyEvent event) {
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
@Override
|
|
21
|
-
public boolean onKeyUp(View view, Editable text, int keyCode, KeyEvent event) {
|
|
22
|
-
return false;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
@Override
|
|
26
|
-
public boolean onKeyOther(View view, Editable text, KeyEvent event) {
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
@Override
|
|
31
|
-
public void clearMetaKeyState(View view, Editable content, int states) {
|
|
32
|
-
}
|
|
33
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
package com.wix.reactnativeuilib.textinput;
|
|
2
|
-
|
|
3
|
-
import android.text.Editable;
|
|
4
|
-
import android.text.method.KeyListener;
|
|
5
|
-
import android.view.KeyEvent;
|
|
6
|
-
import android.view.View;
|
|
7
|
-
|
|
8
|
-
import com.facebook.react.bridge.Arguments;
|
|
9
|
-
import com.facebook.react.bridge.ReactApplicationContext;
|
|
10
|
-
import com.facebook.react.modules.core.DeviceEventManagerModule;
|
|
11
|
-
|
|
12
|
-
public class KeyListenerProxy implements KeyListener {
|
|
13
|
-
|
|
14
|
-
final private ReactApplicationContext mContext;
|
|
15
|
-
final private KeyListener mKeyListener;
|
|
16
|
-
|
|
17
|
-
KeyListenerProxy(ReactApplicationContext context, KeyListener keyListener) {
|
|
18
|
-
mContext = context;
|
|
19
|
-
mKeyListener = keyListener == null ? new DefaultKeyListener() : keyListener;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
@Override
|
|
23
|
-
public int getInputType() {
|
|
24
|
-
return mKeyListener.getInputType();
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
@Override
|
|
28
|
-
public boolean onKeyDown(View view, Editable text, int keyCode, KeyEvent event) {
|
|
29
|
-
return mKeyListener.onKeyDown(view, text, keyCode, event);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
@Override
|
|
33
|
-
public boolean onKeyUp(View view, Editable text, int keyCode, KeyEvent event) {
|
|
34
|
-
if (keyCode == KeyEvent.KEYCODE_DEL) {
|
|
35
|
-
emitBackspacePressEvent();
|
|
36
|
-
}
|
|
37
|
-
return mKeyListener.onKeyUp(view, text, keyCode, event);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
@Override
|
|
41
|
-
public boolean onKeyOther(View view, Editable text, KeyEvent event) {
|
|
42
|
-
return mKeyListener.onKeyOther(view, text, event);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
@Override
|
|
46
|
-
public void clearMetaKeyState(View view, Editable content, int states) {
|
|
47
|
-
mKeyListener.clearMetaKeyState(view, content, states);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
private void emitBackspacePressEvent() {
|
|
51
|
-
mContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class).emit("onBackspacePress", Arguments.createMap());
|
|
52
|
-
}
|
|
53
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
package com.wix.reactnativeuilib.textinput;
|
|
2
|
-
|
|
3
|
-
import android.util.Log;
|
|
4
|
-
import android.view.View;
|
|
5
|
-
|
|
6
|
-
import com.facebook.react.bridge.ReactApplicationContext;
|
|
7
|
-
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
8
|
-
import com.facebook.react.bridge.ReactMethod;
|
|
9
|
-
import com.facebook.react.uimanager.IllegalViewOperationException;
|
|
10
|
-
import com.facebook.react.uimanager.NativeViewHierarchyManager;
|
|
11
|
-
import com.facebook.react.uimanager.UIBlock;
|
|
12
|
-
import com.facebook.react.uimanager.UIManagerModule;
|
|
13
|
-
import com.facebook.react.views.textinput.ReactEditText;
|
|
14
|
-
|
|
15
|
-
public class TextInputDelKeyHandlerModule extends ReactContextBaseJavaModule {
|
|
16
|
-
|
|
17
|
-
private final static String REACT_CLASS = "TextInputDelKeyHandler";
|
|
18
|
-
|
|
19
|
-
TextInputDelKeyHandlerModule(ReactApplicationContext reactContext) {
|
|
20
|
-
super(reactContext);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
@Override
|
|
24
|
-
public String getName() {
|
|
25
|
-
return REACT_CLASS;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
@ReactMethod
|
|
29
|
-
public void register(final Integer textInputTag) {
|
|
30
|
-
final ReactApplicationContext reactContext = this.getReactApplicationContext();
|
|
31
|
-
final UIManagerModule uiManager = reactContext.getNativeModule(UIManagerModule.class);
|
|
32
|
-
|
|
33
|
-
uiManager.addUIBlock(new UIBlock() {
|
|
34
|
-
public void execute(NativeViewHierarchyManager viewHierarchyManager) {
|
|
35
|
-
Log.d("ReactNativeJS","registering tag = " + textInputTag);
|
|
36
|
-
final View view;
|
|
37
|
-
try {
|
|
38
|
-
view = viewHierarchyManager.resolveView(textInputTag);
|
|
39
|
-
} catch (IllegalViewOperationException e) {
|
|
40
|
-
Log.d("ReactNativeJS","no view for tag = " + textInputTag);
|
|
41
|
-
e.printStackTrace();
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
final ReactEditText editText = ViewUtils.getEditTextInView(view);
|
|
45
|
-
|
|
46
|
-
if (editText != null) {
|
|
47
|
-
Log.d("ReactNativeJS","has editText for tag = " + textInputTag);
|
|
48
|
-
final KeyListenerProxy keyListenerProxy = new KeyListenerProxy(reactContext, editText.getKeyListener());
|
|
49
|
-
editText.setKeyListener(keyListenerProxy);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
package com.wix.reactnativeuilib.textinput;
|
|
2
|
-
|
|
3
|
-
import com.facebook.react.ReactPackage;
|
|
4
|
-
import com.facebook.react.bridge.JavaScriptModule;
|
|
5
|
-
import com.facebook.react.bridge.NativeModule;
|
|
6
|
-
import com.facebook.react.bridge.ReactApplicationContext;
|
|
7
|
-
import com.facebook.react.uimanager.ViewManager;
|
|
8
|
-
|
|
9
|
-
import java.util.Arrays;
|
|
10
|
-
import java.util.Collections;
|
|
11
|
-
import java.util.List;
|
|
12
|
-
|
|
13
|
-
public class TextInputDelKeyHandlerPackage implements ReactPackage {
|
|
14
|
-
@Override
|
|
15
|
-
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
|
|
16
|
-
return Arrays.<NativeModule>asList(new TextInputDelKeyHandlerModule(reactContext));
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
// @Override
|
|
20
|
-
// public List<Class<? extends JavaScriptModule>> createJSModules() {
|
|
21
|
-
// return Collections.emptyList();
|
|
22
|
-
// }
|
|
23
|
-
|
|
24
|
-
@Override
|
|
25
|
-
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
|
|
26
|
-
return Collections.emptyList();
|
|
27
|
-
}
|
|
28
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
package com.wix.reactnativeuilib.textinput;
|
|
2
|
-
|
|
3
|
-
import android.view.View;
|
|
4
|
-
import android.view.ViewGroup;
|
|
5
|
-
|
|
6
|
-
import androidx.annotation.Nullable;
|
|
7
|
-
|
|
8
|
-
import com.facebook.react.views.textinput.ReactEditText;
|
|
9
|
-
|
|
10
|
-
class ViewUtils {
|
|
11
|
-
|
|
12
|
-
@Nullable
|
|
13
|
-
static ReactEditText getEditTextInView(View view) {
|
|
14
|
-
if (view == null) {
|
|
15
|
-
return null;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
if (view instanceof ReactEditText) {
|
|
19
|
-
return (ReactEditText) view;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
if (view instanceof ViewGroup) {
|
|
23
|
-
final ViewGroup viewGroup = (ViewGroup) view;
|
|
24
|
-
|
|
25
|
-
for (int i = 0; i < viewGroup.getChildCount(); i++) {
|
|
26
|
-
final View child = viewGroup.getChildAt(i);
|
|
27
|
-
final View childView = getEditTextInView(child);
|
|
28
|
-
|
|
29
|
-
if (childView != null) {
|
|
30
|
-
return (ReactEditText) childView;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
return null;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { requireNativeComponent, processColor, Platform, StyleSheet, Modal } from 'react-native';
|
|
3
|
-
const NativeHighlighterView = requireNativeComponent('HighlighterView');
|
|
4
|
-
const DefaultOverlayColor = 'rgba(0, 0, 0, 0.5)';
|
|
5
|
-
const HighlighterOverlayView = props => {
|
|
6
|
-
const {
|
|
7
|
-
overlayColor,
|
|
8
|
-
borderRadius,
|
|
9
|
-
strokeColor,
|
|
10
|
-
strokeWidth,
|
|
11
|
-
visible,
|
|
12
|
-
onRequestClose,
|
|
13
|
-
highlightFrame,
|
|
14
|
-
style,
|
|
15
|
-
children,
|
|
16
|
-
highlightViewTag,
|
|
17
|
-
highlightViewTagParams,
|
|
18
|
-
minimumRectSize,
|
|
19
|
-
innerPadding
|
|
20
|
-
} = props;
|
|
21
|
-
let overlayColorToUse = overlayColor || DefaultOverlayColor;
|
|
22
|
-
let strokeColorToUse = strokeColor;
|
|
23
|
-
if (Platform.OS === 'android') {
|
|
24
|
-
// @ts-ignore
|
|
25
|
-
overlayColorToUse = processColor(overlayColorToUse);
|
|
26
|
-
// @ts-ignore
|
|
27
|
-
strokeColorToUse = processColor(strokeColorToUse);
|
|
28
|
-
}
|
|
29
|
-
return <Modal visible={!!visible} animationType={'fade'} transparent onRequestClose={() => onRequestClose?.()}>
|
|
30
|
-
<NativeHighlighterView
|
|
31
|
-
// @ts-ignore, this became private, not sure if I should remove it
|
|
32
|
-
highlightFrame={highlightFrame} style={[style, {
|
|
33
|
-
...StyleSheet.absoluteFillObject,
|
|
34
|
-
backgroundColor: 'transparent'
|
|
35
|
-
}]} overlayColor={overlayColorToUse} borderRadius={borderRadius} strokeColor={strokeColorToUse} strokeWidth={strokeWidth} highlightViewTag={highlightViewTag} highlightViewTagParams={highlightViewTagParams} minimumRectSize={minimumRectSize} innerPadding={innerPadding} />
|
|
36
|
-
{children}
|
|
37
|
-
</Modal>;
|
|
38
|
-
};
|
|
39
|
-
HighlighterOverlayView.displayName = 'IGNORE';
|
|
40
|
-
export default HighlighterOverlayView;
|
package/lib/components/Keyboard/KeyboardInput/CustomKeyboardView/CustomKeyboardView.android.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { requireNativeComponent } from 'react-native';
|
|
3
|
-
import TextInputKeyboardManager from "../TextInputKeyboardManager/TextInputKeyboardManager.android";
|
|
4
|
-
import KeyboardRegistry from "../KeyboardRegistry";
|
|
5
|
-
import CustomKeyboardViewBase from "../CustomKeyboardViewBase";
|
|
6
|
-
const CustomKeyboardViewNativeAndroid = requireNativeComponent('CustomKeyboardViewNativeTemp');
|
|
7
|
-
export default class CustomKeyboardView extends CustomKeyboardViewBase {
|
|
8
|
-
static displayName = 'IGNORE';
|
|
9
|
-
async componentDidUpdate(prevProps) {
|
|
10
|
-
const {
|
|
11
|
-
component
|
|
12
|
-
} = this.props;
|
|
13
|
-
if (prevProps.component !== component && !component) {
|
|
14
|
-
await TextInputKeyboardManager.reset();
|
|
15
|
-
}
|
|
16
|
-
super.componentDidUpdate(prevProps);
|
|
17
|
-
}
|
|
18
|
-
render() {
|
|
19
|
-
const {
|
|
20
|
-
component,
|
|
21
|
-
initialProps
|
|
22
|
-
} = this.props;
|
|
23
|
-
const KeyboardComponent = component && KeyboardRegistry.getKeyboard(component);
|
|
24
|
-
return <CustomKeyboardViewNativeAndroid>
|
|
25
|
-
{KeyboardComponent && <KeyboardComponent {...initialProps} />}
|
|
26
|
-
</CustomKeyboardViewNativeAndroid>;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description: util for managing the keyboard.
|
|
3
|
-
* @example: https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/nativeComponentScreens/keyboardInput/KeyboardInputViewScreen.js
|
|
4
|
-
*/
|
|
5
|
-
export default class KeyboardUtils {
|
|
6
|
-
static displayName: string;
|
|
7
|
-
/**
|
|
8
|
-
* Used to dismiss (close) the keyboard.
|
|
9
|
-
*/
|
|
10
|
-
static dismiss: () => void;
|
|
11
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Keyboard } from 'react-native';
|
|
2
|
-
import TextInputKeyboardManager from "../TextInputKeyboardManager";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @description: util for managing the keyboard.
|
|
6
|
-
* @example: https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/nativeComponentScreens/keyboardInput/KeyboardInputViewScreen.js
|
|
7
|
-
*/
|
|
8
|
-
export default class KeyboardUtils {
|
|
9
|
-
static displayName = 'KeyboardUtils';
|
|
10
|
-
/**
|
|
11
|
-
* Used to dismiss (close) the keyboard.
|
|
12
|
-
*/
|
|
13
|
-
static dismiss = () => {
|
|
14
|
-
Keyboard.dismiss();
|
|
15
|
-
TextInputKeyboardManager.dismissKeyboard();
|
|
16
|
-
};
|
|
17
|
-
}
|
package/panningViews.d.ts
DELETED
package/panningViews.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require('./src/components/panningViews').default;
|
package/sharedTransition.d.ts
DELETED
package/sharedTransition.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require('./src/components/sharedTransition').default;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
-
import { PanningDirections } from '../panningViews/panningProvider';
|
|
4
|
-
interface DialogDismissibleProps {
|
|
5
|
-
/**
|
|
6
|
-
* Additional styling
|
|
7
|
-
*/
|
|
8
|
-
style?: StyleProp<ViewStyle>;
|
|
9
|
-
/**
|
|
10
|
-
* The direction of the allowed pan (default is DOWN)
|
|
11
|
-
* Types: UP, DOWN, LEFT and RIGHT (using PanningProvider.Directions.###)
|
|
12
|
-
*/
|
|
13
|
-
direction?: PanningDirections;
|
|
14
|
-
/**
|
|
15
|
-
* onDismiss callback
|
|
16
|
-
*/
|
|
17
|
-
onDismiss?: () => void;
|
|
18
|
-
/**
|
|
19
|
-
* The dialog`s container style
|
|
20
|
-
*/
|
|
21
|
-
containerStyle?: StyleProp<ViewStyle>;
|
|
22
|
-
/**
|
|
23
|
-
* Whether to show the dialog or not
|
|
24
|
-
*/
|
|
25
|
-
visible?: boolean;
|
|
26
|
-
}
|
|
27
|
-
interface Props extends DialogDismissibleProps {
|
|
28
|
-
children?: React.ReactNode | React.ReactNode[];
|
|
29
|
-
}
|
|
30
|
-
declare const DialogDismissibleView: {
|
|
31
|
-
(props: Props): React.JSX.Element;
|
|
32
|
-
displayName: string;
|
|
33
|
-
};
|
|
34
|
-
export default DialogDismissibleView;
|
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
import _isUndefined from "lodash/isUndefined";
|
|
2
|
-
import React, { useEffect, useRef, useCallback, useContext } from 'react';
|
|
3
|
-
import { Animated, Easing, StyleSheet } from 'react-native';
|
|
4
|
-
import { Constants } from "../../commons/new";
|
|
5
|
-
import View from "../view";
|
|
6
|
-
import PanningContext from "../panningViews/panningContext";
|
|
7
|
-
import PanningProvider from "../panningViews/panningProvider";
|
|
8
|
-
import PanResponderView from "../panningViews/panResponderView";
|
|
9
|
-
const MAXIMUM_DRAGS_AFTER_SWIPE = 2;
|
|
10
|
-
|
|
11
|
-
// TODO: move this to panningContext
|
|
12
|
-
|
|
13
|
-
const DEFAULT_DIRECTION = PanningProvider.Directions.DOWN;
|
|
14
|
-
const DialogDismissibleView = props => {
|
|
15
|
-
const {
|
|
16
|
-
direction = DEFAULT_DIRECTION,
|
|
17
|
-
visible: propsVisible,
|
|
18
|
-
containerStyle,
|
|
19
|
-
style,
|
|
20
|
-
children,
|
|
21
|
-
onDismiss = () => {}
|
|
22
|
-
} = props;
|
|
23
|
-
// @ts-expect-error
|
|
24
|
-
const {
|
|
25
|
-
isPanning,
|
|
26
|
-
dragDeltas,
|
|
27
|
-
swipeDirections
|
|
28
|
-
} = useContext(PanningContext);
|
|
29
|
-
const width = useRef(Constants.screenWidth);
|
|
30
|
-
const height = useRef(Constants.screenHeight);
|
|
31
|
-
const TOP_INSET = useRef(Constants.isIphoneX ? Constants.getSafeAreaInsets().top : Constants.isIOS ? 20 : 0);
|
|
32
|
-
const BOTTOM_INSET = useRef(Constants.isIphoneX ? Constants.getSafeAreaInsets().bottom : Constants.isIOS ? 20 : 0);
|
|
33
|
-
const thresholdX = useRef(0);
|
|
34
|
-
const thresholdY = useRef(0);
|
|
35
|
-
const dragsCounter = useRef(0);
|
|
36
|
-
const containerRef = useRef();
|
|
37
|
-
const animatedValue = useRef(new Animated.Value(0));
|
|
38
|
-
const mutableSwipeDirections = useRef({});
|
|
39
|
-
const prevDragDeltas = useRef();
|
|
40
|
-
const prevSwipeDirections = useRef();
|
|
41
|
-
const visible = useRef(Boolean(propsVisible));
|
|
42
|
-
const getHiddenLocation = useCallback((left, top) => {
|
|
43
|
-
const result = {
|
|
44
|
-
left: 0,
|
|
45
|
-
top: 0
|
|
46
|
-
};
|
|
47
|
-
switch (direction) {
|
|
48
|
-
case PanningProvider.Directions.LEFT:
|
|
49
|
-
result.left = -left - width.current;
|
|
50
|
-
break;
|
|
51
|
-
case PanningProvider.Directions.RIGHT:
|
|
52
|
-
result.left = Constants.screenWidth - left;
|
|
53
|
-
break;
|
|
54
|
-
case PanningProvider.Directions.UP:
|
|
55
|
-
result.top = -top - height.current - TOP_INSET.current;
|
|
56
|
-
break;
|
|
57
|
-
case PanningProvider.Directions.DOWN:
|
|
58
|
-
default:
|
|
59
|
-
result.top = Constants.screenHeight - top + BOTTOM_INSET.current;
|
|
60
|
-
break;
|
|
61
|
-
}
|
|
62
|
-
return result;
|
|
63
|
-
}, [direction]);
|
|
64
|
-
const hiddenLocation = useRef(getHiddenLocation(0, 0));
|
|
65
|
-
const animateTo = useCallback((toValue, animationEndCallback) => {
|
|
66
|
-
Animated.timing(animatedValue.current, {
|
|
67
|
-
toValue,
|
|
68
|
-
duration: 300,
|
|
69
|
-
easing: Easing.bezier(0.2, 0, 0.35, 1),
|
|
70
|
-
useNativeDriver: true
|
|
71
|
-
}).start(animationEndCallback);
|
|
72
|
-
}, []);
|
|
73
|
-
const isSwiping = useCallback(() => {
|
|
74
|
-
return !_isUndefined(mutableSwipeDirections.current.x) || !_isUndefined(mutableSwipeDirections.current.y);
|
|
75
|
-
}, []);
|
|
76
|
-
const resetSwipe = useCallback(() => {
|
|
77
|
-
dragsCounter.current = 0;
|
|
78
|
-
mutableSwipeDirections.current = {};
|
|
79
|
-
}, []);
|
|
80
|
-
const onDrag = useCallback(() => {
|
|
81
|
-
if (isSwiping()) {
|
|
82
|
-
if (dragsCounter.current < MAXIMUM_DRAGS_AFTER_SWIPE) {
|
|
83
|
-
dragsCounter.current += 1;
|
|
84
|
-
} else {
|
|
85
|
-
resetSwipe();
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}, [isSwiping, resetSwipe]);
|
|
89
|
-
const hide = useCallback(() => {
|
|
90
|
-
// TODO: test we're not animating?
|
|
91
|
-
animateTo(0, () => {
|
|
92
|
-
visible.current = false;
|
|
93
|
-
onDismiss?.();
|
|
94
|
-
});
|
|
95
|
-
}, [animateTo, onDismiss]);
|
|
96
|
-
useEffect(() => {
|
|
97
|
-
if (isPanning && (dragDeltas.x || dragDeltas.y) && (dragDeltas.x !== prevDragDeltas.current?.x || dragDeltas.y !== prevDragDeltas.current?.y)) {
|
|
98
|
-
onDrag();
|
|
99
|
-
prevDragDeltas.current = dragDeltas;
|
|
100
|
-
}
|
|
101
|
-
}, [isPanning, dragDeltas, onDrag, hide]);
|
|
102
|
-
useEffect(() => {
|
|
103
|
-
if (isPanning && (swipeDirections.x || swipeDirections.y) && (swipeDirections.x !== prevSwipeDirections.current?.x || swipeDirections.y !== prevSwipeDirections.current?.y)) {
|
|
104
|
-
mutableSwipeDirections.current = swipeDirections;
|
|
105
|
-
}
|
|
106
|
-
}, [isPanning, swipeDirections, hide]);
|
|
107
|
-
useEffect(() => {
|
|
108
|
-
if (visible.current && !propsVisible) {
|
|
109
|
-
hide();
|
|
110
|
-
}
|
|
111
|
-
}, [propsVisible, hide]);
|
|
112
|
-
const onLayout = useCallback(event => {
|
|
113
|
-
// DO NOT move the width\height into the measureInWindow - it causes errors with orientation change
|
|
114
|
-
const layout = event.nativeEvent.layout;
|
|
115
|
-
width.current = layout.width;
|
|
116
|
-
height.current = layout.height;
|
|
117
|
-
thresholdX.current = width.current / 2;
|
|
118
|
-
thresholdY.current = height.current / 2;
|
|
119
|
-
if (containerRef.current) {
|
|
120
|
-
// @ts-ignore TODO: can we fix this on ViewProps \ View?
|
|
121
|
-
containerRef.current.measureInWindow((x, y) => {
|
|
122
|
-
hiddenLocation.current = getHiddenLocation(x, y);
|
|
123
|
-
animateTo(1);
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
}, [getHiddenLocation, animateTo]);
|
|
127
|
-
const getAnimationStyle = useCallback(() => {
|
|
128
|
-
return {
|
|
129
|
-
transform: [{
|
|
130
|
-
translateX: animatedValue.current.interpolate({
|
|
131
|
-
inputRange: [0, 1],
|
|
132
|
-
outputRange: [hiddenLocation.current.left, 0]
|
|
133
|
-
})
|
|
134
|
-
}, {
|
|
135
|
-
translateY: animatedValue.current.interpolate({
|
|
136
|
-
inputRange: [0, 1],
|
|
137
|
-
outputRange: [hiddenLocation.current.top, 0]
|
|
138
|
-
})
|
|
139
|
-
}]
|
|
140
|
-
};
|
|
141
|
-
}, []);
|
|
142
|
-
const resetToShown = useCallback((left, top, direction) => {
|
|
143
|
-
const toValue =
|
|
144
|
-
//@ts-expect-error
|
|
145
|
-
[PanningProvider.Directions.LEFT, PanningProvider.Directions.RIGHT].includes(direction) ? 1 + left / hiddenLocation.current.left : 1 + top / hiddenLocation.current.top;
|
|
146
|
-
animateTo(toValue);
|
|
147
|
-
}, [animateTo]);
|
|
148
|
-
const onPanLocationChanged = useCallback(({
|
|
149
|
-
left = 0,
|
|
150
|
-
top = 0
|
|
151
|
-
}) => {
|
|
152
|
-
const endValue = {
|
|
153
|
-
x: Math.round(left),
|
|
154
|
-
y: Math.round(top)
|
|
155
|
-
};
|
|
156
|
-
if (isSwiping()) {
|
|
157
|
-
hide();
|
|
158
|
-
} else {
|
|
159
|
-
resetSwipe();
|
|
160
|
-
if (direction === PanningProvider.Directions.LEFT && endValue.x <= -thresholdX.current || direction === PanningProvider.Directions.RIGHT && endValue.x >= thresholdX.current || direction === PanningProvider.Directions.UP && endValue.y <= -thresholdY.current || direction === PanningProvider.Directions.DOWN && endValue.y >= thresholdY.current) {
|
|
161
|
-
hide();
|
|
162
|
-
} else {
|
|
163
|
-
resetToShown(left, top, direction);
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
}, [isSwiping, hide, resetSwipe, direction, resetToShown]);
|
|
167
|
-
return (
|
|
168
|
-
// @ts-ignore
|
|
169
|
-
<View ref={containerRef} style={containerStyle} onLayout={onLayout}>
|
|
170
|
-
<PanResponderView
|
|
171
|
-
// !visible.current && styles.hidden is done to fix a bug is iOS
|
|
172
|
-
style={[style, getAnimationStyle(), !visible.current && styles.hidden]} isAnimated onPanLocationChanged={onPanLocationChanged}>
|
|
173
|
-
{children}
|
|
174
|
-
</PanResponderView>
|
|
175
|
-
</View>
|
|
176
|
-
);
|
|
177
|
-
};
|
|
178
|
-
DialogDismissibleView.displayName = 'IGNORE';
|
|
179
|
-
export default DialogDismissibleView;
|
|
180
|
-
const styles = StyleSheet.create({
|
|
181
|
-
hidden: {
|
|
182
|
-
opacity: 0
|
|
183
|
-
}
|
|
184
|
-
});
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
interface Props {
|
|
3
|
-
testID?: string;
|
|
4
|
-
dialogVisibility?: boolean;
|
|
5
|
-
modalVisibility?: boolean;
|
|
6
|
-
overlayBackgroundColor?: string;
|
|
7
|
-
onFadeDone?: () => void;
|
|
8
|
-
fadeOut?: boolean;
|
|
9
|
-
}
|
|
10
|
-
declare const OverlayFadingBackground: {
|
|
11
|
-
({ testID, dialogVisibility, modalVisibility, overlayBackgroundColor, onFadeDone: propsOnFadeDone, fadeOut }: Props): React.JSX.Element;
|
|
12
|
-
displayName: string;
|
|
13
|
-
};
|
|
14
|
-
export default OverlayFadingBackground;
|