Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 this issue May 28, 2024 · 3 comments

Comments

@AmraneAchraf1
Copy link

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
Copy link
Author

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 (



);
}

@surrenderios
Copy link

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
Copy link

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:
#304

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants