prscX / react-native-tooltips

React Native: Native Tooltip View
Apache License 2.0
271 stars 40 forks source link

Android: View.getParent() on a null object reference #12

Closed StevenMasini closed 5 years ago

StevenMasini commented 5 years ago

Hi @prscX

I found out a crash on Android when the reference props provided on the javascript side has not been acknowledged yet by react native.

In react native, references to component are only known after the first call to the render method.

On Android when final ViewGroup target = activity.findViewById(view); receive an non-existent id, target will then be null. Of course null object don't have access to the method getParent and will trigger an exception.

On iOS I suppose that's not an issue as the method presentFromView might be protected from receiving Nil.

I will submit a Pull Request that fix this issue for Android.

prscX commented 5 years ago

Thanks @StevenMasini for reporting the issue and sharing the detailed root cause.

I have merged the PR.

Thanks </ Pranav >

StevenMasini commented 5 years ago

I think we can close this issue.

prscX commented 5 years ago

Thanks @StevenMasini. Closed 😄

Thanks </ Pranav >