react-native-keyboard-controller 1.10.0 → 1.10.2

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.
Files changed (144) hide show
  1. package/android/src/main/java/com/reactnativekeyboardcontroller/extensions/EditText.kt +31 -1
  2. package/ios/.clang-format +30 -30
  3. package/ios/.swiftlint.yml +1 -1
  4. package/ios/observers/FocusedInputObserver.swift +1 -0
  5. package/ios/views/KeyboardControllerViewManager.swift +12 -2
  6. package/jest/index.js +14 -4
  7. package/lib/commonjs/animated.js +19 -19
  8. package/lib/commonjs/animated.js.map +1 -1
  9. package/lib/commonjs/bindings.js.map +1 -1
  10. package/lib/commonjs/bindings.native.js +6 -6
  11. package/lib/commonjs/bindings.native.js.map +1 -1
  12. package/lib/commonjs/components/KeyboardAvoidingView/hooks.js +19 -5
  13. package/lib/commonjs/components/KeyboardAvoidingView/hooks.js.map +1 -1
  14. package/lib/commonjs/components/KeyboardAvoidingView/index.js +12 -7
  15. package/lib/commonjs/components/KeyboardAvoidingView/index.js.map +1 -1
  16. package/lib/commonjs/components/KeyboardAwareScrollView/index.js +10 -8
  17. package/lib/commonjs/components/KeyboardAwareScrollView/index.js.map +1 -1
  18. package/lib/commonjs/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js +5 -5
  19. package/lib/commonjs/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js.map +1 -1
  20. package/lib/commonjs/components/KeyboardAwareScrollView/utils.js +2 -2
  21. package/lib/commonjs/components/KeyboardAwareScrollView/utils.js.map +1 -1
  22. package/lib/commonjs/components/KeyboardStickyView/index.js +9 -5
  23. package/lib/commonjs/components/KeyboardStickyView/index.js.map +1 -1
  24. package/lib/commonjs/components/hooks/useKeyboardInterpolation.js +88 -0
  25. package/lib/commonjs/components/hooks/useKeyboardInterpolation.js.map +1 -0
  26. package/lib/commonjs/components/index.js.map +1 -1
  27. package/lib/commonjs/constants.js.map +1 -1
  28. package/lib/commonjs/context.js.map +1 -1
  29. package/lib/commonjs/hooks.js.map +1 -1
  30. package/lib/commonjs/index.js.map +1 -1
  31. package/lib/commonjs/internal.js +1 -1
  32. package/lib/commonjs/internal.js.map +1 -1
  33. package/lib/commonjs/monkey-patch.android.js +1 -1
  34. package/lib/commonjs/monkey-patch.android.js.map +1 -1
  35. package/lib/commonjs/monkey-patch.js.map +1 -1
  36. package/lib/commonjs/reanimated.js.map +1 -1
  37. package/lib/commonjs/reanimated.native.js +12 -12
  38. package/lib/commonjs/reanimated.native.js.map +1 -1
  39. package/lib/commonjs/replicas.js +5 -5
  40. package/lib/commonjs/replicas.js.map +1 -1
  41. package/lib/commonjs/specs/KeyboardControllerViewNativeComponent.js +1 -1
  42. package/lib/commonjs/specs/KeyboardControllerViewNativeComponent.js.map +1 -1
  43. package/lib/commonjs/specs/KeyboardGestureAreaNativeComponent.js +2 -2
  44. package/lib/commonjs/specs/KeyboardGestureAreaNativeComponent.js.map +1 -1
  45. package/lib/commonjs/specs/NativeKeyboardController.js +1 -1
  46. package/lib/commonjs/specs/NativeKeyboardController.js.map +1 -1
  47. package/lib/commonjs/specs/NativeStatusBarManagerCompat.js +1 -1
  48. package/lib/commonjs/specs/NativeStatusBarManagerCompat.js.map +1 -1
  49. package/lib/commonjs/types.js.map +1 -1
  50. package/lib/commonjs/utils.js.map +1 -1
  51. package/lib/module/animated.js +27 -27
  52. package/lib/module/animated.js.map +1 -1
  53. package/lib/module/bindings.js +1 -1
  54. package/lib/module/bindings.js.map +1 -1
  55. package/lib/module/bindings.native.js +7 -7
  56. package/lib/module/bindings.native.js.map +1 -1
  57. package/lib/module/components/KeyboardAvoidingView/hooks.js +19 -5
  58. package/lib/module/components/KeyboardAvoidingView/hooks.js.map +1 -1
  59. package/lib/module/components/KeyboardAvoidingView/index.js +15 -11
  60. package/lib/module/components/KeyboardAvoidingView/index.js.map +1 -1
  61. package/lib/module/components/KeyboardAwareScrollView/index.js +16 -14
  62. package/lib/module/components/KeyboardAwareScrollView/index.js.map +1 -1
  63. package/lib/module/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js +8 -8
  64. package/lib/module/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js.map +1 -1
  65. package/lib/module/components/KeyboardAwareScrollView/utils.js +2 -2
  66. package/lib/module/components/KeyboardAwareScrollView/utils.js.map +1 -1
  67. package/lib/module/components/KeyboardStickyView/index.js +9 -6
  68. package/lib/module/components/KeyboardStickyView/index.js.map +1 -1
  69. package/lib/module/components/hooks/useKeyboardInterpolation.js +81 -0
  70. package/lib/module/components/hooks/useKeyboardInterpolation.js.map +1 -0
  71. package/lib/module/components/index.js +3 -3
  72. package/lib/module/components/index.js.map +1 -1
  73. package/lib/module/context.js +2 -2
  74. package/lib/module/context.js.map +1 -1
  75. package/lib/module/hooks.js +5 -5
  76. package/lib/module/hooks.js.map +1 -1
  77. package/lib/module/index.js +8 -8
  78. package/lib/module/index.js.map +1 -1
  79. package/lib/module/internal.js +4 -4
  80. package/lib/module/internal.js.map +1 -1
  81. package/lib/module/monkey-patch.android.js +2 -2
  82. package/lib/module/monkey-patch.android.js.map +1 -1
  83. package/lib/module/monkey-patch.js.map +1 -1
  84. package/lib/module/reanimated.js.map +1 -1
  85. package/lib/module/reanimated.native.js +13 -13
  86. package/lib/module/reanimated.native.js.map +1 -1
  87. package/lib/module/replicas.js +11 -11
  88. package/lib/module/replicas.js.map +1 -1
  89. package/lib/module/specs/KeyboardControllerViewNativeComponent.js +2 -2
  90. package/lib/module/specs/KeyboardControllerViewNativeComponent.js.map +1 -1
  91. package/lib/module/specs/KeyboardGestureAreaNativeComponent.js +3 -3
  92. package/lib/module/specs/KeyboardGestureAreaNativeComponent.js.map +1 -1
  93. package/lib/module/specs/NativeKeyboardController.js +2 -2
  94. package/lib/module/specs/NativeKeyboardController.js.map +1 -1
  95. package/lib/module/specs/NativeStatusBarManagerCompat.js +2 -2
  96. package/lib/module/specs/NativeStatusBarManagerCompat.js.map +1 -1
  97. package/lib/module/types.js.map +1 -1
  98. package/lib/module/utils.js.map +1 -1
  99. package/lib/typescript/animated.d.ts +1 -1
  100. package/lib/typescript/bindings.d.ts +1 -1
  101. package/lib/typescript/bindings.native.d.ts +1 -1
  102. package/lib/typescript/components/KeyboardAvoidingView/index.d.ts +4 -4
  103. package/lib/typescript/components/KeyboardAwareScrollView/index.d.ts +2 -2
  104. package/lib/typescript/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.d.ts +1 -1
  105. package/lib/typescript/components/KeyboardStickyView/index.d.ts +2 -2
  106. package/lib/typescript/components/hooks/useKeyboardInterpolation.d.ts +20 -0
  107. package/lib/typescript/components/index.d.ts +3 -3
  108. package/lib/typescript/context.d.ts +4 -4
  109. package/lib/typescript/hooks.d.ts +3 -3
  110. package/lib/typescript/index.d.ts +8 -8
  111. package/lib/typescript/internal.d.ts +2 -2
  112. package/lib/typescript/reanimated.d.ts +1 -1
  113. package/lib/typescript/reanimated.native.d.ts +1 -1
  114. package/lib/typescript/replicas.d.ts +1 -1
  115. package/lib/typescript/specs/KeyboardControllerViewNativeComponent.d.ts +3 -3
  116. package/lib/typescript/specs/KeyboardGestureAreaNativeComponent.d.ts +4 -4
  117. package/lib/typescript/specs/NativeKeyboardController.d.ts +1 -1
  118. package/lib/typescript/specs/NativeStatusBarManagerCompat.d.ts +1 -1
  119. package/lib/typescript/types.d.ts +3 -3
  120. package/package.json +8 -10
  121. package/src/animated.tsx +39 -39
  122. package/src/bindings.native.ts +11 -11
  123. package/src/bindings.ts +3 -3
  124. package/src/components/KeyboardAvoidingView/hooks.ts +20 -6
  125. package/src/components/KeyboardAvoidingView/index.tsx +25 -24
  126. package/src/components/KeyboardAwareScrollView/index.tsx +29 -25
  127. package/src/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.ts +13 -13
  128. package/src/components/KeyboardAwareScrollView/utils.ts +3 -3
  129. package/src/components/KeyboardStickyView/index.tsx +12 -12
  130. package/src/components/hooks/useKeyboardInterpolation.ts +108 -0
  131. package/src/components/index.ts +3 -3
  132. package/src/context.ts +7 -7
  133. package/src/hooks.ts +12 -12
  134. package/src/index.ts +8 -8
  135. package/src/internal.ts +9 -9
  136. package/src/monkey-patch.android.ts +2 -2
  137. package/src/reanimated.native.ts +20 -20
  138. package/src/reanimated.ts +1 -1
  139. package/src/replicas.ts +16 -16
  140. package/src/specs/KeyboardControllerViewNativeComponent.ts +5 -5
  141. package/src/specs/KeyboardGestureAreaNativeComponent.ts +7 -7
  142. package/src/specs/NativeKeyboardController.ts +3 -3
  143. package/src/specs/NativeStatusBarManagerCompat.ts +3 -3
  144. package/src/types.ts +21 -21
