mohebifar / react-native-copilot

Step-by-step walkthrough tooltip for your react native app
MIT License
2.22k stars 406 forks source link

Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()? #321

Open AmraneAchraf1 opened 3 months ago

AmraneAchraf1 commented 3 months ago

ERROR Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?

  • expo 51
  • expo router
AmraneAchraf1 commented 3 months ago

const CopilotText = walkthroughable(Text);

const HomeScreen = () => { const { start } = useCopilot(); const ref = useRef(null);

return (

Hello world!
surrenderios commented 2 months ago

Use React Native inner components, for example, Text, Image, etc.

If you use your custom component, you should recursively pass copilot to children.

See the example: GitHub Issue

surrenderios commented 2 months ago

const CopilotText = walkthroughable(Text);

const HomeScreen = () => { const { start } = useCopilot(); const ref = useRef(null);

return ( Hello world! <Button title="Start" onPress={() => start()} /> ); };

export default function TabOneScreen() { return ( ); }

example: https://github.com/mohebifar/react-native-copilot/issues/304