prscX / react-native-tooltips

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

New tooltip appear each time render is triggered #10

Closed StevenMasini closed 5 years ago

StevenMasini commented 5 years ago

Hi Pranav, me again ^^

Actually the first time I integrated the library into my project, I noticed that a new tooltip will be created and display each time the render method of my container is triggered.

In order to avoid this issue I had to change the class extended by RNTooltip from Component to PureComponent.

PureComponent will perform a shallow compare into shouldComponentUpdate method in order to reduce the amount of useless re-render.

This is an easy fix, I can submit a Pull Request for this if you want ?

prscX commented 5 years ago

Thanks @StevenMasini for the effort and sharing the solution.

I believe shared solution is the best approach in order to fix this issue. Please share a PR for the same.

Thanks </ Pranav >

StevenMasini commented 5 years ago

11

prscX commented 5 years ago

Thanks @StevenMasini for the effort and PR.

I have merged and released a build with the same. Can you please install and verify the same.

Thanks </ Pranav >

StevenMasini commented 5 years ago

Well it wasn't much, but I am glad I could help ^^