react-native-keyboard-controller 1.14.5 → 1.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/build.gradle +3 -2
- package/android/gradle.properties +1 -0
- package/android/src/fabric/java/com/reactnativekeyboardcontroller/KeyboardControllerModule.kt +2 -2
- package/android/src/main/java/com/reactnativekeyboardcontroller/extensions/EditText.kt +35 -0
- package/android/src/main/java/com/reactnativekeyboardcontroller/extensions/ThemedReactContext.kt +18 -0
- package/android/src/main/java/com/reactnativekeyboardcontroller/listeners/KeyboardAnimationCallback.kt +5 -0
- package/android/src/main/java/com/reactnativekeyboardcontroller/modal/ModalAttachedWatcher.kt +9 -6
- package/android/src/main/java/com/reactnativekeyboardcontroller/modules/KeyboardControllerModuleImpl.kt +13 -4
- package/android/src/paper/java/com/reactnativekeyboardcontroller/KeyboardControllerModule.kt +2 -2
- package/ios/KeyboardControllerModule.mm +3 -3
- package/ios/KeyboardControllerModuleImpl.swift +66 -0
- package/ios/events/KeyboardEventEmitterPayload.swift +23 -0
- package/ios/extensions/UIKeyboardAppearance.swift +21 -0
- package/ios/extensions/UIKeyboardType.swift +30 -0
- package/ios/observers/KeyboardMovementObserver.swift +4 -14
- package/ios/protocols/TextInput.swift +5 -1
- package/ios/traversal/ViewHierarchyNavigator.swift +4 -1
- package/jest/index.js +20 -15
- package/lib/commonjs/animated.js +6 -0
- package/lib/commonjs/animated.js.map +1 -1
- package/lib/commonjs/bindings.js +5 -3
- package/lib/commonjs/bindings.js.map +1 -1
- package/lib/commonjs/bindings.native.js +2 -8
- package/lib/commonjs/bindings.native.js.map +1 -1
- package/lib/commonjs/components/KeyboardAvoidingView/index.js.map +1 -1
- package/lib/commonjs/components/KeyboardStickyView/index.js +3 -2
- package/lib/commonjs/components/KeyboardStickyView/index.js.map +1 -1
- package/lib/commonjs/components/KeyboardToolbar/index.js +14 -6
- package/lib/commonjs/components/KeyboardToolbar/index.js.map +1 -1
- package/lib/commonjs/hooks/index.js +3 -3
- package/lib/commonjs/hooks/index.js.map +1 -1
- package/lib/commonjs/hooks/useWindowDimensions/index.android.js +5 -0
- package/lib/commonjs/hooks/useWindowDimensions/index.android.js.map +1 -1
- package/lib/commonjs/index.js +12 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/internal.js +2 -2
- package/lib/commonjs/internal.js.map +1 -1
- package/lib/commonjs/module.js +45 -0
- package/lib/commonjs/module.js.map +1 -0
- package/lib/commonjs/specs/NativeKeyboardController.js.map +1 -1
- package/lib/commonjs/types.js.map +1 -1
- package/lib/module/animated.js +6 -0
- package/lib/module/animated.js.map +1 -1
- package/lib/module/bindings.js +4 -2
- package/lib/module/bindings.js.map +1 -1
- package/lib/module/bindings.native.js +1 -7
- package/lib/module/bindings.native.js.map +1 -1
- package/lib/module/components/KeyboardAvoidingView/index.js.map +1 -1
- package/lib/module/components/KeyboardStickyView/index.js +3 -2
- package/lib/module/components/KeyboardStickyView/index.js.map +1 -1
- package/lib/module/components/KeyboardToolbar/index.js +12 -4
- package/lib/module/components/KeyboardToolbar/index.js.map +1 -1
- package/lib/module/hooks/index.js +1 -1
- package/lib/module/hooks/index.js.map +1 -1
- package/lib/module/hooks/useWindowDimensions/index.android.js +5 -0
- package/lib/module/hooks/useWindowDimensions/index.android.js.map +1 -1
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/internal.js +2 -2
- package/lib/module/internal.js.map +1 -1
- package/lib/module/module.js +39 -0
- package/lib/module/module.js.map +1 -0
- package/lib/module/specs/NativeKeyboardController.js.map +1 -1
- package/lib/module/types.js.map +1 -1
- package/lib/typescript/bindings.d.ts +2 -2
- package/lib/typescript/bindings.native.d.ts +1 -2
- package/lib/typescript/components/KeyboardAvoidingView/index.d.ts +14 -24
- package/lib/typescript/components/KeyboardStickyView/index.d.ts +4 -0
- package/lib/typescript/components/KeyboardToolbar/index.d.ts +2 -1
- package/lib/typescript/index.d.ts +1 -0
- package/lib/typescript/module.d.ts +2 -0
- package/lib/typescript/specs/NativeKeyboardController.d.ts +1 -1
- package/lib/typescript/types.d.ts +14 -3
- package/package.json +1 -1
- package/src/animated.tsx +6 -0
- package/src/bindings.native.ts +1 -8
- package/src/bindings.ts +4 -2
- package/src/components/KeyboardAvoidingView/index.tsx +27 -11
- package/src/components/KeyboardStickyView/index.tsx +12 -3
- package/src/components/KeyboardToolbar/index.tsx +11 -4
- package/src/hooks/index.ts +1 -1
- package/src/hooks/useWindowDimensions/index.android.ts +5 -0
- package/src/index.ts +1 -0
- package/src/internal.ts +2 -2
- package/src/module.ts +50 -0
- package/src/specs/NativeKeyboardController.ts +1 -1
- package/src/types.ts +16 -2
package/android/build.gradle
CHANGED
|
@@ -158,14 +158,15 @@ repositories {
|
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
def kotlin_version = getExtOrDefault('kotlinVersion')
|
|
161
|
+
def reactNativeVersion = getExtOrDefault('reactNativeVersion')
|
|
161
162
|
|
|
162
163
|
dependencies {
|
|
163
164
|
if (project.ext.shouldConsumeReactNativeFromMavenCentral()) {
|
|
164
165
|
// noinspection GradleDynamicVersion
|
|
165
|
-
implementation
|
|
166
|
+
implementation "com.facebook.react:react-android:$reactNativeVersion"
|
|
166
167
|
} else {
|
|
167
168
|
// noinspection GradleDynamicVersion
|
|
168
|
-
implementation
|
|
169
|
+
implementation "com.facebook.react:react-native:$reactNativeVersion"
|
|
169
170
|
}
|
|
170
171
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
171
172
|
implementation 'androidx.core:core-ktx:1.5.0-beta03'
|
|
@@ -2,6 +2,7 @@ package com.reactnativekeyboardcontroller.extensions
|
|
|
2
2
|
|
|
3
3
|
import android.os.Build
|
|
4
4
|
import android.text.Editable
|
|
5
|
+
import android.text.InputType
|
|
5
6
|
import android.text.TextWatcher
|
|
6
7
|
import android.view.View
|
|
7
8
|
import android.widget.EditText
|
|
@@ -110,6 +111,40 @@ fun EditText?.focus() {
|
|
|
110
111
|
}
|
|
111
112
|
}
|
|
112
113
|
|
|
114
|
+
val EditText?.keyboardType: String
|
|
115
|
+
get() {
|
|
116
|
+
if (this == null) {
|
|
117
|
+
return "default"
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// Extract base input type class
|
|
121
|
+
val inputTypeClass = inputType and InputType.TYPE_MASK_CLASS
|
|
122
|
+
val inputTypeVariation = inputType and InputType.TYPE_MASK_VARIATION
|
|
123
|
+
|
|
124
|
+
// Check for special input types
|
|
125
|
+
return when {
|
|
126
|
+
inputTypeVariation == InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS -> "email-address"
|
|
127
|
+
inputTypeVariation == InputType.TYPE_TEXT_VARIATION_URI -> "url"
|
|
128
|
+
inputTypeVariation == InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD -> "visible-password"
|
|
129
|
+
|
|
130
|
+
// Check for specific input type classes
|
|
131
|
+
inputTypeClass == InputType.TYPE_CLASS_NUMBER ->
|
|
132
|
+
when {
|
|
133
|
+
(inputType and InputType.TYPE_NUMBER_FLAG_DECIMAL) != 0 &&
|
|
134
|
+
(inputType and InputType.TYPE_NUMBER_FLAG_SIGNED) == 0 -> "decimal-pad"
|
|
135
|
+
|
|
136
|
+
(inputType and InputType.TYPE_NUMBER_FLAG_SIGNED) != 0 -> "numeric"
|
|
137
|
+
|
|
138
|
+
else -> "number-pad"
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
inputTypeClass == InputType.TYPE_CLASS_PHONE -> "phone-pad"
|
|
142
|
+
inputTypeClass == InputType.TYPE_CLASS_TEXT -> "default"
|
|
143
|
+
|
|
144
|
+
else -> "default"
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
113
148
|
class KeyboardControllerSelectionWatcher(
|
|
114
149
|
private val editText: ReactEditText,
|
|
115
150
|
private val action: (start: Int, end: Int, startX: Double, startY: Double, endX: Double, endY: Double) -> Unit,
|
package/android/src/main/java/com/reactnativekeyboardcontroller/extensions/ThemedReactContext.kt
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
package com.reactnativekeyboardcontroller.extensions
|
|
2
2
|
|
|
3
|
+
import android.content.Context
|
|
4
|
+
import android.os.Build
|
|
3
5
|
import com.facebook.react.bridge.ReactContext
|
|
4
6
|
import com.facebook.react.bridge.WritableMap
|
|
5
7
|
import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
@@ -34,3 +36,19 @@ fun ThemedReactContext?.emitEvent(
|
|
|
34
36
|
|
|
35
37
|
Logger.i("ThemedReactContext", event)
|
|
36
38
|
}
|
|
39
|
+
|
|
40
|
+
val ThemedReactContext?.appearance: String
|
|
41
|
+
get() =
|
|
42
|
+
when {
|
|
43
|
+
this == null -> "default"
|
|
44
|
+
isSystemDarkMode(this) -> "dark"
|
|
45
|
+
else -> "light"
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
private fun isSystemDarkMode(context: Context): Boolean =
|
|
49
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
|
50
|
+
(context.getSystemService(Context.UI_MODE_SERVICE) as? android.app.UiModeManager)
|
|
51
|
+
?.nightMode == android.app.UiModeManager.MODE_NIGHT_YES
|
|
52
|
+
} else {
|
|
53
|
+
false
|
|
54
|
+
}
|
|
@@ -15,12 +15,15 @@ import com.facebook.react.views.textinput.ReactEditText
|
|
|
15
15
|
import com.facebook.react.views.view.ReactViewGroup
|
|
16
16
|
import com.reactnativekeyboardcontroller.constants.Keyboard
|
|
17
17
|
import com.reactnativekeyboardcontroller.events.KeyboardTransitionEvent
|
|
18
|
+
import com.reactnativekeyboardcontroller.extensions.appearance
|
|
18
19
|
import com.reactnativekeyboardcontroller.extensions.dispatchEvent
|
|
19
20
|
import com.reactnativekeyboardcontroller.extensions.dp
|
|
20
21
|
import com.reactnativekeyboardcontroller.extensions.emitEvent
|
|
21
22
|
import com.reactnativekeyboardcontroller.extensions.isKeyboardAnimation
|
|
23
|
+
import com.reactnativekeyboardcontroller.extensions.keyboardType
|
|
22
24
|
import com.reactnativekeyboardcontroller.interactive.InteractiveKeyboardProvider
|
|
23
25
|
import com.reactnativekeyboardcontroller.log.Logger
|
|
26
|
+
import com.reactnativekeyboardcontroller.traversal.FocusedInputHolder
|
|
24
27
|
import kotlin.math.abs
|
|
25
28
|
|
|
26
29
|
private val TAG = KeyboardAnimationCallback::class.qualifiedName
|
|
@@ -425,6 +428,8 @@ class KeyboardAnimationCallback(
|
|
|
425
428
|
params.putInt("duration", duration)
|
|
426
429
|
params.putDouble("timestamp", System.currentTimeMillis().toDouble())
|
|
427
430
|
params.putInt("target", viewTagFocused)
|
|
431
|
+
params.putString("type", FocusedInputHolder.get()?.keyboardType)
|
|
432
|
+
params.putString("appearance", context.appearance)
|
|
428
433
|
|
|
429
434
|
return params
|
|
430
435
|
}
|
package/android/src/main/java/com/reactnativekeyboardcontroller/modal/ModalAttachedWatcher.kt
CHANGED
|
@@ -65,14 +65,17 @@ class ModalAttachedWatcher(
|
|
|
65
65
|
)
|
|
66
66
|
|
|
67
67
|
rootView.addView(eventView)
|
|
68
|
-
// on Android < 12 all events for `WindowInsetsAnimationCallback`
|
|
69
|
-
// go through main `rootView`, so we don't need to stop main
|
|
70
|
-
// callback - otherwise keyboard transitions will not be animated
|
|
71
|
-
this.callback()?.suspend(areEventsComingFromOwnWindow)
|
|
72
|
-
ViewCompat.setWindowInsetsAnimationCallback(rootView, callback)
|
|
73
|
-
ViewCompat.setOnApplyWindowInsetsListener(eventView, callback)
|
|
74
68
|
|
|
75
69
|
if (areEventsComingFromOwnWindow) {
|
|
70
|
+
// on Android < 12 all events for `WindowInsetsAnimationCallback`
|
|
71
|
+
// go through main `rootView`, so we don't need to stop main
|
|
72
|
+
// callback - otherwise keyboard transitions will not be animated
|
|
73
|
+
this.callback()?.suspend(true)
|
|
74
|
+
// attaching callback to Modal on Android < 12 can cause ghost animations, see: https://github.com/kirillzyusko/react-native-keyboard-controller/pull/718
|
|
75
|
+
// and overall attaching additional callbacks (if animation events go through the main window) is not necessary
|
|
76
|
+
ViewCompat.setWindowInsetsAnimationCallback(rootView, callback)
|
|
77
|
+
ViewCompat.setOnApplyWindowInsetsListener(eventView, callback)
|
|
78
|
+
|
|
76
79
|
// when modal is shown then keyboard will be hidden by default
|
|
77
80
|
//
|
|
78
81
|
// - if events are coming from main window - then keyboard position
|
|
@@ -22,19 +22,28 @@ class KeyboardControllerModuleImpl(
|
|
|
22
22
|
setSoftInputMode(mDefaultMode)
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
fun dismiss() {
|
|
25
|
+
fun dismiss(keepFocus: Boolean) {
|
|
26
26
|
val activity = mReactContext.currentActivity
|
|
27
27
|
val view: View? = FocusedInputHolder.get()
|
|
28
28
|
|
|
29
29
|
if (view != null) {
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
UiThreadUtil.runOnUiThread {
|
|
31
|
+
val imm = activity?.getSystemService(Context.INPUT_METHOD_SERVICE) as? InputMethodManager
|
|
32
|
+
imm?.hideSoftInputFromWindow(view.windowToken, 0)
|
|
33
|
+
if (!keepFocus) {
|
|
34
|
+
view.clearFocus()
|
|
35
|
+
}
|
|
36
|
+
}
|
|
32
37
|
}
|
|
33
38
|
}
|
|
34
39
|
|
|
35
40
|
fun setFocusTo(direction: String) {
|
|
36
41
|
if (direction == "current") {
|
|
37
|
-
|
|
42
|
+
UiThreadUtil.runOnUiThread {
|
|
43
|
+
FocusedInputHolder.focus()
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return
|
|
38
47
|
}
|
|
39
48
|
|
|
40
49
|
val view: View? = FocusedInputHolder.get()
|
|
@@ -68,13 +68,13 @@ RCT_EXPORT_METHOD(setInputMode : (nonnull NSNumber *)mode)
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
71
|
-
- (void)dismiss
|
|
71
|
+
- (void)dismiss:(BOOL)keepFocus
|
|
72
72
|
#else
|
|
73
|
-
RCT_EXPORT_METHOD(dismiss)
|
|
73
|
+
RCT_EXPORT_METHOD(dismiss : (BOOL)keepFocus)
|
|
74
74
|
#endif
|
|
75
75
|
{
|
|
76
76
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
77
|
-
[
|
|
77
|
+
[KeyboardControllerModuleImpl dismiss:keepFocus];
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
80
|
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
//
|
|
2
|
+
// KeyboardControllerModuleImpl.swift
|
|
3
|
+
// Pods
|
|
4
|
+
//
|
|
5
|
+
// Created by Kiryl Ziusko on 19/11/2024.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import UIKit
|
|
10
|
+
|
|
11
|
+
@objc(KeyboardControllerModuleImpl)
|
|
12
|
+
public class KeyboardControllerModuleImpl: NSObject {
|
|
13
|
+
private static let keyboardRevealGestureName = "keyboardRevealGesture"
|
|
14
|
+
|
|
15
|
+
@objc
|
|
16
|
+
public static func dismiss(_ keepFocus: Bool) {
|
|
17
|
+
guard let input = UIResponder.current as? TextInput else { return }
|
|
18
|
+
|
|
19
|
+
if keepFocus {
|
|
20
|
+
let tapGesture = UITapGestureRecognizer(target: self, action: #selector(onTextInputTapped(_:)))
|
|
21
|
+
tapGesture.name = keyboardRevealGestureName
|
|
22
|
+
input.addGestureRecognizer(tapGesture)
|
|
23
|
+
|
|
24
|
+
input.inputView = UIView()
|
|
25
|
+
input.reloadInputViews()
|
|
26
|
+
|
|
27
|
+
NotificationCenter.default.addObserver(
|
|
28
|
+
self,
|
|
29
|
+
selector: #selector(onResponderResigned(_:)),
|
|
30
|
+
name: UITextField.textDidEndEditingNotification,
|
|
31
|
+
object: input
|
|
32
|
+
)
|
|
33
|
+
} else {
|
|
34
|
+
input.resignFirstResponder()
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@objc static func onTextInputTapped(_ gesture: UITapGestureRecognizer) {
|
|
39
|
+
if gesture.state == .ended {
|
|
40
|
+
guard let input = UIResponder.current as? TextInput else { return }
|
|
41
|
+
|
|
42
|
+
cleanup(input)
|
|
43
|
+
|
|
44
|
+
input.becomeFirstResponder()
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
@objc static func onResponderResigned(_ notification: Notification) {
|
|
49
|
+
guard let input = notification.object as? TextInput else { return }
|
|
50
|
+
|
|
51
|
+
cleanup(input)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
static func cleanup(_ input: TextInput) {
|
|
55
|
+
input.inputView = nil
|
|
56
|
+
input.reloadInputViews()
|
|
57
|
+
|
|
58
|
+
if let gestures = input.gestureRecognizers {
|
|
59
|
+
for gesture in gestures where gesture.name == keyboardRevealGestureName {
|
|
60
|
+
input.removeGestureRecognizer(gesture)
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
NotificationCenter.default.removeObserver(self, name: UITextField.textDidEndEditingNotification, object: input)
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//
|
|
2
|
+
// KeyboardEventEmitterPayload.swift
|
|
3
|
+
// Pods
|
|
4
|
+
//
|
|
5
|
+
// Created by Kiryl Ziusko on 07/12/2024.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import UIKit
|
|
10
|
+
|
|
11
|
+
public func buildEventParams(_ height: Double, _ duration: Int, _ tag: NSNumber) -> [AnyHashable: Any] {
|
|
12
|
+
var data = [AnyHashable: Any]()
|
|
13
|
+
let input = FocusedInputHolder.shared.get()
|
|
14
|
+
|
|
15
|
+
data["height"] = height
|
|
16
|
+
data["duration"] = duration
|
|
17
|
+
data["timestamp"] = Date.currentTimeStamp
|
|
18
|
+
data["target"] = tag
|
|
19
|
+
data["type"] = input?.keyboardType.name ?? "default"
|
|
20
|
+
data["appearance"] = input?.keyboardAppearance.name ?? "default"
|
|
21
|
+
|
|
22
|
+
return data
|
|
23
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//
|
|
2
|
+
// UIKeyboardAppearance.swift
|
|
3
|
+
// Pods
|
|
4
|
+
//
|
|
5
|
+
// Created by Kiryl Ziusko on 08/12/2024.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import UIKit
|
|
10
|
+
|
|
11
|
+
public extension UIKeyboardAppearance {
|
|
12
|
+
var name: String {
|
|
13
|
+
switch self {
|
|
14
|
+
case .default: return "default"
|
|
15
|
+
case .dark: return "dark"
|
|
16
|
+
case .light: return "light"
|
|
17
|
+
@unknown default:
|
|
18
|
+
return "default"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//
|
|
2
|
+
// UIKeyboardType.swift
|
|
3
|
+
// Pods
|
|
4
|
+
//
|
|
5
|
+
// Created by Kiryl Ziusko on 08/12/2024.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import UIKit
|
|
10
|
+
|
|
11
|
+
extension UIKeyboardType {
|
|
12
|
+
private static let keyboardTypeToStringMapping: [UIKeyboardType: String] = [
|
|
13
|
+
.default: "default",
|
|
14
|
+
.asciiCapable: "ascii-capable",
|
|
15
|
+
.numbersAndPunctuation: "numbers-and-punctuation",
|
|
16
|
+
.URL: "url",
|
|
17
|
+
.numberPad: "number-pad",
|
|
18
|
+
.phonePad: "phone-pad",
|
|
19
|
+
.namePhonePad: "name-phone-pad",
|
|
20
|
+
.emailAddress: "email-address",
|
|
21
|
+
.decimalPad: "decimal-pad",
|
|
22
|
+
.twitter: "twitter",
|
|
23
|
+
.webSearch: "web-search",
|
|
24
|
+
.asciiCapableNumberPad: "ascii-capable-number-pad",
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
var name: String {
|
|
28
|
+
return UIKeyboardType.keyboardTypeToStringMapping[self] ?? "default"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -173,7 +173,7 @@ public class KeyboardMovementObserver: NSObject {
|
|
|
173
173
|
|
|
174
174
|
onRequestAnimation()
|
|
175
175
|
onEvent("onKeyboardMoveStart", Float(keyboardHeight) as NSNumber, 1, duration as NSNumber, tag)
|
|
176
|
-
onNotify("KeyboardController::keyboardWillShow",
|
|
176
|
+
onNotify("KeyboardController::keyboardWillShow", buildEventParams(keyboardHeight, duration, tag))
|
|
177
177
|
|
|
178
178
|
setupKeyboardWatcher()
|
|
179
179
|
initializeAnimation(fromValue: prevKeyboardPosition, toValue: keyboardHeight)
|
|
@@ -187,7 +187,7 @@ public class KeyboardMovementObserver: NSObject {
|
|
|
187
187
|
|
|
188
188
|
onRequestAnimation()
|
|
189
189
|
onEvent("onKeyboardMoveStart", 0, 0, duration as NSNumber, tag)
|
|
190
|
-
onNotify("KeyboardController::keyboardWillHide",
|
|
190
|
+
onNotify("KeyboardController::keyboardWillHide", buildEventParams(0, duration, tag))
|
|
191
191
|
|
|
192
192
|
setupKeyboardWatcher()
|
|
193
193
|
removeKVObserver()
|
|
@@ -210,7 +210,7 @@ public class KeyboardMovementObserver: NSObject {
|
|
|
210
210
|
|
|
211
211
|
onCancelAnimation()
|
|
212
212
|
onEvent("onKeyboardMoveEnd", height as NSNumber, progress as NSNumber, duration as NSNumber, tag)
|
|
213
|
-
onNotify("KeyboardController::keyboardDidShow",
|
|
213
|
+
onNotify("KeyboardController::keyboardDidShow", buildEventParams(height, duration, tag))
|
|
214
214
|
|
|
215
215
|
removeKeyboardWatcher()
|
|
216
216
|
setupKVObserver()
|
|
@@ -224,7 +224,7 @@ public class KeyboardMovementObserver: NSObject {
|
|
|
224
224
|
|
|
225
225
|
onCancelAnimation()
|
|
226
226
|
onEvent("onKeyboardMoveEnd", 0 as NSNumber, 0, duration as NSNumber, tag)
|
|
227
|
-
onNotify("KeyboardController::keyboardDidHide",
|
|
227
|
+
onNotify("KeyboardController::keyboardDidHide", buildEventParams(0, duration, tag))
|
|
228
228
|
|
|
229
229
|
removeKeyboardWatcher()
|
|
230
230
|
animation = nil
|
|
@@ -309,14 +309,4 @@ public class KeyboardMovementObserver: NSObject {
|
|
|
309
309
|
tag
|
|
310
310
|
)
|
|
311
311
|
}
|
|
312
|
-
|
|
313
|
-
private func getEventParams(_ height: Double, _ duration: Int) -> [AnyHashable: Any] {
|
|
314
|
-
var data = [AnyHashable: Any]()
|
|
315
|
-
data["height"] = height
|
|
316
|
-
data["duration"] = duration
|
|
317
|
-
data["timestamp"] = Date.currentTimeStamp
|
|
318
|
-
data["target"] = tag
|
|
319
|
-
|
|
320
|
-
return data
|
|
321
|
-
}
|
|
322
312
|
}
|
|
@@ -9,7 +9,11 @@
|
|
|
9
9
|
import Foundation
|
|
10
10
|
import UIKit
|
|
11
11
|
|
|
12
|
-
public protocol TextInput:
|
|
12
|
+
public protocol TextInput: UIView {
|
|
13
|
+
// default common methods/properties
|
|
14
|
+
var inputView: UIView? { get set }
|
|
15
|
+
var keyboardType: UIKeyboardType { get }
|
|
16
|
+
var keyboardAppearance: UIKeyboardAppearance { get }
|
|
13
17
|
func focus()
|
|
14
18
|
}
|
|
15
19
|
|
|
@@ -14,7 +14,10 @@ public class ViewHierarchyNavigator: NSObject {
|
|
|
14
14
|
@objc public static func setFocusTo(direction: String) {
|
|
15
15
|
DispatchQueue.main.async {
|
|
16
16
|
if direction == "current" {
|
|
17
|
-
FocusedInputHolder.shared.
|
|
17
|
+
let input = FocusedInputHolder.shared.get()
|
|
18
|
+
input?.inputView = nil
|
|
19
|
+
input?.reloadInputViews()
|
|
20
|
+
input?.focus()
|
|
18
21
|
return
|
|
19
22
|
}
|
|
20
23
|
|
package/jest/index.js
CHANGED
|
@@ -6,24 +6,27 @@ const values = {
|
|
|
6
6
|
height: new Animated.Value(0),
|
|
7
7
|
},
|
|
8
8
|
reanimated: {
|
|
9
|
-
progress: { value: 0 },
|
|
10
|
-
height: { value: 0 },
|
|
9
|
+
progress: { value: 0, get: jest.fn().mockReturnValue(0), set: jest.fn() },
|
|
10
|
+
height: { value: 0, get: jest.fn().mockReturnValue(0), set: jest.fn() },
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
const inputData = {
|
|
14
|
+
target: 1,
|
|
15
|
+
parentScrollViewTarget: -1,
|
|
16
|
+
layout: {
|
|
17
|
+
x: 0,
|
|
18
|
+
y: 0,
|
|
19
|
+
width: 200,
|
|
20
|
+
height: 40,
|
|
21
|
+
absoluteX: 0,
|
|
22
|
+
absoluteY: 100,
|
|
11
23
|
},
|
|
12
24
|
};
|
|
13
25
|
const focusedInput = {
|
|
14
26
|
input: {
|
|
15
|
-
value:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
layout: {
|
|
19
|
-
x: 0,
|
|
20
|
-
y: 0,
|
|
21
|
-
width: 200,
|
|
22
|
-
height: 40,
|
|
23
|
-
absoluteX: 0,
|
|
24
|
-
absoluteY: 100,
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
+
value: inputData,
|
|
28
|
+
get: jest.fn().mockReturnValue(inputData),
|
|
29
|
+
set: jest.fn(),
|
|
27
30
|
},
|
|
28
31
|
};
|
|
29
32
|
|
|
@@ -49,8 +52,10 @@ const mock = {
|
|
|
49
52
|
KeyboardController: {
|
|
50
53
|
setInputMode: jest.fn(),
|
|
51
54
|
setDefaultMode: jest.fn(),
|
|
52
|
-
dismiss: jest.fn(),
|
|
55
|
+
dismiss: jest.fn().mockReturnValue(Promise.resolve()),
|
|
53
56
|
setFocusTo: jest.fn(),
|
|
57
|
+
isVisible: jest.fn().mockReturnValue(false),
|
|
58
|
+
state: jest.fn().mockReturnValue(null),
|
|
54
59
|
},
|
|
55
60
|
AndroidSoftInputModes: {
|
|
56
61
|
SOFT_INPUT_ADJUST_NOTHING: 48,
|
package/lib/commonjs/animated.js
CHANGED
|
@@ -109,6 +109,11 @@ const KeyboardProvider = ({
|
|
|
109
109
|
"worklet";
|
|
110
110
|
|
|
111
111
|
updateSharedValues(event, ["android", "ios"]);
|
|
112
|
+
},
|
|
113
|
+
onKeyboardMoveEnd: event => {
|
|
114
|
+
"worklet";
|
|
115
|
+
|
|
116
|
+
updateSharedValues(event, ["android"]);
|
|
112
117
|
}
|
|
113
118
|
}, []);
|
|
114
119
|
const inputLayoutHandler = (0, _reanimated.useFocusedInputLayoutHandler)({
|
|
@@ -151,6 +156,7 @@ const KeyboardProvider = ({
|
|
|
151
156
|
onKeyboardMoveStart: OS === "ios" ? onKeyboardMove : undefined,
|
|
152
157
|
onKeyboardMove: OS === "android" ? onKeyboardMove : undefined,
|
|
153
158
|
onKeyboardMoveInteractive: onKeyboardMove,
|
|
159
|
+
onKeyboardMoveEnd: OS === "android" ? onKeyboardMove : undefined,
|
|
154
160
|
onFocusedInputLayoutChangedReanimated: inputLayoutHandler
|
|
155
161
|
}, children), /*#__PURE__*/_react.default.createElement(_reactNative.Animated.View, {
|
|
156
162
|
// we are using this small hack, because if the component (where
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeIsEdgeToEdge","_reactNativeReanimated","_bindings","_context","_eventMappings","_internal","_monkeyPatch","_reanimated","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","IS_EDGE_TO_EDGE","isEdgeToEdge","KeyboardControllerViewAnimated","Reanimated","createAnimatedComponent","Animated","KeyboardControllerView","styles","StyleSheet","create","container","flex","hidden","display","position","OS","Platform","KeyboardProvider","children","statusBarTranslucent","navigationBarTranslucent","enabled","initiallyEnabled","viewTagRef","useRef","setEnabled","useState","progress","useAnimatedValue","height","progressSV","useSharedValue","heightSV","layout","setKeyboardHandlers","useEventHandlerRegistration","keyboardEventsMap","setInputHandlers","focusedInputEventsMap","context","useMemo","animated","multiply","reanimated","style","transform","translateX","translateY","onKeyboardMove","event","nativeEvent","useNativeDriver","updateSharedValues","platforms","includes","value","keyboardHandler","useAnimatedKeyboardHandler","onKeyboardMoveStart","onKeyboardMoveInteractive","inputLayoutHandler","useFocusedInputLayoutHandler","onFocusedInputLayoutChanged","target","useEffect","applyMonkeyPatch","revertMonkeyPatch","__DEV__","controlEdgeToEdgeValues","createElement","KeyboardContext","Provider","ref","onKeyboardMoveReanimated","undefined","onFocusedInputLayoutChangedReanimated","View","exports"],"sources":["animated.tsx"],"sourcesContent":["/* eslint react/jsx-sort-props: off */\nimport React, { useEffect, useMemo, useRef, useState } 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 { KeyboardControllerView } from \"./bindings\";\nimport { KeyboardContext } from \"./context\";\nimport { focusedInputEventsMap, keyboardEventsMap } from \"./event-mappings\";\nimport { useAnimatedValue, useEventHandlerRegistration } from \"./internal\";\nimport { applyMonkeyPatch, revertMonkeyPatch } from \"./monkey-patch\";\nimport {\n useAnimatedKeyboardHandler,\n useFocusedInputLayoutHandler,\n} from \"./reanimated\";\n\nimport type { KeyboardAnimationContext } from \"./context\";\nimport type {\n FocusedInputHandler,\n FocusedInputLayoutChangedEvent,\n KeyboardControllerProps,\n KeyboardHandler,\n NativeEvent,\n} from \"./types\";\nimport type { ViewStyle } from \"react-native\";\n\nconst 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 * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/14\n * @platform android\n */\n statusBarTranslucent?: boolean;\n /**\n * Set the value to `true`, if you use translucent navigation bar on Android.\n * Defaults to `false`.\n *\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/119\n * @platform android\n */\n navigationBarTranslucent?: boolean;\n /**\n * A boolean prop indicating whether the module is enabled. It indicate only initial state,\n * i. e. if you try to change this prop after component mount it will not have any effect.\n * To change the property in runtime use `useKeyboardController` hook and `setEnabled` method.\n * Defaults to `true`.\n */\n enabled?: boolean;\n};\n\n// capture `Platform.OS` in separate variable to avoid deep workletization of entire RN package\n// see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/393 and https://github.com/kirillzyusko/react-native-keyboard-controller/issues/294 for more details\nconst OS = Platform.OS;\n\nexport const KeyboardProvider = ({\n children,\n statusBarTranslucent,\n navigationBarTranslucent,\n enabled: initiallyEnabled = true,\n}: KeyboardProviderProps) => {\n // ref\n const viewTagRef = 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<KeyboardHandler>(\n keyboardEventsMap,\n viewTagRef,\n );\n const setInputHandlers = useEventHandlerRegistration<FocusedInputHandler>(\n focusedInputEventsMap,\n viewTagRef,\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 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 },\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 // effects\n useEffect(() => {\n if (enabled) {\n applyMonkeyPatch();\n } else {\n revertMonkeyPatch();\n }\n }, [enabled]);\n\n if (__DEV__) {\n controlEdgeToEdgeValues({ statusBarTranslucent, navigationBarTranslucent });\n }\n\n return (\n <KeyboardContext.Provider value={context}>\n <KeyboardControllerViewAnimated\n ref={viewTagRef}\n enabled={enabled}\n navigationBarTranslucent={IS_EDGE_TO_EDGE || navigationBarTranslucent}\n statusBarTranslucent={IS_EDGE_TO_EDGE || statusBarTranslucent}\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 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;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,wBAAA,GAAAF,OAAA;AAIA,IAAAG,sBAAA,GAAAJ,uBAAA,CAAAC,OAAA;AAEA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,cAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AACA,IAAAQ,YAAA,GAAAR,OAAA;AACA,IAAAS,WAAA,GAAAT,OAAA;AAGsB,SAAAU,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAZ,wBAAAY,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC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AAC7C,OAAO,CAAC,CAAC;EAEb,IAAI8C,OAAO,EAAE;IACX,IAAAC,gDAAuB,EAAC;MAAEjD,oBAAoB;MAAEC;IAAyB,CAAC,CAAC;EAC7E;EAEA,oBACEpD,MAAA,CAAAkB,OAAA,CAAAmF,aAAA,CAAC9F,QAAA,CAAA+F,eAAe,CAACC,QAAQ;IAAChB,KAAK,EAAEhB;EAAQ,gBACvCvE,MAAA,CAAAkB,OAAA,CAAAmF,aAAA,CAACnE,8BAA8B;IAC7BsE,GAAG,EAAEjD,UAAW;IAChBF,OAAO,EAAEA,OAAQ;IACjBD,wBAAwB,EAAEpB,eAAe,IAAIoB,wBAAyB;IACtED,oBAAoB,EAAEnB,eAAe,IAAImB,oBAAqB;IAC9DyB,KAAK,EAAErC,MAAM,CAACG;IACd;IAAA;IACA+D,wBAAwB,EAAEjB,eAAgB;IAC1CE,mBAAmB,EAAE3C,EAAE,KAAK,KAAK,GAAGiC,cAAc,GAAG0B,SAAU;IAC/D1B,cAAc,EAAEjC,EAAE,KAAK,SAAS,GAAGiC,cAAc,GAAG0B,SAAU;IAC9Df,yBAAyB,EAAEX,cAAe;IAC1C2B,qCAAqC,EAAEf;EAAmB,GAEzD1C,QAC6B,CAAC,eACjClD,MAAA,CAAAkB,OAAA,CAAAmF,aAAA,CAAClG,YAAA,CAAAkC,QAAQ,CAACuE,IAAI;IACZ;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACAhC,KAAK,EAAEA;EAAM,CACd,CACuB,CAAC;AAE/B,CAAC;AAACiC,OAAA,CAAA5D,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeIsEdgeToEdge","_reactNativeReanimated","_bindings","_context","_eventMappings","_internal","_monkeyPatch","_reanimated","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","IS_EDGE_TO_EDGE","isEdgeToEdge","KeyboardControllerViewAnimated","Reanimated","createAnimatedComponent","Animated","KeyboardControllerView","styles","StyleSheet","create","container","flex","hidden","display","position","OS","Platform","KeyboardProvider","children","statusBarTranslucent","navigationBarTranslucent","enabled","initiallyEnabled","viewTagRef","useRef","setEnabled","useState","progress","useAnimatedValue","height","progressSV","useSharedValue","heightSV","layout","setKeyboardHandlers","useEventHandlerRegistration","keyboardEventsMap","setInputHandlers","focusedInputEventsMap","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","applyMonkeyPatch","revertMonkeyPatch","__DEV__","controlEdgeToEdgeValues","createElement","KeyboardContext","Provider","ref","onKeyboardMoveReanimated","undefined","onFocusedInputLayoutChangedReanimated","View","exports"],"sources":["animated.tsx"],"sourcesContent":["/* eslint react/jsx-sort-props: off */\nimport React, { useEffect, useMemo, useRef, useState } 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 { KeyboardControllerView } from \"./bindings\";\nimport { KeyboardContext } from \"./context\";\nimport { focusedInputEventsMap, keyboardEventsMap } from \"./event-mappings\";\nimport { useAnimatedValue, useEventHandlerRegistration } from \"./internal\";\nimport { applyMonkeyPatch, revertMonkeyPatch } from \"./monkey-patch\";\nimport {\n useAnimatedKeyboardHandler,\n useFocusedInputLayoutHandler,\n} from \"./reanimated\";\n\nimport type { KeyboardAnimationContext } from \"./context\";\nimport type {\n FocusedInputHandler,\n FocusedInputLayoutChangedEvent,\n KeyboardControllerProps,\n KeyboardHandler,\n NativeEvent,\n} from \"./types\";\nimport type { ViewStyle } from \"react-native\";\n\nconst 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 * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/14\n * @platform android\n */\n statusBarTranslucent?: boolean;\n /**\n * Set the value to `true`, if you use translucent navigation bar on Android.\n * Defaults to `false`.\n *\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/119\n * @platform android\n */\n navigationBarTranslucent?: boolean;\n /**\n * A boolean prop indicating whether the module is enabled. It indicate only initial state,\n * i. e. if you try to change this prop after component mount it will not have any effect.\n * To change the property in runtime use `useKeyboardController` hook and `setEnabled` method.\n * Defaults to `true`.\n */\n enabled?: boolean;\n};\n\n// capture `Platform.OS` in separate variable to avoid deep workletization of entire RN package\n// see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/393 and https://github.com/kirillzyusko/react-native-keyboard-controller/issues/294 for more details\nconst OS = Platform.OS;\n\nexport const KeyboardProvider = ({\n children,\n statusBarTranslucent,\n navigationBarTranslucent,\n enabled: initiallyEnabled = true,\n}: KeyboardProviderProps) => {\n // ref\n const viewTagRef = 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<KeyboardHandler>(\n keyboardEventsMap,\n viewTagRef,\n );\n const setInputHandlers = useEventHandlerRegistration<FocusedInputHandler>(\n focusedInputEventsMap,\n viewTagRef,\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 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 // effects\n useEffect(() => {\n if (enabled) {\n applyMonkeyPatch();\n } else {\n revertMonkeyPatch();\n }\n }, [enabled]);\n\n if (__DEV__) {\n controlEdgeToEdgeValues({ statusBarTranslucent, navigationBarTranslucent });\n }\n\n return (\n <KeyboardContext.Provider value={context}>\n <KeyboardControllerViewAnimated\n ref={viewTagRef}\n enabled={enabled}\n navigationBarTranslucent={IS_EDGE_TO_EDGE || navigationBarTranslucent}\n statusBarTranslucent={IS_EDGE_TO_EDGE || statusBarTranslucent}\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;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,wBAAA,GAAAF,OAAA;AAIA,IAAAG,sBAAA,GAAAJ,uBAAA,CAAAC,OAAA;AAEA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,cAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AACA,IAAAQ,YAAA,GAAAR,OAAA;AACA,IAAAS,WAAA,GAAAT,OAAA;AAGsB,SAAAU,yBAAAC,CAAA,6BAA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c,EAAEjC,EAAE,KAAK,SAAS,GAAGiC,cAAc,GAAG2B,SAAU;IAC9DhB,yBAAyB,EAAEX,cAAe;IAC1CY,iBAAiB,EAAE7C,EAAE,KAAK,SAAS,GAAGiC,cAAc,GAAG2B,SAAU;IACjEC,qCAAqC,EAAEf;EAAmB,GAEzD3C,QAC6B,CAAC,eACjClD,MAAA,CAAAkB,OAAA,CAAAoF,aAAA,CAACnG,YAAA,CAAAkC,QAAQ,CAACwE,IAAI;IACZ;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACAjC,KAAK,EAAEA;EAAM,CACd,CACuB,CAAC;AAE/B,CAAC;AAACkC,OAAA,CAAA7D,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
package/lib/commonjs/bindings.js
CHANGED
|
@@ -3,14 +3,16 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.WindowDimensionsEvents = exports.RCTOverKeyboardView = exports.KeyboardGestureArea = exports.KeyboardEvents = exports.KeyboardControllerView = exports.
|
|
6
|
+
exports.WindowDimensionsEvents = exports.RCTOverKeyboardView = exports.KeyboardGestureArea = exports.KeyboardEvents = exports.KeyboardControllerView = exports.KeyboardControllerNative = exports.FocusedInputEvents = void 0;
|
|
7
7
|
var _reactNative = require("react-native");
|
|
8
8
|
const NOOP = () => {};
|
|
9
|
-
const
|
|
9
|
+
const KeyboardControllerNative = exports.KeyboardControllerNative = {
|
|
10
10
|
setDefaultMode: NOOP,
|
|
11
11
|
setInputMode: NOOP,
|
|
12
12
|
dismiss: NOOP,
|
|
13
|
-
setFocusTo: NOOP
|
|
13
|
+
setFocusTo: NOOP,
|
|
14
|
+
addListener: NOOP,
|
|
15
|
+
removeListeners: NOOP
|
|
14
16
|
};
|
|
15
17
|
const KeyboardEvents = exports.KeyboardEvents = {
|
|
16
18
|
addListener: () => ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","NOOP","
|
|
1
|
+
{"version":3,"names":["_reactNative","require","NOOP","KeyboardControllerNative","exports","setDefaultMode","setInputMode","dismiss","setFocusTo","addListener","removeListeners","KeyboardEvents","remove","FocusedInputEvents","WindowDimensionsEvents","KeyboardControllerView","View","KeyboardGestureArea","RCTOverKeyboardView"],"sources":["bindings.ts"],"sourcesContent":["import { View } from \"react-native\";\n\nimport type {\n FocusedInputEventsModule,\n KeyboardControllerNativeModule,\n KeyboardControllerProps,\n KeyboardEventsModule,\n KeyboardGestureAreaProps,\n OverKeyboardViewProps,\n WindowDimensionsEventsModule,\n} from \"./types\";\nimport type { EmitterSubscription } from \"react-native\";\n\nconst NOOP = () => {};\n\nexport const KeyboardControllerNative: KeyboardControllerNativeModule = {\n setDefaultMode: NOOP,\n setInputMode: NOOP,\n dismiss: NOOP,\n setFocusTo: NOOP,\n addListener: NOOP,\n removeListeners: NOOP,\n};\nexport const KeyboardEvents: KeyboardEventsModule = {\n addListener: () => ({ remove: NOOP } as EmitterSubscription),\n};\n/**\n * This API is not documented, it's for internal usage only (for now), and is a subject to potential breaking changes in future.\n * Use it with cautious.\n */\nexport const FocusedInputEvents: FocusedInputEventsModule = {\n addListener: () => ({ remove: NOOP } as EmitterSubscription),\n};\nexport const WindowDimensionsEvents: WindowDimensionsEventsModule = {\n addListener: () => ({ remove: NOOP } as EmitterSubscription),\n};\nexport const KeyboardControllerView =\n View as unknown as React.FC<KeyboardControllerProps>;\nexport const KeyboardGestureArea =\n View as unknown as React.FC<KeyboardGestureAreaProps>;\nexport const RCTOverKeyboardView =\n View as unknown as React.FC<OverKeyboardViewProps>;\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAaA,MAAMC,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AAEd,MAAMC,wBAAwD,GAAAC,OAAA,CAAAD,wBAAA,GAAG;EACtEE,cAAc,EAAEH,IAAI;EACpBI,YAAY,EAAEJ,IAAI;EAClBK,OAAO,EAAEL,IAAI;EACbM,UAAU,EAAEN,IAAI;EAChBO,WAAW,EAAEP,IAAI;EACjBQ,eAAe,EAAER;AACnB,CAAC;AACM,MAAMS,cAAoC,GAAAP,OAAA,CAAAO,cAAA,GAAG;EAClDF,WAAW,EAAEA,CAAA,MAAO;IAAEG,MAAM,EAAEV;EAAK,CAAC;AACtC,CAAC;AACD;AACA;AACA;AACA;AACO,MAAMW,kBAA4C,GAAAT,OAAA,CAAAS,kBAAA,GAAG;EAC1DJ,WAAW,EAAEA,CAAA,MAAO;IAAEG,MAAM,EAAEV;EAAK,CAAC;AACtC,CAAC;AACM,MAAMY,sBAAoD,GAAAV,OAAA,CAAAU,sBAAA,GAAG;EAClEL,WAAW,EAAEA,CAAA,MAAO;IAAEG,MAAM,EAAEV;EAAK,CAAC;AACtC,CAAC;AACM,MAAMa,sBAAsB,GAAAX,OAAA,CAAAW,sBAAA,GACjCC,iBAAoD;AAC/C,MAAMC,mBAAmB,GAAAb,OAAA,CAAAa,mBAAA,GAC9BD,iBAAqD;AAChD,MAAME,mBAAmB,GAAAd,OAAA,CAAAc,mBAAA,GAC9BF,iBAAkD","ignoreList":[]}
|