react-component / tooltip

React Tooltip
http://react-component.github.io/tooltip/
MIT License
924 stars 188 forks source link

`align` props not working after `v6`, and some tooltips are not working because of ref bug #439

Closed xsjcTony closed 1 year ago

xsjcTony commented 1 year ago

align: The below code is not positioning the tooltip correctly in v6, where v5 does: image

For tooltip that is not working, I got the following errors in console:

It should be mainly because of the first ref one image

tomasztomys commented 1 year ago

v6 in my case: Uncaught TypeError: _tooltipRef$current.forcePopupAlign is not a function

zombieJ commented 1 year ago

targetOffset is removed in latest @rc-component/trigger. For ref error, let me check.

xsjcTony commented 1 year ago

targetOffset is removed in latest @rc-component/trigger. For ref error, let me check.

Thanks for that. If targetOffset is not valid anymore, should we remove the TypeScript declaration for such prop? And also is there any way to achieve the same effect as targetOffset previously did?

zombieJ commented 1 year ago

Yes. It should be clean up

xsjcTony commented 1 year ago

嗯嗯好的。那请问下现在该怎么去改变他的定位呢?有没有什么prop可以透传给trigger? 文档好像很久没更新了, TS定义也靠不住了🫠😭

zombieJ commented 1 year ago

current is forceAlign, ~let me compatible for forcePopupAlign~

Seems it's better to declear Tooltip ref this time instead. Since origin is any type.

xsjcTony commented 1 year ago

@zombieJ Hey, thanks for the fix, but the issue still exists. Or if you want me to open a separate ticket, I can do it.

I made a minimal reproduction: https://stackblitz.com/edit/vitejs-vite-8228fq?file=src/App.tsx

If you open the console, you will see this error, and I think it's the reason the tooltip is not working correctly (where you can try by hovering on the icon and unhover). The same approach is working correctly in v5.3.1, but after I upgraded to v6, it breaks, so it's preventing me from upgrading to v6 :( image

xsjcTony commented 1 year ago

And also I still can't figure out how to use forceAlign to achieve the same effect targetOffset previously does:(

Is there any documentation on it? thanks.

zombieJ commented 1 year ago

targetOffset is removed which not can realize by forceAlign. For the reproduce, let me check ref issue.

xsjcTony commented 1 year ago

@zombieJ Thanks for the inspection. But what I mean is, I realize that targetOffset has been removed, so do you mean there's no way to achieve what targetOffset is doing before it's getting removed? Or do we have some alternative way to achieve the same effect? I can't find any documentation related to it :(

zombieJ commented 1 year ago

Since we do not use targetOffset prop, I though this is useless. But for your feedback, I think it should be add back. But not promise the deadline, it will back in some feature minor version.

xsjcTony commented 1 year ago

Oh, thanks a lot for that. That would be really helpful if it can be added back.

xsjcTony commented 1 year ago

@zombieJ Hey, appreciated the fix but it seems still not working for me. Can you please inspect the following:

Regarding the ref issue, yes it has been fixed, but the React icon is still not getting popup properly (it works in v5)

Regarding the targetOffset, I can see it has been added back, but it's not taking effect.

I've prepared two reproductions with exactly the same code, except one is v6 and another is v5 for you to compare.

v6: https://stackblitz.com/edit/vitejs-vite-8228fq?file=src/App.tsx v5: https://stackblitz.com/edit/vitejs-vite-jelnh4?file=src/App.tsx

Appreciate it!

xsjcTony commented 1 year ago

@zombieJ Hey sorry to bother, but can you please have a look at my reproduction above,, as I confirmed just now both targetOffset and tooltip on icon are still broken.

xsjcTony commented 1 year ago

Please refer to #444 since this ticket is no longer active, thanks.