@@ -2,7 +2,10 @@ package com.reactnativekeyboardcontroller.extensions
2
2
 
3
3
  import android.text.Editable
4
4
  import android.text.TextWatcher
5
+ import android.util.Log
5
6
  import android.widget.EditText
7
+ import com.facebook.react.views.textinput.ReactEditText
8
+ import java.lang.reflect.Field
6
9
 
7
10
  /**
8
11
  * Adds a listener that will be fired only once for each unique value.
@@ -30,7 +33,34 @@ fun EditText.addOnTextChangedListener(action: (String) -> Unit): TextWatcher {
30
33
  }
31
34
  }
32
35
 
33
- addTextChangedListener(listener)
36
+ // we can not simply call `addTextChangedListener(listener)`, because the issue
37
+ // https://github.com/kirillzyusko/react-native-keyboard-controller/issues/324
38
+ // will be reproducible again.
39
+ //
40
+ // so here we push our listener to first position to avoid the soft crash
41
+ try {
42
+ val clazz: Class<*> = ReactEditText::class.java
43
+ val field: Field = clazz.getDeclaredField("mListeners")
44
+ field.isAccessible = true
45
+ val fieldValue = field[this]
46
+ val listeners = fieldValue as? ArrayList<*>
47
+
48
+ if (listeners != null && listeners.all { it is TextWatcher }) {
49
+ // fieldValue is an ArrayList<TextWatch>
50
+ val textWatchListeners = listeners as ArrayList<TextWatcher>
51
+
52
+ textWatchListeners.add(0, listener)
53
+ } else {
54
+ Log.w(
55
+ javaClass.simpleName,
56
+ "Can not attach listener because `fieldValue` does not belong to `ArrayList<TextWatcher>`",
57
+ )
58
+ }
59
+ } catch (e: ClassCastException) {
60
+ Log.w(javaClass.simpleName, "Can not attach listener because casting failed: ${e.message}")
61
+ } catch (e: NoSuchFieldException) {
62
+ Log.w(javaClass.simpleName, "Can not attach listener because field `mListeners` not found: ${e.message}")
63
+ }
34
64
 
35
65
  return listener
36
66
  }
package/ios/.clang-format CHANGED
@@ -4,7 +4,7 @@ AlignAfterOpenBracket: AlwaysBreak
4
4
  AlignConsecutiveAssignments: false
5
5
  AlignConsecutiveDeclarations: false
6
6
  AlignEscapedNewlinesLeft: true
7
- AlignOperands: false
7
+ AlignOperands: false
8
8
  AlignTrailingComments: false
9
9
  AllowAllParametersOfDeclarationOnNextLine: false
10
10
  AllowShortBlocksOnASingleLine: false
@@ -18,45 +18,45 @@ AlwaysBreakTemplateDeclarations: true
18
18
  BinPackArguments: false
19
19
  BinPackParameters: false
20
20
  BraceWrapping:
21
- AfterClass: false
21
+ AfterClass: false
22
22
  AfterControlStatement: false
23
- AfterEnum: false
24
- AfterFunction: false
25
- AfterNamespace: false
23
+ AfterEnum: false
24
+ AfterFunction: false
25
+ AfterNamespace: false
26
26
  AfterObjCDeclaration: false
27
- AfterStruct: false
28
- AfterUnion: false
29
- BeforeCatch: false
30
- BeforeElse: false
31
- IndentBraces: false
27
+ AfterStruct: false
28
+ AfterUnion: false
29
+ BeforeCatch: false
30
+ BeforeElse: false
31
+ IndentBraces: false
32
32
  BreakBeforeBinaryOperators: None
33
33
  BreakBeforeBraces: Attach
34
34
  BreakBeforeTernaryOperators: true
35
35
  BreakConstructorInitializersBeforeComma: false
36
36
  BreakAfterJavaFieldAnnotations: false
37
37
  BreakStringLiterals: false
38
- ColumnLimit: 80
39
- CommentPragmas: '^ IWYU pragma:'
38
+ ColumnLimit: 80
39
+ CommentPragmas: "^ IWYU pragma:"
40
40
  ConstructorInitializerAllOnOneLineOrOnePerLine: true
41
41
  ConstructorInitializerIndentWidth: 4
42
42
  ContinuationIndentWidth: 4
43
43
  Cpp11BracedListStyle: true
44
44
  DerivePointerAlignment: false
45
- DisableFormat: false
46
- ForEachMacros: [ FOR_EACH_RANGE, FOR_EACH, ]
45
+ DisableFormat: false
46
+ ForEachMacros: [FOR_EACH_RANGE, FOR_EACH]
47
47
  IncludeCategories:
48
- - Regex: '^<.*\.h(pp)?>'
49
- Priority: 1
50
- - Regex: '^<.*'
51
- Priority: 2
52
- - Regex: '.*'
53
- Priority: 3
48
+ - Regex: '^<.*\.h(pp)?>'
49
+ Priority: 1
50
+ - Regex: "^<.*"
51
+ Priority: 2
52
+ - Regex: ".*"
53
+ Priority: 3
54
54
  IndentCaseLabels: true
55
- IndentWidth: 2
55
+ IndentWidth: 2
56
56
  IndentWrappedFunctionNames: false
57
57
  KeepEmptyLinesAtTheStartOfBlocks: false
58
- MacroBlockBegin: ''
59
- MacroBlockEnd: ''
58
+ MacroBlockBegin: ""
59
+ MacroBlockEnd: ""
60
60
  MaxEmptyLinesToKeep: 1
61
61
  NamespaceIndentation: None
62
62
  ObjCBlockIndentWidth: 2
@@ -69,22 +69,22 @@ PenaltyBreakString: 1000
69
69
  PenaltyExcessCharacter: 1000000
70
70
  PenaltyReturnTypeOnItsOwnLine: 200
71
71
  PointerAlignment: Right
72
- ReflowComments: true
73
- SortIncludes: true
72
+ ReflowComments: true
73
+ SortIncludes: true
74
74
  SpaceAfterCStyleCast: false
75
75
  SpaceBeforeAssignmentOperators: true
76
76
  SpaceBeforeParens: ControlStatements
77
77
  SpaceInEmptyParentheses: false
78
78
  SpacesBeforeTrailingComments: 1
79
- SpacesInAngles: false
79
+ SpacesInAngles: false
80
80
  SpacesInContainerLiterals: true
81
81
  SpacesInCStyleCastParentheses: false
82
82
  SpacesInParentheses: false
83
83
  SpacesInSquareBrackets: false
84
- Standard: Cpp11
85
- TabWidth: 8
86
- UseTab: Never
84
+ Standard: Cpp11
85
+ TabWidth: 8
86
+ UseTab: Never
87
87
  ---
88
88
  Language: ObjC
89
- ColumnLimit: 100
89
+ ColumnLimit: 100
90
90
  BreakBeforeBraces: WebKit
@@ -7,4 +7,4 @@ line_length:
7
7
  ignores_urls: true
8
8
 
9
9
  excluded:
10
- - Pods
10
+ - Pods
@@ -79,6 +79,7 @@ public class FocusedInputObserver: NSObject {
79
79
 
80
80
  @objc func keyboardWillHide(_: Notification) {
81
81
  removeObservers()
82
+ currentInput = nil
82
83
  dispatchEventToJS(data: noFocusedInputEvent)
83
84
  }
84
85
 
@@ -39,8 +39,18 @@ class KeyboardControllerView: UIView {
39
39
  self.bridge = bridge
40
40
  eventDispatcher = bridge.eventDispatcher()
41
41
  super.init(frame: frame)
42
- inputObserver = FocusedInputObserver(onLayoutChangedHandler: onLayoutChanged, onTextChangedHandler: onTextChanged)
43
- keyboardObserver = KeyboardMovementObserver(handler: onEvent, onNotify: onNotify)
42
+ inputObserver = FocusedInputObserver(
43
+ onLayoutChangedHandler: { [weak self] event in self?.onLayoutChanged(event: event) },
44
+ onTextChangedHandler: { [weak self] text in self?.onTextChanged(text: text) }
45
+ )
46
+ keyboardObserver = KeyboardMovementObserver(
47
+ handler: { [weak self] event, height, progress, duration, target in
48
+ self?.onEvent(event: event, height: height, progress: progress, duration: duration, target: target)
49
+ },
50
+ onNotify: { [weak self] event, data in
51
+ self?.onNotify(event: event, data: data)
52
+ }
53
+ )
44
54
  }
45
55
 
46
56
  @available(*, unavailable)
package/jest/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Animated } from 'react-native';
1
+ import { Animated, ScrollView, View } from "react-native";
2
2
 
3
3
  const values = {
4
4
  animated: {
@@ -28,13 +28,19 @@ const focusedInput = {
28
28
 
29
29
  const mock = {
30
30
  // hooks
31
+ /// keyboard
31
32
  useKeyboardAnimation: jest.fn().mockReturnValue(values.animated),
32
33
  useReanimatedKeyboardAnimation: jest.fn().mockReturnValue(values.reanimated),
33
34
  useResizeMode: jest.fn(),
34
35
  useGenericKeyboardHandler: jest.fn(),
35
36
  useKeyboardHandler: jest.fn(),
37
+ /// input
36
38
  useReanimatedFocusedInput: jest.fn().mockReturnValue(focusedInput),
37
39
  useFocusedInputHandler: jest.fn(),
40
+ /// module
41
+ useKeyboardController: jest
42
+ .fn()
43
+ .mockReturnValue({ setEnabled: jest.fn(), enabled: true }),
38
44
  // modules
39
45
  KeyboardController: {
40
46
  setInputMode: jest.fn(),
@@ -45,10 +51,14 @@ const mock = {
45
51
  addListener: jest.fn(() => ({ remove: jest.fn() })),
46
52
  },
47
53
  // views
48
- KeyboardControllerView: 'KeyboardControllerView',
49
- KeyboardGestureArea: 'KeyboardGestureArea',
54
+ KeyboardControllerView: "KeyboardControllerView",
55
+ KeyboardGestureArea: "KeyboardGestureArea",
50
56
  // providers
51
- KeyboardProvider: 'KeyboardProvider',
57
+ KeyboardProvider: "KeyboardProvider",
58
+ // components
59
+ KeyboardStickyView: View,
60
+ KeyboardAvoidingView: View,
61
+ KeyboardAwareScrollView: ScrollView,
52
62
  };
53
63
 
54
64
  module.exports = mock;
@@ -20,8 +20,8 @@ const styles = _reactNative.StyleSheet.create({
20
20
  flex: 1
21
21
  },
22
22
  hidden: {
23
- display: 'none',
24
- position: 'absolute'
23
+ display: "none",
24
+ position: "absolute"
25
25
  }
26
26
  });
27
27
  const KeyboardProvider = _ref => {
@@ -75,7 +75,7 @@ const KeyboardProvider = _ref => {
75
75
  }), []);
76
76
  // handlers
77
77
  const updateSharedValues = (event, platforms) => {
78
- 'worklet';
78
+ "worklet";
79
79
 
80
80
  if (platforms.includes(_reactNative.Platform.OS)) {
81
81
  progressSV.value = event.progress;
@@ -84,32 +84,32 @@ const KeyboardProvider = _ref => {
84
84
  };
85
85
  const keyboardHandler = (0, _reanimated.useAnimatedKeyboardHandler)({
86
86
  onKeyboardMoveStart: event => {
87
- 'worklet';
87
+ "worklet";
88
88
 
89
- broadcastKeyboardEvents('onStart', event);
90
- updateSharedValues(event, ['ios']);
89
+ broadcastKeyboardEvents("onStart", event);
90
+ updateSharedValues(event, ["ios"]);
91
91
  },
92
92
  onKeyboardMove: event => {
93
- 'worklet';
93
+ "worklet";
94
94
 
95
- broadcastKeyboardEvents('onMove', event);
96
- updateSharedValues(event, ['android']);
95
+ broadcastKeyboardEvents("onMove", event);
96
+ updateSharedValues(event, ["android"]);
97
97
  },
98
98
  onKeyboardMoveEnd: event => {
99
- 'worklet';
99
+ "worklet";
100
100
 
101
- broadcastKeyboardEvents('onEnd', event);
101
+ broadcastKeyboardEvents("onEnd", event);
102
102
  },
103
103
  onKeyboardMoveInteractive: event => {
104
- 'worklet';
104
+ "worklet";
105
105
 
106
- updateSharedValues(event, ['android', 'ios']);
107
- broadcastKeyboardEvents('onInteractive', event);
106
+ updateSharedValues(event, ["android", "ios"]);
107
+ broadcastKeyboardEvents("onInteractive", event);
108
108
  }
109
109
  }, []);
110
110
  const inputLayoutHandler = (0, _reanimated.useFocusedInputLayoutHandler)({
111
111
  onFocusedInputLayoutChanged: e => {
112
- 'worklet';
112
+ "worklet";
113
113
 
114
114
  if (e.target !== -1) {
115
115
  layout.value = e;
@@ -120,9 +120,9 @@ const KeyboardProvider = _ref => {
120
120
  }, []);
121
121
  const inputTextHandler = (0, _reanimated.useFocusedInputTextHandler)({
122
122
  onFocusedInputTextChanged: e => {
123
- 'worklet';
123
+ "worklet";
124
124
 
125
- broadcastInputEvents('onChangeText', e);
125
+ broadcastInputEvents("onChangeText", e);
126
126
  }
127
127
  }, []);
128
128
  // effects
@@ -138,8 +138,8 @@ const KeyboardProvider = _ref => {
138
138
  }, /*#__PURE__*/_react.default.createElement(KeyboardControllerViewAnimated, {
139
139
  enabled: enabled,
140
140
  onKeyboardMoveReanimated: keyboardHandler,
141
- onKeyboardMoveStart: _reactNative.Platform.OS === 'ios' ? onKeyboardMove : undefined,
142
- onKeyboardMove: _reactNative.Platform.OS === 'android' ? onKeyboardMove : undefined,
141
+ onKeyboardMoveStart: _reactNative.Platform.OS === "ios" ? onKeyboardMove : undefined,
142
+ onKeyboardMove: _reactNative.Platform.OS === "android" ? onKeyboardMove : undefined,
143
143
  onKeyboardMoveInteractive: onKeyboardMove,
144
144
  onFocusedInputLayoutChangedReanimated: inputLayoutHandler,
145
145
  onFocusedInputTextChangedReanimated: inputTextHandler,
@@ -1 +1 @@
1
- {"version":3,"names":["KeyboardControllerViewAnimated","Reanimated","createAnimatedComponent","Animated","KeyboardControllerView","styles","StyleSheet","create","container","flex","hidden","display","position","KeyboardProvider","children","statusBarTranslucent","navigationBarTranslucent","enabled","initiallyEnabled","setEnabled","useState","progress","useAnimatedValue","height","progressSV","useSharedValue","heightSV","layout","setKeyboardHandlers","broadcastKeyboardEvents","useSharedHandlers","setInputHandlers","broadcastInputEvents","context","useMemo","animated","multiply","reanimated","style","transform","translateX","translateY","onKeyboardMove","event","nativeEvent","useNativeDriver","updateSharedValues","platforms","includes","Platform","OS","value","keyboardHandler","useAnimatedKeyboardHandler","onKeyboardMoveStart","onKeyboardMoveEnd","onKeyboardMoveInteractive","inputLayoutHandler","useFocusedInputLayoutHandler","onFocusedInputLayoutChanged","e","target","inputTextHandler","useFocusedInputTextHandler","onFocusedInputTextChanged","useEffect","applyMonkeyPatch","revertMonkeyPatch","undefined"],"sources":["animated.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useState } from 'react';\nimport { Animated, Platform, StyleSheet } from 'react-native';\nimport Reanimated, { useSharedValue } from 'react-native-reanimated';\n\nimport { KeyboardControllerView } from './bindings';\nimport { KeyboardContext } from './context';\nimport { useAnimatedValue, useSharedHandlers } from './internal';\nimport { applyMonkeyPatch, revertMonkeyPatch } from './monkey-patch';\nimport {\n useAnimatedKeyboardHandler,\n useFocusedInputLayoutHandler,\n useFocusedInputTextHandler,\n} from './reanimated';\n\nimport type { KeyboardAnimationContext } from './context';\nimport type {\n FocusedInputHandler,\n FocusedInputLayoutChangedEvent,\n KeyboardControllerProps,\n KeyboardHandler,\n NativeEvent,\n} from './types';\nimport type { ViewStyle } from 'react-native';\n\nconst KeyboardControllerViewAnimated = Reanimated.createAnimatedComponent(\n Animated.createAnimatedComponent(\n KeyboardControllerView\n ) as React.FC<KeyboardControllerProps>\n);\n\ntype Styles = {\n container: ViewStyle;\n hidden: ViewStyle;\n};\n\nconst styles = StyleSheet.create<Styles>({\n container: {\n flex: 1,\n },\n hidden: {\n display: 'none',\n position: 'absolute',\n },\n});\n\ntype KeyboardProviderProps = {\n children: React.ReactNode;\n /**\n * Set the value to `true`, if you use translucent status bar on Android.\n * If you already control status bar translucency via `react-native-screens`\n * or `StatusBar` component from `react-native`, you can ignore it.\n * Defaults to `false`.\n *\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/14\n * @platform android\n */\n statusBarTranslucent?: boolean;\n /**\n * Set the value to `true`, if you use translucent navigation bar on Android.\n * Defaults to `false`.\n *\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/119\n * @platform android\n */\n navigationBarTranslucent?: boolean;\n /**\n * A boolean prop indicating whether the module is enabled. It indicate only initial state,\n * i. e. if you try to change this prop after component mount it will not have any effect.\n * To change the property in runtime use `useKeyboardController` hook and `setEnabled` method.\n * Defaults to `true`.\n */\n enabled?: boolean;\n};\n\nexport const KeyboardProvider = ({\n children,\n statusBarTranslucent,\n navigationBarTranslucent,\n enabled: initiallyEnabled = true,\n}: KeyboardProviderProps) => {\n // state\n const [enabled, setEnabled] = useState(initiallyEnabled);\n // animated values\n const progress = useAnimatedValue(0);\n const height = useAnimatedValue(0);\n // shared values\n const progressSV = useSharedValue(0);\n const heightSV = useSharedValue(0);\n const layout = useSharedValue<FocusedInputLayoutChangedEvent | null>(null);\n const [setKeyboardHandlers, broadcastKeyboardEvents] =\n useSharedHandlers<KeyboardHandler>();\n const [setInputHandlers, broadcastInputEvents] =\n useSharedHandlers<FocusedInputHandler>();\n // memo\n const context = useMemo<KeyboardAnimationContext>(\n () => ({\n enabled,\n animated: { progress: progress, height: Animated.multiply(height, -1) },\n reanimated: { progress: progressSV, height: heightSV },\n layout,\n setKeyboardHandlers,\n setInputHandlers,\n setEnabled,\n }),\n [enabled]\n );\n const style = useMemo(\n () => [\n styles.hidden,\n { transform: [{ translateX: height }, { translateY: progress }] },\n ],\n []\n );\n const onKeyboardMove = useMemo(\n () =>\n Animated.event(\n [\n {\n nativeEvent: {\n progress,\n height,\n },\n },\n ],\n { useNativeDriver: true }\n ),\n []\n );\n // handlers\n const updateSharedValues = (event: NativeEvent, platforms: string[]) => {\n 'worklet';\n\n if (platforms.includes(Platform.OS)) {\n progressSV.value = event.progress;\n heightSV.value = -event.height;\n }\n };\n const keyboardHandler = useAnimatedKeyboardHandler(\n {\n onKeyboardMoveStart: (event: NativeEvent) => {\n 'worklet';\n\n broadcastKeyboardEvents('onStart', event);\n updateSharedValues(event, ['ios']);\n },\n onKeyboardMove: (event: NativeEvent) => {\n 'worklet';\n\n broadcastKeyboardEvents('onMove', event);\n updateSharedValues(event, ['android']);\n },\n onKeyboardMoveEnd: (event: NativeEvent) => {\n 'worklet';\n\n broadcastKeyboardEvents('onEnd', event);\n },\n onKeyboardMoveInteractive: (event: NativeEvent) => {\n 'worklet';\n\n updateSharedValues(event, ['android', 'ios']);\n broadcastKeyboardEvents('onInteractive', event);\n },\n },\n []\n );\n const inputLayoutHandler = useFocusedInputLayoutHandler(\n {\n onFocusedInputLayoutChanged: (e) => {\n 'worklet';\n\n if (e.target !== -1) {\n layout.value = e;\n } else {\n layout.value = null;\n }\n },\n },\n []\n );\n const inputTextHandler = useFocusedInputTextHandler(\n {\n onFocusedInputTextChanged: (e) => {\n 'worklet';\n\n broadcastInputEvents('onChangeText', e);\n },\n },\n []\n );\n // effects\n useEffect(() => {\n if (enabled) {\n applyMonkeyPatch();\n } else {\n revertMonkeyPatch();\n }\n }, [enabled]);\n\n return (\n <KeyboardContext.Provider value={context}>\n <KeyboardControllerViewAnimated\n enabled={enabled}\n onKeyboardMoveReanimated={keyboardHandler}\n onKeyboardMoveStart={Platform.OS === 'ios' ? onKeyboardMove : undefined}\n onKeyboardMove={Platform.OS === 'android' ? onKeyboardMove : undefined}\n onKeyboardMoveInteractive={onKeyboardMove}\n onFocusedInputLayoutChangedReanimated={inputLayoutHandler}\n onFocusedInputTextChangedReanimated={inputTextHandler}\n navigationBarTranslucent={navigationBarTranslucent}\n statusBarTranslucent={statusBarTranslucent}\n style={styles.container}\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;AACA;AAEA;AACA;AACA;AACA;AACA;AAIsB;AAAA;AAYtB,MAAMA,8BAA8B,GAAGC,8BAAU,CAACC,uBAAuB,CACvEC,qBAAQ,CAACD,uBAAuB,CAC9BE,gCAAsB,CACvB,CACF;AAOD,MAAMC,MAAM,GAAGC,uBAAU,CAACC,MAAM,CAAS;EACvCC,SAAS,EAAE;IACTC,IAAI,EAAE;EACR,CAAC;EACDC,MAAM,EAAE;IACNC,OAAO,EAAE,MAAM;IACfC,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC;AA+BK,MAAMC,gBAAgB,GAAG,QAKH;EAAA,IALI;IAC/BC,QAAQ;IACRC,oBAAoB;IACpBC,wBAAwB;IACxBC,OAAO,EAAEC,gBAAgB,GAAG;EACP,CAAC;EACtB;EACA,MAAM,CAACD,OAAO,EAAEE,UAAU,CAAC,GAAG,IAAAC,eAAQ,EAACF,gBAAgB,CAAC;EACxD;EACA,MAAMG,QAAQ,GAAG,IAAAC,0BAAgB,EAAC,CAAC,CAAC;EACpC,MAAMC,MAAM,GAAG,IAAAD,0BAAgB,EAAC,CAAC,CAAC;EAClC;EACA,MAAME,UAAU,GAAG,IAAAC,qCAAc,EAAC,CAAC,CAAC;EACpC,MAAMC,QAAQ,GAAG,IAAAD,qCAAc,EAAC,CAAC,CAAC;EAClC,MAAME,MAAM,GAAG,IAAAF,qCAAc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ACX,IAAAiD,6BAAgB,GAAE;IACpB,CAAC,MAAM;MACL,IAAAC,8BAAiB,GAAE;IACrB;EACF,CAAC,EAAE,CAAClD,OAAO,CAAC,CAAC;EAEb,oBACE,6BAAC,wBAAe,CAAC,QAAQ;IAAC,KAAK,EAAEgB;EAAQ,gBACvC,6BAAC,8BAA8B;IAC7B,OAAO,EAAEhB,OAAQ;IACjB,wBAAwB,EAAEmC,eAAgB;IAC1C,mBAAmB,EAAEH,qBAAQ,CAACC,EAAE,KAAK,KAAK,GAAGR,cAAc,GAAG0B,SAAU;IACxE,cAAc,EAAEnB,qBAAQ,CAACC,EAAE,KAAK,SAAS,GAAGR,cAAc,GAAG0B,SAAU;IACvE,yBAAyB,EAAE1B,cAAe;IAC1C,qCAAqC,EAAEe,kBAAmB;IAC1D,mCAAmC,EAAEK,gBAAiB;IACtD,wBAAwB,EAAE9C,wBAAyB;IACnD,oBAAoB,EAAED,oBAAqB;IAC3C,KAAK,EAAEV,MAAM,CAACG;EAAU,GAEvBM,QAAQ,CACsB,eACjC,6BAAC,qBAAQ,CAAC,IAAI;IACZ;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,KAAK,EAAEwB;EAAM,EACb,CACuB;AAE/B,CAAC;AAAC"}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeReanimated","_bindings","_context","_internal","_monkeyPatch","_reanimated","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","KeyboardControllerViewAnimated","Reanimated","createAnimatedComponent","Animated","KeyboardControllerView","styles","StyleSheet","create","container","flex","hidden","display","position","KeyboardProvider","_ref","children","statusBarTranslucent","navigationBarTranslucent","enabled","initiallyEnabled","setEnabled","useState","progress","useAnimatedValue","height","progressSV","useSharedValue","heightSV","layout","setKeyboardHandlers","broadcastKeyboardEvents","useSharedHandlers","setInputHandlers","broadcastInputEvents","context","useMemo","animated","multiply","reanimated","style","transform","translateX","translateY","onKeyboardMove","event","nativeEvent","useNativeDriver","updateSharedValues","platforms","includes","Platform","OS","value","keyboardHandler","useAnimatedKeyboardHandler","onKeyboardMoveStart","onKeyboardMoveEnd","onKeyboardMoveInteractive","inputLayoutHandler","useFocusedInputLayoutHandler","onFocusedInputLayoutChanged","e","target","inputTextHandler","useFocusedInputTextHandler","onFocusedInputTextChanged","useEffect","applyMonkeyPatch","revertMonkeyPatch","createElement","KeyboardContext","Provider","onKeyboardMoveReanimated","undefined","onFocusedInputLayoutChangedReanimated","onFocusedInputTextChangedReanimated","View","exports"],"sources":["animated.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useState } from \"react\";\nimport { Animated, Platform, StyleSheet } from \"react-native\";\nimport Reanimated, { useSharedValue } from \"react-native-reanimated\";\n\nimport { KeyboardControllerView } from \"./bindings\";\nimport { KeyboardContext } from \"./context\";\nimport { useAnimatedValue, useSharedHandlers } from \"./internal\";\nimport { applyMonkeyPatch, revertMonkeyPatch } from \"./monkey-patch\";\nimport {\n useAnimatedKeyboardHandler,\n useFocusedInputLayoutHandler,\n useFocusedInputTextHandler,\n} from \"./reanimated\";\n\nimport type { KeyboardAnimationContext } from \"./context\";\nimport type {\n FocusedInputHandler,\n FocusedInputLayoutChangedEvent,\n KeyboardControllerProps,\n KeyboardHandler,\n NativeEvent,\n} from \"./types\";\nimport type { ViewStyle } from \"react-native\";\n\nconst KeyboardControllerViewAnimated = Reanimated.createAnimatedComponent(\n Animated.createAnimatedComponent(\n KeyboardControllerView,\n ) as React.FC<KeyboardControllerProps>,\n);\n\ntype Styles = {\n container: ViewStyle;\n hidden: ViewStyle;\n};\n\nconst styles = StyleSheet.create<Styles>({\n container: {\n flex: 1,\n },\n hidden: {\n display: \"none\",\n position: \"absolute\",\n },\n});\n\ntype KeyboardProviderProps = {\n children: React.ReactNode;\n /**\n * Set the value to `true`, if you use translucent status bar on Android.\n * If you already control status bar translucency via `react-native-screens`\n * or `StatusBar` component from `react-native`, you can ignore it.\n * Defaults to `false`.\n *\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/14\n * @platform android\n */\n statusBarTranslucent?: boolean;\n /**\n * Set the value to `true`, if you use translucent navigation bar on Android.\n * Defaults to `false`.\n *\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/119\n * @platform android\n */\n navigationBarTranslucent?: boolean;\n /**\n * A boolean prop indicating whether the module is enabled. It indicate only initial state,\n * i. e. if you try to change this prop after component mount it will not have any effect.\n * To change the property in runtime use `useKeyboardController` hook and `setEnabled` method.\n * Defaults to `true`.\n */\n enabled?: boolean;\n};\n\nexport const KeyboardProvider = ({\n children,\n statusBarTranslucent,\n navigationBarTranslucent,\n enabled: initiallyEnabled = true,\n}: KeyboardProviderProps) => {\n // state\n const [enabled, setEnabled] = useState(initiallyEnabled);\n // animated values\n const progress = useAnimatedValue(0);\n const height = useAnimatedValue(0);\n // shared values\n const progressSV = useSharedValue(0);\n const heightSV = useSharedValue(0);\n const layout = useSharedValue<FocusedInputLayoutChangedEvent | null>(null);\n const [setKeyboardHandlers, broadcastKeyboardEvents] =\n useSharedHandlers<KeyboardHandler>();\n const [setInputHandlers, broadcastInputEvents] =\n useSharedHandlers<FocusedInputHandler>();\n // memo\n const context = useMemo<KeyboardAnimationContext>(\n () => ({\n enabled,\n animated: { progress: progress, height: Animated.multiply(height, -1) },\n reanimated: { progress: progressSV, height: heightSV },\n layout,\n setKeyboardHandlers,\n setInputHandlers,\n setEnabled,\n }),\n [enabled],\n );\n const style = useMemo(\n () => [\n styles.hidden,\n { transform: [{ translateX: height }, { translateY: progress }] },\n ],\n [],\n );\n const onKeyboardMove = useMemo(\n () =>\n Animated.event(\n [\n {\n nativeEvent: {\n progress,\n height,\n },\n },\n ],\n { useNativeDriver: true },\n ),\n [],\n );\n // handlers\n const updateSharedValues = (event: NativeEvent, platforms: string[]) => {\n \"worklet\";\n\n if (platforms.includes(Platform.OS)) {\n progressSV.value = event.progress;\n heightSV.value = -event.height;\n }\n };\n const keyboardHandler = useAnimatedKeyboardHandler(\n {\n onKeyboardMoveStart: (event: NativeEvent) => {\n \"worklet\";\n\n broadcastKeyboardEvents(\"onStart\", event);\n updateSharedValues(event, [\"ios\"]);\n },\n onKeyboardMove: (event: NativeEvent) => {\n \"worklet\";\n\n broadcastKeyboardEvents(\"onMove\", event);\n updateSharedValues(event, [\"android\"]);\n },\n onKeyboardMoveEnd: (event: NativeEvent) => {\n \"worklet\";\n\n broadcastKeyboardEvents(\"onEnd\", event);\n },\n onKeyboardMoveInteractive: (event: NativeEvent) => {\n \"worklet\";\n\n updateSharedValues(event, [\"android\", \"ios\"]);\n broadcastKeyboardEvents(\"onInteractive\", event);\n },\n },\n [],\n );\n const inputLayoutHandler = useFocusedInputLayoutHandler(\n {\n onFocusedInputLayoutChanged: (e) => {\n \"worklet\";\n\n if (e.target !== -1) {\n layout.value = e;\n } else {\n layout.value = null;\n }\n },\n },\n [],\n );\n const inputTextHandler = useFocusedInputTextHandler(\n {\n onFocusedInputTextChanged: (e) => {\n \"worklet\";\n\n broadcastInputEvents(\"onChangeText\", e);\n },\n },\n [],\n );\n // effects\n useEffect(() => {\n if (enabled) {\n applyMonkeyPatch();\n } else {\n revertMonkeyPatch();\n }\n }, [enabled]);\n\n return (\n <KeyboardContext.Provider value={context}>\n <KeyboardControllerViewAnimated\n enabled={enabled}\n onKeyboardMoveReanimated={keyboardHandler}\n onKeyboardMoveStart={Platform.OS === \"ios\" ? onKeyboardMove : undefined}\n onKeyboardMove={Platform.OS === \"android\" ? onKeyboardMove : undefined}\n onKeyboardMoveInteractive={onKeyboardMove}\n onFocusedInputLayoutChangedReanimated={inputLayoutHandler}\n onFocusedInputTextChangedReanimated={inputTextHandler}\n navigationBarTranslucent={navigationBarTranslucent}\n statusBarTranslucent={statusBarTranslucent}\n style={styles.container}\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,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,sBAAA,GAAAH,uBAAA,CAAAC,OAAA;AAEA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AACA,IAAAO,WAAA,GAAAP,OAAA;AAIsB,SAAAQ,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAV,wBAAAc,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAAE,GAAA,CAAAL,GAAA,SAAAM,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA,IAAAX,GAAA,QAAAW,GAAA,kBAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAd,GAAA,EAAAW,GAAA,SAAAI,I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EAAC,CAAC;IACpB,CAAC,MAAM;MACL,IAAAC,8BAAiB,EAAC,CAAC;IACrB;EACF,CAAC,EAAE,CAAClD,OAAO,CAAC,CAAC;EAEb,oBACElD,MAAA,CAAAiB,OAAA,CAAAoF,aAAA,CAAC/F,QAAA,CAAAgG,eAAe,CAACC,QAAQ;IAACnB,KAAK,EAAElB;EAAQ,gBACvClE,MAAA,CAAAiB,OAAA,CAAAoF,aAAA,CAACrE,8BAA8B;IAC7BkB,OAAO,EAAEA,OAAQ;IACjBsD,wBAAwB,EAAEnB,eAAgB;IAC1CE,mBAAmB,EAAEL,qBAAQ,CAACC,EAAE,KAAK,KAAK,GAAGR,cAAc,GAAG8B,SAAU;IACxE9B,cAAc,EAAEO,qBAAQ,CAACC,EAAE,KAAK,SAAS,GAAGR,cAAc,GAAG8B,SAAU;IACvEhB,yBAAyB,EAAEd,cAAe;IAC1C+B,qCAAqC,EAAEhB,kBAAmB;IAC1DiB,mCAAmC,EAAEZ,gBAAiB;IACtD9C,wBAAwB,EAAEA,wBAAyB;IACnDD,oBAAoB,EAAEA,oBAAqB;IAC3CuB,KAAK,EAAElC,MAAM,CAACG;EAAU,GAEvBO,QAC6B,CAAC,eACjC/C,MAAA,CAAAiB,OAAA,CAAAoF,aAAA,CAAClG,YAAA,CAAAgC,QAAQ,CAACyE,IAAI;IACZ;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACArC,KAAK,EAAEA;EAAM,CACd,CACuB,CAAC;AAE/B,CAAC;AAACsC,OAAA,CAAAhE,gBAAA,GAAAA,gBAAA"}
@@ -1 +1 @@
1
- {"version":3,"names":["NOOP","KeyboardController","setDefaultMode","setInputMode","dismiss","addListener","removeListeners","KeyboardEvents","remove","KeyboardControllerView","View","KeyboardGestureArea"],"sources":["bindings.ts"],"sourcesContent":["import { View } from 'react-native';\n\nimport type {\n KeyboardControllerModule,\n KeyboardControllerProps,\n KeyboardEventsModule,\n KeyboardGestureAreaProps,\n} from './types';\nimport type { EmitterSubscription } from 'react-native';\n\nconst NOOP = () => {};\nexport const KeyboardController: KeyboardControllerModule = {\n setDefaultMode: NOOP,\n setInputMode: NOOP,\n dismiss: NOOP,\n addListener: NOOP,\n removeListeners: NOOP,\n};\nexport const KeyboardEvents: KeyboardEventsModule = {\n addListener: () => ({ remove: NOOP } as EmitterSubscription),\n};\nexport const KeyboardControllerView =\n View as unknown as React.FC<KeyboardControllerProps>;\nexport const KeyboardGestureArea =\n View as unknown as React.FC<KeyboardGestureAreaProps>;\n"],"mappings":";;;;;;AAAA;AAUA,MAAMA,IAAI,GAAG,MAAM,CAAC,CAAC;AACd,MAAMC,kBAA4C,GAAG;EAC1DC,cAAc,EAAEF,IAAI;EACpBG,YAAY,EAAEH,IAAI;EAClBI,OAAO,EAAEJ,IAAI;EACbK,WAAW,EAAEL,IAAI;EACjBM,eAAe,EAAEN;AACnB,CAAC;AAAC;AACK,MAAMO,cAAoC,GAAG;EAClDF,WAAW,EAAE,OAAO;IAAEG,MAAM,EAAER;EAAK,CAAC;AACtC,CAAC;AAAC;AACK,MAAMS,sBAAsB,GACjCC,iBAAoD;AAAC;AAChD,MAAMC,mBAAmB,GAC9BD,iBAAqD;AAAC"}
1
+ {"version":3,"names":["_reactNative","require","NOOP","KeyboardController","setDefaultMode","setInputMode","dismiss","addListener","removeListeners","exports","KeyboardEvents","remove","KeyboardControllerView","View","KeyboardGestureArea"],"sources":["bindings.ts"],"sourcesContent":["import { View } from \"react-native\";\n\nimport type {\n KeyboardControllerModule,\n KeyboardControllerProps,\n KeyboardEventsModule,\n KeyboardGestureAreaProps,\n} from \"./types\";\nimport type { EmitterSubscription } from \"react-native\";\n\nconst NOOP = () => {};\nexport const KeyboardController: KeyboardControllerModule = {\n setDefaultMode: NOOP,\n setInputMode: NOOP,\n dismiss: NOOP,\n addListener: NOOP,\n removeListeners: NOOP,\n};\nexport const KeyboardEvents: KeyboardEventsModule = {\n addListener: () => ({ remove: NOOP } as EmitterSubscription),\n};\nexport const KeyboardControllerView =\n View as unknown as React.FC<KeyboardControllerProps>;\nexport const KeyboardGestureArea =\n View as unknown as React.FC<KeyboardGestureAreaProps>;\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAUA,MAAMC,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AACd,MAAMC,kBAA4C,GAAG;EAC1DC,cAAc,EAAEF,IAAI;EACpBG,YAAY,EAAEH,IAAI;EAClBI,OAAO,EAAEJ,IAAI;EACbK,WAAW,EAAEL,IAAI;EACjBM,eAAe,EAAEN;AACnB,CAAC;AAACO,OAAA,CAAAN,kBAAA,GAAAA,kBAAA;AACK,MAAMO,cAAoC,GAAG;EAClDH,WAAW,EAAEA,CAAA,MAAO;IAAEI,MAAM,EAAET;EAAK,CAAC;AACtC,CAAC;AAACO,OAAA,CAAAC,cAAA,GAAAA,cAAA;AACK,MAAME,sBAAsB,GACjCC,iBAAoD;AAACJ,OAAA,CAAAG,sBAAA,GAAAA,sBAAA;AAChD,MAAME,mBAAmB,GAC9BD,iBAAqD;AAACJ,OAAA,CAAAK,mBAAA,GAAAA,mBAAA"}
@@ -7,9 +7,9 @@ exports.KeyboardGestureArea = exports.KeyboardEvents = exports.KeyboardControlle
7
7
  var _reactNative = require("react-native");
8
8
  const LINKING_ERROR = `The package 'react-native-keyboard-controller' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
9
9
  ios: "- You have run 'pod install'\n",
10
- default: ''
11
- }) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
12
- const RCTKeyboardController = require('./specs/NativeKeyboardController').default;
10
+ default: ""
11
+ }) + "- You rebuilt the app after installing the package\n" + "- You are not using Expo Go\n";
12
+ const RCTKeyboardController = require("./specs/NativeKeyboardController").default;
13
13
  const KeyboardController = RCTKeyboardController ? RCTKeyboardController : new Proxy({}, {
14
14
  get() {
15
15
  throw new Error(LINKING_ERROR);
@@ -18,12 +18,12 @@ const KeyboardController = RCTKeyboardController ? RCTKeyboardController : new P
18
18
  exports.KeyboardController = KeyboardController;
19
19
  const eventEmitter = new _reactNative.NativeEventEmitter(KeyboardController);
20
20
  const KeyboardEvents = {
21
- addListener: (name, cb) => eventEmitter.addListener('KeyboardController::' + name, cb)
21
+ addListener: (name, cb) => eventEmitter.addListener("KeyboardController::" + name, cb)
22
22
  };
23
23
  exports.KeyboardEvents = KeyboardEvents;
24
- const KeyboardControllerView = require('./specs/KeyboardControllerViewNativeComponent').default;
24
+ const KeyboardControllerView = require("./specs/KeyboardControllerViewNativeComponent").default;
25
25
  exports.KeyboardControllerView = KeyboardControllerView;
26
- const KeyboardGestureArea = _reactNative.Platform.OS === 'android' && _reactNative.Platform.Version >= 30 ? require('./specs/KeyboardGestureAreaNativeComponent').default : _ref => {
26
+ const KeyboardGestureArea = _reactNative.Platform.OS === "android" && _reactNative.Platform.Version >= 30 ? require("./specs/KeyboardGestureAreaNativeComponent").default : _ref => {
27
27
  let {
28
28
  children
29
29
  } = _ref;
@@ -1 +1 @@
1
- {"version":3,"names":["LINKING_ERROR","Platform","select","ios","default","RCTKeyboardController","require","KeyboardController","Proxy","get","Error","eventEmitter","NativeEventEmitter","KeyboardEvents","addListener","name","cb","KeyboardControllerView","KeyboardGestureArea","OS","Version","children"],"sources":["bindings.native.ts"],"sourcesContent":["import { NativeEventEmitter, Platform } from 'react-native';\n\nimport type {\n KeyboardControllerModule,\n KeyboardControllerProps,\n KeyboardEventsModule,\n KeyboardGestureAreaProps,\n} from './types';\n\nconst LINKING_ERROR =\n `The package 'react-native-keyboard-controller' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo Go\\n';\n\nconst RCTKeyboardController =\n require('./specs/NativeKeyboardController').default;\nexport const KeyboardController = (\n RCTKeyboardController\n ? RCTKeyboardController\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n )\n) as KeyboardControllerModule;\n\nconst eventEmitter = new NativeEventEmitter(KeyboardController);\n\nexport const KeyboardEvents: KeyboardEventsModule = {\n addListener: (name, cb) =>\n eventEmitter.addListener('KeyboardController::' + name, cb),\n};\nexport const KeyboardControllerView: React.FC<KeyboardControllerProps> =\n require('./specs/KeyboardControllerViewNativeComponent').default;\nexport const KeyboardGestureArea: React.FC<KeyboardGestureAreaProps> =\n Platform.OS === 'android' && Platform.Version >= 30\n ? require('./specs/KeyboardGestureAreaNativeComponent').default\n : ({ children }: KeyboardGestureAreaProps) => children;\n"],"mappings":";;;;;;AAAA;AASA,MAAMA,aAAa,GAChB,2FAA0F,GAC3FC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,qBAAqB,GACzBC,OAAO,CAAC,kCAAkC,CAAC,CAACF,OAAO;AAC9C,MAAMG,kBAAkB,GAC7BF,qBAAqB,GACjBA,qBAAqB,GACrB,IAAIG,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAG,GAAG;IACJ,MAAM,IAAIC,KAAK,CAACV,aAAa,CAAC;EAChC;AACF,CAAC,CAEoB;AAAC;AAE9B,MAAMW,YAAY,GAAG,IAAIC,+BAAkB,CAACL,kBAAkB,CAAC;AAExD,MAAMM,cAAoC,GAAG;EAClDC,WAAW,EAAE,CAACC,IAAI,EAAEC,EAAE,KACpBL,YAAY,CAACG,WAAW,CAAC,sBAAsB,GAAGC,IAAI,EAAEC,EAAE;AAC9D,CAAC;AAAC;AACK,MAAMC,sBAAyD,GACpEX,OAAO,CAAC,+CAA+C,CAAC,CAACF,OAAO;AAAC;AAC5D,MAAMc,mBAAuD,GAClEjB,qBAAQ,CAACkB,EAAE,KAAK,SAAS,IAAIlB,qBAAQ,CAACmB,OAAO,IAAI,EAAE,GAC/Cd,OAAO,CAAC,4CAA4C,CAAC,CAACF,OAAO,GAC7D;EAAA,IAAC;IAAEiB;EAAmC,CAAC;EAAA,OAAKA,QAAQ;AAAA;AAAC"}
1
+ {"version":3,"names":["_reactNative","require","LINKING_ERROR","Platform","select","ios","default","RCTKeyboardController","KeyboardController","Proxy","get","Error","exports","eventEmitter","NativeEventEmitter","KeyboardEvents","addListener","name","cb","KeyboardControllerView","KeyboardGestureArea","OS","Version","_ref","children"],"sources":["bindings.native.ts"],"sourcesContent":["import { NativeEventEmitter, Platform } from \"react-native\";\n\nimport type {\n KeyboardControllerModule,\n KeyboardControllerProps,\n KeyboardEventsModule,\n KeyboardGestureAreaProps,\n} from \"./types\";\n\nconst LINKING_ERROR =\n `The package 'react-native-keyboard-controller' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: \"\" }) +\n \"- You rebuilt the app after installing the package\\n\" +\n \"- You are not using Expo Go\\n\";\n\nconst RCTKeyboardController =\n require(\"./specs/NativeKeyboardController\").default;\nexport const KeyboardController = (\n RCTKeyboardController\n ? RCTKeyboardController\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n },\n )\n) as KeyboardControllerModule;\n\nconst eventEmitter = new NativeEventEmitter(KeyboardController);\n\nexport const KeyboardEvents: KeyboardEventsModule = {\n addListener: (name, cb) =>\n eventEmitter.addListener(\"KeyboardController::\" + name, cb),\n};\nexport const KeyboardControllerView: React.FC<KeyboardControllerProps> =\n require(\"./specs/KeyboardControllerViewNativeComponent\").default;\nexport const KeyboardGestureArea: React.FC<KeyboardGestureAreaProps> =\n Platform.OS === \"android\" && Platform.Version >= 30\n ? require(\"./specs/KeyboardGestureAreaNativeComponent\").default\n : ({ children }: KeyboardGestureAreaProps) => children;\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AASA,MAAMC,aAAa,GAChB,2FAA0F,GAC3FC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,qBAAqB,GACzBN,OAAO,CAAC,kCAAkC,CAAC,CAACK,OAAO;AAC9C,MAAME,kBAAkB,GAC7BD,qBAAqB,GACjBA,qBAAqB,GACrB,IAAIE,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACT,aAAa,CAAC;EAChC;AACF,CACF,CACuB;AAACU,OAAA,CAAAJ,kBAAA,GAAAA,kBAAA;AAE9B,MAAMK,YAAY,GAAG,IAAIC,+BAAkB,CAACN,kBAAkB,CAAC;AAExD,MAAMO,cAAoC,GAAG;EAClDC,WAAW,EAAEA,CAACC,IAAI,EAAEC,EAAE,KACpBL,YAAY,CAACG,WAAW,CAAC,sBAAsB,GAAGC,IAAI,EAAEC,EAAE;AAC9D,CAAC;AAACN,OAAA,CAAAG,cAAA,GAAAA,cAAA;AACK,MAAMI,sBAAyD,GACpElB,OAAO,CAAC,+CAA+C,CAAC,CAACK,OAAO;AAACM,OAAA,CAAAO,sBAAA,GAAAA,sBAAA;AAC5D,MAAMC,mBAAuD,GAClEjB,qBAAQ,CAACkB,EAAE,KAAK,SAAS,IAAIlB,qBAAQ,CAACmB,OAAO,IAAI,EAAE,GAC/CrB,OAAO,CAAC,4CAA4C,CAAC,CAACK,OAAO,GAC7DiB,IAAA;EAAA,IAAC;IAAEC;EAAmC,CAAC,GAAAD,IAAA;EAAA,OAAKC,QAAQ;AAAA;AAACZ,OAAA,CAAAQ,mBAAA,GAAAA,mBAAA"}
@@ -5,15 +5,15 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.useKeyboardAnimation = void 0;
7
7
  var _reactNativeReanimated = require("react-native-reanimated");
8
- var _hooks = require("../../hooks");
8
+ var _reactNativeKeyboardController = require("react-native-keyboard-controller");
9
9
  const useKeyboardAnimation = () => {
10
10
  const heightWhenOpened = (0, _reactNativeReanimated.useSharedValue)(0);
11
11
  const height = (0, _reactNativeReanimated.useSharedValue)(0);
12
12
  const progress = (0, _reactNativeReanimated.useSharedValue)(0);
13
13
  const isClosed = (0, _reactNativeReanimated.useSharedValue)(true);
14
- (0, _hooks.useKeyboardHandler)({
14
+ (0, _reactNativeKeyboardController.useKeyboardHandler)({
15
15
  onStart: e => {
16
- 'worklet';
16
+ "worklet";
17
17
 
18
18
  if (e.height > 0) {
19
19
  isClosed.value = false;
@@ -21,15 +21,29 @@ const useKeyboardAnimation = () => {
21
21
  }
22
22
  },
23
23
  onMove: e => {
24
- 'worklet';
24
+ "worklet";
25
25
 
26
26
  progress.value = e.progress;
27
27
  height.value = e.height;
28
28
  },
29
29
  onEnd: e => {
30
- 'worklet';
30
+ "worklet";
31
31
 
32
32
  isClosed.value = e.height === 0;
33
+
34
+ // `height` update happens in `onMove` handler
35
+ // in `onEnd` we need to update only if `onMove`
36
+ // wasn't called (i. e. duration === 0)
37
+ //
38
+ // we can not call this code without condition below
39
+ // because in some corner cases (iOS with `secureTextEntry`)
40
+ // `onEnd` can be emitted before `onMove` and in this case
41
+ // it may lead to choppy/glitchy/jumpy UI
42
+ // see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/327
43
+ if (e.duration === 0) {
44
+ progress.value = e.progress;
45
+ height.value = e.height;
46
+ }
33
47
  }
34
48
  }, []);
35
49
  return {
@@ -1 +1 @@
1
- {"version":3,"names":["useKeyboardAnimation","heightWhenOpened","useSharedValue","height","progress","isClosed","useKeyboardHandler","onStart","e","value","onMove","onEnd"],"sources":["hooks.ts"],"sourcesContent":["import { useSharedValue } from 'react-native-reanimated';\n\nimport { useKeyboardHandler } from '../../hooks';\n\nexport const useKeyboardAnimation = () => {\n const heightWhenOpened = useSharedValue(0);\n const height = useSharedValue(0);\n const progress = useSharedValue(0);\n const isClosed = useSharedValue(true);\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 onEnd: (e) => {\n 'worklet';\n\n isClosed.value = e.height === 0;\n },\n },\n []\n );\n\n return { height, progress, heightWhenOpened, isClosed };\n};\n"],"mappings":";;;;;;AAAA;AAEA;AAEO,MAAMA,oBAAoB,GAAG,MAAM;EACxC,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,yBAAkB,EAChB;IACEC,OAAO,EAAGC,CAAC,IAAK;MACd,SAAS;;MAET,IAAIA,CAAC,CAACL,MAAM,GAAG,CAAC,EAAE;QAChBE,QAAQ,CAACI,KAAK,GAAG,KAAK;QACtBR,gBAAgB,CAACQ,KAAK,GAAGD,CAAC,CAACL,MAAM;MACnC;IACF,CAAC;IACDO,MAAM,EAAGF,CAAC,IAAK;MACb,SAAS;;MAETJ,QAAQ,CAACK,KAAK,GAAGD,CAAC,CAACJ,QAAQ;MAC3BD,MAAM,CAACM,KAAK,GAAGD,CAAC,CAACL,MAAM;IACzB,CAAC;IACDQ,KAAK,EAAGH,CAAC,IAAK;MACZ,SAAS;;MAETH,QAAQ,CAACI,KAAK,GAAGD,CAAC,CAACL,MAAM,KAAK,CAAC;IACjC;EACF,CAAC,EACD,EAAE,CACH;EAED,OAAO;IAAEA,MAAM;IAAEC,QAAQ;IAAEH,gBAAgB;IAAEI;EAAS,CAAC;AACzD,CAAC;AAAC"}
1
+ {"version":3,"names":["_reactNativeReanimated","require","_reactNativeKeyboardController","useKeyboardAnimation","heightWhenOpened","useSharedValue","height","progress","isClosed","useKeyboardHandler","onStart","e","value","onMove","onEnd","duration","exports"],"sources":["hooks.ts"],"sourcesContent":["import { useSharedValue } from \"react-native-reanimated\";\n\nimport { useKeyboardHandler } from \"react-native-keyboard-controller\";\n\nexport const useKeyboardAnimation = () => {\n const heightWhenOpened = useSharedValue(0);\n const height = useSharedValue(0);\n const progress = useSharedValue(0);\n const isClosed = useSharedValue(true);\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 onEnd: (e) => {\n \"worklet\";\n\n isClosed.value = e.height === 0;\n\n // `height` update happens in `onMove` handler\n // in `onEnd` we need to update only if `onMove`\n // wasn't called (i. e. duration === 0)\n //\n // we can not call this code without condition below\n // because in some corner cases (iOS with `secureTextEntry`)\n // `onEnd` can be emitted before `onMove` and in this case\n // it may lead to choppy/glitchy/jumpy UI\n // see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/327\n if (e.duration === 0) {\n progress.value = e.progress;\n height.value = e.height;\n }\n },\n },\n [],\n );\n\n return { height, progress, heightWhenOpened, isClosed };\n};\n"],"mappings":";;;;;;AAAA,IAAAA,sBAAA,GAAAC,OAAA;AAEA,IAAAC,8BAAA,GAAAD,OAAA;AAEO,MAAME,oBAAoB,GAAGA,CAAA,KAAM;EACxC,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,iDAAkB,EAChB;IACEC,OAAO,EAAGC,CAAC,IAAK;MACd,SAAS;;MAET,IAAIA,CAAC,CAACL,MAAM,GAAG,CAAC,EAAE;QAChBE,QAAQ,CAACI,KAAK,GAAG,KAAK;QACtBR,gBAAgB,CAACQ,KAAK,GAAGD,CAAC,CAACL,MAAM;MACnC;IACF,CAAC;IACDO,MAAM,EAAGF,CAAC,IAAK;MACb,SAAS;;MAETJ,QAAQ,CAACK,KAAK,GAAGD,CAAC,CAACJ,QAAQ;MAC3BD,MAAM,CAACM,KAAK,GAAGD,CAAC,CAACL,MAAM;IACzB,CAAC;IACDQ,KAAK,EAAGH,CAAC,IAAK;MACZ,SAAS;;MAETH,QAAQ,CAACI,KAAK,GAAGD,CAAC,CAACL,MAAM,KAAK,CAAC;;MAE/B;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA,IAAIK,CAAC,CAACI,QAAQ,KAAK,CAAC,EAAE;QACpBR,QAAQ,CAACK,KAAK,GAAGD,CAAC,CAACJ,QAAQ;QAC3BD,MAAM,CAACM,KAAK,GAAGD,CAAC,CAACL,MAAM;MACzB;IACF;EACF,CAAC,EACD,EACF,CAAC;EAED,OAAO;IAAEA,MAAM;IAAEC,QAAQ;IAAEH,gBAAgB;IAAEI;EAAS,CAAC;AACzD,CAAC;AAACQ,OAAA,CAAAb,oBAAA,GAAAA,oBAAA"}
@@ -7,7 +7,9 @@ exports.default = void 0;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
8
  var _reactNative = require("react-native");
9
9
  var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated"));
10
+ var _useKeyboardInterpolation = _interopRequireDefault(require("../hooks/useKeyboardInterpolation"));
10
11
  var _hooks = require("./hooks");
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
13
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
12
14
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
13
15
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
@@ -40,13 +42,16 @@ const KeyboardAvoidingView = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) =>
40
42
  height: screenHeight
41
43
  } = (0, _reactNative.useWindowDimensions)();
42
44
  const relativeKeyboardHeight = (0, _react.useCallback)(() => {
43
- 'worklet';
45
+ "worklet";
44
46
 
45
47
  const keyboardY = screenHeight - keyboard.heightWhenOpened.value - keyboardVerticalOffset;
46
48
  return Math.max(frame.value.y + frame.value.height - keyboardY, 0);
47
49
  }, [screenHeight, keyboardVerticalOffset]);
50
+ const {
51
+ interpolate
52
+ } = (0, _useKeyboardInterpolation.default)();
48
53
  const onLayoutWorklet = (0, _react.useCallback)(layout => {
49
- 'worklet';
54
+ "worklet";
50
55
 
51
56
  if (keyboard.isClosed.value) {
52
57
  initialFrame.value = layout;
@@ -57,10 +62,10 @@ const KeyboardAvoidingView = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) =>
57
62
  onLayoutProps === null || onLayoutProps === void 0 ? void 0 : onLayoutProps(e);
58
63
  }, [onLayoutProps]);
59
64
  const animatedStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => {
60
- const bottom = (0, _reactNativeReanimated.interpolate)(keyboard.progress.value, [0, 1], [0, relativeKeyboardHeight()]);
65
+ const bottom = interpolate(keyboard.height.value, [0, relativeKeyboardHeight()]);
61
66
  const bottomHeight = enabled ? bottom : 0;
62
67
  switch (behavior) {
63
- case 'height':
68
+ case "height":
64
69
  if (!keyboard.isClosed.value) {
65
70
  return {
66
71
  height: frame.value.height - bottomHeight,
@@ -68,11 +73,11 @@ const KeyboardAvoidingView = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) =>
68
73
  };
69
74
  }
70
75
  return {};
71
- case 'position':
76
+ case "position":
72
77
  return {
73
78
  bottom: bottomHeight
74
79
  };
75
- case 'padding':
80
+ case "padding":
76
81
  return {
77
82
  paddingBottom: bottomHeight
78
83
  };
@@ -80,7 +85,7 @@ const KeyboardAvoidingView = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) =>
80
85
  return {};
81
86
  }
82
87
  }, [behavior, enabled, relativeKeyboardHeight]);
83
- const isPositionBehavior = behavior === 'position';
88
+ const isPositionBehavior = behavior === "position";
84
89
  const containerStyle = isPositionBehavior ? contentContainerStyle : style;
85
90
  const combinedStyles = (0, _react.useMemo)(() => [containerStyle, animatedStyle], [containerStyle, animatedStyle]);
86
91
  if (isPositionBehavior) {