react-native-keyboard-controller 1.20.2 → 1.20.3
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/src/main/java/com/reactnativekeyboardcontroller/views/overlay/OverKeyboardViewGroup.kt +1 -1
- package/android/src/main/jni/CMakeLists.txt +1 -1
- package/android/src/main/jni/keyboardcontroller.h +24 -0
- package/common/cpp/react/renderer/components/{reactnativekeyboardcontroller → keyboardcontroller}/RNKCKeyboardBackgroundViewComponentDescriptor.h +1 -1
- package/common/cpp/react/renderer/components/{reactnativekeyboardcontroller → keyboardcontroller}/RNKCKeyboardBackgroundViewShadowNode.h +2 -2
- package/common/cpp/react/renderer/components/{reactnativekeyboardcontroller → keyboardcontroller}/RNKCKeyboardControllerViewComponentDescriptor.h +1 -1
- package/common/cpp/react/renderer/components/{reactnativekeyboardcontroller → keyboardcontroller}/RNKCKeyboardControllerViewShadowNode.h +2 -2
- package/common/cpp/react/renderer/components/{reactnativekeyboardcontroller → keyboardcontroller}/RNKCKeyboardExtenderComponentDescriptor.h +1 -1
- package/common/cpp/react/renderer/components/{reactnativekeyboardcontroller → keyboardcontroller}/RNKCKeyboardExtenderShadowNode.h +2 -2
- package/common/cpp/react/renderer/components/{reactnativekeyboardcontroller → keyboardcontroller}/RNKCKeyboardGestureAreaComponentDescriptor.h +1 -1
- package/common/cpp/react/renderer/components/{reactnativekeyboardcontroller → keyboardcontroller}/RNKCKeyboardGestureAreaShadowNode.h +2 -2
- package/common/cpp/react/renderer/components/{reactnativekeyboardcontroller → keyboardcontroller}/RNKCOverKeyboardViewComponentDescriptor.h +1 -1
- package/common/cpp/react/renderer/components/{reactnativekeyboardcontroller → keyboardcontroller}/RNKCOverKeyboardViewShadowNode.h +2 -2
- package/ios/KeyboardControllerModule.mm +1 -1
- package/ios/views/KeyboardBackgroundViewManager.mm +4 -4
- package/ios/views/KeyboardControllerView.mm +4 -4
- package/ios/views/KeyboardExtenderManager.mm +4 -4
- package/ios/views/KeyboardGestureAreaManager.mm +4 -4
- package/ios/views/OverKeyboardViewManager.mm +4 -4
- package/lib/commonjs/animated.js +1 -0
- package/lib/commonjs/animated.js.map +1 -1
- package/lib/commonjs/components/KeyboardAvoidingView/hooks.js +2 -2
- package/lib/commonjs/components/KeyboardAvoidingView/hooks.js.map +1 -1
- package/lib/commonjs/types/index.js +11 -0
- package/lib/commonjs/types/index.js.map +1 -1
- package/lib/commonjs/types/provider.js +2 -0
- package/lib/commonjs/types/provider.js.map +1 -0
- package/lib/module/animated.js +1 -0
- package/lib/module/animated.js.map +1 -1
- package/lib/module/components/KeyboardAvoidingView/hooks.js +2 -2
- package/lib/module/components/KeyboardAvoidingView/hooks.js.map +1 -1
- package/lib/module/types/index.js +1 -0
- package/lib/module/types/index.js.map +1 -1
- package/lib/module/types/provider.js +2 -0
- package/lib/module/types/provider.js.map +1 -0
- package/lib/typescript/animated.d.ts +1 -44
- package/lib/typescript/types/index.d.ts +1 -0
- package/lib/typescript/types/provider.d.ts +43 -0
- package/package.json +2 -2
- package/react-native-keyboard-controller.podspec +1 -1
- package/src/animated.tsx +1 -44
- package/src/components/KeyboardAvoidingView/hooks.ts +2 -2
- package/src/types/index.ts +1 -0
- package/src/types/provider.ts +43 -0
- package/android/src/main/jni/reactnativekeyboardcontroller.h +0 -24
- /package/common/cpp/react/renderer/components/{reactnativekeyboardcontroller → keyboardcontroller}/RNKCKeyboardBackgroundViewShadowNode.cpp +0 -0
- /package/common/cpp/react/renderer/components/{reactnativekeyboardcontroller → keyboardcontroller}/RNKCKeyboardBackgroundViewState.h +0 -0
- /package/common/cpp/react/renderer/components/{reactnativekeyboardcontroller → keyboardcontroller}/RNKCKeyboardControllerViewShadowNode.cpp +0 -0
- /package/common/cpp/react/renderer/components/{reactnativekeyboardcontroller → keyboardcontroller}/RNKCKeyboardControllerViewState.h +0 -0
- /package/common/cpp/react/renderer/components/{reactnativekeyboardcontroller → keyboardcontroller}/RNKCKeyboardExtenderShadowNode.cpp +0 -0
- /package/common/cpp/react/renderer/components/{reactnativekeyboardcontroller → keyboardcontroller}/RNKCKeyboardExtenderState.h +0 -0
- /package/common/cpp/react/renderer/components/{reactnativekeyboardcontroller → keyboardcontroller}/RNKCKeyboardGestureAreaShadowNode.cpp +0 -0
- /package/common/cpp/react/renderer/components/{reactnativekeyboardcontroller → keyboardcontroller}/RNKCKeyboardGestureAreaState.h +0 -0
- /package/common/cpp/react/renderer/components/{reactnativekeyboardcontroller → keyboardcontroller}/RNKCOverKeyboardViewShadowNode.cpp +0 -0
- /package/common/cpp/react/renderer/components/{reactnativekeyboardcontroller → keyboardcontroller}/RNKCOverKeyboardViewState.cpp +0 -0
- /package/common/cpp/react/renderer/components/{reactnativekeyboardcontroller → keyboardcontroller}/RNKCOverKeyboardViewState.h +0 -0
|
@@ -197,7 +197,7 @@ class OverKeyboardRootViewGroup(
|
|
|
197
197
|
eventDispatcher?.let {
|
|
198
198
|
jsPointerDispatcher?.handleMotionEventCompat(event, it, true)
|
|
199
199
|
}
|
|
200
|
-
return super.
|
|
200
|
+
return super.onInterceptHoverEvent(event)
|
|
201
201
|
}
|
|
202
202
|
|
|
203
203
|
override fun onHoverEvent(event: MotionEvent): Boolean {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
cmake_minimum_required(VERSION 3.13)
|
|
2
2
|
set(CMAKE_VERBOSE_MAKEFILE ON)
|
|
3
3
|
|
|
4
|
-
set(LIB_LITERAL
|
|
4
|
+
set(LIB_LITERAL keyboardcontroller)
|
|
5
5
|
set(LIB_TARGET_NAME react_codegen_${LIB_LITERAL})
|
|
6
6
|
|
|
7
7
|
set(LIB_ANDROID_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <ReactCommon/JavaTurboModule.h>
|
|
4
|
+
#include <ReactCommon/TurboModule.h>
|
|
5
|
+
#include <jsi/jsi.h>
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Note this import and that it is not present in autogenerated header file
|
|
9
|
+
* under android/build/generated/source/codegen/jni/keyboardcontroller.h
|
|
10
|
+
*
|
|
11
|
+
* Here we are overriding autogenerated component descriptors by prioritizing our custom headers via include path setup.
|
|
12
|
+
*/
|
|
13
|
+
#include <react/renderer/components/keyboardcontroller/RNKCKeyboardControllerViewComponentDescriptor.h>
|
|
14
|
+
#include <react/renderer/components/keyboardcontroller/RNKCKeyboardGestureAreaComponentDescriptor.h>
|
|
15
|
+
#include <react/renderer/components/keyboardcontroller/RNKCOverKeyboardViewComponentDescriptor.h>
|
|
16
|
+
#include <react/renderer/components/keyboardcontroller/RNKCKeyboardBackgroundViewComponentDescriptor.h>
|
|
17
|
+
|
|
18
|
+
#include <memory>
|
|
19
|
+
#include <string>
|
|
20
|
+
|
|
21
|
+
namespace facebook::react {
|
|
22
|
+
JSI_EXPORT
|
|
23
|
+
std::shared_ptr<TurboModule> keyboardcontroller_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms);
|
|
24
|
+
} // namespace facebook::react
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
#include "RNKCKeyboardBackgroundViewShadowNode.h"
|
|
11
11
|
|
|
12
12
|
#include <react/debug/react_native_assert.h>
|
|
13
|
-
#include <react/renderer/components/
|
|
13
|
+
#include <react/renderer/components/keyboardcontroller/Props.h>
|
|
14
14
|
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
15
15
|
|
|
16
16
|
namespace facebook::react {
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
|
|
10
10
|
#include "RNKCKeyboardBackgroundViewState.h"
|
|
11
11
|
|
|
12
|
-
#include <react/renderer/components/
|
|
13
|
-
#include <react/renderer/components/
|
|
12
|
+
#include <react/renderer/components/keyboardcontroller/EventEmitters.h>
|
|
13
|
+
#include <react/renderer/components/keyboardcontroller/Props.h>
|
|
14
14
|
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
|
|
15
15
|
#include <jsi/jsi.h>
|
|
16
16
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
#include "RNKCKeyboardControllerViewShadowNode.h"
|
|
4
4
|
|
|
5
5
|
#include <react/debug/react_native_assert.h>
|
|
6
|
-
#include <react/renderer/components/
|
|
6
|
+
#include <react/renderer/components/keyboardcontroller/Props.h>
|
|
7
7
|
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
8
8
|
|
|
9
9
|
namespace facebook::react {
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
#include "RNKCKeyboardControllerViewState.h"
|
|
4
4
|
|
|
5
|
-
#include <react/renderer/components/
|
|
6
|
-
#include <react/renderer/components/
|
|
5
|
+
#include <react/renderer/components/keyboardcontroller/EventEmitters.h>
|
|
6
|
+
#include <react/renderer/components/keyboardcontroller/Props.h>
|
|
7
7
|
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
|
|
8
8
|
#include <jsi/jsi.h>
|
|
9
9
|
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
#include "RNKCKeyboardExtenderShadowNode.h"
|
|
11
11
|
|
|
12
12
|
#include <react/debug/react_native_assert.h>
|
|
13
|
-
#include <react/renderer/components/
|
|
13
|
+
#include <react/renderer/components/keyboardcontroller/Props.h>
|
|
14
14
|
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
15
15
|
|
|
16
16
|
namespace facebook::react {
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
|
|
10
10
|
#include "RNKCKeyboardExtenderState.h"
|
|
11
11
|
|
|
12
|
-
#include <react/renderer/components/
|
|
13
|
-
#include <react/renderer/components/
|
|
12
|
+
#include <react/renderer/components/keyboardcontroller/EventEmitters.h>
|
|
13
|
+
#include <react/renderer/components/keyboardcontroller/Props.h>
|
|
14
14
|
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
|
|
15
15
|
#include <jsi/jsi.h>
|
|
16
16
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
#include "RNKCKeyboardGestureAreaShadowNode.h"
|
|
4
4
|
|
|
5
5
|
#include <react/debug/react_native_assert.h>
|
|
6
|
-
#include <react/renderer/components/
|
|
6
|
+
#include <react/renderer/components/keyboardcontroller/Props.h>
|
|
7
7
|
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
8
8
|
|
|
9
9
|
namespace facebook::react {
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
#include "RNKCKeyboardGestureAreaState.h"
|
|
4
4
|
|
|
5
|
-
#include <react/renderer/components/
|
|
6
|
-
#include <react/renderer/components/
|
|
5
|
+
#include <react/renderer/components/keyboardcontroller/EventEmitters.h>
|
|
6
|
+
#include <react/renderer/components/keyboardcontroller/Props.h>
|
|
7
7
|
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
|
|
8
8
|
#include <jsi/jsi.h>
|
|
9
9
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
#include "RNKCOverKeyboardViewShadowNode.h"
|
|
4
4
|
|
|
5
5
|
#include <react/debug/react_native_assert.h>
|
|
6
|
-
#include <react/renderer/components/
|
|
6
|
+
#include <react/renderer/components/keyboardcontroller/Props.h>
|
|
7
7
|
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
8
8
|
|
|
9
9
|
namespace facebook::react {
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
#include "RNKCOverKeyboardViewState.h"
|
|
4
4
|
|
|
5
|
-
#include <react/renderer/components/
|
|
6
|
-
#include <react/renderer/components/
|
|
5
|
+
#include <react/renderer/components/keyboardcontroller/EventEmitters.h>
|
|
6
|
+
#include <react/renderer/components/keyboardcontroller/Props.h>
|
|
7
7
|
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
|
|
8
8
|
#include <jsi/jsi.h>
|
|
9
9
|
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
// Thanks to this guard, we won't import this header when we build for the old architecture.
|
|
13
13
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
14
|
-
#import <
|
|
14
|
+
#import <keyboardcontroller/keyboardcontroller.h>
|
|
15
15
|
#endif
|
|
16
16
|
|
|
17
17
|
#import "KeyboardControllerModule-Header.h"
|
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
#endif
|
|
15
15
|
|
|
16
16
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
17
|
-
#import <react/renderer/components/
|
|
18
|
-
#import <react/renderer/components/
|
|
19
|
-
#import <react/renderer/components/
|
|
20
|
-
#import <react/renderer/components/
|
|
17
|
+
#import <react/renderer/components/keyboardcontroller/EventEmitters.h>
|
|
18
|
+
#import <react/renderer/components/keyboardcontroller/Props.h>
|
|
19
|
+
#import <react/renderer/components/keyboardcontroller/RCTComponentViewHelpers.h>
|
|
20
|
+
#import <react/renderer/components/keyboardcontroller/RNKCKeyboardBackgroundViewComponentDescriptor.h>
|
|
21
21
|
|
|
22
22
|
#import "RCTFabricComponentsPlugins.h"
|
|
23
23
|
#endif
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
#import <react_native_keyboard_controller/react_native_keyboard_controller-Swift.h>
|
|
21
21
|
#endif
|
|
22
22
|
|
|
23
|
-
#import <react/renderer/components/
|
|
24
|
-
#import <react/renderer/components/
|
|
25
|
-
#import <react/renderer/components/
|
|
26
|
-
#import <react/renderer/components/
|
|
23
|
+
#import <react/renderer/components/keyboardcontroller/EventEmitters.h>
|
|
24
|
+
#import <react/renderer/components/keyboardcontroller/Props.h>
|
|
25
|
+
#import <react/renderer/components/keyboardcontroller/RCTComponentViewHelpers.h>
|
|
26
|
+
#import <react/renderer/components/keyboardcontroller/RNKCKeyboardControllerViewComponentDescriptor.h>
|
|
27
27
|
|
|
28
28
|
#import "KeyboardControllerModule-Header.h"
|
|
29
29
|
#import "RCTFabricComponentsPlugins.h"
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
17
17
|
#import <React/RCTSurfaceTouchHandler.h>
|
|
18
18
|
|
|
19
|
-
#import <react/renderer/components/
|
|
20
|
-
#import <react/renderer/components/
|
|
21
|
-
#import <react/renderer/components/
|
|
22
|
-
#import <react/renderer/components/
|
|
19
|
+
#import <react/renderer/components/keyboardcontroller/EventEmitters.h>
|
|
20
|
+
#import <react/renderer/components/keyboardcontroller/Props.h>
|
|
21
|
+
#import <react/renderer/components/keyboardcontroller/RCTComponentViewHelpers.h>
|
|
22
|
+
#import <react/renderer/components/keyboardcontroller/RNKCKeyboardExtenderComponentDescriptor.h>
|
|
23
23
|
|
|
24
24
|
#import "RCTFabricComponentsPlugins.h"
|
|
25
25
|
#endif
|
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
#endif
|
|
15
15
|
|
|
16
16
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
17
|
-
#import <react/renderer/components/
|
|
18
|
-
#import <react/renderer/components/
|
|
19
|
-
#import <react/renderer/components/
|
|
20
|
-
#import <react/renderer/components/
|
|
17
|
+
#import <react/renderer/components/keyboardcontroller/EventEmitters.h>
|
|
18
|
+
#import <react/renderer/components/keyboardcontroller/Props.h>
|
|
19
|
+
#import <react/renderer/components/keyboardcontroller/RCTComponentViewHelpers.h>
|
|
20
|
+
#import <react/renderer/components/keyboardcontroller/RNKCKeyboardGestureAreaComponentDescriptor.h>
|
|
21
21
|
|
|
22
22
|
#import "RCTFabricComponentsPlugins.h"
|
|
23
23
|
#endif
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
17
17
|
#import <React/RCTSurfaceTouchHandler.h>
|
|
18
18
|
|
|
19
|
-
#import <react/renderer/components/
|
|
20
|
-
#import <react/renderer/components/
|
|
21
|
-
#import <react/renderer/components/
|
|
22
|
-
#import <react/renderer/components/
|
|
19
|
+
#import <react/renderer/components/keyboardcontroller/EventEmitters.h>
|
|
20
|
+
#import <react/renderer/components/keyboardcontroller/Props.h>
|
|
21
|
+
#import <react/renderer/components/keyboardcontroller/RCTComponentViewHelpers.h>
|
|
22
|
+
#import <react/renderer/components/keyboardcontroller/RNKCOverKeyboardViewComponentDescriptor.h>
|
|
23
23
|
|
|
24
24
|
#import "RCTFabricComponentsPlugins.h"
|
|
25
25
|
#endif
|
package/lib/commonjs/animated.js
CHANGED
|
@@ -27,6 +27,7 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
27
27
|
position: "absolute"
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
|
+
|
|
30
31
|
// capture `Platform.OS` in separate variable to avoid deep workletization of entire RN package
|
|
31
32
|
// 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
|
|
32
33
|
const OS = _reactNative.Platform.OS;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeIsEdgeToEdge","_reactNativeReanimated","_bindings","_context","_internal","_module","_reanimated","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","IS_EDGE_TO_EDGE","isEdgeToEdge","KeyboardControllerViewAnimated","Reanimated","createAnimatedComponent","Animated","KeyboardControllerView","styles","StyleSheet","create","container","flex","hidden","display","position","OS","Platform","KeyboardProvider","props","children","statusBarTranslucent","navigationBarTranslucent","preserveEdgeToEdge","enabled","initiallyEnabled","preload","viewRef","useRef","setEnabled","useState","progress","useAnimatedValue","height","progressSV","useSharedValue","heightSV","layout","setKeyboardHandlers","useEventHandlerRegistration","setInputHandlers","update","useCallback","KeyboardControllerViewCommands","synchronizeFocusedInputLayout","current","Promise","resolve","subscription","FocusedInputEvents","addListener","remove","context","useMemo","animated","multiply","reanimated","style","transform","translateX","translateY","onKeyboardMove","event","nativeEvent","useNativeDriver","updateSharedValues","platforms","includes","value","keyboardHandler","useAnimatedKeyboardHandler","onKeyboardMoveStart","onKeyboardMoveInteractive","onKeyboardMoveEnd","inputLayoutHandler","useFocusedInputLayoutHandler","onFocusedInputLayoutChanged","target","useEffect","KeyboardController","__DEV__","controlEdgeToEdgeValues","createElement","KeyboardContext","Provider","ref","onKeyboardMoveReanimated","undefined","onFocusedInputLayoutChangedReanimated","View","exports"],"sources":["animated.tsx"],"sourcesContent":["/* eslint react/jsx-sort-props: off */\nimport React, {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { Animated, Platform, StyleSheet } from \"react-native\";\nimport {\n controlEdgeToEdgeValues,\n isEdgeToEdge,\n} from \"react-native-is-edge-to-edge\";\nimport Reanimated, { useSharedValue } from \"react-native-reanimated\";\n\nimport {\n FocusedInputEvents,\n KeyboardControllerView,\n KeyboardControllerViewCommands,\n} from \"./bindings\";\nimport { KeyboardContext } from \"./context\";\nimport { useAnimatedValue, useEventHandlerRegistration } from \"./internal\";\nimport { KeyboardController } from \"./module\";\nimport {\n useAnimatedKeyboardHandler,\n useFocusedInputLayoutHandler,\n} from \"./reanimated\";\n\nimport type { KeyboardAnimationContext } from \"./context\";\nimport type {\n FocusedInputLayoutChangedEvent,\n KeyboardControllerProps,\n NativeEvent,\n} from \"./types\";\nimport type { ViewStyle } from \"react-native\";\n\nconst IS_EDGE_TO_EDGE = isEdgeToEdge();\n\nconst KeyboardControllerViewAnimated = Reanimated.createAnimatedComponent(\n Animated.createAnimatedComponent(KeyboardControllerView),\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 * @platform android\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/14\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 * @platform android\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/119\n */\n navigationBarTranslucent?: boolean;\n /**\n * A boolean property indicating whether to keep edge-to-edge mode always enabled (even when you disable the module).\n * Defaults to `false`.\n *\n * @platform android\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/592\n */\n preserveEdgeToEdge?: boolean;\n /**\n * A boolean prop indicating whether the module is enabled. It indicate only initial state\n * (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 * A boolean prop indicating whether to preload the keyboard to reduce time-to-interaction (TTI) on first input focus.\n * Defaults to `true`.\n *\n * @platform ios\n */\n preload?: 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\n/**\n * A component that wrap your app. Under the hood it works with {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-controller-view|KeyboardControllerView} to receive events during keyboard movements,\n * maps these events to `Animated`/`Reanimated` values and store them in context.\n *\n * @param props - Provider props, such as `statusBarTranslucent`, `navigationBarTranslucent`, etc.\n * @returns A component that should be mounted in root of your App layout.\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-provider|Documentation} page for more details.\n * @example\n * ```tsx\n * <KeyboardProvider>\n * <NavigationContainer />\n * </KeyboardProvider>\n * ```\n */\nexport const KeyboardProvider = (props: KeyboardProviderProps) => {\n const {\n children,\n statusBarTranslucent,\n navigationBarTranslucent,\n preserveEdgeToEdge,\n enabled: initiallyEnabled = true,\n preload = true,\n } = props;\n // ref\n const viewRef = useRef<React.Component<KeyboardControllerProps>>(null);\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 = useEventHandlerRegistration(viewRef);\n const setInputHandlers = useEventHandlerRegistration(viewRef);\n const update = useCallback(async () => {\n KeyboardControllerViewCommands.synchronizeFocusedInputLayout(\n viewRef.current,\n );\n\n await new Promise((resolve) => {\n const subscription = FocusedInputEvents.addListener(\n \"layoutDidSynchronize\",\n () => {\n subscription.remove();\n resolve(null);\n },\n );\n });\n }, []);\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 update,\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 // Setting useNativeDriver to true on web triggers a warning due to the absence of a native driver for web. Therefore, it is set to false.\n { useNativeDriver: Platform.OS !== \"web\" },\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 updateSharedValues(event, [\"ios\"]);\n },\n onKeyboardMove: (event: NativeEvent) => {\n \"worklet\";\n\n updateSharedValues(event, [\"android\"]);\n },\n onKeyboardMoveInteractive: (event: NativeEvent) => {\n \"worklet\";\n\n updateSharedValues(event, [\"android\", \"ios\"]);\n },\n onKeyboardMoveEnd: (event: NativeEvent) => {\n \"worklet\";\n\n updateSharedValues(event, [\"android\"]);\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\n useEffect(() => {\n if (preload) {\n KeyboardController.preload();\n }\n }, [preload]);\n\n if (__DEV__) {\n controlEdgeToEdgeValues({\n statusBarTranslucent,\n navigationBarTranslucent,\n preserveEdgeToEdge,\n });\n }\n\n return (\n <KeyboardContext.Provider value={context}>\n <KeyboardControllerViewAnimated\n ref={viewRef}\n enabled={enabled}\n navigationBarTranslucent={IS_EDGE_TO_EDGE || navigationBarTranslucent}\n statusBarTranslucent={IS_EDGE_TO_EDGE || statusBarTranslucent}\n preserveEdgeToEdge={IS_EDGE_TO_EDGE || preserveEdgeToEdge}\n style={styles.container}\n // on*Reanimated prop must precede animated handlers to work correctly\n onKeyboardMoveReanimated={keyboardHandler}\n onKeyboardMoveStart={OS === \"ios\" ? onKeyboardMove : undefined}\n onKeyboardMove={OS === \"android\" ? onKeyboardMove : undefined}\n onKeyboardMoveInteractive={onKeyboardMove}\n onKeyboardMoveEnd={OS === \"android\" ? onKeyboardMove : undefined}\n onFocusedInputLayoutChangedReanimated={inputLayoutHandler}\n >\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":";;;;;;AACA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAOA,IAAAC,YAAA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OAAO,CAAC,CAAC;EAEb,IAAIsD,OAAO,EAAE;IACX,IAAAC,gDAAuB,EAAC;MACtB5D,oBAAoB;MACpBC,wBAAwB;MACxBC;IACF,CAAC,CAAC;EACJ;EAEA,oBACEpD,MAAA,CAAAqB,OAAA,CAAA0F,aAAA,CAACxG,QAAA,CAAAyG,eAAe,CAACC,QAAQ;IAAChB,KAAK,EAAEhB;EAAQ,gBACvCjF,MAAA,CAAAqB,OAAA,CAAA0F,aAAA,CAAC/E,8BAA8B;IAC7BkF,GAAG,EAAE1D,OAAQ;IACbH,OAAO,EAAEA,OAAQ;IACjBF,wBAAwB,EAAErB,eAAe,IAAIqB,wBAAyB;IACtED,oBAAoB,EAAEpB,eAAe,IAAIoB,oBAAqB;IAC9DE,kBAAkB,EAAEtB,eAAe,IAAIsB,kBAAmB;IAC1DkC,KAAK,EAAEjD,MAAM,CAACG;IACd;IAAA;IACA2E,wBAAwB,EAAEjB,eAAgB;IAC1CE,mBAAmB,EAAEvD,EAAE,KAAK,KAAK,GAAG6C,cAAc,GAAG0B,SAAU;IAC/D1B,cAAc,EAAE7C,EAAE,KAAK,SAAS,GAAG6C,cAAc,GAAG0B,SAAU;IAC9Df,yBAAyB,EAAEX,cAAe;IAC1CY,iBAAiB,EAAEzD,EAAE,KAAK,SAAS,GAAG6C,cAAc,GAAG0B,SAAU;IACjEC,qCAAqC,EAAEd;EAAmB,GAEzDtD,QAC6B,CAAC,eACjCjD,MAAA,CAAAqB,OAAA,CAAA0F,aAAA,CAAC5G,YAAA,CAAAgC,QAAQ,CAACmF,IAAI;IACZ;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACAhC,KAAK,EAAEA;EAAM,CACd,CACuB,CAAC;AAE/B,CAAC;AAACiC,OAAA,CAAAxE,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeIsEdgeToEdge","_reactNativeReanimated","_bindings","_context","_internal","_module","_reanimated","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","IS_EDGE_TO_EDGE","isEdgeToEdge","KeyboardControllerViewAnimated","Reanimated","createAnimatedComponent","Animated","KeyboardControllerView","styles","StyleSheet","create","container","flex","hidden","display","position","OS","Platform","KeyboardProvider","props","children","statusBarTranslucent","navigationBarTranslucent","preserveEdgeToEdge","enabled","initiallyEnabled","preload","viewRef","useRef","setEnabled","useState","progress","useAnimatedValue","height","progressSV","useSharedValue","heightSV","layout","setKeyboardHandlers","useEventHandlerRegistration","setInputHandlers","update","useCallback","KeyboardControllerViewCommands","synchronizeFocusedInputLayout","current","Promise","resolve","subscription","FocusedInputEvents","addListener","remove","context","useMemo","animated","multiply","reanimated","style","transform","translateX","translateY","onKeyboardMove","event","nativeEvent","useNativeDriver","updateSharedValues","platforms","includes","value","keyboardHandler","useAnimatedKeyboardHandler","onKeyboardMoveStart","onKeyboardMoveInteractive","onKeyboardMoveEnd","inputLayoutHandler","useFocusedInputLayoutHandler","onFocusedInputLayoutChanged","target","useEffect","KeyboardController","__DEV__","controlEdgeToEdgeValues","createElement","KeyboardContext","Provider","ref","onKeyboardMoveReanimated","undefined","onFocusedInputLayoutChangedReanimated","View","exports"],"sources":["animated.tsx"],"sourcesContent":["/* eslint react/jsx-sort-props: off */\nimport React, {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { Animated, Platform, StyleSheet } from \"react-native\";\nimport {\n controlEdgeToEdgeValues,\n isEdgeToEdge,\n} from \"react-native-is-edge-to-edge\";\nimport Reanimated, { useSharedValue } from \"react-native-reanimated\";\n\nimport {\n FocusedInputEvents,\n KeyboardControllerView,\n KeyboardControllerViewCommands,\n} from \"./bindings\";\nimport { KeyboardContext } from \"./context\";\nimport { useAnimatedValue, useEventHandlerRegistration } from \"./internal\";\nimport { KeyboardController } from \"./module\";\nimport {\n useAnimatedKeyboardHandler,\n useFocusedInputLayoutHandler,\n} from \"./reanimated\";\n\nimport type { KeyboardAnimationContext } from \"./context\";\nimport type {\n FocusedInputLayoutChangedEvent,\n KeyboardControllerProps,\n KeyboardProviderProps,\n NativeEvent,\n} from \"./types\";\nimport type { ViewStyle } from \"react-native\";\n\nconst IS_EDGE_TO_EDGE = isEdgeToEdge();\n\nconst KeyboardControllerViewAnimated = Reanimated.createAnimatedComponent(\n Animated.createAnimatedComponent(KeyboardControllerView),\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\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\n/**\n * A component that wrap your app. Under the hood it works with {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-controller-view|KeyboardControllerView} to receive events during keyboard movements,\n * maps these events to `Animated`/`Reanimated` values and store them in context.\n *\n * @param props - Provider props, such as `statusBarTranslucent`, `navigationBarTranslucent`, etc.\n * @returns A component that should be mounted in root of your App layout.\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-provider|Documentation} page for more details.\n * @example\n * ```tsx\n * <KeyboardProvider>\n * <NavigationContainer />\n * </KeyboardProvider>\n * ```\n */\nexport const KeyboardProvider = (props: KeyboardProviderProps) => {\n const {\n children,\n statusBarTranslucent,\n navigationBarTranslucent,\n preserveEdgeToEdge,\n enabled: initiallyEnabled = true,\n preload = true,\n } = props;\n // ref\n const viewRef = useRef<React.Component<KeyboardControllerProps>>(null);\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 = useEventHandlerRegistration(viewRef);\n const setInputHandlers = useEventHandlerRegistration(viewRef);\n const update = useCallback(async () => {\n KeyboardControllerViewCommands.synchronizeFocusedInputLayout(\n viewRef.current,\n );\n\n await new Promise((resolve) => {\n const subscription = FocusedInputEvents.addListener(\n \"layoutDidSynchronize\",\n () => {\n subscription.remove();\n resolve(null);\n },\n );\n });\n }, []);\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 update,\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 // Setting useNativeDriver to true on web triggers a warning due to the absence of a native driver for web. Therefore, it is set to false.\n { useNativeDriver: Platform.OS !== \"web\" },\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 updateSharedValues(event, [\"ios\"]);\n },\n onKeyboardMove: (event: NativeEvent) => {\n \"worklet\";\n\n updateSharedValues(event, [\"android\"]);\n },\n onKeyboardMoveInteractive: (event: NativeEvent) => {\n \"worklet\";\n\n updateSharedValues(event, [\"android\", \"ios\"]);\n },\n onKeyboardMoveEnd: (event: NativeEvent) => {\n \"worklet\";\n\n updateSharedValues(event, [\"android\"]);\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\n useEffect(() => {\n if (preload) {\n KeyboardController.preload();\n }\n }, [preload]);\n\n if (__DEV__) {\n controlEdgeToEdgeValues({\n statusBarTranslucent,\n navigationBarTranslucent,\n preserveEdgeToEdge,\n });\n }\n\n return (\n <KeyboardContext.Provider value={context}>\n <KeyboardControllerViewAnimated\n ref={viewRef}\n enabled={enabled}\n navigationBarTranslucent={IS_EDGE_TO_EDGE || navigationBarTranslucent}\n statusBarTranslucent={IS_EDGE_TO_EDGE || statusBarTranslucent}\n preserveEdgeToEdge={IS_EDGE_TO_EDGE || preserveEdgeToEdge}\n style={styles.container}\n // on*Reanimated prop must precede animated handlers to work correctly\n onKeyboardMoveReanimated={keyboardHandler}\n onKeyboardMoveStart={OS === \"ios\" ? onKeyboardMove : undefined}\n onKeyboardMove={OS === \"android\" ? onKeyboardMove : undefined}\n onKeyboardMoveInteractive={onKeyboardMove}\n onKeyboardMoveEnd={OS === \"android\" ? onKeyboardMove : undefined}\n onFocusedInputLayoutChangedReanimated={inputLayoutHandler}\n >\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":";;;;;;AACA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAOA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,wBAAA,GAAAF,OAAA;AAIA,IAAAG,sBAAA,GAAAJ,uBAAA,CAAAC,OAAA;AAEA,IAAAI,SAAA,GAAAJ,OAAA;AAKA,IAAAK,Q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pD,MAAA,CAAAqB,OAAA,CAAA0F,aAAA,CAACxG,QAAA,CAAAyG,eAAe,CAACC,QAAQ;IAAChB,KAAK,EAAEhB;EAAQ,gBACvCjF,MAAA,CAAAqB,OAAA,CAAA0F,aAAA,CAAC/E,8BAA8B;IAC7BkF,GAAG,EAAE1D,OAAQ;IACbH,OAAO,EAAEA,OAAQ;IACjBF,wBAAwB,EAAErB,eAAe,IAAIqB,wBAAyB;IACtED,oBAAoB,EAAEpB,eAAe,IAAIoB,oBAAqB;IAC9DE,kBAAkB,EAAEtB,eAAe,IAAIsB,kBAAmB;IAC1DkC,KAAK,EAAEjD,MAAM,CAACG;IACd;IAAA;IACA2E,wBAAwB,EAAEjB,eAAgB;IAC1CE,mBAAmB,EAAEvD,EAAE,KAAK,KAAK,GAAG6C,cAAc,GAAG0B,SAAU;IAC/D1B,cAAc,EAAE7C,EAAE,KAAK,SAAS,GAAG6C,cAAc,GAAG0B,SAAU;IAC9Df,yBAAyB,EAAEX,cAAe;IAC1CY,iBAAiB,EAAEzD,EAAE,KAAK,SAAS,GAAG6C,cAAc,GAAG0B,SAAU;IACjEC,qCAAqC,EAAEd;EAAmB,GAEzDtD,QAC6B,CAAC,eACjCjD,MAAA,CAAAqB,OAAA,CAAA0F,aAAA,CAAC5G,YAAA,CAAAgC,QAAQ,CAACmF,IAAI;IACZ;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACAhC,KAAK,EAAEA;EAAM,CACd,CACuB,CAAC;AAE/B,CAAC;AAACiC,OAAA,CAAAxE,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
|
@@ -89,7 +89,7 @@ const useTranslateAnimation = () => {
|
|
|
89
89
|
onMove: e => {
|
|
90
90
|
"worklet";
|
|
91
91
|
|
|
92
|
-
if (OS
|
|
92
|
+
if (OS !== "ios") {
|
|
93
93
|
translate.value = e.progress;
|
|
94
94
|
}
|
|
95
95
|
},
|
|
@@ -103,7 +103,7 @@ const useTranslateAnimation = () => {
|
|
|
103
103
|
"worklet";
|
|
104
104
|
|
|
105
105
|
padding.value = e.progress;
|
|
106
|
-
if (OS
|
|
106
|
+
if (OS !== "ios") {
|
|
107
107
|
translate.value = e.progress;
|
|
108
108
|
}
|
|
109
109
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_reactNative","_reactNativeReanimated","_context","_hooks","OS","Platform","useKeyboardAnimation","reanimated","useKeyboardContext","heightWhenOpened","useSharedValue","height","progress","isClosed","useLayoutEffect","initialHeight","value","initialProgress","useKeyboardHandler","onStart","e","onMove","onInteractive","onEnd","exports","useTranslateAnimation","padding","translate"],"sources":["hooks.ts"],"sourcesContent":["import { useLayoutEffect } from \"react\";\nimport { Platform } from \"react-native\";\nimport { useSharedValue } from \"react-native-reanimated\";\n\nimport { useKeyboardContext } from \"../../context\";\nimport { useKeyboardHandler } from \"../../hooks\";\n\nconst OS = Platform.OS;\n\nexport const useKeyboardAnimation = () => {\n const { reanimated } = useKeyboardContext();\n\n const heightWhenOpened = useSharedValue(0);\n const height = useSharedValue(0);\n const progress = useSharedValue(0);\n const isClosed = useSharedValue(true);\n\n useLayoutEffect(() => {\n const initialHeight = -reanimated.height.value;\n const initialProgress = reanimated.progress.value;\n\n // eslint-disable-next-line react-compiler/react-compiler\n heightWhenOpened.value = initialHeight;\n height.value = initialHeight;\n progress.value = initialProgress;\n isClosed.value = initialProgress === 0;\n }, []);\n\n useKeyboardHandler(\n {\n onStart: (e) => {\n \"worklet\";\n\n if (e.height > 0) {\n isClosed.value = false;\n heightWhenOpened.value = e.height;\n }\n },\n onMove: (e) => {\n \"worklet\";\n\n progress.value = e.progress;\n height.value = e.height;\n },\n onInteractive: (e) => {\n \"worklet\";\n\n progress.value = e.progress;\n height.value = e.height;\n },\n onEnd: (e) => {\n \"worklet\";\n\n isClosed.value = e.height === 0;\n\n height.value = e.height;\n progress.value = e.progress;\n },\n },\n [],\n );\n\n return { height, progress, heightWhenOpened, isClosed };\n};\nexport const useTranslateAnimation = () => {\n const { reanimated } = useKeyboardContext();\n\n const padding = useSharedValue(0);\n const translate = useSharedValue(0);\n\n useLayoutEffect(() => {\n // eslint-disable-next-line react-compiler/react-compiler\n padding.value = reanimated.progress.value;\n }, []);\n\n useKeyboardHandler(\n {\n onStart: (e) => {\n \"worklet\";\n\n if (e.height === 0) {\n padding.value = 0;\n }\n if (OS === \"ios\") {\n translate.value = e.progress;\n }\n },\n onMove: (e) => {\n \"worklet\";\n\n if (OS
|
|
1
|
+
{"version":3,"names":["_react","require","_reactNative","_reactNativeReanimated","_context","_hooks","OS","Platform","useKeyboardAnimation","reanimated","useKeyboardContext","heightWhenOpened","useSharedValue","height","progress","isClosed","useLayoutEffect","initialHeight","value","initialProgress","useKeyboardHandler","onStart","e","onMove","onInteractive","onEnd","exports","useTranslateAnimation","padding","translate"],"sources":["hooks.ts"],"sourcesContent":["import { useLayoutEffect } from \"react\";\nimport { Platform } from \"react-native\";\nimport { useSharedValue } from \"react-native-reanimated\";\n\nimport { useKeyboardContext } from \"../../context\";\nimport { useKeyboardHandler } from \"../../hooks\";\n\nconst OS = Platform.OS;\n\nexport const useKeyboardAnimation = () => {\n const { reanimated } = useKeyboardContext();\n\n const heightWhenOpened = useSharedValue(0);\n const height = useSharedValue(0);\n const progress = useSharedValue(0);\n const isClosed = useSharedValue(true);\n\n useLayoutEffect(() => {\n const initialHeight = -reanimated.height.value;\n const initialProgress = reanimated.progress.value;\n\n // eslint-disable-next-line react-compiler/react-compiler\n heightWhenOpened.value = initialHeight;\n height.value = initialHeight;\n progress.value = initialProgress;\n isClosed.value = initialProgress === 0;\n }, []);\n\n useKeyboardHandler(\n {\n onStart: (e) => {\n \"worklet\";\n\n if (e.height > 0) {\n isClosed.value = false;\n heightWhenOpened.value = e.height;\n }\n },\n onMove: (e) => {\n \"worklet\";\n\n progress.value = e.progress;\n height.value = e.height;\n },\n onInteractive: (e) => {\n \"worklet\";\n\n progress.value = e.progress;\n height.value = e.height;\n },\n onEnd: (e) => {\n \"worklet\";\n\n isClosed.value = e.height === 0;\n\n height.value = e.height;\n progress.value = e.progress;\n },\n },\n [],\n );\n\n return { height, progress, heightWhenOpened, isClosed };\n};\nexport const useTranslateAnimation = () => {\n const { reanimated } = useKeyboardContext();\n\n const padding = useSharedValue(0);\n const translate = useSharedValue(0);\n\n useLayoutEffect(() => {\n // eslint-disable-next-line react-compiler/react-compiler\n padding.value = reanimated.progress.value;\n }, []);\n\n useKeyboardHandler(\n {\n onStart: (e) => {\n \"worklet\";\n\n if (e.height === 0) {\n padding.value = 0;\n }\n if (OS === \"ios\") {\n translate.value = e.progress;\n }\n },\n onMove: (e) => {\n \"worklet\";\n\n if (OS !== \"ios\") {\n translate.value = e.progress;\n }\n },\n onInteractive: (e) => {\n \"worklet\";\n\n padding.value = 0;\n\n translate.value = e.progress;\n },\n onEnd: (e) => {\n \"worklet\";\n\n padding.value = e.progress;\n\n if (OS !== \"ios\") {\n translate.value = e.progress;\n }\n },\n },\n [],\n );\n\n return { translate, padding };\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,sBAAA,GAAAF,OAAA;AAEA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAEA,MAAMK,EAAE,GAAGC,qBAAQ,CAACD,EAAE;AAEf,MAAME,oBAAoB,GAAGA,CAAA,KAAM;EACxC,MAAM;IAAEC;EAAW,CAAC,GAAG,IAAAC,2BAAkB,EAAC,CAAC;EAE3C,MAAMC,gBAAgB,GAAG,IAAAC,qCAAc,EAAC,CAAC,CAAC;EAC1C,MAAMC,MAAM,GAAG,IAAAD,qCAAc,EAAC,CAAC,CAAC;EAChC,MAAME,QAAQ,GAAG,IAAAF,qCAAc,EAAC,CAAC,CAAC;EAClC,MAAMG,QAAQ,GAAG,IAAAH,qCAAc,EAAC,IAAI,CAAC;EAErC,IAAAI,sBAAe,EAAC,MAAM;IACpB,MAA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CAAAC,qBAAA,GAAAA,qBAAA","ignoreList":[]}
|
|
@@ -47,4 +47,15 @@ Object.keys(_internal).forEach(function (key) {
|
|
|
47
47
|
}
|
|
48
48
|
});
|
|
49
49
|
});
|
|
50
|
+
var _provider = require("./provider");
|
|
51
|
+
Object.keys(_provider).forEach(function (key) {
|
|
52
|
+
if (key === "default" || key === "__esModule") return;
|
|
53
|
+
if (key in exports && exports[key] === _provider[key]) return;
|
|
54
|
+
Object.defineProperty(exports, key, {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () {
|
|
57
|
+
return _provider[key];
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
});
|
|
50
61
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_hooks","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_views","_module","_internal"],"sources":["index.ts"],"sourcesContent":["export * from \"./hooks\";\nexport * from \"./views\";\nexport * from \"./module\";\nexport * from \"./internal\";\n"],"mappings":";;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,MAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,MAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,MAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,MAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,MAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,MAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,MAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,OAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,OAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,OAAA,CAAAN,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAE,OAAA,CAAAN,GAAA;IAAA;EAAA;AAAA;AACA,IAAAO,SAAA,GAAAX,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAS,SAAA,EAAAR,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAO,SAAA,CAAAP,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAG,SAAA,CAAAP,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_hooks","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_views","_module","_internal","_provider"],"sources":["index.ts"],"sourcesContent":["export * from \"./hooks\";\nexport * from \"./views\";\nexport * from \"./module\";\nexport * from \"./internal\";\nexport * from \"./provider\";\n"],"mappings":";;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,MAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA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,SAAA,CAAAP,GAAA;IAAA;EAAA;AAAA;AACA,IAAAQ,SAAA,GAAAZ,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAU,SAAA,EAAAT,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAQ,SAAA,CAAAR,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAI,SAAA,CAAAR,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["provider.ts"],"sourcesContent":["export type 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 * @platform android\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/14\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 * @platform android\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/119\n */\n navigationBarTranslucent?: boolean;\n /**\n * A boolean property indicating whether to keep edge-to-edge mode always enabled (even when you disable the module).\n * Defaults to `false`.\n *\n * @platform android\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/592\n */\n preserveEdgeToEdge?: boolean;\n /**\n * A boolean prop indicating whether the module is enabled. It indicate only initial state\n * (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 * A boolean prop indicating whether to preload the keyboard to reduce time-to-interaction (TTI) on first input focus.\n * Defaults to `true`.\n *\n * @platform ios\n */\n preload?: boolean;\n};\n"],"mappings":"","ignoreList":[]}
|
package/lib/module/animated.js
CHANGED
|
@@ -19,6 +19,7 @@ const styles = StyleSheet.create({
|
|
|
19
19
|
position: "absolute"
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
|
+
|
|
22
23
|
// capture `Platform.OS` in separate variable to avoid deep workletization of entire RN package
|
|
23
24
|
// 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
|
|
24
25
|
const OS = Platform.OS;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useCallback","useEffect","useMemo","useRef","useState","Animated","Platform","StyleSheet","controlEdgeToEdgeValues","isEdgeToEdge","Reanimated","useSharedValue","FocusedInputEvents","KeyboardControllerView","KeyboardControllerViewCommands","KeyboardContext","useAnimatedValue","useEventHandlerRegistration","KeyboardController","useAnimatedKeyboardHandler","useFocusedInputLayoutHandler","IS_EDGE_TO_EDGE","KeyboardControllerViewAnimated","createAnimatedComponent","styles","create","container","flex","hidden","display","position","OS","KeyboardProvider","props","children","statusBarTranslucent","navigationBarTranslucent","preserveEdgeToEdge","enabled","initiallyEnabled","preload","viewRef","setEnabled","progress","height","progressSV","heightSV","layout","setKeyboardHandlers","setInputHandlers","update","synchronizeFocusedInputLayout","current","Promise","resolve","subscription","addListener","remove","context","animated","multiply","reanimated","style","transform","translateX","translateY","onKeyboardMove","event","nativeEvent","useNativeDriver","updateSharedValues","platforms","includes","value","keyboardHandler","onKeyboardMoveStart","onKeyboardMoveInteractive","onKeyboardMoveEnd","inputLayoutHandler","onFocusedInputLayoutChanged","e","target","__DEV__","createElement","Provider","ref","onKeyboardMoveReanimated","undefined","onFocusedInputLayoutChangedReanimated","View"],"sources":["animated.tsx"],"sourcesContent":["/* eslint react/jsx-sort-props: off */\nimport React, {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { Animated, Platform, StyleSheet } from \"react-native\";\nimport {\n controlEdgeToEdgeValues,\n isEdgeToEdge,\n} from \"react-native-is-edge-to-edge\";\nimport Reanimated, { useSharedValue } from \"react-native-reanimated\";\n\nimport {\n FocusedInputEvents,\n KeyboardControllerView,\n KeyboardControllerViewCommands,\n} from \"./bindings\";\nimport { KeyboardContext } from \"./context\";\nimport { useAnimatedValue, useEventHandlerRegistration } from \"./internal\";\nimport { KeyboardController } from \"./module\";\nimport {\n useAnimatedKeyboardHandler,\n useFocusedInputLayoutHandler,\n} from \"./reanimated\";\n\nimport type { KeyboardAnimationContext } from \"./context\";\nimport type {\n FocusedInputLayoutChangedEvent,\n KeyboardControllerProps,\n NativeEvent,\n} from \"./types\";\nimport type { ViewStyle } from \"react-native\";\n\nconst IS_EDGE_TO_EDGE = isEdgeToEdge();\n\nconst KeyboardControllerViewAnimated = Reanimated.createAnimatedComponent(\n Animated.createAnimatedComponent(KeyboardControllerView),\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 * @platform android\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/14\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 * @platform android\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/119\n */\n navigationBarTranslucent?: boolean;\n /**\n * A boolean property indicating whether to keep edge-to-edge mode always enabled (even when you disable the module).\n * Defaults to `false`.\n *\n * @platform android\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/592\n */\n preserveEdgeToEdge?: boolean;\n /**\n * A boolean prop indicating whether the module is enabled. It indicate only initial state\n * (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 * A boolean prop indicating whether to preload the keyboard to reduce time-to-interaction (TTI) on first input focus.\n * Defaults to `true`.\n *\n * @platform ios\n */\n preload?: 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\n/**\n * A component that wrap your app. Under the hood it works with {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-controller-view|KeyboardControllerView} to receive events during keyboard movements,\n * maps these events to `Animated`/`Reanimated` values and store them in context.\n *\n * @param props - Provider props, such as `statusBarTranslucent`, `navigationBarTranslucent`, etc.\n * @returns A component that should be mounted in root of your App layout.\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-provider|Documentation} page for more details.\n * @example\n * ```tsx\n * <KeyboardProvider>\n * <NavigationContainer />\n * </KeyboardProvider>\n * ```\n */\nexport const KeyboardProvider = (props: KeyboardProviderProps) => {\n const {\n children,\n statusBarTranslucent,\n navigationBarTranslucent,\n preserveEdgeToEdge,\n enabled: initiallyEnabled = true,\n preload = true,\n } = props;\n // ref\n const viewRef = useRef<React.Component<KeyboardControllerProps>>(null);\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 = useEventHandlerRegistration(viewRef);\n const setInputHandlers = useEventHandlerRegistration(viewRef);\n const update = useCallback(async () => {\n KeyboardControllerViewCommands.synchronizeFocusedInputLayout(\n viewRef.current,\n );\n\n await new Promise((resolve) => {\n const subscription = FocusedInputEvents.addListener(\n \"layoutDidSynchronize\",\n () => {\n subscription.remove();\n resolve(null);\n },\n );\n });\n }, []);\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 update,\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 // Setting useNativeDriver to true on web triggers a warning due to the absence of a native driver for web. Therefore, it is set to false.\n { useNativeDriver: Platform.OS !== \"web\" },\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 updateSharedValues(event, [\"ios\"]);\n },\n onKeyboardMove: (event: NativeEvent) => {\n \"worklet\";\n\n updateSharedValues(event, [\"android\"]);\n },\n onKeyboardMoveInteractive: (event: NativeEvent) => {\n \"worklet\";\n\n updateSharedValues(event, [\"android\", \"ios\"]);\n },\n onKeyboardMoveEnd: (event: NativeEvent) => {\n \"worklet\";\n\n updateSharedValues(event, [\"android\"]);\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\n useEffect(() => {\n if (preload) {\n KeyboardController.preload();\n }\n }, [preload]);\n\n if (__DEV__) {\n controlEdgeToEdgeValues({\n statusBarTranslucent,\n navigationBarTranslucent,\n preserveEdgeToEdge,\n });\n }\n\n return (\n <KeyboardContext.Provider value={context}>\n <KeyboardControllerViewAnimated\n ref={viewRef}\n enabled={enabled}\n navigationBarTranslucent={IS_EDGE_TO_EDGE || navigationBarTranslucent}\n statusBarTranslucent={IS_EDGE_TO_EDGE || statusBarTranslucent}\n preserveEdgeToEdge={IS_EDGE_TO_EDGE || preserveEdgeToEdge}\n style={styles.container}\n // on*Reanimated prop must precede animated handlers to work correctly\n onKeyboardMoveReanimated={keyboardHandler}\n onKeyboardMoveStart={OS === \"ios\" ? onKeyboardMove : undefined}\n onKeyboardMove={OS === \"android\" ? onKeyboardMove : undefined}\n onKeyboardMoveInteractive={onKeyboardMove}\n onKeyboardMoveEnd={OS === \"android\" ? onKeyboardMove : undefined}\n onFocusedInputLayoutChangedReanimated={inputLayoutHandler}\n >\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;AACA,OAAOA,KAAK,IACVC,WAAW,EACXC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACH,OAAO;AACd,SAASC,QAAQ,EAAEC,QAAQ,EAAEC,UAAU,QAAQ,cAAc;AAC7D,SACEC,uBAAuB,EACvBC,YAAY,QACP,8BAA8B;AACrC,OAAOC,UAAU,IAAIC,cAAc,QAAQ,yBAAyB;AAEpE,SACEC,kBAAkB,EAClBC,sBAAsB,EACtBC,8BAA8B,QACzB,YAAY;AACnB,SAASC,eAAe,QAAQ,WAAW;AAC3C,SAASC,gBAAgB,EAAEC,2BAA2B,QAAQ,YAAY;AAC1E,SAASC,kBAAkB,QAAQ,UAAU;AAC7C,SACE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,IAAI0C,OAAO,EAAE;IACX1E,uBAAuB,CAAC;MACtB2B,oBAAoB;MACpBC,wBAAwB;MACxBC;IACF,CAAC,CAAC;EACJ;EAEA,oBACEtC,KAAA,CAAAoF,aAAA,CAACpE,eAAe,CAACqE,QAAQ;IAACX,KAAK,EAAEf;EAAQ,gBACvC3D,KAAA,CAAAoF,aAAA,CAAC7D,8BAA8B;IAC7B+D,GAAG,EAAE5C,OAAQ;IACbH,OAAO,EAAEA,OAAQ;IACjBF,wBAAwB,EAAEf,eAAe,IAAIe,wBAAyB;IACtED,oBAAoB,EAAEd,eAAe,IAAIc,oBAAqB;IAC9DE,kBAAkB,EAAEhB,eAAe,IAAIgB,kBAAmB;IAC1DyB,KAAK,EAAEtC,MAAM,CAACE;IACd;IAAA;IACA4D,wBAAwB,EAAEZ,eAAgB;IAC1CC,mBAAmB,EAAE5C,EAAE,KAAK,KAAK,GAAGmC,cAAc,GAAGqB,SAAU;IAC/DrB,cAAc,EAAEnC,EAAE,KAAK,SAAS,GAAGmC,cAAc,GAAGqB,SAAU;IAC9DX,yBAAyB,EAAEV,cAAe;IAC1CW,iBAAiB,EAAE9C,EAAE,KAAK,SAAS,GAAGmC,cAAc,GAAGqB,SAAU;IACjEC,qCAAqC,EAAEV;EAAmB,GAEzD5C,QAC6B,CAAC,eACjCnC,KAAA,CAAAoF,aAAA,CAAC9E,QAAQ,CAACoF,IAAI;IACZ;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA3B,KAAK,EAAEA;EAAM,CACd,CACuB,CAAC;AAE/B,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["React","useCallback","useEffect","useMemo","useRef","useState","Animated","Platform","StyleSheet","controlEdgeToEdgeValues","isEdgeToEdge","Reanimated","useSharedValue","FocusedInputEvents","KeyboardControllerView","KeyboardControllerViewCommands","KeyboardContext","useAnimatedValue","useEventHandlerRegistration","KeyboardController","useAnimatedKeyboardHandler","useFocusedInputLayoutHandler","IS_EDGE_TO_EDGE","KeyboardControllerViewAnimated","createAnimatedComponent","styles","create","container","flex","hidden","display","position","OS","KeyboardProvider","props","children","statusBarTranslucent","navigationBarTranslucent","preserveEdgeToEdge","enabled","initiallyEnabled","preload","viewRef","setEnabled","progress","height","progressSV","heightSV","layout","setKeyboardHandlers","setInputHandlers","update","synchronizeFocusedInputLayout","current","Promise","resolve","subscription","addListener","remove","context","animated","multiply","reanimated","style","transform","translateX","translateY","onKeyboardMove","event","nativeEvent","useNativeDriver","updateSharedValues","platforms","includes","value","keyboardHandler","onKeyboardMoveStart","onKeyboardMoveInteractive","onKeyboardMoveEnd","inputLayoutHandler","onFocusedInputLayoutChanged","e","target","__DEV__","createElement","Provider","ref","onKeyboardMoveReanimated","undefined","onFocusedInputLayoutChangedReanimated","View"],"sources":["animated.tsx"],"sourcesContent":["/* eslint react/jsx-sort-props: off */\nimport React, {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { Animated, Platform, StyleSheet } from \"react-native\";\nimport {\n controlEdgeToEdgeValues,\n isEdgeToEdge,\n} from \"react-native-is-edge-to-edge\";\nimport Reanimated, { useSharedValue } from \"react-native-reanimated\";\n\nimport {\n FocusedInputEvents,\n KeyboardControllerView,\n KeyboardControllerViewCommands,\n} from \"./bindings\";\nimport { KeyboardContext } from \"./context\";\nimport { useAnimatedValue, useEventHandlerRegistration } from \"./internal\";\nimport { KeyboardController } from \"./module\";\nimport {\n useAnimatedKeyboardHandler,\n useFocusedInputLayoutHandler,\n} from \"./reanimated\";\n\nimport type { KeyboardAnimationContext } from \"./context\";\nimport type {\n FocusedInputLayoutChangedEvent,\n KeyboardControllerProps,\n KeyboardProviderProps,\n NativeEvent,\n} from \"./types\";\nimport type { ViewStyle } from \"react-native\";\n\nconst IS_EDGE_TO_EDGE = isEdgeToEdge();\n\nconst KeyboardControllerViewAnimated = Reanimated.createAnimatedComponent(\n Animated.createAnimatedComponent(KeyboardControllerView),\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\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\n/**\n * A component that wrap your app. Under the hood it works with {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-controller-view|KeyboardControllerView} to receive events during keyboard movements,\n * maps these events to `Animated`/`Reanimated` values and store them in context.\n *\n * @param props - Provider props, such as `statusBarTranslucent`, `navigationBarTranslucent`, etc.\n * @returns A component that should be mounted in root of your App layout.\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-provider|Documentation} page for more details.\n * @example\n * ```tsx\n * <KeyboardProvider>\n * <NavigationContainer />\n * </KeyboardProvider>\n * ```\n */\nexport const KeyboardProvider = (props: KeyboardProviderProps) => {\n const {\n children,\n statusBarTranslucent,\n navigationBarTranslucent,\n preserveEdgeToEdge,\n enabled: initiallyEnabled = true,\n preload = true,\n } = props;\n // ref\n const viewRef = useRef<React.Component<KeyboardControllerProps>>(null);\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 = useEventHandlerRegistration(viewRef);\n const setInputHandlers = useEventHandlerRegistration(viewRef);\n const update = useCallback(async () => {\n KeyboardControllerViewCommands.synchronizeFocusedInputLayout(\n viewRef.current,\n );\n\n await new Promise((resolve) => {\n const subscription = FocusedInputEvents.addListener(\n \"layoutDidSynchronize\",\n () => {\n subscription.remove();\n resolve(null);\n },\n );\n });\n }, []);\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 update,\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 // Setting useNativeDriver to true on web triggers a warning due to the absence of a native driver for web. Therefore, it is set to false.\n { useNativeDriver: Platform.OS !== \"web\" },\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 updateSharedValues(event, [\"ios\"]);\n },\n onKeyboardMove: (event: NativeEvent) => {\n \"worklet\";\n\n updateSharedValues(event, [\"android\"]);\n },\n onKeyboardMoveInteractive: (event: NativeEvent) => {\n \"worklet\";\n\n updateSharedValues(event, [\"android\", \"ios\"]);\n },\n onKeyboardMoveEnd: (event: NativeEvent) => {\n \"worklet\";\n\n updateSharedValues(event, [\"android\"]);\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\n useEffect(() => {\n if (preload) {\n KeyboardController.preload();\n }\n }, [preload]);\n\n if (__DEV__) {\n controlEdgeToEdgeValues({\n statusBarTranslucent,\n navigationBarTranslucent,\n preserveEdgeToEdge,\n });\n }\n\n return (\n <KeyboardContext.Provider value={context}>\n <KeyboardControllerViewAnimated\n ref={viewRef}\n enabled={enabled}\n navigationBarTranslucent={IS_EDGE_TO_EDGE || navigationBarTranslucent}\n statusBarTranslucent={IS_EDGE_TO_EDGE || statusBarTranslucent}\n preserveEdgeToEdge={IS_EDGE_TO_EDGE || preserveEdgeToEdge}\n style={styles.container}\n // on*Reanimated prop must precede animated handlers to work correctly\n onKeyboardMoveReanimated={keyboardHandler}\n onKeyboardMoveStart={OS === \"ios\" ? onKeyboardMove : undefined}\n onKeyboardMove={OS === \"android\" ? onKeyboardMove : undefined}\n onKeyboardMoveInteractive={onKeyboardMove}\n onKeyboardMoveEnd={OS === \"android\" ? onKeyboardMove : undefined}\n onFocusedInputLayoutChangedReanimated={inputLayoutHandler}\n >\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;AACA,OAAOA,KAAK,IACVC,WAAW,EACXC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACH,OAAO;AACd,SAASC,QAAQ,EAAEC,QAAQ,EAAEC,UAAU,QAAQ,cAAc;AAC7D,SACEC,uBAAuB,EACvBC,YAAY,QACP,8BAA8B;AACrC,OAAOC,UAAU,IAAIC,cAAc,QAAQ,yBAAyB;AAEpE,SACEC,kBAAkB,EAClBC,sBAAsB,EACtBC,8BAA8B,QACzB,YAAY;AACnB,SAASC,eAAe,QAAQ,WAAW;AAC3C,SAASC,gBAAgB,EAAEC,2BAA2B,QAAQ,YAAY;AAC1E,SAASC,kBAAkB,QAAQ,UAAU;AAC7C,SACEC,0BAA0B,EAC1BC,4BAA4B,QACvB,cAAc;AAWrB,MAAMC,eAAe,GAAGZ,YAAY,CAAC,CAAC;AA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AAC,CAAC;EACJ;EAEA,oBACEtC,KAAA,CAAAoF,aAAA,CAACpE,eAAe,CAACqE,QAAQ;IAACX,KAAK,EAAEf;EAAQ,gBACvC3D,KAAA,CAAAoF,aAAA,CAAC7D,8BAA8B;IAC7B+D,GAAG,EAAE5C,OAAQ;IACbH,OAAO,EAAEA,OAAQ;IACjBF,wBAAwB,EAAEf,eAAe,IAAIe,wBAAyB;IACtED,oBAAoB,EAAEd,eAAe,IAAIc,oBAAqB;IAC9DE,kBAAkB,EAAEhB,eAAe,IAAIgB,kBAAmB;IAC1DyB,KAAK,EAAEtC,MAAM,CAACE;IACd;IAAA;IACA4D,wBAAwB,EAAEZ,eAAgB;IAC1CC,mBAAmB,EAAE5C,EAAE,KAAK,KAAK,GAAGmC,cAAc,GAAGqB,SAAU;IAC/DrB,cAAc,EAAEnC,EAAE,KAAK,SAAS,GAAGmC,cAAc,GAAGqB,SAAU;IAC9DX,yBAAyB,EAAEV,cAAe;IAC1CW,iBAAiB,EAAE9C,EAAE,KAAK,SAAS,GAAGmC,cAAc,GAAGqB,SAAU;IACjEC,qCAAqC,EAAEV;EAAmB,GAEzD5C,QAC6B,CAAC,eACjCnC,KAAA,CAAAoF,aAAA,CAAC9E,QAAQ,CAACoF,IAAI;IACZ;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA3B,KAAK,EAAEA;EAAM,CACd,CACuB,CAAC;AAE/B,CAAC","ignoreList":[]}
|
|
@@ -82,7 +82,7 @@ export const useTranslateAnimation = () => {
|
|
|
82
82
|
onMove: e => {
|
|
83
83
|
"worklet";
|
|
84
84
|
|
|
85
|
-
if (OS
|
|
85
|
+
if (OS !== "ios") {
|
|
86
86
|
translate.value = e.progress;
|
|
87
87
|
}
|
|
88
88
|
},
|
|
@@ -96,7 +96,7 @@ export const useTranslateAnimation = () => {
|
|
|
96
96
|
"worklet";
|
|
97
97
|
|
|
98
98
|
padding.value = e.progress;
|
|
99
|
-
if (OS
|
|
99
|
+
if (OS !== "ios") {
|
|
100
100
|
translate.value = e.progress;
|
|
101
101
|
}
|
|
102
102
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useLayoutEffect","Platform","useSharedValue","useKeyboardContext","useKeyboardHandler","OS","useKeyboardAnimation","reanimated","heightWhenOpened","height","progress","isClosed","initialHeight","value","initialProgress","onStart","e","onMove","onInteractive","onEnd","useTranslateAnimation","padding","translate"],"sources":["hooks.ts"],"sourcesContent":["import { useLayoutEffect } from \"react\";\nimport { Platform } from \"react-native\";\nimport { useSharedValue } from \"react-native-reanimated\";\n\nimport { useKeyboardContext } from \"../../context\";\nimport { useKeyboardHandler } from \"../../hooks\";\n\nconst OS = Platform.OS;\n\nexport const useKeyboardAnimation = () => {\n const { reanimated } = useKeyboardContext();\n\n const heightWhenOpened = useSharedValue(0);\n const height = useSharedValue(0);\n const progress = useSharedValue(0);\n const isClosed = useSharedValue(true);\n\n useLayoutEffect(() => {\n const initialHeight = -reanimated.height.value;\n const initialProgress = reanimated.progress.value;\n\n // eslint-disable-next-line react-compiler/react-compiler\n heightWhenOpened.value = initialHeight;\n height.value = initialHeight;\n progress.value = initialProgress;\n isClosed.value = initialProgress === 0;\n }, []);\n\n useKeyboardHandler(\n {\n onStart: (e) => {\n \"worklet\";\n\n if (e.height > 0) {\n isClosed.value = false;\n heightWhenOpened.value = e.height;\n }\n },\n onMove: (e) => {\n \"worklet\";\n\n progress.value = e.progress;\n height.value = e.height;\n },\n onInteractive: (e) => {\n \"worklet\";\n\n progress.value = e.progress;\n height.value = e.height;\n },\n onEnd: (e) => {\n \"worklet\";\n\n isClosed.value = e.height === 0;\n\n height.value = e.height;\n progress.value = e.progress;\n },\n },\n [],\n );\n\n return { height, progress, heightWhenOpened, isClosed };\n};\nexport const useTranslateAnimation = () => {\n const { reanimated } = useKeyboardContext();\n\n const padding = useSharedValue(0);\n const translate = useSharedValue(0);\n\n useLayoutEffect(() => {\n // eslint-disable-next-line react-compiler/react-compiler\n padding.value = reanimated.progress.value;\n }, []);\n\n useKeyboardHandler(\n {\n onStart: (e) => {\n \"worklet\";\n\n if (e.height === 0) {\n padding.value = 0;\n }\n if (OS === \"ios\") {\n translate.value = e.progress;\n }\n },\n onMove: (e) => {\n \"worklet\";\n\n if (OS
|
|
1
|
+
{"version":3,"names":["useLayoutEffect","Platform","useSharedValue","useKeyboardContext","useKeyboardHandler","OS","useKeyboardAnimation","reanimated","heightWhenOpened","height","progress","isClosed","initialHeight","value","initialProgress","onStart","e","onMove","onInteractive","onEnd","useTranslateAnimation","padding","translate"],"sources":["hooks.ts"],"sourcesContent":["import { useLayoutEffect } from \"react\";\nimport { Platform } from \"react-native\";\nimport { useSharedValue } from \"react-native-reanimated\";\n\nimport { useKeyboardContext } from \"../../context\";\nimport { useKeyboardHandler } from \"../../hooks\";\n\nconst OS = Platform.OS;\n\nexport const useKeyboardAnimation = () => {\n const { reanimated } = useKeyboardContext();\n\n const heightWhenOpened = useSharedValue(0);\n const height = useSharedValue(0);\n const progress = useSharedValue(0);\n const isClosed = useSharedValue(true);\n\n useLayoutEffect(() => {\n const initialHeight = -reanimated.height.value;\n const initialProgress = reanimated.progress.value;\n\n // eslint-disable-next-line react-compiler/react-compiler\n heightWhenOpened.value = initialHeight;\n height.value = initialHeight;\n progress.value = initialProgress;\n isClosed.value = initialProgress === 0;\n }, []);\n\n useKeyboardHandler(\n {\n onStart: (e) => {\n \"worklet\";\n\n if (e.height > 0) {\n isClosed.value = false;\n heightWhenOpened.value = e.height;\n }\n },\n onMove: (e) => {\n \"worklet\";\n\n progress.value = e.progress;\n height.value = e.height;\n },\n onInteractive: (e) => {\n \"worklet\";\n\n progress.value = e.progress;\n height.value = e.height;\n },\n onEnd: (e) => {\n \"worklet\";\n\n isClosed.value = e.height === 0;\n\n height.value = e.height;\n progress.value = e.progress;\n },\n },\n [],\n );\n\n return { height, progress, heightWhenOpened, isClosed };\n};\nexport const useTranslateAnimation = () => {\n const { reanimated } = useKeyboardContext();\n\n const padding = useSharedValue(0);\n const translate = useSharedValue(0);\n\n useLayoutEffect(() => {\n // eslint-disable-next-line react-compiler/react-compiler\n padding.value = reanimated.progress.value;\n }, []);\n\n useKeyboardHandler(\n {\n onStart: (e) => {\n \"worklet\";\n\n if (e.height === 0) {\n padding.value = 0;\n }\n if (OS === \"ios\") {\n translate.value = e.progress;\n }\n },\n onMove: (e) => {\n \"worklet\";\n\n if (OS !== \"ios\") {\n translate.value = e.progress;\n }\n },\n onInteractive: (e) => {\n \"worklet\";\n\n padding.value = 0;\n\n translate.value = e.progress;\n },\n onEnd: (e) => {\n \"worklet\";\n\n padding.value = e.progress;\n\n if (OS !== \"ios\") {\n translate.value = e.progress;\n }\n },\n },\n [],\n );\n\n return { translate, padding };\n};\n"],"mappings":"AAAA,SAASA,eAAe,QAAQ,OAAO;AACvC,SAASC,QAAQ,QAAQ,cAAc;AACvC,SAASC,cAAc,QAAQ,yBAAyB;AAExD,SAASC,kBAAkB,QAAQ,eAAe;AAClD,SAASC,kBAAkB,QAAQ,aAAa;AAEhD,MAAMC,EAAE,GAAGJ,QAAQ,CAACI,EAAE;AAEtB,OAAO,MAAMC,oBAAoB,GAAGA,CAAA,KAAM;EACxC,MAAM;IAAEC;EAAW,CAAC,GAAGJ,kBAAkB,CAAC,CAAC;EAE3C,MAAMK,gBAAgB,GAAGN,cAAc,CAAC,CAAC,CAAC;EAC1C,MAAMO,MAAM,GAAGP,cAAc,CAAC,CAAC,CAAC;EAChC,MAAMQ,QAAQ,GAAGR,cAAc,CAAC,CAAC,CAAC;EAClC,MAAMS,QAAQ,GAAGT,cAAc,CAAC,IAAI,CAAC;EAErCF,eAAe,CAAC,MAAM;IACpB,MAAMY,aAAa,GAAG,CAACL,UAAU,CAACE,MAAM,CAACI,KAAK;IAC9C,MAAMC,eAAe,GAAGP,UAAU,CAACG,QAAQ,CAACG,KAAK;;IAEjD;IACAL,gBAAgB,CAACK,KAAK,GAAGD,aAAa;IACtCH,MAAM,CAACI,KAAK,GAAGD,aAAa;IAC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B;IACAqB,OAAO,CAACR,KAAK,GAAGN,UAAU,CAACG,QAAQ,CAACG,KAAK;EAC3C,CAAC,EAAE,EAAE,CAAC;EAENT,kBAAkB,CAChB;IACEW,OAAO,EAAGC,CAAC,IAAK;MACd,SAAS;;MAET,IAAIA,CAAC,CAACP,MAAM,KAAK,CAAC,EAAE;QAClBY,OAAO,CAACR,KAAK,GAAG,CAAC;MACnB;MACA,IAAIR,EAAE,KAAK,KAAK,EAAE;QAChBiB,SAAS,CAACT,KAAK,GAAGG,CAAC,CAACN,QAAQ;MAC9B;IACF,CAAC;IACDO,MAAM,EAAGD,CAAC,IAAK;MACb,SAAS;;MAET,IAAIX,EAAE,KAAK,KAAK,EAAE;QAChBiB,SAAS,CAACT,KAAK,GAAGG,CAAC,CAACN,QAAQ;MAC9B;IACF,CAAC;IACDQ,aAAa,EAAGF,CAAC,IAAK;MACpB,SAAS;;MAETK,OAAO,CAACR,KAAK,GAAG,CAAC;MAEjBS,SAAS,CAACT,KAAK,GAAGG,CAAC,CAACN,QAAQ;IAC9B,CAAC;IACDS,KAAK,EAAGH,CAAC,IAAK;MACZ,SAAS;;MAETK,OAAO,CAACR,KAAK,GAAGG,CAAC,CAACN,QAAQ;MAE1B,IAAIL,EAAE,KAAK,KAAK,EAAE;QAChBiB,SAAS,CAACT,KAAK,GAAGG,CAAC,CAACN,QAAQ;MAC9B;IACF;EACF,CAAC,EACD,EACF,CAAC;EAED,OAAO;IAAEY,SAAS;IAAED;EAAQ,CAAC;AAC/B,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./hooks\";\nexport * from \"./views\";\nexport * from \"./module\";\nexport * from \"./internal\";\n"],"mappings":"AAAA,cAAc,SAAS;AACvB,cAAc,SAAS;AACvB,cAAc,UAAU;AACxB,cAAc,YAAY","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./hooks\";\nexport * from \"./views\";\nexport * from \"./module\";\nexport * from \"./internal\";\nexport * from \"./provider\";\n"],"mappings":"AAAA,cAAc,SAAS;AACvB,cAAc,SAAS;AACvB,cAAc,UAAU;AACxB,cAAc,YAAY;AAC1B,cAAc,YAAY","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["provider.ts"],"sourcesContent":["export type 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 * @platform android\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/14\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 * @platform android\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/119\n */\n navigationBarTranslucent?: boolean;\n /**\n * A boolean property indicating whether to keep edge-to-edge mode always enabled (even when you disable the module).\n * Defaults to `false`.\n *\n * @platform android\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/592\n */\n preserveEdgeToEdge?: boolean;\n /**\n * A boolean prop indicating whether the module is enabled. It indicate only initial state\n * (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 * A boolean prop indicating whether to preload the keyboard to reduce time-to-interaction (TTI) on first input focus.\n * Defaults to `true`.\n *\n * @platform ios\n */\n preload?: boolean;\n};\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1,47 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
type KeyboardProviderProps
|
|
3
|
-
children: React.ReactNode;
|
|
4
|
-
/**
|
|
5
|
-
* Set the value to `true`, if you use translucent status bar on Android.
|
|
6
|
-
* If you already control status bar translucency via `react-native-screens`
|
|
7
|
-
* or `StatusBar` component from `react-native`, you can ignore it.
|
|
8
|
-
* Defaults to `false`.
|
|
9
|
-
*
|
|
10
|
-
* @platform android
|
|
11
|
-
* @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/14
|
|
12
|
-
*/
|
|
13
|
-
statusBarTranslucent?: boolean;
|
|
14
|
-
/**
|
|
15
|
-
* Set the value to `true`, if you use translucent navigation bar on Android.
|
|
16
|
-
* Defaults to `false`.
|
|
17
|
-
*
|
|
18
|
-
* @platform android
|
|
19
|
-
* @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/119
|
|
20
|
-
*/
|
|
21
|
-
navigationBarTranslucent?: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* A boolean property indicating whether to keep edge-to-edge mode always enabled (even when you disable the module).
|
|
24
|
-
* Defaults to `false`.
|
|
25
|
-
*
|
|
26
|
-
* @platform android
|
|
27
|
-
* @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/592
|
|
28
|
-
*/
|
|
29
|
-
preserveEdgeToEdge?: boolean;
|
|
30
|
-
/**
|
|
31
|
-
* A boolean prop indicating whether the module is enabled. It indicate only initial state
|
|
32
|
-
* (if you try to change this prop after component mount it will not have any effect).
|
|
33
|
-
* To change the property in runtime use `useKeyboardController` hook and `setEnabled` method.
|
|
34
|
-
* Defaults to `true`.
|
|
35
|
-
*/
|
|
36
|
-
enabled?: boolean;
|
|
37
|
-
/**
|
|
38
|
-
* A boolean prop indicating whether to preload the keyboard to reduce time-to-interaction (TTI) on first input focus.
|
|
39
|
-
* Defaults to `true`.
|
|
40
|
-
*
|
|
41
|
-
* @platform ios
|
|
42
|
-
*/
|
|
43
|
-
preload?: boolean;
|
|
44
|
-
};
|
|
2
|
+
import type { KeyboardProviderProps } from "./types";
|
|
45
3
|
/**
|
|
46
4
|
* A component that wrap your app. Under the hood it works with {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-controller-view|KeyboardControllerView} to receive events during keyboard movements,
|
|
47
5
|
* maps these events to `Animated`/`Reanimated` values and store them in context.
|
|
@@ -57,4 +15,3 @@ type KeyboardProviderProps = {
|
|
|
57
15
|
* ```
|
|
58
16
|
*/
|
|
59
17
|
export declare const KeyboardProvider: (props: KeyboardProviderProps) => React.JSX.Element;
|
|
60
|
-
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export type KeyboardProviderProps = {
|
|
2
|
+
children: React.ReactNode;
|
|
3
|
+
/**
|
|
4
|
+
* Set the value to `true`, if you use translucent status bar on Android.
|
|
5
|
+
* If you already control status bar translucency via `react-native-screens`
|
|
6
|
+
* or `StatusBar` component from `react-native`, you can ignore it.
|
|
7
|
+
* Defaults to `false`.
|
|
8
|
+
*
|
|
9
|
+
* @platform android
|
|
10
|
+
* @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/14
|
|
11
|
+
*/
|
|
12
|
+
statusBarTranslucent?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Set the value to `true`, if you use translucent navigation bar on Android.
|
|
15
|
+
* Defaults to `false`.
|
|
16
|
+
*
|
|
17
|
+
* @platform android
|
|
18
|
+
* @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/119
|
|
19
|
+
*/
|
|
20
|
+
navigationBarTranslucent?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* A boolean property indicating whether to keep edge-to-edge mode always enabled (even when you disable the module).
|
|
23
|
+
* Defaults to `false`.
|
|
24
|
+
*
|
|
25
|
+
* @platform android
|
|
26
|
+
* @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/592
|
|
27
|
+
*/
|
|
28
|
+
preserveEdgeToEdge?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* A boolean prop indicating whether the module is enabled. It indicate only initial state
|
|
31
|
+
* (if you try to change this prop after component mount it will not have any effect).
|
|
32
|
+
* To change the property in runtime use `useKeyboardController` hook and `setEnabled` method.
|
|
33
|
+
* Defaults to `true`.
|
|
34
|
+
*/
|
|
35
|
+
enabled?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* A boolean prop indicating whether to preload the keyboard to reduce time-to-interaction (TTI) on first input focus.
|
|
38
|
+
* Defaults to `true`.
|
|
39
|
+
*
|
|
40
|
+
* @platform ios
|
|
41
|
+
*/
|
|
42
|
+
preload?: boolean;
|
|
43
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-keyboard-controller",
|
|
3
|
-
"version": "1.20.
|
|
3
|
+
"version": "1.20.3",
|
|
4
4
|
"description": "Keyboard manager which works in identical way on both iOS and Android",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -172,7 +172,7 @@
|
|
|
172
172
|
]
|
|
173
173
|
},
|
|
174
174
|
"codegenConfig": {
|
|
175
|
-
"name": "
|
|
175
|
+
"name": "keyboardcontroller",
|
|
176
176
|
"type": "all",
|
|
177
177
|
"jsSrcsDir": "./src/specs",
|
|
178
178
|
"android": {
|
|
@@ -61,7 +61,7 @@ Pod::Spec.new do |s|
|
|
|
61
61
|
if new_arch_enabled
|
|
62
62
|
s.subspec "common" do |ss|
|
|
63
63
|
ss.source_files = ["common/cpp/**/*.{cpp,h}"]
|
|
64
|
-
ss.header_dir = "react/renderer/components/
|
|
64
|
+
ss.header_dir = "react/renderer/components/keyboardcontroller"
|
|
65
65
|
ss.private_header_files = "common/cpp/**/*.{h}"
|
|
66
66
|
ss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/common/cpp\"" }
|
|
67
67
|
end
|
package/src/animated.tsx
CHANGED
|
@@ -30,6 +30,7 @@ import type { KeyboardAnimationContext } from "./context";
|
|
|
30
30
|
import type {
|
|
31
31
|
FocusedInputLayoutChangedEvent,
|
|
32
32
|
KeyboardControllerProps,
|
|
33
|
+
KeyboardProviderProps,
|
|
33
34
|
NativeEvent,
|
|
34
35
|
} from "./types";
|
|
35
36
|
import type { ViewStyle } from "react-native";
|
|
@@ -55,50 +56,6 @@ const styles = StyleSheet.create<Styles>({
|
|
|
55
56
|
},
|
|
56
57
|
});
|
|
57
58
|
|
|
58
|
-
type KeyboardProviderProps = {
|
|
59
|
-
children: React.ReactNode;
|
|
60
|
-
/**
|
|
61
|
-
* Set the value to `true`, if you use translucent status bar on Android.
|
|
62
|
-
* If you already control status bar translucency via `react-native-screens`
|
|
63
|
-
* or `StatusBar` component from `react-native`, you can ignore it.
|
|
64
|
-
* Defaults to `false`.
|
|
65
|
-
*
|
|
66
|
-
* @platform android
|
|
67
|
-
* @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/14
|
|
68
|
-
*/
|
|
69
|
-
statusBarTranslucent?: boolean;
|
|
70
|
-
/**
|
|
71
|
-
* Set the value to `true`, if you use translucent navigation bar on Android.
|
|
72
|
-
* Defaults to `false`.
|
|
73
|
-
*
|
|
74
|
-
* @platform android
|
|
75
|
-
* @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/119
|
|
76
|
-
*/
|
|
77
|
-
navigationBarTranslucent?: boolean;
|
|
78
|
-
/**
|
|
79
|
-
* A boolean property indicating whether to keep edge-to-edge mode always enabled (even when you disable the module).
|
|
80
|
-
* Defaults to `false`.
|
|
81
|
-
*
|
|
82
|
-
* @platform android
|
|
83
|
-
* @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/592
|
|
84
|
-
*/
|
|
85
|
-
preserveEdgeToEdge?: boolean;
|
|
86
|
-
/**
|
|
87
|
-
* A boolean prop indicating whether the module is enabled. It indicate only initial state
|
|
88
|
-
* (if you try to change this prop after component mount it will not have any effect).
|
|
89
|
-
* To change the property in runtime use `useKeyboardController` hook and `setEnabled` method.
|
|
90
|
-
* Defaults to `true`.
|
|
91
|
-
*/
|
|
92
|
-
enabled?: boolean;
|
|
93
|
-
/**
|
|
94
|
-
* A boolean prop indicating whether to preload the keyboard to reduce time-to-interaction (TTI) on first input focus.
|
|
95
|
-
* Defaults to `true`.
|
|
96
|
-
*
|
|
97
|
-
* @platform ios
|
|
98
|
-
*/
|
|
99
|
-
preload?: boolean;
|
|
100
|
-
};
|
|
101
|
-
|
|
102
59
|
// capture `Platform.OS` in separate variable to avoid deep workletization of entire RN package
|
|
103
60
|
// 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
|
|
104
61
|
const OS = Platform.OS;
|
|
@@ -88,7 +88,7 @@ export const useTranslateAnimation = () => {
|
|
|
88
88
|
onMove: (e) => {
|
|
89
89
|
"worklet";
|
|
90
90
|
|
|
91
|
-
if (OS
|
|
91
|
+
if (OS !== "ios") {
|
|
92
92
|
translate.value = e.progress;
|
|
93
93
|
}
|
|
94
94
|
},
|
|
@@ -104,7 +104,7 @@ export const useTranslateAnimation = () => {
|
|
|
104
104
|
|
|
105
105
|
padding.value = e.progress;
|
|
106
106
|
|
|
107
|
-
if (OS
|
|
107
|
+
if (OS !== "ios") {
|
|
108
108
|
translate.value = e.progress;
|
|
109
109
|
}
|
|
110
110
|
},
|
package/src/types/index.ts
CHANGED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export type KeyboardProviderProps = {
|
|
2
|
+
children: React.ReactNode;
|
|
3
|
+
/**
|
|
4
|
+
* Set the value to `true`, if you use translucent status bar on Android.
|
|
5
|
+
* If you already control status bar translucency via `react-native-screens`
|
|
6
|
+
* or `StatusBar` component from `react-native`, you can ignore it.
|
|
7
|
+
* Defaults to `false`.
|
|
8
|
+
*
|
|
9
|
+
* @platform android
|
|
10
|
+
* @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/14
|
|
11
|
+
*/
|
|
12
|
+
statusBarTranslucent?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Set the value to `true`, if you use translucent navigation bar on Android.
|
|
15
|
+
* Defaults to `false`.
|
|
16
|
+
*
|
|
17
|
+
* @platform android
|
|
18
|
+
* @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/119
|
|
19
|
+
*/
|
|
20
|
+
navigationBarTranslucent?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* A boolean property indicating whether to keep edge-to-edge mode always enabled (even when you disable the module).
|
|
23
|
+
* Defaults to `false`.
|
|
24
|
+
*
|
|
25
|
+
* @platform android
|
|
26
|
+
* @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/592
|
|
27
|
+
*/
|
|
28
|
+
preserveEdgeToEdge?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* A boolean prop indicating whether the module is enabled. It indicate only initial state
|
|
31
|
+
* (if you try to change this prop after component mount it will not have any effect).
|
|
32
|
+
* To change the property in runtime use `useKeyboardController` hook and `setEnabled` method.
|
|
33
|
+
* Defaults to `true`.
|
|
34
|
+
*/
|
|
35
|
+
enabled?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* A boolean prop indicating whether to preload the keyboard to reduce time-to-interaction (TTI) on first input focus.
|
|
38
|
+
* Defaults to `true`.
|
|
39
|
+
*
|
|
40
|
+
* @platform ios
|
|
41
|
+
*/
|
|
42
|
+
preload?: boolean;
|
|
43
|
+
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#include <ReactCommon/JavaTurboModule.h>
|
|
4
|
-
#include <ReactCommon/TurboModule.h>
|
|
5
|
-
#include <jsi/jsi.h>
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Note this import and that it is not present in autogenerated header file
|
|
9
|
-
* under android/build/generated/source/codegen/jni/reactnativekeyboardcontroller.h
|
|
10
|
-
*
|
|
11
|
-
* Here we are overriding autogenerated component descriptors by prioritizing our custom headers via include path setup.
|
|
12
|
-
*/
|
|
13
|
-
#include <react/renderer/components/reactnativekeyboardcontroller/RNKCKeyboardControllerViewComponentDescriptor.h>
|
|
14
|
-
#include <react/renderer/components/reactnativekeyboardcontroller/RNKCKeyboardGestureAreaComponentDescriptor.h>
|
|
15
|
-
#include <react/renderer/components/reactnativekeyboardcontroller/RNKCOverKeyboardViewComponentDescriptor.h>
|
|
16
|
-
#include <react/renderer/components/reactnativekeyboardcontroller/RNKCKeyboardBackgroundViewComponentDescriptor.h>
|
|
17
|
-
|
|
18
|
-
#include <memory>
|
|
19
|
-
#include <string>
|
|
20
|
-
|
|
21
|
-
namespace facebook::react {
|
|
22
|
-
JSI_EXPORT
|
|
23
|
-
std::shared_ptr<TurboModule> reactnativekeyboardcontroller_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms);
|
|
24
|
-
} // namespace facebook::react
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|