uilib-native 3.0.4 → 3.0.8
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 → 078d1206f8e28097fd785bd635dfbdf6/results.bin} +0 -0
- package/android/build/.transforms/078d1206f8e28097fd785bd635dfbdf6/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/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.tsx +226 -0
- package/components/Keyboard/KeyboardInput/{KeyboardRegistry.js → KeyboardRegistry.ts} +12 -11
- package/components/Keyboard/KeyboardInput/{TextInputKeyboardManager.android.js → TextInputKeyboardManager/TextInputKeyboardManager.android.ts} +0 -0
- 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/keyboardAccessoryView.api.json +57 -0
- package/components/Keyboard/KeyboardInput/keyboardRegistry.api.json +50 -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 +96 -0
- package/components/Keyboard/KeyboardTracking/KeyboardTrackingView/keyboardTrackingView.api.json +95 -0
- package/components/Keyboard/KeyboardTracking/keyboardAwareInsetsView.api.json +14 -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 +16 -0
- package/ios/reactnativeuilib/keyboardtrackingview/KeyboardTrackingViewTempManager.m +40 -3
- package/ios/reactnativeuilib.xcodeproj/project.xcworkspace/xcuserdata/inbalti.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/reactnativeuilib.xcodeproj/xcuserdata/{michaelle.xcuserdatad → inbalti.xcuserdatad}/xcschemes/xcschememanagement.plist +0 -5
- 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/KeyboardInput/KeyboardAccessoryView.js +0 -287
- 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/xcuserdata/michaelle.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
|
@@ -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,
|
|
@@ -17,11 +17,11 @@ const getKeyboardsWithIDs = keyboardIDs => {
|
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* @description: used for registering keyboards and performing certain actions on the keyboards.
|
|
20
|
-
* @example: https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/nativeComponentScreens/
|
|
20
|
+
* @example: https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/nativeComponentScreens/keyboardAccessory/demoKeyboards.js
|
|
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,16 +110,17 @@ 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
|
|
|
117
117
|
/**
|
|
118
|
+
* @deprecated
|
|
118
119
|
* iOS only (experimental)
|
|
119
120
|
* Call to make the keyboard full screen
|
|
120
121
|
* componentID (string) - the ID of the keyboard.
|
|
121
122
|
*/
|
|
122
|
-
static toggleExpandedKeyboard = componentID => {
|
|
123
|
+
static toggleExpandedKeyboard = (componentID: string) => {
|
|
123
124
|
KeyboardRegistry.notifyListeners('onToggleExpandedKeyboard', {keyboardId: componentID});
|
|
124
125
|
};
|
|
125
126
|
}
|
|
File without changes
|
|
@@ -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;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "KeyboardAccessoryView",
|
|
3
|
+
"category": "keyboard",
|
|
4
|
+
"description": "View that allows replacing the default keyboard with other components",
|
|
5
|
+
"example": "https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/nativeComponentScreens/keyboardAccessory/KeyboardAccessoryViewScreen.js",
|
|
6
|
+
"images": [
|
|
7
|
+
"https://github.com/wix/react-native-ui-lib/blob/master/demo/showcase/KeyboardAccessoryView/KeyboardAccessoryView.gif?raw=true"
|
|
8
|
+
],
|
|
9
|
+
"props": [
|
|
10
|
+
{
|
|
11
|
+
"name": "renderContent",
|
|
12
|
+
"type": "() => React.ReactElement",
|
|
13
|
+
"description": "Content to be rendered above the keyboard"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"name": "kbInputRef",
|
|
17
|
+
"type": "any",
|
|
18
|
+
"description": "The reference to the actual text input (or the keyboard may not reset when instructed to, etc.).\niOS only.",
|
|
19
|
+
"required": true
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"name": "kbComponent",
|
|
23
|
+
"type": "string",
|
|
24
|
+
"description": "The keyboard ID (the componentID sent to KeyboardRegistry)"
|
|
25
|
+
},
|
|
26
|
+
{"name": "kbInitialProps", "type": "any", "description": "The props that will be sent to the KeyboardComponent"},
|
|
27
|
+
{
|
|
28
|
+
"name": "onHeightChanged",
|
|
29
|
+
"type": "(height: number) => void",
|
|
30
|
+
"description": "A callback for when the height is changed"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"name": "onItemSelected",
|
|
34
|
+
"type": "() => void",
|
|
35
|
+
"description": "Callback that will be called when an item on the keyboard has been pressed."
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"name": "onRequestShowKeyboard",
|
|
39
|
+
"type": "() => void",
|
|
40
|
+
"description": "Callback that will be called if KeyboardRegistry.requestShowKeyboard is called."
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"name": "onKeyboardResigned",
|
|
44
|
+
"type": "() => void",
|
|
45
|
+
"description": "Callback that will be called once the keyboard has been closed"
|
|
46
|
+
}
|
|
47
|
+
],
|
|
48
|
+
"snippet": [
|
|
49
|
+
"<KeyboardAccessoryView",
|
|
50
|
+
" renderContent={this.renderContent()}",
|
|
51
|
+
" kbInputRef={this.inputRef}",
|
|
52
|
+
" kbComponent={$1}",
|
|
53
|
+
" kbInitialProps={$2}",
|
|
54
|
+
" onHeightChanged={this.onHeightChanged()}",
|
|
55
|
+
" scrollBehavior={KeyboardAccessoryView.scrollBehaviors.NONE$3}",
|
|
56
|
+
"/>"
|
|
57
|
+
]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "KeyboardRegistry",
|
|
3
|
+
"category": "keyboard",
|
|
4
|
+
"description": "used for registering keyboards and performing certain actions on the keyboards.",
|
|
5
|
+
"example": "https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/nativeComponentScreens/keyboardAccessory/demoKeyboards.js",
|
|
6
|
+
"props": [
|
|
7
|
+
{
|
|
8
|
+
"name": "registerKeyboard",
|
|
9
|
+
"type": "static function",
|
|
10
|
+
"description": "Register a new keyboard.\ncomponentID (string) - the ID of the keyboard.\ngenerator (function) - a function for the creation of the keyboard.\nparams (object) - to be returned when using other methods (i.e. getKeyboards and getAllKeyboards)."
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"name": "getKeyboard",
|
|
14
|
+
"type": "static function",
|
|
15
|
+
"description": "Get a specific keyboard\ncomponentID (string) - the ID of the keyboard."
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"name": "getKeyboards",
|
|
19
|
+
"type": "static function",
|
|
20
|
+
"description": "Get keyboards by IDs\ncomponentIDs (string[]) - the ID of the keyboard."
|
|
21
|
+
},
|
|
22
|
+
{"name": "getAllKeyboards", "type": "static function", "description": "Get all keyboards"},
|
|
23
|
+
{
|
|
24
|
+
"name": "addListener",
|
|
25
|
+
"type": "static function",
|
|
26
|
+
"description": "Add a listener for a callback.\nglobalID (string) - ID that includes the componentID and the event name\n (i.e. if componentID='kb1' globalID='kb1.onItemSelected')\ncallback (function) - the callback to be called when the said event happens"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"name": "notifyListeners",
|
|
30
|
+
"type": "static function",
|
|
31
|
+
"description": "Notify that an event has occurred.\nglobalID (string) - ID that includes the componentID and the event name\n (i.e. if componentID='kb1' globalID='kb1.onItemSelected')\nargs (object) - data to be sent to the listener."
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"name": "removeListeners",
|
|
35
|
+
"type": "static function",
|
|
36
|
+
"description": "Remove a listener for a callback.\nglobalID (string) - ID that includes the componentID and the event name\n (i.e. if componentID='kb1' globalID='kb1.onItemSelected')"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"name": "onItemSelected",
|
|
40
|
+
"type": "static function",
|
|
41
|
+
"description": "Default event to be used for when an item on the keyboard has been pressed.\ncomponentID (string) - the ID of the keyboard.\nargs (object) - data to be sent to the listener."
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"name": "requestShowKeyboard",
|
|
45
|
+
"type": "static function",
|
|
46
|
+
"description": "Request to show the keyboard\ncomponentID (string) - the ID of the keyboard."
|
|
47
|
+
}
|
|
48
|
+
],
|
|
49
|
+
"snippet": ["KeyboardRegistry.registerKeyboard('keyboardName$1', () => KeyboardComponent$2)"]
|
|
50
|
+
}
|
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,96 @@
|
|
|
1
|
+
import React, {forwardRef} from 'react';
|
|
2
|
+
import {Platform, NativeModules, 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
|
+
const SCROLL_BEHAVIORS = {
|
|
8
|
+
NONE: NativeModules.KeyboardTrackingViewTempManager?.KeyboardTrackingScrollBehaviorNone,
|
|
9
|
+
SCROLL_TO_BOTTOM_INVERTED_ONLY:
|
|
10
|
+
NativeModules.KeyboardTrackingViewTempManager?.KeyboardTrackingScrollBehaviorScrollToBottomInvertedOnly,
|
|
11
|
+
FIXED_OFFSET: NativeModules.KeyboardTrackingViewTempManager?.KeyboardTrackingScrollBehaviorFixedOffset
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export type KeyboardTrackingViewProps = ViewProps & {
|
|
15
|
+
/**
|
|
16
|
+
* Enables tracking of the keyboard when it's dismissed interactively (false by default).
|
|
17
|
+
* Why? When using an external keyboard (BT),
|
|
18
|
+
* you still get the keyboard events and the view just hovers when you focus the input.
|
|
19
|
+
* Also, if you're not using interactive style of dismissing the keyboard
|
|
20
|
+
* (or if you don't have an input inside this view) it doesn't make sense to track it anyway.
|
|
21
|
+
* (This is caused because of the usage of inputAccessory to be able to track the
|
|
22
|
+
* keyboard interactive change and it introduces this bug)
|
|
23
|
+
*/
|
|
24
|
+
trackInteractive?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* iOS only.
|
|
27
|
+
* Show the keyboard on a negative scroll
|
|
28
|
+
* default: false
|
|
29
|
+
*/
|
|
30
|
+
revealKeyboardInteractive?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* iOS only.
|
|
33
|
+
* Set to false to turn off inset management and manage it yourself
|
|
34
|
+
* default: true
|
|
35
|
+
*/
|
|
36
|
+
manageScrollView?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* iOS only.
|
|
39
|
+
* Set to true manageScrollView is set to true and still does not work,
|
|
40
|
+
* it means that the ScrollView found is the wrong one and you'll have
|
|
41
|
+
* to have the KeyboardAccessoryView and the ScrollView as siblings
|
|
42
|
+
* and set this to true
|
|
43
|
+
*
|
|
44
|
+
* default: false
|
|
45
|
+
*/
|
|
46
|
+
requiresSameParentToManageScrollView?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* iOS only.
|
|
49
|
+
* Allow hitting sub-views that are placed beyond the view bounds
|
|
50
|
+
*
|
|
51
|
+
* default: false
|
|
52
|
+
*/
|
|
53
|
+
allowHitsOutsideBounds?: boolean;
|
|
54
|
+
scrollToFocusedInput?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* iOS only.
|
|
57
|
+
* The scrolling behavior (NONE | SCROLL_TO_BOTTOM_INVERTED_ONLY | FIXED_OFFSET)
|
|
58
|
+
*/
|
|
59
|
+
scrollBehavior?: number;
|
|
60
|
+
/**
|
|
61
|
+
* iOS only.
|
|
62
|
+
* Add a SafeArea view beneath the KeyboardAccessoryView
|
|
63
|
+
* default: false
|
|
64
|
+
*/
|
|
65
|
+
addBottomView?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* iOS only.
|
|
68
|
+
* The bottom view's color
|
|
69
|
+
* default: 'white'
|
|
70
|
+
*/
|
|
71
|
+
bottomViewColor?: string;
|
|
72
|
+
/**
|
|
73
|
+
* Allow control safe area
|
|
74
|
+
*/
|
|
75
|
+
useSafeArea?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Whether or not to include bottom tab bar inset
|
|
78
|
+
*/
|
|
79
|
+
usesBottomTabs?: boolean;
|
|
80
|
+
ref?: any;
|
|
81
|
+
style?: ViewStyle;
|
|
82
|
+
children?: React.ReactChild | React.ReactChild[];
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const KeyboardTrackingView = forwardRef(({children, ...others}: KeyboardTrackingViewProps, ref: any) => {
|
|
86
|
+
const KeyboardTrackingViewContainer = isAndroid ? KeyboardTrackingViewAndroid : KeyboardTrackingViewIOS;
|
|
87
|
+
return (
|
|
88
|
+
<KeyboardTrackingViewContainer {...others} ref={ref}>
|
|
89
|
+
{children}
|
|
90
|
+
</KeyboardTrackingViewContainer>
|
|
91
|
+
);
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
export default KeyboardTrackingView as (typeof KeyboardTrackingView & {scrollBehaviors: typeof SCROLL_BEHAVIORS});
|
|
95
|
+
// @ts-expect-error
|
|
96
|
+
KeyboardTrackingView.scrollBehaviors = SCROLL_BEHAVIORS;
|
package/components/Keyboard/KeyboardTracking/KeyboardTrackingView/keyboardTrackingView.api.json
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "KeyboardTrackingView",
|
|
3
|
+
"category": "keyboard",
|
|
4
|
+
"description": "A UI component that enables 'keyboard tracking' for this view and it's sub-views.\nWould typically be used when you have a TextField or TextInput inside this view.",
|
|
5
|
+
"note": "This view is useful only for iOS.",
|
|
6
|
+
"example": "https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/nativeComponentScreens/KeyboardTrackingViewScreen.js",
|
|
7
|
+
"images": [
|
|
8
|
+
"https://github.com/wix/react-native-ui-lib/blob/master/demo/showcase/KeyboardTrackingView/KeyboardTrackingView.gif?raw=true"
|
|
9
|
+
],
|
|
10
|
+
"props": [
|
|
11
|
+
{
|
|
12
|
+
"name": "trackInteractive",
|
|
13
|
+
"type": "boolean",
|
|
14
|
+
"description": "Enables tracking of the keyboard when it's dismissed interactively (false by default).\nWhy? When using an external keyboard (BT),\nyou still get the keyboard events and the view just hovers when you focus the input.\nAlso, if you're not using interactive style of dismissing the keyboard\n(or if you don't have an input inside this view) it doesn't make sense to track it anyway.\n(This is caused because of the usage of inputAccessory to be able to track the keyboard interactive change and it introduces this bug)"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"name": "scrollToFocusedInput",
|
|
18
|
+
"type": "boolean",
|
|
19
|
+
"description": "Should the scrollView scroll to the focused input"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"name": "scrollBehavior",
|
|
23
|
+
"type": "number",
|
|
24
|
+
"description": "The scrolling behavior (use KeyboardTrackingView.scrollBehaviors.NONE | SCROLL_TO_BOTTOM_INVERTED_ONLY | FIXED_OFFSET)",
|
|
25
|
+
"note": "iOS only"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"name": "revealKeyboardInteractive",
|
|
29
|
+
"type": "boolean",
|
|
30
|
+
"description": "Show the keyboard on a negative scroll\niOS only.",
|
|
31
|
+
"note": "iOS only",
|
|
32
|
+
"default": "false"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"name": "manageScrollView",
|
|
36
|
+
"type": "boolean",
|
|
37
|
+
"description": "Set to false to turn off inset management and manage it yourself\niOS only.",
|
|
38
|
+
"note": "iOS only",
|
|
39
|
+
"default": "true"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"name": "requiresSameParentToManageScrollView",
|
|
43
|
+
"type": "boolean",
|
|
44
|
+
"description": "Set to true manageScrollView is set to true and still does not work,\nit means that the ScrollView found is the wrong one and you'll have\nto have the KeyboardAccessoryView and the ScrollView as siblings\nand set this to true\niOS only.",
|
|
45
|
+
"note": "iOS only",
|
|
46
|
+
"default": "false"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"name": "allowHitsOutsideBounds",
|
|
50
|
+
"type": "boolean",
|
|
51
|
+
"description": "Allow hitting sub-views that are placed beyond the view bounds\niOS only.",
|
|
52
|
+
"note": "iOS only",
|
|
53
|
+
"default": "false"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"name": "addBottomView",
|
|
57
|
+
"type": "boolean",
|
|
58
|
+
"description": "Add a view beneath the KeyboardAccessoryView\niOS only.",
|
|
59
|
+
"note": "iOS only",
|
|
60
|
+
"default": "false"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"name": "bottomViewColor",
|
|
64
|
+
"type": "string",
|
|
65
|
+
"description": "The bottom view's color\niOS only.",
|
|
66
|
+
"note": "iOS only",
|
|
67
|
+
"default": "white"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"name": "useSafeArea",
|
|
71
|
+
"type": "boolean",
|
|
72
|
+
"description": "Whether or not to handle SafeArea\niOS only.",
|
|
73
|
+
"note": "iOS only",
|
|
74
|
+
"default": "true"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"name": "usesBottomTabs",
|
|
78
|
+
"type": "boolean",
|
|
79
|
+
"description": "Whether or not to include bottom tab bar inset\niOS only.",
|
|
80
|
+
"note": "iOS only",
|
|
81
|
+
"default": "false"
|
|
82
|
+
},
|
|
83
|
+
{"name": "ref", "type": "any", "description": ""},
|
|
84
|
+
{"name": "style", "type": "ViewStyle", "description": ""}
|
|
85
|
+
],
|
|
86
|
+
"snippet": [
|
|
87
|
+
"<KeyboardTrackingView",
|
|
88
|
+
" style={$1}",
|
|
89
|
+
" trackInteractive",
|
|
90
|
+
" useSafeArea",
|
|
91
|
+
">",
|
|
92
|
+
" $2",
|
|
93
|
+
"</KeyboardTrackingView>"
|
|
94
|
+
]
|
|
95
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "KeyboardAwareInsetsView",
|
|
3
|
+
"category": "keyboard",
|
|
4
|
+
"description": "Used to add an inset when a keyboard is used and might hide part of the screen.",
|
|
5
|
+
"note": "This view is useful only for iOS.",
|
|
6
|
+
"extends": ["keyboard/KeyboardTrackingView"],
|
|
7
|
+
"example": "https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/incubatorScreens/IncubatorTextFieldScreen.tsx",
|
|
8
|
+
"snippet": ["<ScrollView>",
|
|
9
|
+
" <TextField/>",
|
|
10
|
+
" <TextField/>",
|
|
11
|
+
" <KeyboardAwareInsetsView/>",
|
|
12
|
+
"<ScrollView>"
|
|
13
|
+
]
|
|
14
|
+
}
|
|
@@ -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;
|