I am using react native 0.64, I want to load my profile screen from home screen without using navigation. Is it possible? Can anyone help?
- import profile screen in home screen and then use the profile component like this => <Profile />MehdiNasiriPoor– MehdiNasiriPoor2022-09-18 06:48:16 +00:00Commented Sep 18, 2022 at 6:48
- isn't it for component? I want to stay at the home screen. But want to render the profile screen from home. But the way you prescribed will show the profile component in the home page which I don't want to showkawsar ahmad– kawsar ahmad2022-09-18 06:54:38 +00:00Commented Sep 18, 2022 at 6:54
Add a comment |
1 Answer
You should use a state for represent home or profile. for ex:
function HomeScreen() { const [screenName, setScreenName] = useState('home') if (screenName == 'profile') { return <ProfileScreen/> } return { ... // handling the event to go Profile screen setScreenName('profile') ... } } 1 Comment
kawsar ahmad
Thanks for replying. But That's not What I wanted. I have a screen called speedtest screen which load okla custom speedtest webview, basically, it takes a much longer time to load. So, I wanted to load speedtest screen as soon as user logged in(without navigating) user will stay at home screen.