prscX / react-native-tooltips

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

Missing parent view reference in both iOS/Android #14

Closed StevenMasini closed 5 years ago

StevenMasini commented 5 years ago

Hi @prscX me again,

While I was investigating two different bug on iOS and Android, I found out that they actually share the same root cause.

  1. On iOS the tooltip goes off screen if display around an element which is close to the border of the screen
  2. On Android the tooltip appear but will stay on the screen even if the user goes to another page.

The root cause of these two issues is that the library don't require the parent view reference on the javascript side. Which should add a prop to retrieve the parent view reference.

I am also working on PR for this right now.

prscX commented 5 years ago

Thanks @StevenMasini for sharing the issue and solution. I will merge the PR.

Thanks </ Pranav >

StevenMasini commented 5 years ago

I am still working on the PR and testing my changes on my own project.

For now iOS work very well, even solved another bug that I didn't expect, but I will give more detail in the PR.

For android I am blocked with a bug which I think is related to this issue from react-native.

To make it simple, the method findNodeHandle does not return the right viewId to the android native side, which cause findViewById to return null.

For now there is not much I can do to solve this bug, but at least the library does not make the app crash thanks to my previous commit #13

I will try to update to the latest version of react native 0.57 (for now I am still using 0.55.4) and see if I still have this issue. If so I will open an issue there to see if we can fix it.

prscX commented 5 years ago

Hi @StevenMasini:

For Android you need to add collapasable:false props to the view you are targeting. Basically for performance improvement RN is not maintaining view tree map in native for the container views.

But if you add collapasable:false it will start working. Please refer below link for the detailed explanation:

RNView

Please let me know incase it does not works.

Thanks </ Pranav >

StevenMasini commented 5 years ago

@prscX You was right, there is a correlation between this optimization and the issue that findNodeHandle has to retrieve correct viewId. This helped me to solve some issues I had in my own project. We should probably mention it in the documentation.

I am going to submit my PR soon for this issue. Review it carefully and let me know if you want to add any change to it.

StevenMasini commented 5 years ago

@prscX I close this issue as the branch #16 has been merged.