react-native-keyboard-controller 1.10.0 → 1.10.1

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 (141) hide show
  1. package/ios/.clang-format +30 -30
  2. package/ios/.swiftlint.yml +1 -1
  3. package/jest/index.js +4 -4
  4. package/lib/commonjs/animated.js +19 -19
  5. package/lib/commonjs/animated.js.map +1 -1
  6. package/lib/commonjs/bindings.js.map +1 -1
  7. package/lib/commonjs/bindings.native.js +6 -6
  8. package/lib/commonjs/bindings.native.js.map +1 -1
  9. package/lib/commonjs/components/KeyboardAvoidingView/hooks.js +5 -3
  10. package/lib/commonjs/components/KeyboardAvoidingView/hooks.js.map +1 -1
  11. package/lib/commonjs/components/KeyboardAvoidingView/index.js +12 -7
  12. package/lib/commonjs/components/KeyboardAvoidingView/index.js.map +1 -1
  13. package/lib/commonjs/components/KeyboardAwareScrollView/index.js +5 -5
  14. package/lib/commonjs/components/KeyboardAwareScrollView/index.js.map +1 -1
  15. package/lib/commonjs/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js +5 -5
  16. package/lib/commonjs/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js.map +1 -1
  17. package/lib/commonjs/components/KeyboardAwareScrollView/utils.js +2 -2
  18. package/lib/commonjs/components/KeyboardAwareScrollView/utils.js.map +1 -1
  19. package/lib/commonjs/components/KeyboardStickyView/index.js +7 -3
  20. package/lib/commonjs/components/KeyboardStickyView/index.js.map +1 -1
  21. package/lib/commonjs/components/hooks/useKeyboardInterpolation.js +81 -0
  22. package/lib/commonjs/components/hooks/useKeyboardInterpolation.js.map +1 -0
  23. package/lib/commonjs/components/index.js.map +1 -1
  24. package/lib/commonjs/constants.js.map +1 -1
  25. package/lib/commonjs/context.js.map +1 -1
  26. package/lib/commonjs/hooks.js.map +1 -1
  27. package/lib/commonjs/index.js.map +1 -1
  28. package/lib/commonjs/internal.js +1 -1
  29. package/lib/commonjs/internal.js.map +1 -1
  30. package/lib/commonjs/monkey-patch.android.js +1 -1
  31. package/lib/commonjs/monkey-patch.android.js.map +1 -1
  32. package/lib/commonjs/monkey-patch.js.map +1 -1
  33. package/lib/commonjs/reanimated.js.map +1 -1
  34. package/lib/commonjs/reanimated.native.js +12 -12
  35. package/lib/commonjs/reanimated.native.js.map +1 -1
  36. package/lib/commonjs/replicas.js +5 -5
  37. package/lib/commonjs/replicas.js.map +1 -1
  38. package/lib/commonjs/specs/KeyboardControllerViewNativeComponent.js +1 -1
  39. package/lib/commonjs/specs/KeyboardControllerViewNativeComponent.js.map +1 -1
  40. package/lib/commonjs/specs/KeyboardGestureAreaNativeComponent.js +2 -2
  41. package/lib/commonjs/specs/KeyboardGestureAreaNativeComponent.js.map +1 -1
  42. package/lib/commonjs/specs/NativeKeyboardController.js +1 -1
  43. package/lib/commonjs/specs/NativeKeyboardController.js.map +1 -1
  44. package/lib/commonjs/specs/NativeStatusBarManagerCompat.js +1 -1
  45. package/lib/commonjs/specs/NativeStatusBarManagerCompat.js.map +1 -1
  46. package/lib/commonjs/types.js.map +1 -1
  47. package/lib/commonjs/utils.js.map +1 -1
  48. package/lib/module/animated.js +27 -27
  49. package/lib/module/animated.js.map +1 -1
  50. package/lib/module/bindings.js +1 -1
  51. package/lib/module/bindings.js.map +1 -1
  52. package/lib/module/bindings.native.js +7 -7
  53. package/lib/module/bindings.native.js.map +1 -1
  54. package/lib/module/components/KeyboardAvoidingView/hooks.js +7 -5
  55. package/lib/module/components/KeyboardAvoidingView/hooks.js.map +1 -1
  56. package/lib/module/components/KeyboardAvoidingView/index.js +15 -11
  57. package/lib/module/components/KeyboardAvoidingView/index.js.map +1 -1
  58. package/lib/module/components/KeyboardAwareScrollView/index.js +11 -11
  59. package/lib/module/components/KeyboardAwareScrollView/index.js.map +1 -1
  60. package/lib/module/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js +8 -8
  61. package/lib/module/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js.map +1 -1
  62. package/lib/module/components/KeyboardAwareScrollView/utils.js +2 -2
  63. package/lib/module/components/KeyboardAwareScrollView/utils.js.map +1 -1
  64. package/lib/module/components/KeyboardStickyView/index.js +9 -6
  65. package/lib/module/components/KeyboardStickyView/index.js.map +1 -1
  66. package/lib/module/components/hooks/useKeyboardInterpolation.js +74 -0
  67. package/lib/module/components/hooks/useKeyboardInterpolation.js.map +1 -0
  68. package/lib/module/components/index.js +3 -3
  69. package/lib/module/components/index.js.map +1 -1
  70. package/lib/module/context.js +2 -2
  71. package/lib/module/context.js.map +1 -1
  72. package/lib/module/hooks.js +5 -5
  73. package/lib/module/hooks.js.map +1 -1
  74. package/lib/module/index.js +8 -8
  75. package/lib/module/index.js.map +1 -1
  76. package/lib/module/internal.js +4 -4
  77. package/lib/module/internal.js.map +1 -1
  78. package/lib/module/monkey-patch.android.js +2 -2
  79. package/lib/module/monkey-patch.android.js.map +1 -1
  80. package/lib/module/monkey-patch.js.map +1 -1
  81. package/lib/module/reanimated.js.map +1 -1
  82. package/lib/module/reanimated.native.js +13 -13
  83. package/lib/module/reanimated.native.js.map +1 -1
  84. package/lib/module/replicas.js +11 -11
  85. package/lib/module/replicas.js.map +1 -1
  86. package/lib/module/specs/KeyboardControllerViewNativeComponent.js +2 -2
  87. package/lib/module/specs/KeyboardControllerViewNativeComponent.js.map +1 -1
  88. package/lib/module/specs/KeyboardGestureAreaNativeComponent.js +3 -3
  89. package/lib/module/specs/KeyboardGestureAreaNativeComponent.js.map +1 -1
  90. package/lib/module/specs/NativeKeyboardController.js +2 -2
  91. package/lib/module/specs/NativeKeyboardController.js.map +1 -1
  92. package/lib/module/specs/NativeStatusBarManagerCompat.js +2 -2
  93. package/lib/module/specs/NativeStatusBarManagerCompat.js.map +1 -1
  94. package/lib/module/types.js.map +1 -1
  95. package/lib/module/utils.js.map +1 -1
  96. package/lib/typescript/animated.d.ts +1 -1
  97. package/lib/typescript/bindings.d.ts +1 -1
  98. package/lib/typescript/bindings.native.d.ts +1 -1
  99. package/lib/typescript/components/KeyboardAvoidingView/index.d.ts +4 -4
  100. package/lib/typescript/components/KeyboardAwareScrollView/index.d.ts +2 -2
  101. package/lib/typescript/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.d.ts +1 -1
  102. package/lib/typescript/components/KeyboardStickyView/index.d.ts +2 -2
  103. package/lib/typescript/components/hooks/useKeyboardInterpolation.d.ts +20 -0
  104. package/lib/typescript/components/index.d.ts +3 -3
  105. package/lib/typescript/context.d.ts +4 -4
  106. package/lib/typescript/hooks.d.ts +3 -3
  107. package/lib/typescript/index.d.ts +8 -8
  108. package/lib/typescript/internal.d.ts +2 -2
  109. package/lib/typescript/reanimated.d.ts +1 -1
  110. package/lib/typescript/reanimated.native.d.ts +1 -1
  111. package/lib/typescript/replicas.d.ts +1 -1
  112. package/lib/typescript/specs/KeyboardControllerViewNativeComponent.d.ts +3 -3
  113. package/lib/typescript/specs/KeyboardGestureAreaNativeComponent.d.ts +4 -4
  114. package/lib/typescript/specs/NativeKeyboardController.d.ts +1 -1
  115. package/lib/typescript/specs/NativeStatusBarManagerCompat.d.ts +1 -1
  116. package/lib/typescript/types.d.ts +3 -3
  117. package/package.json +8 -10
  118. package/src/animated.tsx +39 -39
  119. package/src/bindings.native.ts +11 -11
  120. package/src/bindings.ts +3 -3
  121. package/src/components/KeyboardAvoidingView/hooks.ts +9 -6
  122. package/src/components/KeyboardAvoidingView/index.tsx +25 -24
  123. package/src/components/KeyboardAwareScrollView/index.tsx +23 -23
  124. package/src/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.ts +13 -13
  125. package/src/components/KeyboardAwareScrollView/utils.ts +3 -3
  126. package/src/components/KeyboardStickyView/index.tsx +11 -12
  127. package/src/components/hooks/useKeyboardInterpolation.ts +96 -0
  128. package/src/components/index.ts +3 -3
  129. package/src/context.ts +7 -7
  130. package/src/hooks.ts +12 -12
  131. package/src/index.ts +8 -8
  132. package/src/internal.ts +9 -9
  133. package/src/monkey-patch.android.ts +2 -2
  134. package/src/reanimated.native.ts +20 -20
  135. package/src/reanimated.ts +1 -1
  136. package/src/replicas.ts +16 -16
  137. package/src/specs/KeyboardControllerViewNativeComponent.ts +5 -5
  138. package/src/specs/KeyboardGestureAreaNativeComponent.ts +7 -7
  139. package/src/specs/NativeKeyboardController.ts +3 -3
  140. package/src/specs/NativeStatusBarManagerCompat.ts +3 -3
  141. package/src/types.ts +21 -21
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
package/jest/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Animated } from 'react-native';
1
+ import { Animated } from "react-native";
2
2
 
