@react-native-ohos/react-native-keyboard-controller 1.12.8-rc.7 → 1.12.9
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/LICENSE +21 -21
- package/README.OpenSource +10 -10
- package/README.md +603 -19
- package/harmony/keyboard_controller/BuildProfile.ets +16 -16
- package/harmony/keyboard_controller/Index.ets +8 -8
- package/harmony/keyboard_controller/ResourceTable.txt +8 -8
- package/harmony/keyboard_controller/build-profile.json5 +31 -31
- package/harmony/keyboard_controller/hvigorfile.ts +6 -6
- package/harmony/keyboard_controller/obfuscation-rules.txt +17 -17
- package/harmony/keyboard_controller/oh-package-lock.json5 +29 -0
- package/harmony/keyboard_controller/oh-package.json5 +11 -11
- package/harmony/keyboard_controller/src/main/cpp/CMakeLists.txt +7 -7
- package/harmony/keyboard_controller/src/main/cpp/EventEmitters.cpp +119 -96
- package/harmony/keyboard_controller/src/main/cpp/EventEmitters.h +90 -90
- package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewComponentDescriptor.h +77 -77
- package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewComponentInstance.cpp +816 -158
- package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewComponentInstance.h +147 -74
- package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewJSIBinder.h +43 -43
- package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaComponentDescriptor.h +64 -64
- package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaComponentInstance.cpp +88 -88
- package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaComponentInstance.h +63 -63
- package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaJSIBinder.h +39 -39
- package/harmony/keyboard_controller/src/main/cpp/RNKeyboardController.cpp +25 -25
- package/harmony/keyboard_controller/src/main/cpp/RNKeyboardController.h +27 -27
- package/harmony/keyboard_controller/src/main/cpp/RNKeyboardControllerPackage.cpp +43 -43
- package/harmony/keyboard_controller/src/main/cpp/RNKeyboardControllerPackage.h +56 -56
- package/harmony/keyboard_controller/src/main/cpp/RNStatusBarManagerCompat.cpp +24 -24
- package/harmony/keyboard_controller/src/main/cpp/RNStatusBarManagerCompat.h +28 -28
- package/harmony/keyboard_controller/src/main/cpp/ViewHierarchyNavigator.cpp +186 -0
- package/harmony/keyboard_controller/src/main/cpp/ViewHierarchyNavigator.h +112 -0
- package/harmony/keyboard_controller/src/main/cpp/keyboardControllerPackage.cpp +43 -43
- package/harmony/keyboard_controller/src/main/cpp/keyboardControllerPackage.h +56 -56
- package/harmony/keyboard_controller/src/main/ets/Logger.ts +45 -45
- package/harmony/keyboard_controller/src/main/ets/RNKeyboardControllerPackage.ets +49 -49
- package/harmony/keyboard_controller/src/main/ets/RNKeyboardControllerTurboModule.ts +405 -210
- package/harmony/keyboard_controller/src/main/ets/RNStatusBarManagerCompatTurboModule.ts +107 -98
- package/harmony/keyboard_controller/src/main/ets/Type.ts +41 -41
- package/harmony/keyboard_controller/src/main/module.json +29 -29
- package/harmony/keyboard_controller/src/main/module.json5 +11 -11
- package/harmony/keyboard_controller/src/main/resources/base/element/string.json +8 -8
- package/harmony/keyboard_controller/src/main/resources/en_US/element/string.json +8 -8
- package/harmony/keyboard_controller/src/main/resources/zh_CN/element/string.json +8 -8
- package/harmony/keyboard_controller/ts.ets +8 -8
- package/harmony/keyboard_controller.har +0 -0
- package/lib/commonjs/animated.js +4 -16
- package/lib/commonjs/animated.js.map +1 -1
- package/lib/commonjs/bindings.js +3 -3
- package/lib/commonjs/bindings.js.map +1 -1
- package/lib/commonjs/bindings.native.js +3 -3
- package/lib/commonjs/bindings.native.js.map +1 -1
- package/lib/commonjs/components/KeyboardAvoidingView/hooks.js.map +1 -1
- package/lib/commonjs/components/KeyboardAvoidingView/index.js +3 -3
- package/lib/commonjs/components/KeyboardAvoidingView/index.js.map +1 -1
- package/lib/commonjs/components/KeyboardAwareScrollView/index.js +43 -41
- package/lib/commonjs/components/KeyboardAwareScrollView/index.js.map +1 -1
- package/lib/commonjs/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js +3 -3
- package/lib/commonjs/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js.map +1 -1
- package/lib/commonjs/components/KeyboardAwareScrollView/utils.js.map +1 -1
- package/lib/commonjs/components/KeyboardStickyView/index.js.map +1 -1
- package/lib/commonjs/components/KeyboardToolbar/Arrow.js.map +1 -1
- package/lib/commonjs/components/KeyboardToolbar/Button.js.map +1 -1
- package/lib/commonjs/components/KeyboardToolbar/colors.js.map +1 -1
- package/lib/commonjs/components/KeyboardToolbar/colors.native.js.map +1 -1
- package/lib/commonjs/components/KeyboardToolbar/index.js +3 -3
- package/lib/commonjs/components/KeyboardToolbar/index.js.map +1 -1
- package/lib/commonjs/components/KeyboardToolbar/types.js.map +1 -1
- package/lib/commonjs/components/hooks/useColorScheme.js.map +1 -1
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/constants.js +2 -0
- package/lib/commonjs/constants.js.map +1 -1
- package/lib/commonjs/context.js.map +1 -1
- package/lib/commonjs/hooks/index.js.map +1 -1
- package/lib/commonjs/hooks/useWindowDimensions/index.android.js.map +1 -1
- package/lib/commonjs/hooks/useWindowDimensions/index.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/internal.js +18 -18
- package/lib/commonjs/internal.js.map +1 -1
- package/lib/commonjs/monkey-patch.android.js +4 -4
- package/lib/commonjs/monkey-patch.android.js.map +1 -1
- package/lib/commonjs/monkey-patch.js.map +1 -1
- package/lib/commonjs/reanimated.js.map +1 -1
- package/lib/commonjs/reanimated.native.js.map +1 -1
- package/lib/commonjs/specs/KeyboardControllerViewNativeComponent.js.map +1 -1
- package/lib/commonjs/specs/KeyboardGestureAreaNativeComponent.js.map +1 -1
- package/lib/commonjs/specs/NativeKeyboardController.js.map +1 -1
- package/lib/commonjs/specs/NativeStatusBarManagerCompat.js.map +1 -1
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/utils.js.map +1 -1
- package/lib/module/animated.js +5 -17
- package/lib/module/animated.js.map +1 -1
- package/lib/module/bindings.js +3 -3
- package/lib/module/bindings.js.map +1 -1
- package/lib/module/bindings.native.js +3 -3
- package/lib/module/bindings.native.js.map +1 -1
- package/lib/module/components/KeyboardAvoidingView/hooks.js.map +1 -1
- package/lib/module/components/KeyboardAvoidingView/index.js +3 -3
- package/lib/module/components/KeyboardAvoidingView/index.js.map +1 -1
- package/lib/module/components/KeyboardAwareScrollView/index.js +44 -42
- package/lib/module/components/KeyboardAwareScrollView/index.js.map +1 -1
- package/lib/module/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js +3 -3
- package/lib/module/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js.map +1 -1
- package/lib/module/components/KeyboardAwareScrollView/utils.js.map +1 -1
- package/lib/module/components/KeyboardStickyView/index.js.map +1 -1
- package/lib/module/components/KeyboardToolbar/Arrow.js.map +1 -1
- package/lib/module/components/KeyboardToolbar/Button.js.map +1 -1
- package/lib/module/components/KeyboardToolbar/colors.js.map +1 -1
- package/lib/module/components/KeyboardToolbar/colors.native.js.map +1 -1
- package/lib/module/components/KeyboardToolbar/index.js +3 -3
- package/lib/module/components/KeyboardToolbar/index.js.map +1 -1
- package/lib/module/components/KeyboardToolbar/types.js.map +1 -1
- package/lib/module/components/hooks/useColorScheme.js.map +1 -1
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/constants.js +2 -0
- package/lib/module/constants.js.map +1 -1
- package/lib/module/context.js.map +1 -1
- package/lib/module/hooks/index.js.map +1 -1
- package/lib/module/hooks/useWindowDimensions/index.android.js.map +1 -1
- package/lib/module/hooks/useWindowDimensions/index.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/internal.js +18 -18
- package/lib/module/internal.js.map +1 -1
- package/lib/module/monkey-patch.android.js +4 -4
- package/lib/module/monkey-patch.android.js.map +1 -1
- package/lib/module/monkey-patch.js.map +1 -1
- package/lib/module/reanimated.js.map +1 -1
- package/lib/module/reanimated.native.js.map +1 -1
- package/lib/module/specs/KeyboardControllerViewNativeComponent.js.map +1 -1
- package/lib/module/specs/KeyboardGestureAreaNativeComponent.js.map +1 -1
- package/lib/module/specs/NativeKeyboardController.js.map +1 -1
- package/lib/module/specs/NativeStatusBarManagerCompat.js.map +1 -1
- package/lib/module/types.js.map +1 -1
- package/lib/module/utils.js.map +1 -1
- package/lib/typescript/types.d.ts +1 -0
- package/package.json +181 -177
- package/src/animated.tsx +246 -253
- package/src/bindings.native.ts +57 -57
- package/src/bindings.ts +38 -38
- package/src/components/KeyboardAvoidingView/hooks.ts +58 -58
- package/src/components/KeyboardAvoidingView/index.tsx +156 -156
- package/src/components/KeyboardAwareScrollView/index.tsx +381 -373
- package/src/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.ts +133 -133
- package/src/components/KeyboardAwareScrollView/utils.ts +41 -41
- package/src/components/KeyboardStickyView/index.tsx +57 -57
- package/src/components/KeyboardToolbar/Arrow.tsx +80 -80
- package/src/components/KeyboardToolbar/Button.tsx +98 -98
- package/src/components/KeyboardToolbar/colors.native.ts +37 -37
- package/src/components/KeyboardToolbar/colors.ts +16 -16
- package/src/components/KeyboardToolbar/index.tsx +211 -211
- package/src/components/KeyboardToolbar/types.ts +40 -40
- package/src/components/hooks/useColorScheme.ts +5 -5
- package/src/components/index.ts +11 -11
- package/src/constants.ts +19 -19
- package/src/context.ts +65 -65
- package/src/hooks/index.ts +90 -90
- package/src/hooks/useWindowDimensions/index.android.ts +33 -33
- package/src/hooks/useWindowDimensions/index.ts +1 -1
- package/src/index.ts +21 -21
- package/src/internal.ts +84 -84
- package/src/monkey-patch.android.ts +44 -44
- package/src/monkey-patch.ts +4 -4
- package/src/reanimated.native.ts +132 -132
- package/src/reanimated.ts +29 -29
- package/src/specs/KeyboardControllerViewNativeComponent.ts +70 -70
- package/src/specs/KeyboardGestureAreaNativeComponent.ts +15 -15
- package/src/specs/NativeKeyboardController.ts +19 -19
- package/src/specs/NativeStatusBarManagerCompat.ts +14 -14
- package/src/types.ts +212 -211
- package/src/utils.ts +1 -1
- package/react-native-keyboard-controller.podspec +0 -61
|
@@ -1,98 +1,107 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
|
|
3
|
-
* Use of this source code is governed by a MIT license that can be
|
|
4
|
-
* found in the LICENSE file.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { TurboModule } from "@rnoh/react-native-openharmony/ts";
|
|
8
|
-
import window from '@ohos.window';
|
|
9
|
-
import common from '@ohos.app.ability.common';
|
|
10
|
-
import { BusinessError } from '@kit.BasicServicesKit';
|
|
11
|
-
import Logger from './Logger';
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
interface StatusBarManagerCompatSpec {
|
|
15
|
-
getConstants(): {};
|
|
16
|
-
setHidden(hidden: boolean): void;
|
|
17
|
-
setColor(color: number, animated: boolean): void;
|
|
18
|
-
setTranslucent(translucent: boolean): void;
|
|
19
|
-
setStyle(style: string): void;
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
export class RNStatusBarManagerCompatTurboModule extends TurboModule implements StatusBarManagerCompatSpec{
|
|
23
|
-
private context: common.UIAbilityContext;
|
|
24
|
-
constructor(ctx) {
|
|
25
|
-
super(ctx);
|
|
26
|
-
this.context = this.ctx.uiAbilityContext;
|
|
27
|
-
}
|
|
28
|
-
private async setWindowSystemBarProperties(properties:window.SystemBarProperties){
|
|
29
|
-
let windowInstance: window.Window | undefined = undefined;
|
|
30
|
-
windowInstance = await window.getLastWindow(this.context);
|
|
31
|
-
let systemBarProperty = windowInstance.getWindowSystemBarProperties();
|
|
32
|
-
let newSystemBarProperty: window.SystemBarProperties = {
|
|
33
|
-
...systemBarProperty,
|
|
34
|
-
...properties
|
|
35
|
-
};
|
|
36
|
-
try {
|
|
37
|
-
let promise = windowInstance.setWindowSystemBarProperties(newSystemBarProperty);
|
|
38
|
-
promise.then(() => {
|
|
39
|
-
Logger.info('Succeeded in setting the system bar properties.');
|
|
40
|
-
}).catch((err: BusinessError) => {
|
|
41
|
-
Logger.error(`Failed to set the system bar properties. Cause code: ${err.code}, message: ${err.message}`);
|
|
42
|
-
});
|
|
43
|
-
} catch (exception) {
|
|
44
|
-
Logger.error(`Failed to set the system bar properties. Cause code: ${exception.code}, message: ${exception.message}`);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
readonly getConstants:()=>{};
|
|
48
|
-
// set mode
|
|
49
|
-
async setHidden(hidden: boolean): Promise<void> {
|
|
50
|
-
Logger.info("###turboModule setHidden");
|
|
51
|
-
let windowInstance: window.Window | undefined = undefined;
|
|
52
|
-
windowInstance = await window.getLastWindow(this.context);
|
|
53
|
-
let names: Array<'status' | 'navigation'> = ['navigation'];
|
|
54
|
-
hidden && names.push('status');
|
|
55
|
-
try {
|
|
56
|
-
let promise = windowInstance.setWindowSystemBarEnable(names);
|
|
57
|
-
promise.then(() => {
|
|
58
|
-
Logger.info('Succeeded in setting the system bar to be invisible.');
|
|
59
|
-
}).catch((err: BusinessError) => {
|
|
60
|
-
Logger.error(`Failed to set the system bar to be invisible. Cause code: ${err.code}, message: ${err.message}`);
|
|
61
|
-
});
|
|
62
|
-
} catch (exception) {
|
|
63
|
-
Logger.error(`Failed to set the system bar to be invisible. Cause code: ${exception.code}, message: ${exception.message}`);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
async setColor(color: number, animated: boolean): Promise<void> {
|
|
68
|
-
Logger.info("###turboModule setColor");
|
|
69
|
-
let newSystemBarProperty: window.SystemBarProperties = {
|
|
70
|
-
statusBarColor:
|
|
71
|
-
enableStatusBarAnimation:animated
|
|
72
|
-
};
|
|
73
|
-
this.setWindowSystemBarProperties(newSystemBarProperty)
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
async setTranslucent(translucent: boolean): Promise<void> {
|
|
77
|
-
Logger.info("###turboModule setTranslucent");
|
|
78
|
-
let windowInstance: window.Window | undefined = undefined;
|
|
79
|
-
windowInstance = await window.getLastWindow(this.context);
|
|
80
|
-
let systemBarProperty = windowInstance.getWindowSystemBarProperties();
|
|
81
|
-
let newSystemBarProperty: window.SystemBarProperties = {
|
|
82
|
-
statusBarColor:translucent?'#00000000':systemBarProperty.statusBarColor,
|
|
83
|
-
};
|
|
84
|
-
this.setWindowSystemBarProperties(newSystemBarProperty)
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
setStyle(style: 'dark-content'|'light-content'): void {
|
|
88
|
-
Logger.info("###turboModule setStyle");
|
|
89
|
-
let themeFlag= style == "dark-content"
|
|
90
|
-
let newSystemBarProperty: window.SystemBarProperties = {
|
|
91
|
-
statusBarContentColor:themeFlag?"#000000":"#ffffff",
|
|
92
|
-
};
|
|
93
|
-
this.setWindowSystemBarProperties(newSystemBarProperty)
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
|
|
3
|
+
* Use of this source code is governed by a MIT license that can be
|
|
4
|
+
* found in the LICENSE file.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { TurboModule } from "@rnoh/react-native-openharmony/ts";
|
|
8
|
+
import window from '@ohos.window';
|
|
9
|
+
import common from '@ohos.app.ability.common';
|
|
10
|
+
import { BusinessError } from '@kit.BasicServicesKit';
|
|
11
|
+
import Logger from './Logger';
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
interface StatusBarManagerCompatSpec {
|
|
15
|
+
getConstants(): {};
|
|
16
|
+
setHidden(hidden: boolean): void;
|
|
17
|
+
setColor(color: number, animated: boolean): void;
|
|
18
|
+
setTranslucent(translucent: boolean): void;
|
|
19
|
+
setStyle(style: string): void;
|
|
20
|
+
|
|
21
|
+
}
|
|
22
|
+
export class RNStatusBarManagerCompatTurboModule extends TurboModule implements StatusBarManagerCompatSpec{
|
|
23
|
+
private context: common.UIAbilityContext;
|
|
24
|
+
constructor(ctx) {
|
|
25
|
+
super(ctx);
|
|
26
|
+
this.context = this.ctx.uiAbilityContext;
|
|
27
|
+
}
|
|
28
|
+
private async setWindowSystemBarProperties(properties:window.SystemBarProperties){
|
|
29
|
+
let windowInstance: window.Window | undefined = undefined;
|
|
30
|
+
windowInstance = await window.getLastWindow(this.context);
|
|
31
|
+
let systemBarProperty = windowInstance.getWindowSystemBarProperties();
|
|
32
|
+
let newSystemBarProperty: window.SystemBarProperties = {
|
|
33
|
+
...systemBarProperty,
|
|
34
|
+
...properties
|
|
35
|
+
};
|
|
36
|
+
try {
|
|
37
|
+
let promise = windowInstance.setWindowSystemBarProperties(newSystemBarProperty);
|
|
38
|
+
promise.then(() => {
|
|
39
|
+
Logger.info('Succeeded in setting the system bar properties.');
|
|
40
|
+
}).catch((err: BusinessError) => {
|
|
41
|
+
Logger.error(`Failed to set the system bar properties. Cause code: ${err.code}, message: ${err.message}`);
|
|
42
|
+
});
|
|
43
|
+
} catch (exception) {
|
|
44
|
+
Logger.error(`Failed to set the system bar properties. Cause code: ${exception.code}, message: ${exception.message}`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
readonly getConstants:()=>{};
|
|
48
|
+
// set mode
|
|
49
|
+
async setHidden(hidden: boolean): Promise<void> {
|
|
50
|
+
Logger.info("###turboModule setHidden");
|
|
51
|
+
let windowInstance: window.Window | undefined = undefined;
|
|
52
|
+
windowInstance = await window.getLastWindow(this.context);
|
|
53
|
+
let names: Array<'status' | 'navigation'> = ['navigation'];
|
|
54
|
+
hidden && names.push('status');
|
|
55
|
+
try {
|
|
56
|
+
let promise = windowInstance.setWindowSystemBarEnable(names);
|
|
57
|
+
promise.then(() => {
|
|
58
|
+
Logger.info('Succeeded in setting the system bar to be invisible.');
|
|
59
|
+
}).catch((err: BusinessError) => {
|
|
60
|
+
Logger.error(`Failed to set the system bar to be invisible. Cause code: ${err.code}, message: ${err.message}`);
|
|
61
|
+
});
|
|
62
|
+
} catch (exception) {
|
|
63
|
+
Logger.error(`Failed to set the system bar to be invisible. Cause code: ${exception.code}, message: ${exception.message}`);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
async setColor(color: number, animated: boolean): Promise<void> {
|
|
68
|
+
Logger.info("###turboModule setColor");
|
|
69
|
+
let newSystemBarProperty: window.SystemBarProperties = {
|
|
70
|
+
statusBarColor: this.toHarmonyColor(color),
|
|
71
|
+
enableStatusBarAnimation:animated
|
|
72
|
+
};
|
|
73
|
+
this.setWindowSystemBarProperties(newSystemBarProperty)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
async setTranslucent(translucent: boolean): Promise<void> {
|
|
77
|
+
Logger.info("###turboModule setTranslucent");
|
|
78
|
+
let windowInstance: window.Window | undefined = undefined;
|
|
79
|
+
windowInstance = await window.getLastWindow(this.context);
|
|
80
|
+
let systemBarProperty = windowInstance.getWindowSystemBarProperties();
|
|
81
|
+
let newSystemBarProperty: window.SystemBarProperties = {
|
|
82
|
+
statusBarColor:translucent?'#00000000':systemBarProperty.statusBarColor,
|
|
83
|
+
};
|
|
84
|
+
this.setWindowSystemBarProperties(newSystemBarProperty)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
setStyle(style: 'dark-content'|'light-content'): void {
|
|
88
|
+
Logger.info("###turboModule setStyle");
|
|
89
|
+
let themeFlag= style == "dark-content"
|
|
90
|
+
let newSystemBarProperty: window.SystemBarProperties = {
|
|
91
|
+
statusBarContentColor:themeFlag?"#000000":"#ffffff",
|
|
92
|
+
};
|
|
93
|
+
this.setWindowSystemBarProperties(newSystemBarProperty)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
private toHarmonyColor(color: number): string {
|
|
97
|
+
const unsignedColor = color >>> 0;
|
|
98
|
+
const hex = unsignedColor > 0xffffff
|
|
99
|
+
? unsignedColor.toString(16).padStart(8, '0')
|
|
100
|
+
: unsignedColor.toString(16).padStart(6, '0');
|
|
101
|
+
|
|
102
|
+
return `#${hex}`;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
|
|
3
|
-
* Use of this source code is governed by a MIT license that can be
|
|
4
|
-
* found in the LICENSE file.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
export enum KeyboardControllerEventName {
|
|
8
|
-
KEYBOARD_WILL_SHOW="KeyboardController::keyboardWillShow",
|
|
9
|
-
KEYBOARD_DID_SHOW="KeyboardController::keyboardDidShow",
|
|
10
|
-
KEYBOARD_WILL_HIDE="KeyboardController::keyboardWillHide",
|
|
11
|
-
KEYBOARD_DID_HIDE="KeyboardController::keyboardDidHide",
|
|
12
|
-
FOCUS_DID_SET="KeyboardController::focusDidSet"
|
|
13
|
-
}
|
|
14
|
-
export type KeyboardChangeResult = {
|
|
15
|
-
code:number;
|
|
16
|
-
message:string;
|
|
17
|
-
data:number | undefined
|
|
18
|
-
}
|
|
19
|
-
export type KeyboardEvent ={
|
|
20
|
-
height:number;
|
|
21
|
-
duration:number;
|
|
22
|
-
timestamp:number;
|
|
23
|
-
target:number;
|
|
24
|
-
}
|
|
25
|
-
export enum KeyboardStatusType {
|
|
26
|
-
HIDE = 0,
|
|
27
|
-
SHOW = 1
|
|
28
|
-
};
|
|
29
|
-
export type RawTouchPoint={
|
|
30
|
-
pointerId: number;
|
|
31
|
-
windowX: number;
|
|
32
|
-
windowY: number;
|
|
33
|
-
}
|
|
34
|
-
export type RawTouchEvent = {
|
|
35
|
-
action: number;
|
|
36
|
-
actionTouch: RawTouchPoint;
|
|
37
|
-
touchPoints: RawTouchPoint[];
|
|
38
|
-
sourceType: number;
|
|
39
|
-
timestamp: number;
|
|
40
|
-
rootTag:number;
|
|
41
|
-
};
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
|
|
3
|
+
* Use of this source code is governed by a MIT license that can be
|
|
4
|
+
* found in the LICENSE file.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export enum KeyboardControllerEventName {
|
|
8
|
+
KEYBOARD_WILL_SHOW="KeyboardController::keyboardWillShow",
|
|
9
|
+
KEYBOARD_DID_SHOW="KeyboardController::keyboardDidShow",
|
|
10
|
+
KEYBOARD_WILL_HIDE="KeyboardController::keyboardWillHide",
|
|
11
|
+
KEYBOARD_DID_HIDE="KeyboardController::keyboardDidHide",
|
|
12
|
+
FOCUS_DID_SET="KeyboardController::focusDidSet"
|
|
13
|
+
}
|
|
14
|
+
export type KeyboardChangeResult = {
|
|
15
|
+
code:number;
|
|
16
|
+
message:string;
|
|
17
|
+
data:number | undefined
|
|
18
|
+
}
|
|
19
|
+
export type KeyboardEvent ={
|
|
20
|
+
height:number;
|
|
21
|
+
duration:number;
|
|
22
|
+
timestamp:number;
|
|
23
|
+
target:number;
|
|
24
|
+
}
|
|
25
|
+
export enum KeyboardStatusType {
|
|
26
|
+
HIDE = 0,
|
|
27
|
+
SHOW = 1
|
|
28
|
+
};
|
|
29
|
+
export type RawTouchPoint={
|
|
30
|
+
pointerId: number;
|
|
31
|
+
windowX: number;
|
|
32
|
+
windowY: number;
|
|
33
|
+
}
|
|
34
|
+
export type RawTouchEvent = {
|
|
35
|
+
action: number;
|
|
36
|
+
actionTouch: RawTouchPoint;
|
|
37
|
+
touchPoints: RawTouchPoint[];
|
|
38
|
+
sourceType: number;
|
|
39
|
+
timestamp: number;
|
|
40
|
+
rootTag:number;
|
|
41
|
+
};
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
{
|
|
2
|
-
"app": {
|
|
3
|
-
"bundleName": "com.rnoh.lhg.test",
|
|
4
|
-
"debug": true,
|
|
5
|
-
"versionCode": 1000000,
|
|
6
|
-
"versionName": "1.0.0",
|
|
7
|
-
"minAPIVersion": 50000012,
|
|
8
|
-
"targetAPIVersion": 50000012,
|
|
9
|
-
"apiReleaseType": "Beta5",
|
|
10
|
-
"compileSdkVersion": "5.0.0.60",
|
|
11
|
-
"compileSdkType": "HarmonyOS",
|
|
12
|
-
"appEnvironments": [],
|
|
13
|
-
"bundleType": "app"
|
|
14
|
-
},
|
|
15
|
-
"module": {
|
|
16
|
-
"name": "keyboard_controller",
|
|
17
|
-
"type": "har",
|
|
18
|
-
"deviceTypes": [
|
|
19
|
-
"default",
|
|
20
|
-
"tablet",
|
|
21
|
-
"2in1"
|
|
22
|
-
],
|
|
23
|
-
"packageName": "@react-native-oh-tpl/react-native-keyboard-controller",
|
|
24
|
-
"installationFree": false,
|
|
25
|
-
"virtualMachine": "ark12.0.2.0",
|
|
26
|
-
"compileMode": "esmodule",
|
|
27
|
-
"dependencies": []
|
|
28
|
-
}
|
|
29
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"app": {
|
|
3
|
+
"bundleName": "com.rnoh.lhg.test",
|
|
4
|
+
"debug": true,
|
|
5
|
+
"versionCode": 1000000,
|
|
6
|
+
"versionName": "1.0.0",
|
|
7
|
+
"minAPIVersion": 50000012,
|
|
8
|
+
"targetAPIVersion": 50000012,
|
|
9
|
+
"apiReleaseType": "Beta5",
|
|
10
|
+
"compileSdkVersion": "5.0.0.60",
|
|
11
|
+
"compileSdkType": "HarmonyOS",
|
|
12
|
+
"appEnvironments": [],
|
|
13
|
+
"bundleType": "app"
|
|
14
|
+
},
|
|
15
|
+
"module": {
|
|
16
|
+
"name": "keyboard_controller",
|
|
17
|
+
"type": "har",
|
|
18
|
+
"deviceTypes": [
|
|
19
|
+
"default",
|
|
20
|
+
"tablet",
|
|
21
|
+
"2in1"
|
|
22
|
+
],
|
|
23
|
+
"packageName": "@react-native-oh-tpl/react-native-keyboard-controller",
|
|
24
|
+
"installationFree": false,
|
|
25
|
+
"virtualMachine": "ark12.0.2.0",
|
|
26
|
+
"compileMode": "esmodule",
|
|
27
|
+
"dependencies": []
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
{
|
|
2
|
-
"module": {
|
|
3
|
-
"name": "keyboard_controller",
|
|
4
|
-
"type": "har",
|
|
5
|
-
"deviceTypes": [
|
|
6
|
-
"default",
|
|
7
|
-
"tablet",
|
|
8
|
-
"2in1"
|
|
9
|
-
]
|
|
10
|
-
}
|
|
11
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"module": {
|
|
3
|
+
"name": "keyboard_controller",
|
|
4
|
+
"type": "har",
|
|
5
|
+
"deviceTypes": [
|
|
6
|
+
"default",
|
|
7
|
+
"tablet",
|
|
8
|
+
"2in1"
|
|
9
|
+
]
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
{
|
|
2
|
-
"string": [
|
|
3
|
-
{
|
|
4
|
-
"name": "page_show",
|
|
5
|
-
"value": "page from package"
|
|
6
|
-
}
|
|
7
|
-
]
|
|
8
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"string": [
|
|
3
|
+
{
|
|
4
|
+
"name": "page_show",
|
|
5
|
+
"value": "page from package"
|
|
6
|
+
}
|
|
7
|
+
]
|
|
8
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
{
|
|
2
|
-
"string": [
|
|
3
|
-
{
|
|
4
|
-
"name": "page_show",
|
|
5
|
-
"value": "page from package"
|
|
6
|
-
}
|
|
7
|
-
]
|
|
8
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"string": [
|
|
3
|
+
{
|
|
4
|
+
"name": "page_show",
|
|
5
|
+
"value": "page from package"
|
|
6
|
+
}
|
|
7
|
+
]
|
|
8
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
{
|
|
2
|
-
"string": [
|
|
3
|
-
{
|
|
4
|
-
"name": "page_show",
|
|
5
|
-
"value": "page from package"
|
|
6
|
-
}
|
|
7
|
-
]
|
|
8
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"string": [
|
|
3
|
+
{
|
|
4
|
+
"name": "page_show",
|
|
5
|
+
"value": "page from package"
|
|
6
|
+
}
|
|
7
|
+
]
|
|
8
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
|
|
3
|
-
* Use of this source code is governed by a MIT license that can be
|
|
4
|
-
* found in the LICENSE file.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
export * from './src/main/ets/RNKeyboardControllerPackage';
|
|
8
|
-
export * from './src/main/ets/RNKeyboardControllerTurboModule';
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
|
|
3
|
+
* Use of this source code is governed by a MIT license that can be
|
|
4
|
+
* found in the LICENSE file.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export * from './src/main/ets/RNKeyboardControllerPackage';
|
|
8
|
+
export * from './src/main/ets/RNKeyboardControllerTurboModule';
|
|
9
9
|
export * from './src/main/ets/RNStatusBarManagerCompatTurboModule';
|
|
Binary file
|
package/lib/commonjs/animated.js
CHANGED
|
@@ -80,20 +80,8 @@ const KeyboardProvider = ({
|
|
|
80
80
|
|
|
81
81
|
if (platforms.includes(OS)) {
|
|
82
82
|
// eslint-disable-next-line react-compiler/react-compiler
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
progressSV.value = (0, _reactNativeReanimated.withTiming)(event.progress, {
|
|
86
|
-
duration: dur,
|
|
87
|
-
easing: _reactNativeReanimated.Easing.out(_reactNativeReanimated.Easing.exp)
|
|
88
|
-
});
|
|
89
|
-
heightSV.value = (0, _reactNativeReanimated.withTiming)(-event.height, {
|
|
90
|
-
duration: dur,
|
|
91
|
-
easing: _reactNativeReanimated.Easing.out(_reactNativeReanimated.Easing.exp)
|
|
92
|
-
});
|
|
93
|
-
} else {
|
|
94
|
-
progressSV.value = event.progress;
|
|
95
|
-
heightSV.value = -event.height;
|
|
96
|
-
}
|
|
83
|
+
progressSV.value = event.progress;
|
|
84
|
+
heightSV.value = -event.height;
|
|
97
85
|
}
|
|
98
86
|
};
|
|
99
87
|
const keyboardHandler = (0, _reanimated.useAnimatedKeyboardHandler)({
|
|
@@ -107,13 +95,13 @@ const KeyboardProvider = ({
|
|
|
107
95
|
"worklet";
|
|
108
96
|
|
|
109
97
|
broadcastKeyboardEvents("onMove", event);
|
|
110
|
-
updateSharedValues(event, ["android"]);
|
|
98
|
+
updateSharedValues(event, ["android", "harmony"]);
|
|
111
99
|
},
|
|
112
100
|
onKeyboardMoveEnd: event => {
|
|
113
101
|
"worklet";
|
|
114
102
|
|
|
115
103
|
broadcastKeyboardEvents("onEnd", event);
|
|
116
|
-
updateSharedValues(event, [
|
|
104
|
+
updateSharedValues(event, ["android", "harmony"]);
|
|
117
105
|
},
|
|
118
106
|
onKeyboardMoveInteractive: event => {
|
|
119
107
|
"worklet";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeReanimated","_bindings","_context","_internal","_monkeyPatch","_reanimated","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","KeyboardControllerViewAnimated","Reanimated","createAnimatedComponent","Animated","KeyboardControllerView","styles","StyleSheet","create","container","flex","hidden","display","position","OS","Platform","KeyboardProvider","children","statusBarTranslucent","navigationBarTranslucent","enabled","initiallyEnabled","setEnabled","useState","progress","useAnimatedValue","height","progressSV","useSharedValue","heightSV","layout","setKeyboardHandlers","broadcastKeyboardEvents","useSharedHandlers","setInputHandlers","broadcastInputEvents","context","useMemo","animated","multiply","reanimated","style","transform","translateX","translateY","onKeyboardMove","event","nativeEvent","useNativeDriver","updateSharedValues","platforms","includes","dur","value","withTiming","duration","easing","Easing","out","exp","keyboardHandler","useAnimatedKeyboardHandler","onKeyboardMoveStart","onKeyboardMoveEnd","onKeyboardMoveInteractive","inputLayoutHandler","useFocusedInputLayoutHandler","onFocusedInputLayoutChanged","target","inputTextHandler","useFocusedInputTextHandler","onFocusedInputTextChanged","inputSelectionHandler","useFocusedInputSelectionHandler","onFocusedInputSelectionChanged","useEffect","applyMonkeyPatch","revertMonkeyPatch","createElement","KeyboardContext","Provider","onKeyboardMoveReanimated","undefined","onFocusedInputLayoutChangedReanimated","onFocusedInputTextChangedReanimated","onFocusedInputSelectionChangedReanimated","View","exports"],"sources":["animated.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useState } from \"react\";\r\nimport { Animated, Platform, StyleSheet } from \"react-native\";\r\nimport Reanimated, { useSharedValue, Easing, withTiming } from \"react-native-reanimated\";\r\n\r\nimport { KeyboardControllerView } from \"./bindings\";\r\nimport { KeyboardContext } from \"./context\";\r\nimport { useAnimatedValue, useSharedHandlers } from \"./internal\";\r\nimport { applyMonkeyPatch, revertMonkeyPatch } from \"./monkey-patch\";\r\nimport {\r\n useAnimatedKeyboardHandler,\r\n useFocusedInputLayoutHandler,\r\n useFocusedInputSelectionHandler,\r\n useFocusedInputTextHandler,\r\n} from \"./reanimated\";\r\n\r\nimport type { KeyboardAnimationContext } from \"./context\";\r\nimport type {\r\n FocusedInputHandler,\r\n FocusedInputLayoutChangedEvent,\r\n KeyboardControllerProps,\r\n KeyboardHandler,\r\n NativeEvent,\r\n} from \"./types\";\r\nimport type { ViewStyle } from \"react-native\";\r\n\r\nconst KeyboardControllerViewAnimated = Reanimated.createAnimatedComponent(\r\n Animated.createAnimatedComponent(\r\n KeyboardControllerView,\r\n ) as React.FC<KeyboardControllerProps>,\r\n);\r\n\r\ntype Styles = {\r\n container: ViewStyle;\r\n hidden: ViewStyle;\r\n};\r\n\r\nconst styles = StyleSheet.create<Styles>({\r\n container: {\r\n flex: 1,\r\n },\r\n hidden: {\r\n display: \"none\",\r\n position: \"absolute\",\r\n },\r\n});\r\n\r\ntype KeyboardProviderProps = {\r\n children: React.ReactNode;\r\n /**\r\n * Set the value to `true`, if you use translucent status bar on Android.\r\n * If you already control status bar translucency via `react-native-screens`\r\n * or `StatusBar` component from `react-native`, you can ignore it.\r\n * Defaults to `false`.\r\n *\r\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/14\r\n * @platform android\r\n */\r\n statusBarTranslucent?: boolean;\r\n /**\r\n * Set the value to `true`, if you use translucent navigation bar on Android.\r\n * Defaults to `false`.\r\n *\r\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/119\r\n * @platform android\r\n */\r\n navigationBarTranslucent?: boolean;\r\n /**\r\n * A boolean prop indicating whether the module is enabled. It indicate only initial state,\r\n * i. e. if you try to change this prop after component mount it will not have any effect.\r\n * To change the property in runtime use `useKeyboardController` hook and `setEnabled` method.\r\n * Defaults to `true`.\r\n */\r\n enabled?: boolean;\r\n};\r\n\r\n// capture `Platform.OS` in separate variable to avoid deep workletization of entire RN package\r\n// see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/393 and https://github.com/kirillzyusko/react-native-keyboard-controller/issues/294 for more details\r\nconst OS = Platform.OS;\r\n\r\nexport const KeyboardProvider = ({\r\n children,\r\n statusBarTranslucent,\r\n navigationBarTranslucent,\r\n enabled: initiallyEnabled = true,\r\n}: KeyboardProviderProps) => {\r\n // state\r\n const [enabled, setEnabled] = useState(initiallyEnabled);\r\n // animated values\r\n const progress = useAnimatedValue(0);\r\n const height = useAnimatedValue(0);\r\n // shared values\r\n const progressSV = useSharedValue(0);\r\n const heightSV = useSharedValue(0);\r\n const layout = useSharedValue<FocusedInputLayoutChangedEvent | null>(null);\r\n const [setKeyboardHandlers, broadcastKeyboardEvents] =\r\n useSharedHandlers<KeyboardHandler>();\r\n const [setInputHandlers, broadcastInputEvents] =\r\n useSharedHandlers<FocusedInputHandler>();\r\n // memo\r\n const context = useMemo<KeyboardAnimationContext>(\r\n () => ({\r\n enabled,\r\n animated: { progress: progress, height: Animated.multiply(height, -1) },\r\n reanimated: { progress: progressSV, height: heightSV },\r\n layout,\r\n setKeyboardHandlers,\r\n setInputHandlers,\r\n setEnabled,\r\n }),\r\n [enabled],\r\n );\r\n const style = useMemo(\r\n () => [\r\n styles.hidden,\r\n { transform: [{ translateX: height }, { translateY: progress }] },\r\n ],\r\n [],\r\n );\r\n const onKeyboardMove = useMemo(\r\n () =>\r\n Animated.event(\r\n [\r\n {\r\n nativeEvent: {\r\n progress,\r\n height,\r\n },\r\n },\r\n ],\r\n { useNativeDriver: Platform.OS as string == 'harmony' ? false : true },\r\n ),\r\n [],\r\n );\r\n // handlers\r\n const updateSharedValues = (event: NativeEvent, platforms: string[]) => {\r\n \"worklet\";\r\n\r\n if (platforms.includes(OS)) {\r\n // eslint-disable-next-line react-compiler/react-compiler\r\n if (Platform.OS as string == 'harmony') {\r\n const dur = 460\r\n progressSV.value = withTiming(event.progress, { duration: dur, easing: Easing.out(Easing.exp) });\r\n heightSV.value = withTiming(-event.height, { duration: dur, easing: Easing.out(Easing.exp) });\r\n } else {\r\n progressSV.value = event.progress;\r\n heightSV.value = -event.height;\r\n\r\n }\r\n }\r\n };\r\n const keyboardHandler = useAnimatedKeyboardHandler(\r\n {\r\n onKeyboardMoveStart: (event: NativeEvent) => {\r\n \"worklet\";\r\n\r\n broadcastKeyboardEvents(\"onStart\", event);\r\n updateSharedValues(event, [\"ios\"]);\r\n },\r\n onKeyboardMove: (event: NativeEvent) => {\r\n \"worklet\";\r\n\r\n broadcastKeyboardEvents(\"onMove\", event);\r\n updateSharedValues(event, [\"android\"]);\r\n },\r\n onKeyboardMoveEnd: (event: NativeEvent) => {\r\n \"worklet\";\r\n broadcastKeyboardEvents(\"onEnd\", event);\r\n updateSharedValues(event, ['harmony']);\r\n },\r\n onKeyboardMoveInteractive: (event: NativeEvent) => {\r\n \"worklet\";\r\n\r\n updateSharedValues(event, [\"android\", \"ios\"]);\r\n broadcastKeyboardEvents(\"onInteractive\", event);\r\n },\r\n },\r\n [],\r\n );\r\n const inputLayoutHandler = useFocusedInputLayoutHandler(\r\n {\r\n onFocusedInputLayoutChanged: (e) => {\r\n \"worklet\";\r\n\r\n if (e.target !== -1) {\r\n layout.value = e;\r\n } else {\r\n layout.value = null;\r\n }\r\n },\r\n },\r\n [],\r\n );\r\n const inputTextHandler = useFocusedInputTextHandler(\r\n {\r\n onFocusedInputTextChanged: (e) => {\r\n \"worklet\";\r\n\r\n broadcastInputEvents(\"onChangeText\", e);\r\n },\r\n },\r\n [],\r\n );\r\n const inputSelectionHandler = useFocusedInputSelectionHandler(\r\n {\r\n onFocusedInputSelectionChanged: (e) => {\r\n \"worklet\";\r\n broadcastInputEvents(\"onSelectionChange\", e);\r\n },\r\n },\r\n [],\r\n );\r\n // effects\r\n useEffect(() => {\r\n if (enabled) {\r\n applyMonkeyPatch();\r\n } else {\r\n revertMonkeyPatch();\r\n }\r\n }, [enabled]);\r\n\r\n return (\r\n <KeyboardContext.Provider value={context}>\r\n <KeyboardControllerViewAnimated\r\n enabled={enabled}\r\n onKeyboardMoveReanimated={keyboardHandler}\r\n onKeyboardMoveStart={OS === \"ios\" ? onKeyboardMove : undefined}\r\n onKeyboardMove={OS === \"android\" ? onKeyboardMove : undefined}\r\n onKeyboardMoveInteractive={onKeyboardMove}\r\n onKeyboardMoveEnd={OS as string === \"harmony\" ? onKeyboardMove : undefined}\r\n onFocusedInputLayoutChangedReanimated={inputLayoutHandler}\r\n onFocusedInputTextChangedReanimated={inputTextHandler}\r\n onFocusedInputSelectionChangedReanimated={inputSelectionHandler}\r\n navigationBarTranslucent={navigationBarTranslucent}\r\n statusBarTranslucent={statusBarTranslucent}\r\n style={styles.container}\r\n >\r\n <Reanimated.View style={styles.container}>{children}</Reanimated.View>\r\n {/* {children} */}\r\n </KeyboardControllerViewAnimated>\r\n <Animated.View\r\n // we are using this small hack, because if the component (where\r\n // animated value has been used) is unmounted, then animation will\r\n // stop receiving events (seems like it's react-native optimization).\r\n // So we need to keep a reference to the animated value, to keep it's\r\n // always mounted (keep a reference to an animated value).\r\n //\r\n // To test why it's needed, try to open screen which consumes Animated.Value\r\n // then close it and open it again (for example 'Animated transition').\r\n style={style}\r\n />\r\n </KeyboardContext.Provider>\r\n );\r\n};\r\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,sBAAA,GAAAH,uBAAA,CAAAC,OAAA;AAEA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AACA,IAAAO,WAAA,GAAAP,OAAA;AAKsB,SAAAD,wBAAAS,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAX,uBAAA,YAAAA,CAAAS,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP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IACtDgB,wCAAwC,EAAEb,qBAAsB;IAChErD,wBAAwB,EAAEA,wBAAyB;IACnDD,oBAAoB,EAAEA,oBAAqB;IAC3CuB,KAAK,EAAEnC,MAAM,CAACG;EAAU,gBAExBrC,MAAA,CAAAoB,OAAA,CAAAsF,aAAA,CAACtG,sBAAA,CAAAgB,OAAU,CAAC8F,IAAI;IAAC7C,KAAK,EAAEnC,MAAM,CAACG;EAAU,GAAEQ,QAA0B,CAEvC,CAAC,eACjC7C,MAAA,CAAAoB,OAAA,CAAAsF,aAAA,CAACvG,YAAA,CAAA6B,QAAQ,CAACkF,IAAI;IACZ;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA7C,KAAK,EAAEA;EAAM,CACd,CACuB,CAAC;AAE/B,CAAC;AAAC8C,OAAA,CAAAvE,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeReanimated","_bindings","_context","_internal","_monkeyPatch","_reanimated","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","KeyboardControllerViewAnimated","Reanimated","createAnimatedComponent","Animated","KeyboardControllerView","styles","StyleSheet","create","container","flex","hidden","display","position","OS","Platform","KeyboardProvider","children","statusBarTranslucent","navigationBarTranslucent","enabled","initiallyEnabled","setEnabled","useState","progress","useAnimatedValue","height","progressSV","useSharedValue","heightSV","layout","setKeyboardHandlers","broadcastKeyboardEvents","useSharedHandlers","setInputHandlers","broadcastInputEvents","context","useMemo","animated","multiply","reanimated","style","transform","translateX","translateY","onKeyboardMove","event","nativeEvent","useNativeDriver","updateSharedValues","platforms","includes","value","keyboardHandler","useAnimatedKeyboardHandler","onKeyboardMoveStart","onKeyboardMoveEnd","onKeyboardMoveInteractive","inputLayoutHandler","useFocusedInputLayoutHandler","onFocusedInputLayoutChanged","target","inputTextHandler","useFocusedInputTextHandler","onFocusedInputTextChanged","inputSelectionHandler","useFocusedInputSelectionHandler","onFocusedInputSelectionChanged","useEffect","applyMonkeyPatch","revertMonkeyPatch","createElement","KeyboardContext","Provider","onKeyboardMoveReanimated","undefined","onFocusedInputLayoutChangedReanimated","onFocusedInputTextChangedReanimated","onFocusedInputSelectionChangedReanimated","View","exports"],"sources":["animated.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useState } from \"react\";\nimport { Animated, Platform, StyleSheet } from \"react-native\";\nimport Reanimated, { useSharedValue } from \"react-native-reanimated\";\n\nimport { KeyboardControllerView } from \"./bindings\";\nimport { KeyboardContext } from \"./context\";\nimport { useAnimatedValue, useSharedHandlers } from \"./internal\";\nimport { applyMonkeyPatch, revertMonkeyPatch } from \"./monkey-patch\";\nimport {\n useAnimatedKeyboardHandler,\n useFocusedInputLayoutHandler,\n useFocusedInputSelectionHandler,\n useFocusedInputTextHandler,\n} from \"./reanimated\";\n\nimport type { KeyboardAnimationContext } from \"./context\";\nimport type {\n FocusedInputHandler,\n FocusedInputLayoutChangedEvent,\n KeyboardControllerProps,\n KeyboardHandler,\n NativeEvent,\n} from \"./types\";\nimport type { ViewStyle } from \"react-native\";\n\nconst KeyboardControllerViewAnimated = Reanimated.createAnimatedComponent(\n Animated.createAnimatedComponent(\n KeyboardControllerView,\n ) as React.FC<KeyboardControllerProps>,\n);\n\ntype Styles = {\n container: ViewStyle;\n hidden: ViewStyle;\n};\n\nconst styles = StyleSheet.create<Styles>({\n container: {\n flex: 1,\n },\n hidden: {\n display: \"none\",\n position: \"absolute\",\n },\n});\n\ntype KeyboardProviderProps = {\n children: React.ReactNode;\n /**\n * Set the value to `true`, if you use translucent status bar on Android.\n * If you already control status bar translucency via `react-native-screens`\n * or `StatusBar` component from `react-native`, you can ignore it.\n * Defaults to `false`.\n *\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/14\n * @platform android\n */\n statusBarTranslucent?: boolean;\n /**\n * Set the value to `true`, if you use translucent navigation bar on Android.\n * Defaults to `false`.\n *\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/119\n * @platform android\n */\n navigationBarTranslucent?: boolean;\n /**\n * A boolean prop indicating whether the module is enabled. It indicate only initial state,\n * i. e. if you try to change this prop after component mount it will not have any effect.\n * To change the property in runtime use `useKeyboardController` hook and `setEnabled` method.\n * Defaults to `true`.\n */\n enabled?: boolean;\n};\n\n// capture `Platform.OS` in separate variable to avoid deep workletization of entire RN package\n// see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/393 and https://github.com/kirillzyusko/react-native-keyboard-controller/issues/294 for more details\nconst OS = Platform.OS;\n\nexport const KeyboardProvider = ({\n children,\n statusBarTranslucent,\n navigationBarTranslucent,\n enabled: initiallyEnabled = true,\n}: KeyboardProviderProps) => {\n // state\n const [enabled, setEnabled] = useState(initiallyEnabled);\n // animated values\n const progress = useAnimatedValue(0);\n const height = useAnimatedValue(0);\n // shared values\n const progressSV = useSharedValue(0);\n const heightSV = useSharedValue(0);\n const layout = useSharedValue<FocusedInputLayoutChangedEvent | null>(null);\n const [setKeyboardHandlers, broadcastKeyboardEvents] =\n useSharedHandlers<KeyboardHandler>();\n const [setInputHandlers, broadcastInputEvents] =\n useSharedHandlers<FocusedInputHandler>();\n // memo\n const context = useMemo<KeyboardAnimationContext>(\n () => ({\n enabled,\n animated: { progress: progress, height: Animated.multiply(height, -1) },\n reanimated: { progress: progressSV, height: heightSV },\n layout,\n setKeyboardHandlers,\n setInputHandlers,\n setEnabled,\n }),\n [enabled],\n );\n const style = useMemo(\n () => [\n styles.hidden,\n { transform: [{ translateX: height }, { translateY: progress }] },\n ],\n [],\n );\n const onKeyboardMove = useMemo(\n () =>\n Animated.event(\n [\n {\n nativeEvent: {\n progress,\n height,\n },\n },\n ],\n { useNativeDriver: Platform.OS as string == 'harmony' ? false : true },\n ),\n [],\n );\n // handlers\n const updateSharedValues = (event: NativeEvent, platforms: string[]) => {\n \"worklet\";\n\n if (platforms.includes(OS)) {\n // eslint-disable-next-line react-compiler/react-compiler\n progressSV.value = event.progress;\n heightSV.value = -event.height;\n }\n };\n const keyboardHandler = useAnimatedKeyboardHandler(\n {\n onKeyboardMoveStart: (event: NativeEvent) => {\n \"worklet\";\n\n broadcastKeyboardEvents(\"onStart\", event);\n updateSharedValues(event, [\"ios\"]);\n },\n onKeyboardMove: (event: NativeEvent) => {\n \"worklet\";\n\n broadcastKeyboardEvents(\"onMove\", event);\n updateSharedValues(event, [\"android\", \"harmony\"]);\n },\n onKeyboardMoveEnd: (event: NativeEvent) => {\n \"worklet\";\n broadcastKeyboardEvents(\"onEnd\", event);\n updateSharedValues(event, [\"android\", \"harmony\"]);\n },\n onKeyboardMoveInteractive: (event: NativeEvent) => {\n \"worklet\";\n\n updateSharedValues(event, [\"android\", \"ios\"]);\n broadcastKeyboardEvents(\"onInteractive\", event);\n },\n },\n [],\n );\n const inputLayoutHandler = useFocusedInputLayoutHandler(\n {\n onFocusedInputLayoutChanged: (e) => {\n \"worklet\";\n\n if (e.target !== -1) {\n layout.value = e;\n } else {\n layout.value = null;\n }\n },\n },\n [],\n );\n const inputTextHandler = useFocusedInputTextHandler(\n {\n onFocusedInputTextChanged: (e) => {\n \"worklet\";\n\n broadcastInputEvents(\"onChangeText\", e);\n },\n },\n [],\n );\n const inputSelectionHandler = useFocusedInputSelectionHandler(\n {\n onFocusedInputSelectionChanged: (e) => {\n \"worklet\";\n broadcastInputEvents(\"onSelectionChange\", e);\n },\n },\n [],\n );\n // effects\n useEffect(() => {\n if (enabled) {\n applyMonkeyPatch();\n } else {\n revertMonkeyPatch();\n }\n }, [enabled]);\n\n return (\n <KeyboardContext.Provider value={context}>\n <KeyboardControllerViewAnimated\n enabled={enabled}\n onKeyboardMoveReanimated={keyboardHandler}\n onKeyboardMoveStart={OS === \"ios\" ? onKeyboardMove : undefined}\n onKeyboardMove={OS === \"android\" ? onKeyboardMove : undefined}\n onKeyboardMoveInteractive={onKeyboardMove}\n onKeyboardMoveEnd={OS as string === \"harmony\" ? onKeyboardMove : undefined}\n onFocusedInputLayoutChangedReanimated={inputLayoutHandler}\n onFocusedInputTextChangedReanimated={inputTextHandler}\n onFocusedInputSelectionChangedReanimated={inputSelectionHandler}\n navigationBarTranslucent={navigationBarTranslucent}\n statusBarTranslucent={statusBarTranslucent}\n style={styles.container}\n >\n <Reanimated.View style={styles.container}>{children}</Reanimated.View>\n {/* {children} */}\n </KeyboardControllerViewAnimated>\n <Animated.View\n // we are using this small hack, because if the component (where\n // animated value has been used) is unmounted, then animation will\n // stop receiving events (seems like it's react-native optimization).\n // So we need to keep a reference to the animated value, to keep it's\n // always mounted (keep a reference to an animated value).\n //\n // To test why it's needed, try to open screen which consumes Animated.Value\n // then close it and open it again (for example 'Animated transition').\n style={style}\n />\n </KeyboardContext.Provider>\n );\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,sBAAA,GAAAH,uBAAA,CAAAC,OAAA;AAEA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AACA,IAAAO,WAAA,GAAAP,OAAA;AAKsB,SAAAD,wBAAAS,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAX,uBAAA,YAAAA,CAAAS,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UA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KAAK,EAAEnC,MAAM,CAACG;EAAU,gBAExBrC,MAAA,CAAAoB,OAAA,CAAA+E,aAAA,CAAC/F,sBAAA,CAAAgB,OAAU,CAACuF,IAAI;IAACtC,KAAK,EAAEnC,MAAM,CAACG;EAAU,GAAEQ,QAA0B,CAEvC,CAAC,eACjC7C,MAAA,CAAAoB,OAAA,CAAA+E,aAAA,CAAChG,YAAA,CAAA6B,QAAQ,CAAC2E,IAAI;IACZ;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACAtC,KAAK,EAAEA;EAAM,CACd,CACuB,CAAC;AAE/B,CAAC;AAACuC,OAAA,CAAAhE,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
package/lib/commonjs/bindings.js
CHANGED
|
@@ -19,9 +19,9 @@ const KeyboardEvents = exports.KeyboardEvents = {
|
|
|
19
19
|
remove: NOOP
|
|
20
20
|
})
|
|
21
21
|
};
|
|
22
|
-
/**
|
|
23
|
-
* This API is not documented, it's for internal usage only (for now), and is a subject to potential breaking changes in future.
|
|
24
|
-
* Use it with cautious.
|
|
22
|
+
/**
|
|
23
|
+
* This API is not documented, it's for internal usage only (for now), and is a subject to potential breaking changes in future.
|
|
24
|
+
* Use it with cautious.
|
|
25
25
|
*/
|
|
26
26
|
const FocusedInputEvents = exports.FocusedInputEvents = {
|
|
27
27
|
addListener: () => ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","NOOP","KeyboardController","exports","setDefaultMode","setInputMode","dismiss","setFocusTo","addListener","removeListeners","KeyboardEvents","remove","FocusedInputEvents","WindowDimensionsEvents","KeyboardControllerView","View","KeyboardGestureArea"],"sources":["bindings.ts"],"sourcesContent":["import { View } from \"react-native\";\
|
|
1
|
+
{"version":3,"names":["_reactNative","require","NOOP","KeyboardController","exports","setDefaultMode","setInputMode","dismiss","setFocusTo","addListener","removeListeners","KeyboardEvents","remove","FocusedInputEvents","WindowDimensionsEvents","KeyboardControllerView","View","KeyboardGestureArea"],"sources":["bindings.ts"],"sourcesContent":["import { View } from \"react-native\";\n\nimport type {\n FocusedInputEventsModule,\n KeyboardControllerModule,\n KeyboardControllerProps,\n KeyboardEventsModule,\n KeyboardGestureAreaProps,\n WindowDimensionsEventsModule,\n} from \"./types\";\nimport type { EmitterSubscription } from \"react-native\";\n\nconst NOOP = () => {};\nexport const KeyboardController: KeyboardControllerModule = {\n setDefaultMode: NOOP,\n setInputMode: NOOP,\n dismiss: NOOP,\n setFocusTo: NOOP,\n addListener: NOOP,\n removeListeners: NOOP,\n};\nexport const KeyboardEvents: KeyboardEventsModule = {\n addListener: () => ({ remove: NOOP } as EmitterSubscription),\n};\n/**\n * This API is not documented, it's for internal usage only (for now), and is a subject to potential breaking changes in future.\n * Use it with cautious.\n */\nexport const FocusedInputEvents: FocusedInputEventsModule = {\n addListener: () => ({ remove: NOOP } as EmitterSubscription),\n};\nexport const WindowDimensionsEvents: WindowDimensionsEventsModule = {\n addListener: () => ({ remove: NOOP } as EmitterSubscription),\n};\nexport const KeyboardControllerView =\n View as unknown as React.FC<KeyboardControllerProps>;\nexport const KeyboardGestureArea =\n View as unknown as React.FC<KeyboardGestureAreaProps>;\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAYA,MAAMC,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AACd,MAAMC,kBAA4C,GAAAC,OAAA,CAAAD,kBAAA,GAAG;EAC1DE,cAAc,EAAEH,IAAI;EACpBI,YAAY,EAAEJ,IAAI;EAClBK,OAAO,EAAEL,IAAI;EACbM,UAAU,EAAEN,IAAI;EAChBO,WAAW,EAAEP,IAAI;EACjBQ,eAAe,EAAER;AACnB,CAAC;AACM,MAAMS,cAAoC,GAAAP,OAAA,CAAAO,cAAA,GAAG;EAClDF,WAAW,EAAEA,CAAA,MAAO;IAAEG,MAAM,EAAEV;EAAK,CAAC;AACtC,CAAC;AACD;AACA;AACA;AACA;AACO,MAAMW,kBAA4C,GAAAT,OAAA,CAAAS,kBAAA,GAAG;EAC1DJ,WAAW,EAAEA,CAAA,MAAO;IAAEG,MAAM,EAAEV;EAAK,CAAC;AACtC,CAAC;AACM,MAAMY,sBAAoD,GAAAV,OAAA,CAAAU,sBAAA,GAAG;EAClEL,WAAW,EAAEA,CAAA,MAAO;IAAEG,MAAM,EAAEV;EAAK,CAAC;AACtC,CAAC;AACM,MAAMa,sBAAsB,GAAAX,OAAA,CAAAW,sBAAA,GACjCC,iBAAoD;AAC/C,MAAMC,mBAAmB,GAAAb,OAAA,CAAAa,mBAAA,GAC9BD,iBAAqD","ignoreList":[]}
|
|
@@ -20,9 +20,9 @@ const eventEmitter = new _reactNative.NativeEventEmitter(KeyboardController);
|
|
|
20
20
|
const KeyboardEvents = exports.KeyboardEvents = {
|
|
21
21
|
addListener: (name, cb) => eventEmitter.addListener(KEYBOARD_CONTROLLER_NAMESPACE + name, cb)
|
|
22
22
|
};
|
|
23
|
-
/**
|
|
24
|
-
* This API is not documented, it's for internal usage only (for now), and is a subject to potential breaking changes in future.
|
|
25
|
-
* Use it with cautious.
|
|
23
|
+
/**
|
|
24
|
+
* This API is not documented, it's for internal usage only (for now), and is a subject to potential breaking changes in future.
|
|
25
|
+
* Use it with cautious.
|
|
26
26
|
*/
|
|
27
27
|
const FocusedInputEvents = exports.FocusedInputEvents = {
|
|
28
28
|
addListener: (name, cb) => eventEmitter.addListener(KEYBOARD_CONTROLLER_NAMESPACE + name, cb)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","LINKING_ERROR","Platform","select","ios","default","RCTKeyboardController","KeyboardController","exports","Proxy","get","Error","KEYBOARD_CONTROLLER_NAMESPACE","eventEmitter","NativeEventEmitter","KeyboardEvents","addListener","name","cb","FocusedInputEvents","WindowDimensionsEvents","KeyboardControllerView","KeyboardGestureArea","OS","Version","children"],"sources":["bindings.native.ts"],"sourcesContent":["import { NativeEventEmitter, Platform } from \"react-native\";\
|
|
1
|
+
{"version":3,"names":["_reactNative","require","LINKING_ERROR","Platform","select","ios","default","RCTKeyboardController","KeyboardController","exports","Proxy","get","Error","KEYBOARD_CONTROLLER_NAMESPACE","eventEmitter","NativeEventEmitter","KeyboardEvents","addListener","name","cb","FocusedInputEvents","WindowDimensionsEvents","KeyboardControllerView","KeyboardGestureArea","OS","Version","children"],"sources":["bindings.native.ts"],"sourcesContent":["import { NativeEventEmitter, Platform } from \"react-native\";\n\nimport type {\n FocusedInputEventsModule,\n KeyboardControllerModule,\n KeyboardControllerProps,\n KeyboardEventsModule,\n KeyboardGestureAreaProps,\n WindowDimensionsEventsModule,\n} from \"./types\";\n\nconst LINKING_ERROR =\n `The package 'react-native-keyboard-controller' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: \"\" }) +\n \"- You rebuilt the app after installing the package\\n\" +\n \"- You are not using Expo Go\\n\";\n\nconst RCTKeyboardController =\n require(\"./specs/NativeKeyboardController\").default;\nexport const KeyboardController = (\n RCTKeyboardController\n ? RCTKeyboardController\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n },\n )\n) as KeyboardControllerModule;\n\nconst KEYBOARD_CONTROLLER_NAMESPACE = \"KeyboardController::\";\nconst eventEmitter = new NativeEventEmitter(KeyboardController);\n\nexport const KeyboardEvents: KeyboardEventsModule = {\n addListener: (name, cb) =>\n eventEmitter.addListener(KEYBOARD_CONTROLLER_NAMESPACE + name, cb),\n};\n/**\n * This API is not documented, it's for internal usage only (for now), and is a subject to potential breaking changes in future.\n * Use it with cautious.\n */\nexport const FocusedInputEvents: FocusedInputEventsModule = {\n addListener: (name, cb) =>\n eventEmitter.addListener(KEYBOARD_CONTROLLER_NAMESPACE + name, cb),\n};\nexport const WindowDimensionsEvents: WindowDimensionsEventsModule = {\n addListener: (name, cb) =>\n eventEmitter.addListener(KEYBOARD_CONTROLLER_NAMESPACE + name, cb),\n};\nexport const KeyboardControllerView: React.FC<KeyboardControllerProps> =\n require(\"./specs/KeyboardControllerViewNativeComponent\").default;\nexport const KeyboardGestureArea: React.FC<KeyboardGestureAreaProps> =\n Platform.OS === \"android\" && Platform.Version >= 30\n ? require(\"./specs/KeyboardGestureAreaNativeComponent\").default\n : ({ children }: KeyboardGestureAreaProps) => children;\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAWA,MAAMC,aAAa,GACjB,2FAA2F,GAC3FC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,qBAAqB,GACzBN,OAAO,CAAC,kCAAkC,CAAC,CAACK,OAAO;AAC9C,MAAME,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAC7BD,qBAAqB,GACjBA,qBAAqB,GACrB,IAAIG,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACV,aAAa,CAAC;EAChC;AACF,CACF,CACuB;AAE7B,MAAMW,6BAA6B,GAAG,sBAAsB;AAC5D,MAAMC,YAAY,GAAG,IAAIC,+BAAkB,CAACP,kBAAkB,CAAC;AAExD,MAAMQ,cAAoC,GAAAP,OAAA,CAAAO,cAAA,GAAG;EAClDC,WAAW,EAAEA,CAACC,IAAI,EAAEC,EAAE,KACpBL,YAAY,CAACG,WAAW,CAACJ,6BAA6B,GAAGK,IAAI,EAAEC,EAAE;AACrE,CAAC;AACD;AACA;AACA;AACA;AACO,MAAMC,kBAA4C,GAAAX,OAAA,CAAAW,kBAAA,GAAG;EAC1DH,WAAW,EAAEA,CAACC,IAAI,EAAEC,EAAE,KACpBL,YAAY,CAACG,WAAW,CAACJ,6BAA6B,GAAGK,IAAI,EAAEC,EAAE;AACrE,CAAC;AACM,MAAME,sBAAoD,GAAAZ,OAAA,CAAAY,sBAAA,GAAG;EAClEJ,WAAW,EAAEA,CAACC,IAAI,EA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