Search code examples
react-nativeroutesexporeact-native-web

How to get the current page's full url in React Native Web Expo?


A url to my website could be e.g. custom.mywebsite.com or custom2.mywebsite.com. How can I get the full url of this current page that contains 'custom.mywebsite.com' in my React Native for Web app?


Solution

  • Using Expo Linking you can get the full URL on app launch by calling

    Linking.getInitialURL().then((url) => {
        console.log(url);
    });