3
3
  const values = {
4
4
  animated: {
@@ -45,10 +45,10 @@ const mock = {
45
45
  addListener: jest.fn(() => ({ remove: jest.fn() })),
46
46
  },
47
47
  // views
48
- KeyboardControllerView: 'KeyboardControllerView',
49
- KeyboardGestureArea: 'KeyboardGestureArea',
48
+ KeyboardControllerView: "KeyboardControllerView",
49
+ KeyboardGestureArea: "KeyboardGestureArea",
50
50
  // providers
51
- KeyboardProvider: 'KeyboardProvider',
51
+ KeyboardProvider: "KeyboardProvider",
52
52
  };
53
53
 
54
54
  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,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AIhD,OAAO,EAAE;MACX,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,EA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X,IAAAiD,6BAAgB,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"}
@@ -13,7 +13,7 @@ const useKeyboardAnimation = () => {
13
13
  const isClosed = (0, _reactNativeReanimated.useSharedValue)(true);
14
14
  (0, _hooks.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,17 @@ 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
+ progress.value = e.progress;
34
+ height.value = e.height;
33
35
  }
34
36
  }, []);
35
37
  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","_hooks","useKeyboardAnimation","heightWhenOpened","useSharedValue","height","progress","isClosed","useKeyboardHandler","onStart","e","value","onMove","onEnd","exports"],"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 progress.value = e.progress;\n height.value = e.height;\n },\n },\n [],\n );\n\n return { height, progress, heightWhenOpened, isClosed };\n};\n"],"mappings":";;;;;;AAAA,IAAAA,sBAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,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,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;MAE/BC,QAAQ,CAACK,KAAK,GAAGD,CAAC,CAACJ,QAAQ;MAC3BD,MAAM,CAACM,KAAK,GAAGD,CAAC,CAACL,MAAM;IACzB;EACF,CAAC,EACD,EACF,CAAC;EAED,OAAO;IAAEA,MAAM;IAAEC,QAAQ;IAAEH,gBAAgB;IAAEI;EAAS,CAAC;AACzD,CAAC;AAACO,OAAA,CAAAZ,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) {
@@ -1 +1 @@
1
- {"version":3,"names":["defaultLayout","x","y","width","height","KeyboardAvoidingView","forwardRef","ref","behavior","children","contentContainerStyle","enabled","keyboardVerticalOffset","style","onLayout","onLayoutProps","props","initialFrame","useSharedValue","frame","useDerivedValue","value","keyboard","useKeyboardAnimation","screenHeight","useWindowDimensions","relativeKeyboardHeight","useCallback","keyboardY","heightWhenOpened","Math","max","onLayoutWorklet","layout","isClosed","e","runOnUI","nativeEvent","animatedStyle","useAnimatedStyle","bottom","interpolate","progress","bottomHeight","flex","paddingBottom","isPositionBehavior","containerStyle","combinedStyles","useMemo"],"sources":["index.tsx"],"sourcesContent":["import React, { forwardRef, useCallback, useMemo } from 'react';\nimport { View, useWindowDimensions } from 'react-native';\nimport Reanimated, {\n interpolate,\n runOnUI,\n useAnimatedStyle,\n useDerivedValue,\n useSharedValue,\n} from 'react-native-reanimated';\n\nimport { useKeyboardAnimation } from './hooks';\n\nimport type { LayoutRectangle, ViewProps } from 'react-native';\n\ntype Props = {\n /**\n * Specify how to react to the presence of the keyboard.\n */\n behavior?: 'height' | 'position' | 'padding';\n\n /**\n * Style of the content container when `behavior` is 'position'.\n */\n contentContainerStyle?: ViewProps['style'];\n\n /**\n * Controls whether this `KeyboardAvoidingView` instance should take effect.\n * This is useful when more than one is on the screen. Defaults to true.\n */\n enabled?: boolean;\n\n /**\n * Distance between the top of the user screen and the React Native view. This\n * may be non-zero in some cases. Defaults to 0.\n */\n keyboardVerticalOffset?: number;\n} & ViewProps;\n\nconst defaultLayout: LayoutRectangle = {\n x: 0,\n y: 0,\n width: 0,\n height: 0,\n};\n\n/**\n * View that moves out of the way when the keyboard appears by automatically\n * adjusting its height, position, or bottom padding.\n */\nconst KeyboardAvoidingView = forwardRef<View, React.PropsWithChildren<Props>>(\n (\n {\n behavior,\n children,\n contentContainerStyle,\n enabled = true,\n keyboardVerticalOffset = 0,\n style,\n onLayout: onLayoutProps,\n ...props\n },\n ref\n ) => {\n const initialFrame = useSharedValue<LayoutRectangle | null>(null);\n const frame = useDerivedValue(() => initialFrame.value || defaultLayout);\n\n const keyboard = useKeyboardAnimation();\n const { height: screenHeight } = useWindowDimensions();\n\n const relativeKeyboardHeight = useCallback(() => {\n 'worklet';\n\n const keyboardY =\n screenHeight - keyboard.heightWhenOpened.value - keyboardVerticalOffset;\n\n return Math.max(frame.value.y + frame.value.height - keyboardY, 0);\n }, [screenHeight, keyboardVerticalOffset]);\n\n const onLayoutWorklet = useCallback((layout: LayoutRectangle) => {\n 'worklet';\n\n if (keyboard.isClosed.value) {\n initialFrame.value = layout;\n }\n }, []);\n const onLayout = useCallback<NonNullable<ViewProps['onLayout']>>(\n (e) => {\n runOnUI(onLayoutWorklet)(e.nativeEvent.layout);\n onLayoutProps?.(e);\n },\n [onLayoutProps]\n );\n\n const animatedStyle = useAnimatedStyle(() => {\n const bottom = interpolate(\n keyboard.progress.value,\n [0, 1],\n [0, relativeKeyboardHeight()]\n );\n const bottomHeight = enabled ? bottom : 0;\n\n switch (behavior) {\n case 'height':\n if (!keyboard.isClosed.value) {\n return {\n height: frame.value.height - bottomHeight,\n flex: 0,\n };\n }\n\n return {};\n\n case 'position':\n return { bottom: bottomHeight };\n\n case 'padding':\n return { paddingBottom: bottomHeight };\n\n default:\n return {};\n }\n }, [behavior, enabled, relativeKeyboardHeight]);\n const isPositionBehavior = behavior === 'position';\n const containerStyle = isPositionBehavior ? contentContainerStyle : style;\n const combinedStyles = useMemo(\n () => [containerStyle, animatedStyle],\n [containerStyle, animatedStyle]\n );\n\n if (isPositionBehavior) {\n return (\n <View ref={ref} style={style} onLayout={onLayout} {...props}>\n <Reanimated.View style={combinedStyles}>{children}</Reanimated.View>\n </View>\n );\n }\n\n return (\n <Reanimated.View\n ref={ref}\n onLayout={onLayout}\n style={combinedStyles}\n {...props}\n >\n {children}\n </Reanimated.View>\n );\n }\n);\n\nexport default KeyboardAvoidingView;\n"],"mappings":";;;;;;AAAA;AACA;AACA;AAQA;AAA+C;AAAA;AAAA;AA4B/C,MAAMA,aAA8B,GAAG;EACrCC,CAAC,EAAE,CAAC;EACJC,CAAC,EAAE,CAAC;EACJC,KAAK,EAAE,CAAC;EACRC,MAAM,EAAE;AACV,CAAC;;AAED;AACA;AACA;AACA;AACA,MAAMC,oBAAoB,gBAAG,IAA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C,IAAI;MAAC,KAAK,EAAEgC;IAAe,GAAEvC,QAAQ,CAAmB,CAC/D;EAEX;EAEA,oBACE,6BAAC,8BAAU,CAAC,IAAI;IACd,GAAG,EAAEF,GAAI;IACT,QAAQ,EAAEO,QAAS;IACnB,KAAK,EAAEkC;EAAe,GAClBhC,KAAK,GAERP,QAAQ,CACO;AAEtB,CAAC,CACF;AAAC,eAEaJ,oBAAoB;AAAA"}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeReanimated","_useKeyboardInterpolation","_interopRequireDefault","_hooks","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","_extends","assign","bind","target","i","arguments","length","source","apply","defaultLayout","x","y","width","height","KeyboardAvoidingView","forwardRef","_ref","ref","behavior","children","contentContainerStyle","enabled","keyboardVerticalOffset","style","onLayout","onLayoutProps","props","initialFrame","useSharedValue","frame","useDerivedValue","value","keyboard","useKeyboardAnimation","screenHeight","useWindowDimensions","relativeKeyboardHeight","useCallback","keyboardY","heightWhenOpened","Math","max","interpolate","useKeyboardInterpolation","onLayoutWorklet","layout","isClosed","e","runOnUI","nativeEvent","animatedStyle","useAnimatedStyle","bottom","bottomHeight","flex","paddingBottom","isPositionBehavior","containerStyle","combinedStyles","useMemo","createElement","View","_default","exports"],"sources":["index.tsx"],"sourcesContent":["import React, { forwardRef, useCallback, useMemo } from \"react\";\nimport { View, useWindowDimensions } from \"react-native\";\nimport Reanimated, {\n runOnUI,\n useAnimatedStyle,\n useDerivedValue,\n useSharedValue,\n} from \"react-native-reanimated\";\n\nimport useKeyboardInterpolation from \"../hooks/useKeyboardInterpolation\";\n\nimport { useKeyboardAnimation } from \"./hooks\";\n\nimport type { LayoutRectangle, ViewProps } from \"react-native\";\n\ntype Props = {\n /**\n * Specify how to react to the presence of the keyboard.\n */\n behavior?: \"height\" | \"position\" | \"padding\";\n\n /**\n * Style of the content container when `behavior` is 'position'.\n */\n contentContainerStyle?: ViewProps[\"style\"];\n\n /**\n * Controls whether this `KeyboardAvoidingView` instance should take effect.\n * This is useful when more than one is on the screen. Defaults to true.\n */\n enabled?: boolean;\n\n /**\n * Distance between the top of the user screen and the React Native view. This\n * may be non-zero in some cases. Defaults to 0.\n */\n keyboardVerticalOffset?: number;\n} & ViewProps;\n\nconst defaultLayout: LayoutRectangle = {\n x: 0,\n y: 0,\n width: 0,\n height: 0,\n};\n\n/**\n * View that moves out of the way when the keyboard appears by automatically\n * adjusting its height, position, or bottom padding.\n */\nconst KeyboardAvoidingView = forwardRef<View, React.PropsWithChildren<Props>>(\n (\n {\n behavior,\n children,\n contentContainerStyle,\n enabled = true,\n keyboardVerticalOffset = 0,\n style,\n onLayout: onLayoutProps,\n ...props\n },\n ref,\n ) => {\n const initialFrame = useSharedValue<LayoutRectangle | null>(null);\n const frame = useDerivedValue(() => initialFrame.value || defaultLayout);\n\n const keyboard = useKeyboardAnimation();\n const { height: screenHeight } = useWindowDimensions();\n\n const relativeKeyboardHeight = useCallback(() => {\n \"worklet\";\n\n const keyboardY =\n screenHeight - keyboard.heightWhenOpened.value - keyboardVerticalOffset;\n\n return Math.max(frame.value.y + frame.value.height - keyboardY, 0);\n }, [screenHeight, keyboardVerticalOffset]);\n const { interpolate } = useKeyboardInterpolation();\n\n const onLayoutWorklet = useCallback((layout: LayoutRectangle) => {\n \"worklet\";\n\n if (keyboard.isClosed.value) {\n initialFrame.value = layout;\n }\n }, []);\n const onLayout = useCallback<NonNullable<ViewProps[\"onLayout\"]>>(\n (e) => {\n runOnUI(onLayoutWorklet)(e.nativeEvent.layout);\n onLayoutProps?.(e);\n },\n [onLayoutProps],\n );\n\n const animatedStyle = useAnimatedStyle(() => {\n const bottom = interpolate(keyboard.height.value, [\n 0,\n relativeKeyboardHeight(),\n ]);\n const bottomHeight = enabled ? bottom : 0;\n\n switch (behavior) {\n case \"height\":\n if (!keyboard.isClosed.value) {\n return {\n height: frame.value.height - bottomHeight,\n flex: 0,\n };\n }\n\n return {};\n\n case \"position\":\n return { bottom: bottomHeight };\n\n case \"padding\":\n return { paddingBottom: bottomHeight };\n\n default:\n return {};\n }\n }, [behavior, enabled, relativeKeyboardHeight]);\n const isPositionBehavior = behavior === \"position\";\n const containerStyle = isPositionBehavior ? contentContainerStyle : style;\n const combinedStyles = useMemo(\n () => [containerStyle, animatedStyle],\n [containerStyle, animatedStyle],\n );\n\n if (isPositionBehavior) {\n return (\n <View ref={ref} style={style} onLayout={onLayout} {...props}>\n <Reanimated.View style={combinedStyles}>{children}</Reanimated.View>\n </View>\n );\n }\n\n return (\n <Reanimated.View\n ref={ref}\n onLayout={onLayout}\n style={combinedStyles}\n {...props}\n >\n {children}\n </Reanimated.View>\n );\n },\n);\n\nexport default KeyboardAvoidingView;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,sBAAA,GAAAH,uBAAA,CAAAC,OAAA;AAOA,IAAAG,yBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAEA,IAAAK,MAAA,GAAAL,OAAA;AAA+C,SAAAI,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,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,SAAAX,wBAAAO,GAAA,EAAAI,WAAA,SAAAA,WAAA,IAAAJ,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAA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Ac,EAAEP,aAAa,CAChC,CAAC;EAED,IAAIM,kBAAkB,EAAE;IACtB,oBACEtF,MAAA,CAAAU,OAAA,CAAAgF,aAAA,CAACvF,YAAA,CAAAwF,IAAI,EAAA7D,QAAA;MAACiB,GAAG,EAAEA,GAAI;MAACM,KAAK,EAAEA,KAAM;MAACC,QAAQ,EAAEA;IAAS,GAAKE,KAAK,gBACzDxD,MAAA,CAAAU,OAAA,CAAAgF,aAAA,CAACtF,sBAAA,CAAAM,OAAU,CAACiF,IAAI;MAACtC,KAAK,EAAEmC;IAAe,GAAEvC,QAA0B,CAC/D,CAAC;EAEX;EAEA,oBACEjD,MAAA,CAAAU,OAAA,CAAAgF,aAAA,CAACtF,sBAAA,CAAAM,OAAU,CAACiF,IAAI,EAAA7D,QAAA;IACdiB,GAAG,EAAEA,GAAI;IACTO,QAAQ,EAAEA,QAAS;IACnBD,KAAK,EAAEmC;EAAe,GAClBhC,KAAK,GAERP,QACc,CAAC;AAEtB,CACF,CAAC;AAAC,IAAA2C,QAAA,GAEahD,oBAAoB;AAAAiD,OAAA,CAAAnF,OAAA,GAAAkF,QAAA"}
@@ -81,7 +81,7 @@ const KeyboardAwareScrollView = _ref => {
81
81
  * Function that will scroll a ScrollView as keyboard gets moving
82
82
  */
83
83
  const maybeScroll = (0, _react.useCallback)(function (e) {
84
- 'worklet';
84
+ "worklet";
85
85
 
86
86
  var _layout$value, _layout$value2;
87
87
  let animated = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
@@ -103,7 +103,7 @@ const KeyboardAwareScrollView = _ref => {
103
103
  return 0;
104
104
  }, [bottomOffset]);
105
105
  const onChangeText = (0, _react.useCallback)(() => {
106
- 'worklet';
106
+ "worklet";
107
107
 
108
108
  // if typing a text caused layout shift, then we need to ignore this handler
109
109
  // because this event will be handled in `useAnimatedReaction` below
@@ -125,7 +125,7 @@ const KeyboardAwareScrollView = _ref => {
125
125
  }, [onChangeTextHandler]);
126
126
  (0, _useSmoothKeyboardHandler.useSmoothKeyboardHandler)({
127
127
  onStart: e => {
128
- 'worklet';
128
+ "worklet";
129
129
 
130
130
  const keyboardWillChangeSize = keyboardHeight.value !== e.height && e.height > 0;
131
131
  const keyboardWillAppear = e.height > 0 && keyboardHeight.value === 0;
@@ -163,12 +163,12 @@ const KeyboardAwareScrollView = _ref => {
163
163
  }
164
164
  },
165
165
  onMove: e => {
166
- 'worklet';
166
+ "worklet";
167
167
 
168
168
  maybeScroll(e.height);
169
169
  },
170
170
  onEnd: e => {
171
- 'worklet';
171
+ "worklet";
172
172
 
173
173
  keyboardHeight.value = e.height;
174
174
  scrollPosition.value = position.value;