react-native-community/hooks

null is not an object (evaluating e.endCoordinates)

weinbergdavid opened this issue · 1 comments

Bug

I use useKeyboard hook, and when the keyboard is closing I got an error null is not an object (evaluating e.endCoordinates).

Screenshot_20190827-124808

Environment info

React native info output:

info
  React Native Environment Info:
    System:
      OS: Windows 10
      CPU: (4) x64 Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz
      Memory: 5.21 GB / 15.88 GB
    Binaries:
      Yarn: 1.16.0 - C:\Users\David\Projects\WI\personalized-nutrition-app\node_modules\.bin\yarn.CMD
      npm: 6.5.0 - C:\Program Files\nodejs\npm.CMD
    IDEs:
      Android Studio: Version  3.0.0.0 AI-171.4408382

Done in 3.07s.

Library version: 0.9.0

Steps To Reproduce

  1. Add useKeyboard. show a text only if the keyboard is close.
  2. Open the keyboard.
  3. After you close the keyboard you got the error and the text still hidden.

Describe what you expected to happen:

  1. I expect that the text will appear again.

Reproducible sample code

import { useKeyboard } from 'react-native-hooks'
...
const { isKeyboardShow } = useKeyboard()
return (

{!isKeyboardShow && Test useKeyboard}

</View>

)

Possible fix:

Instead of writing endCoordinates: e.endCoordinates, write endCoordinates: e ? e.endCoordinates : null,

Which RN version is this happening on? Is this still relevant? Also, could you try with the latest @react-native-community/hooks?