react-native-walkthrough-tooltip icon indicating copy to clipboard operation
react-native-walkthrough-tooltip copied to clipboard

After misrender tooltip keeps flicking on screen

Open ghost opened this issue 3 years ago • 13 comments

I noticed that trying to render a tooltip with bottom placement when it hasn't enough space to be rendered will cause some strange behavior after closing and opening it again. It will start flickering, but only on the very first render after the "misrender".

https://user-images.githubusercontent.com/47385105/113450719-d1f96900-93d6-11eb-9787-e94bf280b278.mov

Any idea how to implement a placement auto? I saw that there was a feature like that but IDK why it was removed.

ghost avatar Apr 02 '21 20:04 ghost

I am also facing the same issue. Are you able to solve it @emilioheinz

Manya-96 avatar Jun 04 '21 07:06 Manya-96

@Manya-96 No I wasn't 😕

ghost avatar Jun 12 '21 00:06 ghost

Any other solution you tried for this issue? @emilioheinz

Manya-96 avatar Aug 12 '21 09:08 Manya-96

Bump. I also see flickering on Android (but not iOS).

jzxchiang1 avatar Sep 25 '21 18:09 jzxchiang1

I also have the same issue, any solution? @jasongaare

tamir61 avatar Oct 07 '21 14:10 tamir61

Even after upgrading the plugin to the latest version i.e. 1.3.0, the issue still remains. Sadly, I am now looking for an alternative to this plugin.

Ashutosh-Tiwari avatar Dec 30 '21 13:12 Ashutosh-Tiwari

Does anyone have a simple project that reproduces this issues reliably? Something where we could simply:

  1. clone project
  2. npm install
  3. npm start

and see the issue? If so, then we might as a community be able to narrow down the problem and solve it together.

This project is pure JS, so it isn't like we need to get into Objective-C and Kotlin.

gregfenton avatar Dec 30 '21 16:12 gregfenton

Any news on this? Have the same problem on iPhone 11 only running IOS 13. setup: RN - 0.66.4 react-native-walkthrough-tooltip - 1.3.0

https://user-images.githubusercontent.com/60711866/154830546-42ce634c-cfc5-460c-aa2f-25258f42ed78.mov

oregev avatar Feb 20 '22 05:02 oregev

the same issue, any solutions for this @oregev ?

Pakile avatar Mar 23 '22 14:03 Pakile

Same issue, Any solution?

Dassine avatar Jul 05 '22 15:07 Dassine

The issue my team was seeing is slightly different than the above, but the below patch seems to be doing the trick for us. Perhaps something similar would help someone else. :)

diff --git a/node_modules/react-native-walkthrough-tooltip/src/tooltip.js b/node_modules/react-native-walkthrough-tooltip/src/tooltip.js
index 4de1852..076b99f 100644
--- a/node_modules/react-native-walkthrough-tooltip/src/tooltip.js
+++ b/node_modules/react-native-walkthrough-tooltip/src/tooltip.js
@@ -226,8 +226,12 @@ class Tooltip extends Component {
 
   measureContent = e => {
     const { width, height } = e.nativeEvent.layout;
-    const contentSize = new Size(width, height);
-    this.setState({ contentSize }, () => {
+    const newContentSize = new Size(width, height);
+    this.setState(({ contentSize }) => ({
+      contentSize: {
+        width: Math.max(contentSize.width, newContentSize.width),
+        height: Math.max(contentSize.height, newContentSize.height),
+      }}), () => {
       this.computeGeometry();
     });
   };

Possibly related but didn't investigate too far: https://github.com/facebook/react-native/issues/31876

tailorem avatar Sep 09 '22 17:09 tailorem

Thanks @tailorem works well.

codal-mpawar avatar Jan 12 '23 07:01 codal-mpawar

Is this patch above going to be implemented in this project?

tsachit avatar Feb 13 '24 11:02 tsachit

Also facing this issue. I have a state change that triggers a scroll to the tooltip's location and was also controlling the Tooltip's isVisible. My hacky fix has been use setTimeout to delay showing the tooltip by 300-400ms to allow time for the scroll to occur. Also would be interested in getting @tailorem's fix into the package

useEffect(() => {
  scrollRef.({
    y: locations[tutorial.step]
  })
}, [tutorial.step])

then my Tooltip has

  const [open, setOpen] = useState(false)

  useEffect(() => {
    if (tutorial.step === TutorialStep.USER_TAKES) {
      const timeout = setTimeout(() => {
        setOpen(true)
      }, 400)
      return () => clearTimeout(timeout)
    } else {
      setOpen(false)
    }
  }, [tutorial.step])
...
  <Tooltip
    isVisible={open}
    ...
  />

jyaconelli avatar Apr 17 '24 17:04 jyaconelli