Is there a way to await in getStateFromPath in react-navigation?

Viewed 79

I'm using a custom getStateFromPath function to resolve my paths to a state, though to resolve some of the path routes, I need to make an api request to a router endpoint.

Is there any way I can create an async getStateFromPath or achieve the desired effect ?

e.g. something like this would do the trick

const linking = {
  prefixes: ['https://example.com', 'example://'],
  config: {},
  getStateFromPath: async () => {
     const screenName = await getScreenName()
     return {
        routes: [{name: screenName}]
     }
  }
}
0 Answers
Related