Skip to content
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

Generating a new screen when using Expo Router results in wrong placement #2903

Open
jamonholmgren opened this issue Feb 13, 2025 · 3 comments · May be fixed by #2905
Open

Generating a new screen when using Expo Router results in wrong placement #2903

jamonholmgren opened this issue Feb 13, 2025 · 3 comments · May be fixed by #2905
Assignees
Labels

Comments

@jamonholmgren
Copy link
Member

jamonholmgren commented Feb 13, 2025

Describe the bug

Reproduce:

      npx ignite-cli new PizzaApp2025b \
        --bundle=com.pizzaapp2025b \
        --git \
        --install-deps \
        --target-path=/Users/jh/Code/Temp/PizzaApp2025b \
        --remove-demo=false \
        --new-arch \
        --experimental=expo-router \
        --workflow=cng \
        --no-timeout=false \
        --state=mst 

(Keep the demo code in, use expo router.)

npx ignite-cli@latest g screen About

It adds it to ./app/screens. Should be in ./src/app/screens, I believe.

Ignite version

10.1.6 (latest)

Additional info

no

@cdanwards cdanwards self-assigned this Feb 24, 2025
@frankcalise
Copy link
Contributor

You really want to specify via --dir cli switch, there is no way to determine where you want your route in the file-based routing system, unless you just want it to be one huge single stack. It really isn't intended to use defaults.

It's in the generation docs: https://docs.infinite.red/ignite-cli/concept/Generators/#--dir

I guess you can still fix the template to be a destinationDir of src/app instead when making the screen template, but won't buy you much once you graduate to more nested URLs

https://github.com/infinitered/ignite/blob/master/src/tools/react-native.ts#L230-L267

@cdanwards
Copy link
Member

@frankcalise thinking this through, we can't assume the location, but prompting them to input their desired path and then defaulting to src/app. It's rather lightweight and doesn't require a lot on them but if they're familiar with their structure it still helpful.

@frankcalise
Copy link
Contributor

@cdanwards yeah that's interesting.

so something like this might work

IF

destinationDir isn't set in the template, like how the current template works for non expo router

AND

--dir is not provided for expo-router variation

THEN

prompt (enter could even accept a default if we felt like detecting app or src/app exists)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants