-
Notifications
You must be signed in to change notification settings - Fork 1.5k
fix(generate): add support for Expo Router app directory prompts #2905
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
Merged
markrickert
merged 20 commits into
feat/expo-sdk-53
from
cdanwards/2903-expo-router-screen-generator
Jun 23, 2025
Merged
Changes from 18 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
a650053
fix(generate): add support for Expo Router app directory prompts for …
cdanwards 01d8bdb
Adds check for destinationDir in frontmatter or overwrite
cdanwards a405cc7
Update message to say screen
cdanwards 4111b3f
Removed warning for front-matter and updated check for expo-router
cdanwards 87f20e8
Settled on checking the package.json for the expo-router
cdanwards 65480fb
docs(generate): enhance comment to clarify Expo Router app detection …
fpena 6ed7bd8
Adress PR feedback
fpena 8104282
fix(generate): improve directory prompt for Expo Router apps by dynam…
fpena 488c334
fix(generate): update warning message to reflect dynamic directory as…
fpena b98feb0
Improve code with prettier format
fpena 47661ca
fix(generate): set initial value for directory prompt in Expo Router …
fpena ad512b9
Merge branch 'master' into cdanwards/2903-expo-router-screen-generator
jamonholmgren 27b599b
Merge branch 'master' into cdanwards/2903-expo-router-screen-generator
frankcalise 4fad5d1
fix(boilerplate): update expo-router generator templates
frankcalise df10e5a
fix(cli): new route generator template for expo-router
frankcalise 52c2328
fix(cli): non barrel generator template import paths
frankcalise a99f356
chore: merge branch 'feat/expo-sdk-53' into cdanwards/2903-expo-route…
frankcalise c2b3839
refactor: pull out mst
frankcalise a8c4d64
fix(cli): router screen tpl imports
frankcalise e1e8f31
fix(cli): less duped expo-router code
frankcalise File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
| @@ -1,84 +1,5 @@ | ||
| import { Image, ImageStyle, TextStyle, View, ViewStyle } from "react-native" | ||
| import { WelcomeScreen } from '@/screens/WelcomeScreen' | ||
|
|
||
| import { Screen } from "@/components/Screen" | ||
| import { Text } from "@/components/Text" | ||
| import { isRTL } from "@/i18n" | ||
| import { ThemedStyle } from "@/theme" | ||
| import { useAppTheme } from "@/utils/useAppTheme" | ||
| import { useSafeAreaInsetsStyle } from "@/utils/useSafeAreaInsetsStyle" | ||
|
|
||
| const welcomeLogo = require("@assets/images/logo.png") | ||
| const welcomeFace = require("@assets/images/welcome-face.png") | ||
|
|
||
| export default function WelcomeScreen() { | ||
| const $bottomContainerInsets = useSafeAreaInsetsStyle(["bottom"]) | ||
| const { theme, themed } = useAppTheme() | ||
|
|
||
| return ( | ||
| <Screen safeAreaEdges={["top"]} contentContainerStyle={themed($container)}> | ||
| <View style={themed($topContainer)}> | ||
| <Image style={themed($welcomeLogo)} source={welcomeLogo} resizeMode="contain" /> | ||
| <Text | ||
| testID="welcome-heading" | ||
| style={themed($welcomeHeading)} | ||
| tx="welcomeScreen:readyForLaunch" | ||
| preset="heading" | ||
| /> | ||
| <Text tx="welcomeScreen:exciting" preset="subheading" /> | ||
| <Image | ||
| style={$welcomeFace} | ||
| source={welcomeFace} | ||
| resizeMode="contain" | ||
| tintColor={theme.colors.palette.neutral900} | ||
| /> | ||
| </View> | ||
|
|
||
| <View style={[themed($bottomContainer), $bottomContainerInsets]}> | ||
| <Text tx="welcomeScreen:postscript" size="md" /> | ||
| </View> | ||
| </Screen> | ||
| ) | ||
| export default function Index() { | ||
| return <WelcomeScreen /> | ||
| } | ||
|
|
||
| const $container: ThemedStyle<ViewStyle> = ({ colors }) => ({ | ||
| flex: 1, | ||
| backgroundColor: colors.background, | ||
| }) | ||
|
|
||
| const $topContainer: ThemedStyle<ViewStyle> = ({ spacing }) => ({ | ||
| flexShrink: 1, | ||
| flexGrow: 1, | ||
| flexBasis: "57%", | ||
| justifyContent: "center", | ||
| paddingHorizontal: spacing.lg, | ||
| }) | ||
|
|
||
| const $bottomContainer: ThemedStyle<ViewStyle> = ({ colors, spacing }) => ({ | ||
| flexShrink: 1, | ||
| flexGrow: 0, | ||
| flexBasis: "43%", | ||
| backgroundColor: colors.palette.neutral100, | ||
| borderTopLeftRadius: 16, | ||
| borderTopRightRadius: 16, | ||
| paddingHorizontal: spacing.lg, | ||
| justifyContent: "space-around", | ||
| }) | ||
|
|
||
| const $welcomeLogo: ThemedStyle<ImageStyle> = ({ spacing }) => ({ | ||
| height: 88, | ||
| width: "100%", | ||
| marginBottom: spacing.xxl, | ||
| }) | ||
|
|
||
| const $welcomeFace: ImageStyle = { | ||
| height: 169, | ||
| width: 269, | ||
| position: "absolute", | ||
| bottom: -47, | ||
| right: -80, | ||
| transform: [{ scaleX: isRTL ? -1 : 1 }], | ||
| } | ||
|
|
||
| const $welcomeHeading: ThemedStyle<TextStyle> = ({ spacing }) => ({ | ||
| marginBottom: spacing.md, | ||
| }) | ||
This file contains hidden or 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,84 @@ | ||
| import { Image, ImageStyle, TextStyle, View, ViewStyle } from "react-native" | ||
|
|
||
| import { Screen } from "@/components/Screen" | ||
| import { Text } from "@/components/Text" | ||
| import { isRTL } from "@/i18n" | ||
| import { ThemedStyle } from "@/theme" | ||
| import { useAppTheme } from "@/utils/useAppTheme" | ||
| import { useSafeAreaInsetsStyle } from "@/utils/useSafeAreaInsetsStyle" | ||
|
|
||
| const welcomeLogo = require("../../assets/images/logo.png") | ||
| const welcomeFace = require("../../assets/images/welcome-face.png") | ||
|
|
||
| export const WelcomeScreen = function WelcomeScreen() { | ||
| const $bottomContainerInsets = useSafeAreaInsetsStyle(["bottom"]) | ||
| const { theme, themed } = useAppTheme() | ||
|
|
||
| return ( | ||
| <Screen safeAreaEdges={["top"]} contentContainerStyle={themed($container)}> | ||
| <View style={themed($topContainer)}> | ||
| <Image style={themed($welcomeLogo)} source={welcomeLogo} resizeMode="contain" /> | ||
| <Text | ||
| testID="welcome-heading" | ||
| style={themed($welcomeHeading)} | ||
| tx="welcomeScreen:readyForLaunch" | ||
| preset="heading" | ||
| /> | ||
| <Text tx="welcomeScreen:exciting" preset="subheading" /> | ||
| <Image | ||
| style={$welcomeFace} | ||
| source={welcomeFace} | ||
| resizeMode="contain" | ||
| tintColor={theme.colors.palette.neutral900} | ||
| /> | ||
| </View> | ||
|
|
||
| <View style={[themed($bottomContainer), $bottomContainerInsets]}> | ||
| <Text tx="welcomeScreen:postscript" size="md" /> | ||
| </View> | ||
| </Screen> | ||
| ) | ||
| } | ||
|
|
||
| const $container: ThemedStyle<ViewStyle> = ({ colors }) => ({ | ||
| flex: 1, | ||
| backgroundColor: colors.background, | ||
| }) | ||
|
|
||
| const $topContainer: ThemedStyle<ViewStyle> = ({ spacing }) => ({ | ||
| flexShrink: 1, | ||
| flexGrow: 1, | ||
| flexBasis: "57%", | ||
| justifyContent: "center", | ||
| paddingHorizontal: spacing.lg, | ||
| }) | ||
|
|
||
| const $bottomContainer: ThemedStyle<ViewStyle> = ({ colors, spacing }) => ({ | ||
| flexShrink: 1, | ||
| flexGrow: 0, | ||
| flexBasis: "43%", | ||
| backgroundColor: colors.palette.neutral100, | ||
| borderTopLeftRadius: 16, | ||
| borderTopRightRadius: 16, | ||
| paddingHorizontal: spacing.lg, | ||
| justifyContent: "space-around", | ||
| }) | ||
|
|
||
| const $welcomeLogo: ThemedStyle<ImageStyle> = ({ spacing }) => ({ | ||
| height: 88, | ||
| width: "100%", | ||
| marginBottom: spacing.xxl, | ||
| }) | ||
|
|
||
| const $welcomeFace: ImageStyle = { | ||
| height: 169, | ||
| width: 269, | ||
| position: "absolute", | ||
| bottom: -47, | ||
| right: -80, | ||
| transform: [{ scaleX: isRTL ? -1 : 1 }], | ||
| } | ||
|
|
||
| const $welcomeHeading: ThemedStyle<TextStyle> = ({ spacing }) => ({ | ||
| marginBottom: spacing.md, | ||
| }) |
This file contains hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Praise: I love this! Less duplicated code in the boilerplate to maintain! 🎉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm well the WelcomeScreen itself is still duped, but maybe I can get that even better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Woot think I can reduce it further, changes incoming 🙏