I'm working on synchronizing a text input field with the iOS / Android system keyboards so that it sticks to the top of the keyboard, in the documentation for the react native Keyboard module it mentions this method:
scheduleLayoutAnimation
static scheduleLayoutAnimation(event)Useful for syncing TextInput (or other keyboard accessory view) size of position changes with keyboard movements.
However I can't seem to find any further documentation or examples thus far, and my current implementation
Keyboard.scheduleLayoutAnimationscheduleLayoutAnimation((event: any ) => {
console.log('[TextEditor] keyboard event:', event)
})
Throw the following error:
ExceptionsManager.js:179 TypeError: _reactNative.Keyboard.scheduleLayoutAnimationscheduleLayoutAnimation is not a function
Does any one have any experience with this method?
I'm currently on React Native 0.63.3 and testing on iOS 14.2, any help would be greatly appreciated, thanks!
Edit
I was able to get the function signature by calling:
Keyboard.scheduleLayoutAnimationscheduleLayoutAnimation.toString()
Which yields this definition:
function (event) {
var duration = event.duration,
easing = event.easing;
if (duration != null && duration !== 0) {
LayoutAnimation.configureNext({
duration: duration,
update: {
duration: duration,
type: easing != null && LayoutAnimation.Types[easing] || 'keyboard'
}
});
}
}
Maybe this is an issue with strict mode in TypeScript?