uilib-native 3.0.3 → 3.0.6
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/android/build/.transforms/{6a4a003a5436f1cfa6c642f89a88b8f1.bin → 7b85a4cb719e06b1cadba5128a161508/results.bin} +0 -0
- package/android/build/.transforms/7b85a4cb719e06b1cadba5128a161508/transformed/classes/classes.dex +0 -0
- package/android/build/.transforms/faa2afe0bc7898c632042480c288ecc2/results.bin +1 -0
- package/android/build/.transforms/faa2afe0bc7898c632042480c288ecc2/transformed/classes/classes.dex +0 -0
- package/android/build/generated/source/buildConfig/debug/com/wix/reactnativeuilib/BuildConfig.java +0 -8
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/AndroidManifest.xml +3 -5
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output-metadata.json +16 -0
- package/android/build/intermediates/aar_metadata/debug/aar-metadata.properties +2 -0
- package/android/build/intermediates/compile_library_classes_jar/debug/classes.jar +0 -0
- package/android/build/intermediates/compile_r_class_jar/debug/R.jar +0 -0
- package/android/build/intermediates/compile_symbol_list/debug/R.txt +1865 -0
- package/android/build/intermediates/compiled_local_resources/debug/out/layout_wheel_picker.xml.flat +0 -0
- package/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +1 -1
- package/android/build/intermediates/incremental/mergeDebugShaders/merger.xml +1 -1
- package/android/build/intermediates/incremental/packageDebugAssets/merger.xml +1 -1
- package/android/build/intermediates/incremental/packageDebugResources/compile-file-map.properties +2 -2
- package/android/build/intermediates/incremental/packageDebugResources/merger.xml +2 -2
- package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/BuildConfig.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/UiLibPackageList.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/highlighterview/HighlightFrame.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/highlighterview/HighlightViewTagParams.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/highlighterview/HighlighterView.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/highlighterview/HighlighterViewManager$1.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/highlighterview/HighlighterViewManager.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/highlighterview/HighlighterViewPackage.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/highlighterview/ReactHacks.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/highlighterview/ReflectionUtils.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/highlighterview/UiUtils.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/AppContextHolder$1.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/AppContextHolder.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/CustomKeyboardLayout$1.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/CustomKeyboardLayout$2.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/CustomKeyboardLayout$3.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/CustomKeyboardLayout$4.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/CustomKeyboardLayout$5.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/CustomKeyboardLayout.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/CustomKeyboardRootView.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/CustomKeyboardRootViewManager.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/CustomKeyboardRootViewShadow.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/KeyboardInputModule.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/KeyboardInputPackage.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/ReactContextHolder.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/ReactScreenMonitor$1.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/ReactScreenMonitor$Listener.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/ReactScreenMonitor.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/ReactSoftKeyboardMonitor$1.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/ReactSoftKeyboardMonitor$2.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/ReactSoftKeyboardMonitor$Listener.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/ReactSoftKeyboardMonitor.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/utils/PredicateFunc.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/utils/RuntimeUtils$1.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/utils/RuntimeUtils$2.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/utils/RuntimeUtils.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/utils/ViewUtils$1.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/utils/ViewUtils$VisibleViewClassMatchPredicate.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/utils/ViewUtils.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/textinput/DefaultKeyListener.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/textinput/KeyListenerProxy.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/textinput/TextInputDelKeyHandlerModule$1.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/textinput/TextInputDelKeyHandlerModule.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/textinput/TextInputDelKeyHandlerPackage.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/textinput/ViewUtils.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/utils/LogForwarder$LogType.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/utils/LogForwarder.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/wheelpicker/WheelPicker$1.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/wheelpicker/WheelPicker.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/wheelpicker/WheelPickerManager.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/wheelpicker/WheelPickerPackage.class +0 -0
- package/android/build/intermediates/local_only_symbol_list/debug/{parseDebugLibraryResources/R-def.txt → R-def.txt} +0 -0
- package/android/build/intermediates/manifest_merge_blame_file/debug/manifest-merger-blame-debug-report.txt +9 -11
- package/android/build/intermediates/merged_manifest/debug/AndroidManifest.xml +9 -0
- package/android/build/intermediates/navigation_json/debug/navigation.json +1 -0
- package/android/build/intermediates/packaged_manifests/debug/output-metadata.json +16 -0
- package/android/build/intermediates/runtime_library_classes_jar/debug/classes.jar +0 -0
- package/android/build/intermediates/{res/symbol-table-with-package → symbol_list_with_package_name}/debug/package-aware-r.txt +66 -8
- package/android/build/outputs/logs/manifest-merger-debug-report.txt +18 -30
- package/android/build/tmp/compileDebugJavaWithJavac/source-classes-mapping.txt +83 -0
- package/android/src/main/java/com/wix/reactnativeuilib/keyboardinput/CustomKeyboardLayout.java +41 -17
- package/android/src/main/java/com/wix/reactnativeuilib/keyboardinput/CustomKeyboardRootView.java +12 -0
- package/android/src/main/java/com/wix/reactnativeuilib/keyboardinput/KeyboardInputModule.java +1 -1
- package/components/{HighlighterOverlayView.js → HighlighterOverlayView.tsx} +40 -46
- package/components/Keyboard/KeyboardInput/{CustomKeyboardView.android.js → CustomKeyboardView/CustomKeyboardView.android.tsx} +9 -14
- package/components/Keyboard/KeyboardInput/{CustomKeyboardView.ios.js → CustomKeyboardView/CustomKeyboardView.ios.tsx} +20 -21
- package/components/Keyboard/KeyboardInput/CustomKeyboardView/index.tsx +16 -0
- package/components/Keyboard/KeyboardInput/{CustomKeyboardViewBase.js → CustomKeyboardViewBase.tsx} +26 -20
- package/components/Keyboard/KeyboardInput/{KeyboardAccessoryView.js → KeyboardAccessoryView.tsx} +119 -100
- package/components/Keyboard/KeyboardInput/{KeyboardRegistry.js → KeyboardRegistry.ts} +10 -10
- package/components/Keyboard/KeyboardInput/{TextInputKeyboardManager.android.js → TextInputKeyboardManager/TextInputKeyboardManager.android.ts} +1 -1
- package/components/Keyboard/KeyboardInput/{TextInputKeyboardManager.ios.js → TextInputKeyboardManager/TextInputKeyboardManager.ios.ts} +5 -4
- package/components/Keyboard/KeyboardInput/TextInputKeyboardManager/index.ts +9 -0
- package/components/Keyboard/KeyboardInput/utils/{EventEmitterManager.js → EventEmitterManager.ts} +5 -4
- package/components/Keyboard/KeyboardInput/utils/{KeyboardUtils.js → KeyboardUtils.ts} +0 -0
- package/components/Keyboard/KeyboardTracking/{KeyboardAwareInsetsView.js → KeyboardAwareInsetsView.tsx} +3 -4
- package/components/Keyboard/KeyboardTracking/{KeyboardTrackingView.android.js → KeyboardTrackingView/KeyboardTrackingView.android.tsx} +1 -0
- package/components/Keyboard/KeyboardTracking/{KeyboardTrackingView.ios.js → KeyboardTrackingView/KeyboardTrackingView.ios.tsx} +8 -14
- package/components/Keyboard/KeyboardTracking/KeyboardTrackingView/index.tsx +54 -0
- package/components/Keyboard/index.ts +15 -0
- package/components/SafeArea/{SafeAreaInsetsManager.js → SafeAreaInsetsManager.ts} +10 -7
- package/components/SafeArea/SafeAreaSpacerView.tsx +19 -0
- package/components/WheelPicker/WheelPickerItem.tsx +21 -0
- package/components/WheelPicker/{index.js → index.tsx} +58 -38
- package/components/index.ts +14 -0
- package/ios/reactnativeuilib/keyboardtrackingview/KeyboardTrackingViewTempManager.m +44 -2
- package/package.json +1 -1
- package/android/.gradle/5.6.1/fileChanges/last-build.bin +0 -0
- package/android/.gradle/5.6.1/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/5.6.1/gc.properties +0 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/.idea/codeStyles/Project.xml +0 -116
- package/android/.idea/encodings.xml +0 -4
- package/android/.idea/gradle.xml +0 -12
- package/android/.idea/misc.xml +0 -9
- package/android/.idea/modules.xml +0 -8
- package/android/.idea/runConfigurations.xml +0 -12
- package/android/.idea/vcs.xml +0 -6
- package/android/.idea/workspace.xml +0 -547
- package/android/android.iml +0 -18
- package/android/build/.transforms/6a4a003a5436f1cfa6c642f89a88b8f1/classes/classes.dex +0 -0
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output.json +0 -1
- package/android/build/intermediates/compile_library_classes/debug/classes.jar +0 -0
- package/android/build/intermediates/compile_only_not_namespaced_r_class_jar/debug/R.jar +0 -0
- package/android/build/intermediates/incremental/debug-mergeNativeLibs/merge-state +0 -0
- package/android/build/intermediates/library_java_res/debug/res.jar +0 -0
- package/android/build/intermediates/library_manifest/debug/AndroidManifest.xml +0 -11
- package/android/build/intermediates/merged_manifests/debug/output.json +0 -1
- package/android/build/intermediates/runtime_library_classes/debug/classes.jar +0 -0
- package/android/build/intermediates/symbols/debug/R.txt +0 -1801
- package/android/local.properties +0 -8
- package/android/react-native-ui-lib.iml +0 -144
- package/components/Keyboard/index.js +0 -7
- package/components/SafeArea/SafeAreaSpacerView.js +0 -16
- package/components/WheelPicker/WheelPickerItem.js +0 -21
- package/components/index.js +0 -17
- package/ios/reactnativeuilib.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
- package/ios/reactnativeuilib.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- package/ios/reactnativeuilib.xcodeproj/project.xcworkspace/xcuserdata/michaelle.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/reactnativeuilib.xcodeproj/xcuserdata/michaelle.xcuserdatad/xcschemes/xcschememanagement.plist +0 -19
package/components/Keyboard/KeyboardInput/{KeyboardAccessoryView.js → KeyboardAccessoryView.tsx}
RENAMED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React, {Component} from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
2
|
import {
|
|
4
3
|
StyleSheet,
|
|
5
4
|
Platform,
|
|
@@ -7,7 +6,8 @@ import {
|
|
|
7
6
|
NativeEventEmitter,
|
|
8
7
|
DeviceEventEmitter,
|
|
9
8
|
processColor,
|
|
10
|
-
BackHandler
|
|
9
|
+
BackHandler,
|
|
10
|
+
LayoutChangeEvent
|
|
11
11
|
} from 'react-native';
|
|
12
12
|
import KeyboardTrackingView from '../KeyboardTracking/KeyboardTrackingView';
|
|
13
13
|
import CustomKeyboardView from './CustomKeyboardView';
|
|
@@ -18,107 +18,117 @@ const IsAndroid = Platform.OS === 'android';
|
|
|
18
18
|
|
|
19
19
|
const IOS_SCROLL_BEHAVIORS = IsIOS
|
|
20
20
|
? {
|
|
21
|
-
NONE: NativeModules.KeyboardTrackingViewTempManager
|
|
21
|
+
NONE: NativeModules.KeyboardTrackingViewTempManager?.KeyboardTrackingScrollBehaviorNone,
|
|
22
22
|
SCROLL_TO_BOTTOM_INVERTED_ONLY:
|
|
23
|
-
NativeModules.KeyboardTrackingViewTempManager
|
|
24
|
-
FIXED_OFFSET: NativeModules.KeyboardTrackingViewTempManager
|
|
23
|
+
NativeModules.KeyboardTrackingViewTempManager?.KeyboardTrackingScrollBehaviorScrollToBottomInvertedOnly,
|
|
24
|
+
FIXED_OFFSET: NativeModules.KeyboardTrackingViewTempManager?.KeyboardTrackingScrollBehaviorFixedOffset
|
|
25
25
|
}
|
|
26
26
|
: {};
|
|
27
27
|
|
|
28
|
+
export type KeyboardAccessoryViewProps = {
|
|
29
|
+
/**
|
|
30
|
+
* Content to be rendered above the keyboard
|
|
31
|
+
*/
|
|
32
|
+
renderContent?: () => React.ReactElement;
|
|
33
|
+
/**
|
|
34
|
+
* A callback for when the height is changed
|
|
35
|
+
*/
|
|
36
|
+
onHeightChanged?: (height: number) => void;
|
|
37
|
+
/**
|
|
38
|
+
* iOS only.
|
|
39
|
+
* The reference to the actual text input (or the keyboard may not reset when instructed to, etc.).
|
|
40
|
+
* This is required.
|
|
41
|
+
*/
|
|
42
|
+
kbInputRef?: any;
|
|
43
|
+
/**
|
|
44
|
+
* The keyboard ID (the componentID sent to KeyboardRegistry)
|
|
45
|
+
*/
|
|
46
|
+
kbComponent?: string;
|
|
47
|
+
/**
|
|
48
|
+
* The props that will be sent to the KeyboardComponent
|
|
49
|
+
*/
|
|
50
|
+
kbInitialProps?: any;
|
|
51
|
+
/**
|
|
52
|
+
* Callback that will be called when an item on the keyboard has been pressed.
|
|
53
|
+
*/
|
|
54
|
+
onItemSelected?: () => void;
|
|
55
|
+
/**
|
|
56
|
+
* Callback that will be called if KeyboardRegistry.requestShowKeyboard is called.
|
|
57
|
+
*/
|
|
58
|
+
onRequestShowKeyboard?: () => void;
|
|
59
|
+
/**
|
|
60
|
+
* Callback that will be called once the keyboard has been closed
|
|
61
|
+
*/
|
|
62
|
+
onKeyboardResigned?: () => void;
|
|
63
|
+
/**
|
|
64
|
+
* iOS only.
|
|
65
|
+
* The scrolling behavior, use KeyboardAccessoryView.iosScrollBehaviors.X where X is:
|
|
66
|
+
* NONE, SCROLL_TO_BOTTOM_INVERTED_ONLY or FIXED_OFFSET
|
|
67
|
+
*
|
|
68
|
+
* default: FIXED_OFFSET
|
|
69
|
+
*/
|
|
70
|
+
iOSScrollBehavior?: number;
|
|
71
|
+
/**
|
|
72
|
+
* iOS only.
|
|
73
|
+
* Show the keyboard on a negative scroll
|
|
74
|
+
*
|
|
75
|
+
* default: false
|
|
76
|
+
*/
|
|
77
|
+
revealKeyboardInteractive?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* iOS only.
|
|
80
|
+
* Set to false to turn off inset management and manage it yourself
|
|
81
|
+
*
|
|
82
|
+
* default: true
|
|
83
|
+
*/
|
|
84
|
+
manageScrollView?: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* iOS only.
|
|
87
|
+
* Set to true manageScrollView is set to true and still does not work,
|
|
88
|
+
* it means that the ScrollView found is the wrong one and you'll have
|
|
89
|
+
* to have the KeyboardAccessoryView and the ScrollView as siblings
|
|
90
|
+
* and set this to true
|
|
91
|
+
*
|
|
92
|
+
* default: false
|
|
93
|
+
*/
|
|
94
|
+
requiresSameParentToManageScrollView?: boolean;
|
|
95
|
+
/**
|
|
96
|
+
* iOS only.
|
|
97
|
+
* Add a (white) SafeArea view beneath the KeyboardAccessoryView
|
|
98
|
+
*
|
|
99
|
+
* default: false
|
|
100
|
+
*/
|
|
101
|
+
addBottomView?: boolean;
|
|
102
|
+
/**
|
|
103
|
+
* iOS only.
|
|
104
|
+
* Allow hitting sub-views that are placed beyond the view bounds
|
|
105
|
+
*
|
|
106
|
+
* default: false
|
|
107
|
+
*/
|
|
108
|
+
allowHitsOutsideBounds?: boolean;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* iOS only.
|
|
112
|
+
* Whether or not to handle SafeArea
|
|
113
|
+
* default: true
|
|
114
|
+
*/
|
|
115
|
+
useSafeArea?: boolean;
|
|
116
|
+
/**
|
|
117
|
+
* iOS only.
|
|
118
|
+
* Whether or not to include bottom tab bat inset
|
|
119
|
+
* default: true
|
|
120
|
+
*/
|
|
121
|
+
usesBottomTabs?: boolean;
|
|
122
|
+
|
|
123
|
+
children?: React.ReactChild;
|
|
124
|
+
};
|
|
125
|
+
|
|
28
126
|
/**
|
|
29
127
|
* @description: View that allows replacing the default keyboard with other components
|
|
30
128
|
* @example: https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/nativeComponentScreens/keyboardInput/KeyboardInputViewScreen.js
|
|
129
|
+
* @gif: https://github.com/wix/react-native-ui-lib/blob/master/demo/showcase/KeyboardAccessoryView/KeyboardAccessoryView.gif?raw=true
|
|
31
130
|
*/
|
|
32
|
-
class KeyboardAccessoryView extends Component {
|
|
33
|
-
static propTypes = {
|
|
34
|
-
/**
|
|
35
|
-
* Content to be rendered above the keyboard
|
|
36
|
-
*/
|
|
37
|
-
renderContent: PropTypes.func,
|
|
38
|
-
/**
|
|
39
|
-
* A callback for when the height is changed
|
|
40
|
-
*/
|
|
41
|
-
onHeightChanged: PropTypes.func,
|
|
42
|
-
/**
|
|
43
|
-
* iOS only.
|
|
44
|
-
* The reference to the actual text input (or the keyboard may not reset when instructed to, etc.).
|
|
45
|
-
* This is required.
|
|
46
|
-
*/
|
|
47
|
-
kbInputRef: PropTypes.object,
|
|
48
|
-
/**
|
|
49
|
-
* The keyboard ID (the componentID sent to KeyboardRegistry)
|
|
50
|
-
*/
|
|
51
|
-
kbComponent: PropTypes.string,
|
|
52
|
-
/**
|
|
53
|
-
* The props that will be sent to the KeyboardComponent
|
|
54
|
-
*/
|
|
55
|
-
kbInitialProps: PropTypes.object,
|
|
56
|
-
/**
|
|
57
|
-
* Callback that will be called when an item on the keyboard has been pressed.
|
|
58
|
-
*/
|
|
59
|
-
onItemSelected: PropTypes.func,
|
|
60
|
-
/**
|
|
61
|
-
* Callback that will be called if KeyboardRegistry.requestShowKeyboard is called.
|
|
62
|
-
*/
|
|
63
|
-
onRequestShowKeyboard: PropTypes.func,
|
|
64
|
-
/**
|
|
65
|
-
* Callback that will be called once the keyboard has been closed
|
|
66
|
-
*/
|
|
67
|
-
onKeyboardResigned: PropTypes.func,
|
|
68
|
-
/**
|
|
69
|
-
* iOS only.
|
|
70
|
-
* The scrolling behavior, use KeyboardAccessoryView.iosScrollBehaviors.X where X is:
|
|
71
|
-
* NONE, SCROLL_TO_BOTTOM_INVERTED_ONLY or FIXED_OFFSET
|
|
72
|
-
*
|
|
73
|
-
* default: FIXED_OFFSET
|
|
74
|
-
*/
|
|
75
|
-
iOSScrollBehavior: PropTypes.number,
|
|
76
|
-
/**
|
|
77
|
-
* iOS only.
|
|
78
|
-
* Show the keyboard on a negative scroll
|
|
79
|
-
*
|
|
80
|
-
* default: false
|
|
81
|
-
*/
|
|
82
|
-
revealKeyboardInteractive: PropTypes.bool,
|
|
83
|
-
/**
|
|
84
|
-
* iOS only.
|
|
85
|
-
* Set to false to turn off inset management and manage it yourself
|
|
86
|
-
*
|
|
87
|
-
* default: true
|
|
88
|
-
*/
|
|
89
|
-
manageScrollView: PropTypes.bool,
|
|
90
|
-
/**
|
|
91
|
-
* iOS only.
|
|
92
|
-
* Set to true manageScrollView is set to true and still does not work,
|
|
93
|
-
* it means that the ScrollView found is the wrong one and you'll have
|
|
94
|
-
* to have the KeyboardAccessoryView and the ScrollView as siblings
|
|
95
|
-
* and set this to true
|
|
96
|
-
*
|
|
97
|
-
* default: false
|
|
98
|
-
*/
|
|
99
|
-
requiresSameParentToManageScrollView: PropTypes.bool,
|
|
100
|
-
/**
|
|
101
|
-
* iOS only.
|
|
102
|
-
* Add a (white) SafeArea view beneath the KeyboardAccessoryView
|
|
103
|
-
*
|
|
104
|
-
* default: false
|
|
105
|
-
*/
|
|
106
|
-
addBottomView: PropTypes.bool,
|
|
107
|
-
/**
|
|
108
|
-
* iOS only.
|
|
109
|
-
* Allow hitting sub-views that are placed beyond the view bounds
|
|
110
|
-
*
|
|
111
|
-
* default: false
|
|
112
|
-
*/
|
|
113
|
-
allowHitsOutsideBounds: PropTypes.bool,
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* iOS only.
|
|
117
|
-
* Whether or not to handle SafeArea
|
|
118
|
-
* default: true
|
|
119
|
-
*/
|
|
120
|
-
useSafeArea: PropTypes.bool
|
|
121
|
-
};
|
|
131
|
+
class KeyboardAccessoryView extends Component<KeyboardAccessoryViewProps> {
|
|
122
132
|
|
|
123
133
|
static iosScrollBehaviors = IOS_SCROLL_BEHAVIORS;
|
|
124
134
|
|
|
@@ -131,7 +141,11 @@ class KeyboardAccessoryView extends Component {
|
|
|
131
141
|
allowHitsOutsideBounds: false
|
|
132
142
|
};
|
|
133
143
|
|
|
134
|
-
|
|
144
|
+
// TODO: fix
|
|
145
|
+
customInputControllerEventsSubscriber: any;
|
|
146
|
+
trackingViewRef: any;
|
|
147
|
+
|
|
148
|
+
constructor(props: KeyboardAccessoryViewProps) {
|
|
135
149
|
super(props);
|
|
136
150
|
|
|
137
151
|
this.onContainerComponentHeightChanged = this.onContainerComponentHeightChanged.bind(this);
|
|
@@ -153,7 +167,7 @@ class KeyboardAccessoryView extends Component {
|
|
|
153
167
|
}
|
|
154
168
|
}
|
|
155
169
|
|
|
156
|
-
onContainerComponentHeightChanged(event) {
|
|
170
|
+
onContainerComponentHeightChanged(event: LayoutChangeEvent) {
|
|
157
171
|
const {onHeightChanged} = this.props;
|
|
158
172
|
|
|
159
173
|
if (onHeightChanged) {
|
|
@@ -244,13 +258,15 @@ class KeyboardAccessoryView extends Component {
|
|
|
244
258
|
kbComponent,
|
|
245
259
|
onItemSelected,
|
|
246
260
|
onRequestShowKeyboard,
|
|
247
|
-
useSafeArea
|
|
261
|
+
useSafeArea,
|
|
262
|
+
usesBottomTabs
|
|
248
263
|
} = this.props;
|
|
249
264
|
|
|
250
265
|
return (
|
|
251
266
|
<KeyboardTrackingView
|
|
252
|
-
ref={r => (this.trackingViewRef = r)}
|
|
267
|
+
ref={(r: any) => (this.trackingViewRef = r)}
|
|
253
268
|
style={styles.trackingToolbarContainer}
|
|
269
|
+
// @ts-ignore
|
|
254
270
|
onLayout={this.onContainerComponentHeightChanged}
|
|
255
271
|
scrollBehavior={this.getIOSTrackingScrollBehavior()}
|
|
256
272
|
revealKeyboardInteractive={revealKeyboardInteractive}
|
|
@@ -258,8 +274,11 @@ class KeyboardAccessoryView extends Component {
|
|
|
258
274
|
requiresSameParentToManageScrollView={requiresSameParentToManageScrollView}
|
|
259
275
|
addBottomView={addBottomView}
|
|
260
276
|
allowHitsOutsideBounds={allowHitsOutsideBounds}
|
|
277
|
+
usesBottomTabs={usesBottomTabs}
|
|
261
278
|
>
|
|
262
|
-
|
|
279
|
+
<>
|
|
280
|
+
{renderContent?.()}
|
|
281
|
+
</>
|
|
263
282
|
<CustomKeyboardView
|
|
264
283
|
inputRef={kbInputRef}
|
|
265
284
|
component={kbComponent}
|
|
@@ -6,7 +6,7 @@ import EventEmitterManager from './utils/EventEmitterManager';
|
|
|
6
6
|
* Tech debt: how to deal with multiple registries in the app?
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
const getKeyboardsWithIDs = keyboardIDs => {
|
|
9
|
+
const getKeyboardsWithIDs = (keyboardIDs: string[]) => {
|
|
10
10
|
return keyboardIDs.map(keyboardId => {
|
|
11
11
|
return {
|
|
12
12
|
id: keyboardId,
|
|
@@ -21,7 +21,7 @@ const getKeyboardsWithIDs = keyboardIDs => {
|
|
|
21
21
|
*/
|
|
22
22
|
export default class KeyboardRegistry {
|
|
23
23
|
static displayName = 'KeyboardRegistry';
|
|
24
|
-
static registeredKeyboards = {};
|
|
24
|
+
static registeredKeyboards: {[key: string]: any} = {};
|
|
25
25
|
static eventEmitter = new EventEmitterManager();
|
|
26
26
|
|
|
27
27
|
/**
|
|
@@ -30,7 +30,7 @@ export default class KeyboardRegistry {
|
|
|
30
30
|
* generator (function) - a function for the creation of the keyboard.
|
|
31
31
|
* params (object) - to be returned when using other methods (i.e. getKeyboards and getAllKeyboards).
|
|
32
32
|
*/
|
|
33
|
-
static registerKeyboard = (componentID, generator, params = {}) => {
|
|
33
|
+
static registerKeyboard = (componentID: string, generator: Function, params = {}) => {
|
|
34
34
|
if (!_.isFunction(generator)) {
|
|
35
35
|
console.error(`KeyboardRegistry.registerKeyboard: ${componentID} you must register a generator function`);
|
|
36
36
|
return;
|
|
@@ -43,7 +43,7 @@ export default class KeyboardRegistry {
|
|
|
43
43
|
* Get a specific keyboard
|
|
44
44
|
* componentID (string) - the ID of the keyboard.
|
|
45
45
|
*/
|
|
46
|
-
static getKeyboard = componentID => {
|
|
46
|
+
static getKeyboard = (componentID: string) => {
|
|
47
47
|
const res = KeyboardRegistry.registeredKeyboards[componentID];
|
|
48
48
|
if (!res || !res.generator) {
|
|
49
49
|
console.error(`KeyboardRegistry.getKeyboard: ${componentID} used but not yet registered`);
|
|
@@ -74,7 +74,7 @@ export default class KeyboardRegistry {
|
|
|
74
74
|
* (i.e. if componentID='kb1' globalID='kb1.onItemSelected')
|
|
75
75
|
* callback (function) - the callback to be called when the said event happens
|
|
76
76
|
*/
|
|
77
|
-
static addListener = (globalID, callback) => {
|
|
77
|
+
static addListener = (globalID: string, callback: Function) => {
|
|
78
78
|
KeyboardRegistry.eventEmitter.listenOn(globalID, callback);
|
|
79
79
|
};
|
|
80
80
|
|
|
@@ -84,7 +84,7 @@ export default class KeyboardRegistry {
|
|
|
84
84
|
* (i.e. if componentID='kb1' globalID='kb1.onItemSelected')
|
|
85
85
|
* args (object) - data to be sent to the listener.
|
|
86
86
|
*/
|
|
87
|
-
static notifyListeners = (globalID, args) => {
|
|
87
|
+
static notifyListeners = (globalID: string, args: any) => {
|
|
88
88
|
KeyboardRegistry.eventEmitter.emitEvent(globalID, args);
|
|
89
89
|
};
|
|
90
90
|
|
|
@@ -93,7 +93,7 @@ export default class KeyboardRegistry {
|
|
|
93
93
|
* globalID (string) - ID that includes the componentID and the event name
|
|
94
94
|
* (i.e. if componentID='kb1' globalID='kb1.onItemSelected')
|
|
95
95
|
*/
|
|
96
|
-
static removeListeners = globalID => {
|
|
96
|
+
static removeListeners = (globalID: string) => {
|
|
97
97
|
KeyboardRegistry.eventEmitter.removeListeners(globalID);
|
|
98
98
|
};
|
|
99
99
|
|
|
@@ -102,7 +102,7 @@ export default class KeyboardRegistry {
|
|
|
102
102
|
* componentID (string) - the ID of the keyboard.
|
|
103
103
|
* args (object) - data to be sent to the listener.
|
|
104
104
|
*/
|
|
105
|
-
static onItemSelected = (componentID, args) => {
|
|
105
|
+
static onItemSelected = (componentID: string, args: any) => {
|
|
106
106
|
KeyboardRegistry.notifyListeners(`${componentID}.onItemSelected`, args);
|
|
107
107
|
};
|
|
108
108
|
|
|
@@ -110,7 +110,7 @@ export default class KeyboardRegistry {
|
|
|
110
110
|
* Request to show the keyboard
|
|
111
111
|
* componentID (string) - the ID of the keyboard.
|
|
112
112
|
*/
|
|
113
|
-
static requestShowKeyboard = componentID => {
|
|
113
|
+
static requestShowKeyboard = (componentID: string) => {
|
|
114
114
|
KeyboardRegistry.notifyListeners('onRequestShowKeyboard', {keyboardId: componentID});
|
|
115
115
|
};
|
|
116
116
|
|
|
@@ -119,7 +119,7 @@ export default class KeyboardRegistry {
|
|
|
119
119
|
* Call to make the keyboard full screen
|
|
120
120
|
* componentID (string) - the ID of the keyboard.
|
|
121
121
|
*/
|
|
122
|
-
static toggleExpandedKeyboard = componentID => {
|
|
122
|
+
static toggleExpandedKeyboard = (componentID: string) => {
|
|
123
123
|
KeyboardRegistry.notifyListeners('onToggleExpandedKeyboard', {keyboardId: componentID});
|
|
124
124
|
};
|
|
125
125
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {NativeModules} from 'react-native';
|
|
2
2
|
|
|
3
|
-
const CustomKeyboardInput = NativeModules.
|
|
3
|
+
const CustomKeyboardInput = NativeModules.CustomKeyboardInputTemp;
|
|
4
4
|
|
|
5
5
|
export default class TextInputKeyboardManager {
|
|
6
6
|
static reset = () => CustomKeyboardInput.reset();
|
|
@@ -3,7 +3,8 @@ import ReactNative, {NativeModules, LayoutAnimation} from 'react-native';
|
|
|
3
3
|
const CustomInputControllerTemp = NativeModules.CustomInputControllerTemp;
|
|
4
4
|
|
|
5
5
|
export default class TextInputKeyboardManager {
|
|
6
|
-
static setInputComponent = (textInputRef
|
|
6
|
+
static setInputComponent = (textInputRef: any,
|
|
7
|
+
{component, initialProps, useSafeArea}: {component?: string; initialProps: any; useSafeArea?: boolean}) => {
|
|
7
8
|
if (!textInputRef || !CustomInputControllerTemp) {
|
|
8
9
|
return;
|
|
9
10
|
}
|
|
@@ -13,7 +14,7 @@ export default class TextInputKeyboardManager {
|
|
|
13
14
|
}
|
|
14
15
|
};
|
|
15
16
|
|
|
16
|
-
static removeInputComponent = textInputRef => {
|
|
17
|
+
static removeInputComponent = (textInputRef: any) => {
|
|
17
18
|
if (!textInputRef || !CustomInputControllerTemp) {
|
|
18
19
|
return;
|
|
19
20
|
}
|
|
@@ -27,7 +28,7 @@ export default class TextInputKeyboardManager {
|
|
|
27
28
|
CustomInputControllerTemp.dismissKeyboard();
|
|
28
29
|
};
|
|
29
30
|
|
|
30
|
-
static toggleExpandKeyboard = (textInputRef, expand, performLayoutAnimation = false) => {
|
|
31
|
+
static toggleExpandKeyboard = (textInputRef: any, expand: boolean, performLayoutAnimation = false) => {
|
|
31
32
|
if (textInputRef) {
|
|
32
33
|
if (performLayoutAnimation) {
|
|
33
34
|
LayoutAnimation.configureNext(springAnimation);
|
|
@@ -42,7 +43,7 @@ export default class TextInputKeyboardManager {
|
|
|
42
43
|
};
|
|
43
44
|
}
|
|
44
45
|
|
|
45
|
-
function findNodeHandle(ref) {
|
|
46
|
+
function findNodeHandle(ref: any) {
|
|
46
47
|
return ReactNative.findNodeHandle(ref.current || ref);
|
|
47
48
|
}
|
|
48
49
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import {Platform} from 'react-native';
|
|
2
|
+
import {default as TextInputKeyboardManagerIOS} from './TextInputKeyboardManager.ios';
|
|
3
|
+
import {default as TextInputKeyboardManagerAndroid} from './TextInputKeyboardManager.android';
|
|
4
|
+
|
|
5
|
+
const IsAndroid = Platform.OS === 'android';
|
|
6
|
+
|
|
7
|
+
const TextInputKeyboardManager = IsAndroid ? TextInputKeyboardManagerAndroid : TextInputKeyboardManagerIOS;
|
|
8
|
+
|
|
9
|
+
export default TextInputKeyboardManager;
|
package/components/Keyboard/KeyboardInput/utils/{EventEmitterManager.js → EventEmitterManager.ts}
RENAMED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
2
|
|
|
3
3
|
export default class EventEmitterManager {
|
|
4
|
+
handlerCallbacks: {[key: string]: Function[]} = {};
|
|
4
5
|
constructor() {
|
|
5
6
|
this.handlerCallbacks = {};
|
|
6
7
|
}
|
|
7
8
|
|
|
8
|
-
listenOn(eventName, handlerCallback) {
|
|
9
|
+
listenOn(eventName: string, handlerCallback: Function) {
|
|
9
10
|
if (!this.handlerCallbacks[eventName]) {
|
|
10
11
|
this.handlerCallbacks[eventName] = [];
|
|
11
12
|
}
|
|
@@ -14,17 +15,17 @@ export default class EventEmitterManager {
|
|
|
14
15
|
}
|
|
15
16
|
}
|
|
16
17
|
|
|
17
|
-
emitEvent(eventName, params = {}) {
|
|
18
|
+
emitEvent(eventName: string, params = {}) {
|
|
18
19
|
if (this.handlerCallbacks[eventName]) {
|
|
19
20
|
this.handlerCallbacks[eventName].forEach(callback => callback(params));
|
|
20
21
|
}
|
|
21
22
|
}
|
|
22
23
|
|
|
23
|
-
removeListeners(eventName) {
|
|
24
|
+
removeListeners(eventName: string) {
|
|
24
25
|
delete this.handlerCallbacks[eventName];
|
|
25
26
|
}
|
|
26
27
|
|
|
27
|
-
removeListener(eventName, listener) {
|
|
28
|
+
removeListener(eventName: string, listener: Function) {
|
|
28
29
|
const handlers = this.handlerCallbacks[eventName];
|
|
29
30
|
|
|
30
31
|
if (handlers) {
|
|
File without changes
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import {StyleSheet, Dimensions} from 'react-native';
|
|
3
|
-
import KeyboardTrackingView from './KeyboardTrackingView';
|
|
3
|
+
import KeyboardTrackingView, {KeyboardTrackingViewProps} from './KeyboardTrackingView';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @description: Used to add an inset when a keyboard is used and might hide part of the screen.
|
|
7
7
|
*
|
|
8
|
-
* @example: https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/InputsScreen.js
|
|
8
|
+
* @example: https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/TextFieldScreen/InputsScreen.js
|
|
9
9
|
* @notes: This view is useful only for iOS.
|
|
10
10
|
*/
|
|
11
|
-
const KeyboardAwareInsetsView = props => (
|
|
11
|
+
const KeyboardAwareInsetsView = (props: KeyboardTrackingViewProps) => (
|
|
12
12
|
<KeyboardTrackingView {...props} pointerEvents={'none'} style={styles.insetsView} scrollToFocusedInput/>
|
|
13
13
|
);
|
|
14
14
|
|
|
@@ -25,6 +25,5 @@ const styles = StyleSheet.create({
|
|
|
25
25
|
});
|
|
26
26
|
|
|
27
27
|
KeyboardAwareInsetsView.displayName = 'KeyboardAwareInsetsView';
|
|
28
|
-
KeyboardAwareInsetsView.propTypes = KeyboardTrackingView.propTypes;
|
|
29
28
|
|
|
30
29
|
export default KeyboardAwareInsetsView;
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* Created by artald on 15/05/2016.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import PropTypes from 'prop-types';
|
|
6
5
|
import React, {PureComponent} from 'react';
|
|
7
6
|
import ReactNative, {requireNativeComponent, NativeModules} from 'react-native';
|
|
7
|
+
import {KeyboardTrackingViewProps} from './index';
|
|
8
8
|
|
|
9
|
-
const NativeKeyboardTrackingView = requireNativeComponent('KeyboardTrackingViewTemp'
|
|
9
|
+
const NativeKeyboardTrackingView = requireNativeComponent('KeyboardTrackingViewTemp');
|
|
10
10
|
const KeyboardTrackingViewTempManager = NativeModules.KeyboardTrackingViewTempManager;
|
|
11
11
|
|
|
12
12
|
/**
|
|
@@ -15,23 +15,17 @@ const KeyboardTrackingViewTempManager = NativeModules.KeyboardTrackingViewTempMa
|
|
|
15
15
|
*
|
|
16
16
|
* @example: https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/nativeComponentScreens/KeyboardTrackingViewScreen.js
|
|
17
17
|
* @notes: This view is useful only for iOS.
|
|
18
|
+
* @gif: https://github.com/wix/react-native-ui-lib/blob/master/demo/showcase/KeyboardTrackingView/KeyboardTrackingView.gif?raw=true
|
|
18
19
|
*/
|
|
19
|
-
class KeyboardTrackingView extends PureComponent {
|
|
20
|
+
class KeyboardTrackingView extends PureComponent<KeyboardTrackingViewProps> {
|
|
20
21
|
static displayName = 'KeyboardTrackingView';
|
|
21
22
|
|
|
22
|
-
static
|
|
23
|
-
|
|
24
|
-
* Enables tracking of the keyboard when it's dismissed interactively (false by default).
|
|
25
|
-
* Why? When using an external keyboard (BT),
|
|
26
|
-
* you still get the keyboard events and the view just hovers when you focus the input.
|
|
27
|
-
* Also, if you're not using interactive style of dismissing the keyboard
|
|
28
|
-
* (or if you don't have an input inside this view) it doesn't make sense to track it anyway.
|
|
29
|
-
* (This is caused because of the usage of inputAccessory to be able to track the
|
|
30
|
-
* keyboard interactive change and it introduces this bug)
|
|
31
|
-
*/
|
|
32
|
-
trackInteractive: PropTypes.bool
|
|
23
|
+
static defaultProps = {
|
|
24
|
+
useSafeArea: false
|
|
33
25
|
};
|
|
34
26
|
|
|
27
|
+
ref?: any;
|
|
28
|
+
|
|
35
29
|
render() {
|
|
36
30
|
return <NativeKeyboardTrackingView {...this.props} ref={r => (this.ref = r)}/>;
|
|
37
31
|
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React, {forwardRef} from 'react';
|
|
2
|
+
import {Platform, ViewStyle, ViewProps} from 'react-native';
|
|
3
|
+
import {default as KeyboardTrackingViewIOS} from './KeyboardTrackingView.ios';
|
|
4
|
+
import {default as KeyboardTrackingViewAndroid} from './KeyboardTrackingView.android';
|
|
5
|
+
|
|
6
|
+
const isAndroid = Platform.OS === 'android';
|
|
7
|
+
|
|
8
|
+
export type KeyboardTrackingViewProps = ViewProps & {
|
|
9
|
+
/**
|
|
10
|
+
* Enables tracking of the keyboard when it's dismissed interactively (false by default).
|
|
11
|
+
* Why? When using an external keyboard (BT),
|
|
12
|
+
* you still get the keyboard events and the view just hovers when you focus the input.
|
|
13
|
+
* Also, if you're not using interactive style of dismissing the keyboard
|
|
14
|
+
* (or if you don't have an input inside this view) it doesn't make sense to track it anyway.
|
|
15
|
+
* (This is caused because of the usage of inputAccessory to be able to track the
|
|
16
|
+
* keyboard interactive change and it introduces this bug)
|
|
17
|
+
*/
|
|
18
|
+
trackInteractive?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Allow control safe area
|
|
21
|
+
*/
|
|
22
|
+
useSafeArea?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Whether or not to include bottom tab bar inset
|
|
25
|
+
*/
|
|
26
|
+
usesBottomTabs?: boolean;
|
|
27
|
+
|
|
28
|
+
scrollToFocusedInput?: boolean;
|
|
29
|
+
scrollBehavior?: number;
|
|
30
|
+
revealKeyboardInteractive?: boolean;
|
|
31
|
+
manageScrollView?: boolean;
|
|
32
|
+
requiresSameParentToManageScrollView?: boolean;
|
|
33
|
+
addBottomView?: boolean;
|
|
34
|
+
allowHitsOutsideBounds?: boolean;
|
|
35
|
+
|
|
36
|
+
// Can't figure out what it's supposed to be
|
|
37
|
+
ref?: any;
|
|
38
|
+
|
|
39
|
+
children?: React.ReactChild | React.ReactChild[];
|
|
40
|
+
|
|
41
|
+
style?: ViewStyle;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const KeyboardTrackingView = forwardRef(({children, ...others}: KeyboardTrackingViewProps, ref: any) => {
|
|
45
|
+
const KeyboardTrackingViewContainer = isAndroid ? KeyboardTrackingViewAndroid : KeyboardTrackingViewIOS;
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<KeyboardTrackingViewContainer {...others} ref={ref}>
|
|
49
|
+
{children}
|
|
50
|
+
</KeyboardTrackingViewContainer>
|
|
51
|
+
);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
export default KeyboardTrackingView;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import KeyboardTrackingView, {KeyboardTrackingViewProps} from './KeyboardTracking/KeyboardTrackingView';
|
|
2
|
+
import KeyboardAwareInsetsView from './KeyboardTracking/KeyboardAwareInsetsView';
|
|
3
|
+
import KeyboardRegistry from './KeyboardInput/KeyboardRegistry';
|
|
4
|
+
import KeyboardAccessoryView, {KeyboardAccessoryViewProps} from './KeyboardInput/KeyboardAccessoryView';
|
|
5
|
+
import KeyboardUtils from './KeyboardInput/utils/KeyboardUtils';
|
|
6
|
+
|
|
7
|
+
export {KeyboardTrackingViewProps, KeyboardAccessoryViewProps};
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
KeyboardTrackingView,
|
|
11
|
+
KeyboardAwareInsetsView,
|
|
12
|
+
KeyboardRegistry,
|
|
13
|
+
KeyboardAccessoryView,
|
|
14
|
+
KeyboardUtils
|
|
15
|
+
};
|
|
@@ -3,16 +3,19 @@
|
|
|
3
3
|
import {NativeModules, NativeEventEmitter} from 'react-native';
|
|
4
4
|
import _ from 'lodash';
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
type SafeAreaInsetsType = { top: number; left: number; bottom: number; right: number; } | null
|
|
7
|
+
|
|
8
|
+
let SafeAreaInsetsCache: SafeAreaInsetsType = null;
|
|
7
9
|
|
|
8
10
|
const NativeSafeAreaManager = NativeModules.SafeAreaManager;
|
|
9
11
|
|
|
10
12
|
class SafeAreaInsetsManager {
|
|
11
|
-
constructor() {
|
|
12
|
-
this._defaultInsets = {top: 0, left: 0, bottom: 0, right: 0};
|
|
13
|
-
this._safeAreaInsets = this._defaultInsets;
|
|
14
|
-
this._safeAreaChangedDelegates = [];
|
|
15
13
|
|
|
14
|
+
_defaultInsets: SafeAreaInsetsType = {top: 0, left: 0, bottom: 0, right: 0};
|
|
15
|
+
_safeAreaInsets: SafeAreaInsetsType = {top: 0, left: 0, bottom: 0, right: 0};
|
|
16
|
+
_safeAreaChangedDelegates: Array<any> = [];
|
|
17
|
+
|
|
18
|
+
constructor() {
|
|
16
19
|
this.addSafeAreaChangedListener();
|
|
17
20
|
}
|
|
18
21
|
|
|
@@ -46,11 +49,11 @@ class SafeAreaInsetsManager {
|
|
|
46
49
|
return this._safeAreaInsets;
|
|
47
50
|
}
|
|
48
51
|
|
|
49
|
-
addSafeAreaChangedDelegate(delegate) {
|
|
52
|
+
addSafeAreaChangedDelegate(delegate: any) {
|
|
50
53
|
this._safeAreaChangedDelegates.push(delegate);
|
|
51
54
|
}
|
|
52
55
|
|
|
53
|
-
removeSafeAreaChangedDelegate(delegateToRemove) {
|
|
56
|
+
removeSafeAreaChangedDelegate(delegateToRemove: any) {
|
|
54
57
|
_.remove(this._safeAreaChangedDelegates, (currentDelegate) => {
|
|
55
58
|
return currentDelegate === delegateToRemove;
|
|
56
59
|
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {View, requireNativeComponent, ViewStyle, Platform} from 'react-native';
|
|
3
|
+
|
|
4
|
+
const NativeSafeAreaSpacerView = requireNativeComponent('SafeAreaSpacerView');
|
|
5
|
+
const isIOS = Platform.OS === 'ios';
|
|
6
|
+
|
|
7
|
+
export type SafeAreaSpacerViewProps = {
|
|
8
|
+
style?: ViewStyle;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const SafeAreaSpacerView = ({style}: SafeAreaSpacerViewProps) => {
|
|
12
|
+
return (
|
|
13
|
+
// @ts-ignore
|
|
14
|
+
isIOS ? <NativeSafeAreaSpacerView style={style}/> : <View style={style}/>
|
|
15
|
+
);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
SafeAreaSpacerView.displayName = 'IGNORE';
|
|
19
|
+
export default SafeAreaSpacerView;
|