diff --git a/TODO b/TODO index e845126fe..9f3e2f99a 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,5 @@ - (x) close after interactive gesture - sudden jump of 75 pixels -> fixed by detaching iav during `onInteractive` - (x) keyboard hidden -> remove inputAccessoryView - done in resignFirstResponder - (x) iOS 16 - after attaching fake iav we dispatch onEnd with height - 248 (298 - 50) -> ignore events after attaching iav, because in keyboardDidAppear `position` can be a random value (291 or 341) +- (x) text input grow -> can not make interactive gesture (Optional(424.6666666666667) 424.66666666666674) - maybe because of frequent conversions to CGFloat? <- fixed via rounding - show after interactive - keyboard height is 386 -- text input grow -> can not make interactive gesture (Optional(424.6666666666667) 424.66666666666674) - maybe because of frequent conversions to CGFloat? diff --git a/ios/interactive/InvisibleInputAccessoryView.swift b/ios/interactive/InvisibleInputAccessoryView.swift index 7ccd52b37..5ed838730 100644 --- a/ios/interactive/InvisibleInputAccessoryView.swift +++ b/ios/interactive/InvisibleInputAccessoryView.swift @@ -36,6 +36,11 @@ public class InvisibleInputAccessoryView: UIView { layoutIfNeeded() } + public func hide() { + updateHeight(to: 0.0) + superview?.layoutIfNeeded() + } + override public var intrinsicContentSize: CGSize { return CGSize(width: UIView.noIntrinsicMetric, height: frame.height) } diff --git a/ios/observers/KeyboardMovementObserver.swift b/ios/observers/KeyboardMovementObserver.swift index f01dde99f..d4b231239 100644 --- a/ios/observers/KeyboardMovementObserver.swift +++ b/ios/observers/KeyboardMovementObserver.swift @@ -138,7 +138,7 @@ public class KeyboardMovementObserver: NSObject { print("\(keyboardView?.bounds.size.height) \(_keyboardHeight)") // if keyboard height is not equal to its bounds - we can ignore // values, since they'll be invalid and will cause UI jumps - if (keyboardView?.bounds.size.height ?? 0) != _keyboardHeight { + if floor(keyboardView?.bounds.size.height ?? 0) != floor(_keyboardHeight) { return } @@ -164,8 +164,7 @@ public class KeyboardMovementObserver: NSObject { prevKeyboardPosition = position // TODO: needs here? Why in onStart/onEnd after interactive gesture we get keyboard height as 386? - (UIResponder.current?.inputAccessoryView as? InvisibleInputAccessoryView)?.updateHeight(to: 0) - UIResponder.current?.inputAccessoryView?.superview?.layoutIfNeeded() + (UIResponder.current?.inputAccessoryView as? InvisibleInputAccessoryView)?.hide() /// onEvent( "onKeyboardMoveInteractive", diff --git a/ios/swizzling/UIResponderSwizzle.swift b/ios/swizzling/UIResponderSwizzle.swift index e1f8d3bbd..735b3b136 100644 --- a/ios/swizzling/UIResponderSwizzle.swift +++ b/ios/swizzling/UIResponderSwizzle.swift @@ -31,8 +31,7 @@ extension UIResponder { print("Performing custom actions before the original resignFirstResponder") if let textField = self as? TextInput { - (textField.inputAccessoryView as? InvisibleInputAccessoryView)?.updateHeight(to: 0) - textField.inputAccessoryView?.superview?.layoutIfNeeded() + (textField.inputAccessoryView as? InvisibleInputAccessoryView)?.hide() } // Postpone execution of the original resignFirstResponder