[React-Native Android] : On switching between two spotlight targets, the floating dialog is initially rendered in the position of previous target
Describe the bug In Android, On switching between two spotlight targets, the floating dialog is initially rendered in the position of the previous target.
To Reproduce
Steps to reproduce the behavior:
- Select the first target icon.
- Select the second target icon.
- The floating styles remain the same as before for three cycles, and then they re-render with the actual target of the second icon.
Expected behavior The floating dialog is rendered properly in the first render itself.
Screenshots
https://github.com/user-attachments/assets/6a9224a9-2e42-469d-bd42-4d1deaadece0
Context:
- OS: Android (React-Native)
- Browser : NA
- Version: @floating-ui/react-native: 0.10.6
For iOS it's wrapped in requestAnimationFrame, which may be causing the brief flicker:
https://github.com/floating-ui/floating-ui/blob/a8b7a88a73f780c59b89bb8c6e3db16ec589a43d/packages/react-native/src/useFloating.ts#L103
If you call the update() function manually, immediately upon it changing, is the issue still here?
@atomiks - Yes. However, giving the SpotLight component a Key prop and resetting the target after closing the dialog solved the issue. But the component is re-rendered 4 times. Is there any other way to fix this?
Would updating the core and utils packages to the latest be effective?