Test hooks on “keyboardDidShow” in React Native Functional Component

Update 01/05/2021

Updated testing code using @testing-library/react-native
Source code for the sample component

Tricky Part I

Workaround for Tricky Part I

Testing code using enzyme and various mocking
{
keyboardDidShow: [Function: _keyboardDidShow],
keyboardDidHide: [Function: _keyboardDidHide]
}

Tricky Part II

Workaround for Tricky Part II

Other Tests

Conclusion

Hi, I am from the Earth. And you?

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store