-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature(runtime): vendor Expo Router to enable partial usage (#436)
* fix(runtime): add scheme for `expo-router` internal linking * chore(runtime): vendor `expo-router` and dependencies * chore(runtime): vendor `expo-router` within the runtime * chore(runtime): linting issue * refactor(require-context): expose `createVirtualModulePath` for the Snack Runtime * refactor(runtime): replace hardcoded virtual module with `createVirtualModulePath`
- Loading branch information
Showing
11 changed files
with
292 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { ExpoRoot } from 'expo-router'; | ||
import Head from 'expo-router/head'; | ||
|
||
type ExpoRouterAppProps = { | ||
ctx: any; | ||
}; | ||
|
||
/** | ||
* Used as alternative `expo-router/entry`, that works with Snack. | ||
* Instead of registering the root component through API, this returns a component to render. | ||
*/ | ||
export function ExpoRouterApp({ ctx }: ExpoRouterAppProps) { | ||
return ( | ||
<Head.Provider> | ||
<ExpoRoot context={ctx} /> | ||
</Head.Provider> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,6 +38,15 @@ const aliases: { [key: string]: any } = { | |
|
||
// Used by @shopify/react-native-skia, on web only | ||
'@shopify/react-native-skia/lib/module/web': SkiaWeb, | ||
|
||
// Only works when vendored into the runtime ([email protected]) | ||
'expo-router': require('expo-router'), | ||
'expo-router/stack': require('expo-router/stack'), | ||
'expo-router/tabs': require('expo-router/tabs'), | ||
'expo-router/drawer': require('expo-router/drawer'), | ||
'expo-router/html': require('expo-router/html'), | ||
'expo-router/head': require('expo-router/head'), | ||
'expo-router/entry': () => {}, // noop | ||
}; | ||
|
||
export default aliases; |
Oops, something went wrong.