|
| 1 | +diff --git a/node_modules/react-native-keyboard-controller/ios/animations/SpringAnimation.swift b/node_modules/react-native-keyboard-controller/ios/animations/SpringAnimation.swift |
| 2 | +index 8712c29..ddfb495 100644 |
| 3 | +--- a/node_modules/react-native-keyboard-controller/ios/animations/SpringAnimation.swift |
| 4 | ++++ b/node_modules/react-native-keyboard-controller/ios/animations/SpringAnimation.swift |
| 5 | +@@ -31,6 +31,7 @@ public final class SpringAnimation: KeyboardAnimation { |
| 6 | + private let initialVelocity: Double |
| 7 | + |
| 8 | + init(animation: CASpringAnimation, fromValue: Double, toValue: Double) { |
| 9 | ++ print("kav::spring \(animation) | \(fromValue) -> \(toValue)") |
| 10 | + stiffness = animation.stiffness |
| 11 | + damping = animation.damping |
| 12 | + mass = animation.mass |
| 13 | +diff --git a/node_modules/react-native-keyboard-controller/ios/animations/TimingAnimation.swift b/node_modules/react-native-keyboard-controller/ios/animations/TimingAnimation.swift |
| 14 | +index 7120bdb..7dd38bd 100644 |
| 15 | +--- a/node_modules/react-native-keyboard-controller/ios/animations/TimingAnimation.swift |
| 16 | ++++ b/node_modules/react-native-keyboard-controller/ios/animations/TimingAnimation.swift |
| 17 | +@@ -20,6 +20,7 @@ public final class TimingAnimation: KeyboardAnimation { |
| 18 | + private let p2: CGPoint |
| 19 | + |
| 20 | + init(animation: CABasicAnimation, fromValue: Double, toValue: Double) { |
| 21 | ++ print("kav::timing \(animation) | \(fromValue) -> \(toValue)") |
| 22 | + let timingFunction = animation.timingFunction |
| 23 | + var controlPoints: ContiguousArray<Float> = ContiguousArray([0, 0, 0, 0]) |
| 24 | + timingFunction?.getControlPoint(at: 1, values: &controlPoints[0]) |
| 25 | +diff --git a/node_modules/react-native-keyboard-controller/ios/observers/movement/KeyboardTrackingView.swift b/node_modules/react-native-keyboard-controller/ios/observers/movement/KeyboardTrackingView.swift |
| 26 | +index dc07c23..813b377 100644 |
| 27 | +--- a/node_modules/react-native-keyboard-controller/ios/observers/movement/KeyboardTrackingView.swift |
| 28 | ++++ b/node_modules/react-native-keyboard-controller/ios/observers/movement/KeyboardTrackingView.swift |
| 29 | +@@ -40,9 +40,11 @@ public final class KeyboardTrackingView: UIView { |
| 30 | + |
| 31 | + private func setup() { |
| 32 | + // for debug purposes |
| 33 | +- // self.backgroundColor = .red |
| 34 | +- isUserInteractionEnabled = false |
| 35 | +- isHidden = true |
| 36 | ++ self.backgroundColor = .red |
| 37 | ++ // 10 px height |
| 38 | ++ self.frame = CGRect(x: 0, y: 0, width: 1, height: 2) |
| 39 | ++ // isUserInteractionEnabled = false |
| 40 | ++ // isHidden = true |
| 41 | + |
| 42 | + NotificationCenter.default.addObserver( |
| 43 | + self, |
| 44 | +@@ -87,7 +89,7 @@ public final class KeyboardTrackingView: UIView { |
| 45 | + leadingAnchor.constraint(equalTo: topView.leadingAnchor, constant: 0), |
| 46 | + trailingAnchor.constraint(equalTo: topView.trailingAnchor, constant: 0), |
| 47 | + bottomAnchor.constraint(equalTo: topView.keyboardLayoutGuide.topAnchor, constant: 0), |
| 48 | +- heightAnchor.constraint(equalToConstant: 0), |
| 49 | ++ heightAnchor.constraint(equalToConstant: 2), |
| 50 | + ]) |
| 51 | + } |
| 52 | + isAttaching = false |
| 53 | +diff --git a/node_modules/react-native-keyboard-controller/ios/observers/movement/observer/KeyboardMovementObserver+Watcher.swift b/node_modules/react-native-keyboard-controller/ios/observers/movement/observer/KeyboardMovementObserver+Watcher.swift |
| 54 | +index 53148a6..4001123 100644 |
| 55 | +--- a/node_modules/react-native-keyboard-controller/ios/observers/movement/observer/KeyboardMovementObserver+Watcher.swift |
| 56 | ++++ b/node_modules/react-native-keyboard-controller/ios/observers/movement/observer/KeyboardMovementObserver+Watcher.swift |
| 57 | +@@ -22,6 +22,8 @@ extension KeyboardMovementObserver { |
| 58 | + } |
| 59 | + |
| 60 | + @objc func updateKeyboardFrame(link: CADisplayLink) { |
| 61 | ++ print("kav 1") |
| 62 | ++ |
| 63 | + if keyboardTrackingView.view == nil { |
| 64 | + return |
| 65 | + } |
| 66 | +@@ -29,11 +31,16 @@ extension KeyboardMovementObserver { |
| 67 | + let (visibleKeyboardHeight, keyboardFrameY) = keyboardTrackingView.view.frameTransitionInWindow |
| 68 | + var keyboardPosition = visibleKeyboardHeight - KeyboardAreaExtender.shared.offset |
| 69 | + |
| 70 | ++ print("kav 2 \(keyboardPosition) \(prevKeyboardPosition) \(keyboardFrameY)") |
| 71 | ++ |
| 72 | + if keyboardPosition == prevKeyboardPosition || keyboardFrameY == 0 { |
| 73 | + return |
| 74 | + } |
| 75 | + |
| 76 | ++ print("kav 3") |
| 77 | ++ |
| 78 | + if animation == nil { |
| 79 | ++ print("kav - initialize animation: \(prevKeyboardPosition) -> \(keyboardHeight)") |
| 80 | + initializeAnimation(fromValue: prevKeyboardPosition, toValue: keyboardHeight) |
| 81 | + } |
| 82 | + |
| 83 | +@@ -61,6 +68,8 @@ extension KeyboardMovementObserver { |
| 84 | + keyboardPosition = race(position, keyboardPosition) |
| 85 | + } |
| 86 | + |
| 87 | ++ print("kav 4 \(keyboardPosition)") |
| 88 | ++ |
| 89 | + onEvent( |
| 90 | + "onKeyboardMove", |
| 91 | + keyboardPosition as NSNumber, |
| 92 | +diff --git a/node_modules/react-native-keyboard-controller/src/components/KeyboardAvoidingView/hooks.ts b/node_modules/react-native-keyboard-controller/src/components/KeyboardAvoidingView/hooks.ts |
| 93 | +index 4d504fe..c6a5bab 100644 |
| 94 | +--- a/node_modules/react-native-keyboard-controller/src/components/KeyboardAvoidingView/hooks.ts |
| 95 | ++++ b/node_modules/react-native-keyboard-controller/src/components/KeyboardAvoidingView/hooks.ts |
| 96 | +@@ -7,7 +7,7 @@ import { useKeyboardHandler } from "../../hooks"; |
| 97 | + |
| 98 | + const OS = Platform.OS; |
| 99 | + |
| 100 | +-export const useKeyboardAnimation = () => { |
| 101 | ++export const useKeyboardAnimation = (testId) => { |
| 102 | + const { reanimated } = useKeyboardContext(); |
| 103 | + |
| 104 | + const heightWhenOpened = useSharedValue(0); |
| 105 | +@@ -24,6 +24,8 @@ export const useKeyboardAnimation = () => { |
| 106 | + height.value = initialHeight; |
| 107 | + progress.value = initialProgress; |
| 108 | + isClosed.value = initialProgress === 0; |
| 109 | ++ |
| 110 | ++ console.debug("kav-hook", "effect", testId, initialHeight); |
| 111 | + }, []); |
| 112 | + |
| 113 | + useKeyboardHandler( |
| 114 | +@@ -31,6 +33,8 @@ export const useKeyboardAnimation = () => { |
| 115 | + onStart: (e) => { |
| 116 | + "worklet"; |
| 117 | + |
| 118 | ++ console.debug("kav-hook", "onStart", testId, e.height); |
| 119 | ++ |
| 120 | + if (e.height > 0) { |
| 121 | + isClosed.value = false; |
| 122 | + heightWhenOpened.value = e.height; |
| 123 | +@@ -39,6 +43,8 @@ export const useKeyboardAnimation = () => { |
| 124 | + onMove: (e) => { |
| 125 | + "worklet"; |
| 126 | + |
| 127 | ++ console.debug("kav-hook", "onMove", testId, e.height, e.progress); |
| 128 | ++ |
| 129 | + progress.value = e.progress; |
| 130 | + height.value = e.height; |
| 131 | + }, |
| 132 | +@@ -51,13 +57,15 @@ export const useKeyboardAnimation = () => { |
| 133 | + onEnd: (e) => { |
| 134 | + "worklet"; |
| 135 | + |
| 136 | ++ console.debug("kav-hook", "onEnd", testId, e.height); |
| 137 | ++ |
| 138 | + isClosed.value = e.height === 0; |
| 139 | + |
| 140 | + height.value = e.height; |
| 141 | + progress.value = e.progress; |
| 142 | + }, |
| 143 | + }, |
| 144 | +- [], |
| 145 | ++ [testId], |
| 146 | + ); |
| 147 | + |
| 148 | + return { height, progress, heightWhenOpened, isClosed }; |
| 149 | +diff --git a/node_modules/react-native-keyboard-controller/src/components/KeyboardAvoidingView/index.tsx b/node_modules/react-native-keyboard-controller/src/components/KeyboardAvoidingView/index.tsx |
| 150 | +index ba162c2..7bfed06 100644 |
| 151 | +--- a/node_modules/react-native-keyboard-controller/src/components/KeyboardAvoidingView/index.tsx |
| 152 | ++++ b/node_modules/react-native-keyboard-controller/src/components/KeyboardAvoidingView/index.tsx |
| 153 | +@@ -87,6 +87,7 @@ const KeyboardAvoidingView = forwardRef< |
| 154 | + keyboardVerticalOffset = 0, |
| 155 | + style, |
| 156 | + onLayout: onLayoutProps, |
| 157 | ++ testID, |
| 158 | + ...props |
| 159 | + }, |
| 160 | + ref, |
| 161 | +@@ -95,7 +96,7 @@ const KeyboardAvoidingView = forwardRef< |
| 162 | + const frame = useDerivedValue(() => initialFrame.value || defaultLayout); |
| 163 | + |
| 164 | + const { translate, padding } = useTranslateAnimation(); |
| 165 | +- const keyboard = useKeyboardAnimation(); |
| 166 | ++ const keyboard = useKeyboardAnimation(testID); |
| 167 | + const { height: screenHeight } = useWindowDimensions(); |
| 168 | + |
| 169 | + const relativeKeyboardHeight = useCallback(() => { |
| 170 | +@@ -146,6 +147,9 @@ const KeyboardAvoidingView = forwardRef< |
| 171 | + const bottom = interpolateToRelativeKeyboardHeight( |
| 172 | + keyboard.progress.value, |
| 173 | + ); |
| 174 | ++ |
| 175 | ++ console.log("kav-style", keyboard.progress.value, bottom); |
| 176 | ++ |
| 177 | + const translateY = interpolateToRelativeKeyboardHeight(translate.value); |
| 178 | + const paddingBottom = interpolateToRelativeKeyboardHeight(padding.value); |
| 179 | + const height = frame.value.height - bottom; |
0 commit comments