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

Docs don't explain how to initialise a specific (e.g. v0.75) version of a React Native Windows app #987

Open
shirakaba opened this issue Oct 29, 2024 · 1 comment
Assignees
Labels
bug Something isn't working documentation Improvements or additions to documentation
Milestone

Comments

@shirakaba
Copy link

shirakaba commented Oct 29, 2024

Problem Description

Context

⚠️ As the original react-native-windows-init command is to be deprecated from react-native-windows@0.75, we should now use init-windows, even for generating projects using earlier versions.

  • @next docs for init-windows
  • @next "getting started" docs, which recommend:
    • use the @react-native-community/cli@nightly CLI to initialise a new project.
    • install react-native@nightly
    • install react-native-windows@canary
  • 0.75 "getting started" docs, which recommend:
    • use the @react-native-community/cli@ next CLI to initialise a new project.
    • Install react-native@latest
    • Install react-native-windows@^0.75.0

Issue

I am trying to target v0.75 specifically, with the New Arch template.

From previous pull requests in the community, I've been advised by to keep react-native-windows and react-native-macos on the same minor version as react-native to avoid issues with multiple conflicting copies of Metro, etc. So I believe that the docs for v0.75 ought to be adjusted.

To keep all React Natives on the same minor version, I think the instructions should be changed to something like this:

Create a new React Native project
- npx --yes @react-native-community/cli@next init <projectName> --version "latest"
+ npx --yes @react-native-community/cli@next init <projectName> --version "0.75" 
  Add React Native Windows to your project's dependencies
- npm install --save react-native-windows@^0.75.0
+ npm install --save react-native-windows@~0.75.0

Steps To Reproduce

A terminal history of the steps I followed to successfully set up a v0.75 project:

# 1. Create a brand new React Native project named "Fiddle".
npx --yes @react-native-community/cli@next init Fiddle --version 0.75
cd Fiddle

# 2. Add the react-native-windows package (preferably matching the minor version of react-native).
#    This is necessary to add the `init-windows` command to the `react-native` CLI.
npm install --save-exact react-native-windows@~0.75

# 3. Initialise a New Arch app in the repo.
npx react-native init-windows --logging --overwrite --template cpp-app --name Fiddle --namespace Fiddle

# 5. Autolink the project (necessary if running via Visual Studio; but redundant if running via `npx react-native run-windows`)
npx react-native autolink-windows

# 6. Run the project (by opening Fiddle/Fiddle.sln in Visual Studio and running for your preferred arch, or):
npx react-native run-windows --arch x64
# Or, e.g. for Apple Silicon:
npx react-native run-windows --arch arm64

Expected Results

Docs should detail how to set up a designated version of React Native Windows.

CLI version

npx @react-native-community/cli -v

Environment

14.1.0

Community Modules

N/A

Target Platform Version

10.0.22621

Target Device(s)

No response

Visual Studio Version

Visual Studio 2022

Build Configuration

Debug

Snack, code example, screenshot, or link to a repository

Here's a working v0.75 example (both macOS and Windows sides seem to work, in fact) created by following those setup steps.

https://github.com/shirakaba/fiddle-template/tree/e02e01eb9b1a5c5a87955043b1bdd2430184c2c6

@shirakaba shirakaba added the bug Something isn't working label Oct 29, 2024
@chrisglein chrisglein added the documentation Improvements or additions to documentation label Oct 31, 2024
@chrisglein
Copy link
Member

This part:

Install react-native@latest

For 0.75 definitely seems wrong. That's a bug in the docs.

I am trying to target v0.75 specifically, with the New Arch template.

Just to set expectations, the new arch templates are an area of lots of change between 0.75 and 0.76 as we prepare to invite more folks to try out early versions of the new arch on Windows. The steps here may change.

@chrisglein chrisglein transferred this issue from microsoft/react-native-windows Oct 31, 2024
@chrisglein chrisglein added this to the Next milestone Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants