Keyboard animation can be driven not only by CASpringAnimation class. What we want to achieve is to have a single interface that gives us all necessary properties (value for a particular timing, etc.), but will incapsulate calculations of these values internally.
So in this PR I added KeyboardAnimation abstract class that uses some common properties for all animations (from/to value, speed, init time), has universal method for finding a particular timing for a given value (since we use a binary search) and defines other publicly available functions.
And in this PR I also started to use this universal interface (KeyboardAnimation) in KeyboardMovementObserver (SpringAnimation inherits from KeyboardAnimation).
π’ Changelog
iOS
added KeyboardAnimation class and KeyboardAnimationProtocol;
moved all shared logic in KeyboardAnimation class;
started to use KeyboardAnimation as a common interface for animation.
π€ How Has This Been Tested?
Tested on iPhone 11 (iOS 17.4), real device.
πΈ Screenshots (if appropriate):
No visual changes.
π Checklist
[x] CI successfully passed
[x] I added new mocks and corresponding unit-tests if library API was changed
π Description
Added
KeyboardAnimation
class (as common interface) which drives an animation of the keyboard.π‘ Motivation and Context
Follow up for https://github.com/kirillzyusko/react-native-keyboard-controller/pull/412
Keyboard animation can be driven not only by
CASpringAnimation
class. What we want to achieve is to have a single interface that gives us all necessary properties (value for a particular timing, etc.), but will incapsulate calculations of these values internally.So in this PR I added
KeyboardAnimation
abstract class that uses some common properties for all animations (from/to value, speed, init time), has universal method for finding a particular timing for a given value (since we use a binary search) and defines other publicly available functions.And in this PR I also started to use this universal interface (
KeyboardAnimation
) inKeyboardMovementObserver
(SpringAnimation
inherits fromKeyboardAnimation
).π’ Changelog
iOS
KeyboardAnimation
class andKeyboardAnimationProtocol
;KeyboardAnimation
class;KeyboardAnimation
as a common interface foranimation
.π€ How Has This Been Tested?
Tested on iPhone 11 (iOS 17.4), real device.
πΈ Screenshots (if appropriate):
No visual changes.
π Checklist