Содержание
Этот файл содержит неоднозначные символы Юникода, которые могут быть перепутаны с другими в текущей локали. Если это намеренно, можете спокойно проигнорировать это предупреждение. Используйте кнопку Экранировать, чтобы подсветить эти символы.
You can generate a new project using npx
:
npx --package react-native-test-app@latest init
In this example, we will create a project named "sample" in sample
with apps
for all platforms:
✔ What is the name of your test app? … sample
? Which platforms do you need test apps for? ›
Instructions:
↑/↓: Highlight option
←/→/[space]: Toggle selection
a: Toggle all
enter/return: Complete answer
◉ Android
◉ iOS
◉ macOS
◯ visionOS (Experimental)
◉ Windows
✔ Where should we create the new project? … sample
Install npm dependencies inside the new project folder:
Yarn:
cd sample
yarn
npm:
cd sample
npm install
Once the dependencies are installed, follow the platform specific instructions below.
Platform specific instructions
Android
Bundle the JS code and assets by running:
Yarn:
yarn build:android
npm:
npm run build:android
If you're going to use the development server, you can skip this step.
To start the Android app, run:
Yarn:
yarn android
npm:
npm run android
Alternatively, you can also run the app within Android Studio by pointing it to
the android
folder.
iOS
Bundle the JS code and assets by running:
Yarn:
yarn build:ios
npm:
npm run build:ios
If you're going to use the development server, you can skip this step.
Before you can run the iOS app, you must first install its native dependencies:
pod install --project-directory=ios
This command is also responsible for generating the Xcode project. To start the iOS app, run:
Yarn:
yarn ios
npm:
npm run ios
Alternatively, you can also run the app within Xcode by opening the Xcode workspace:
open ios/Sample.xcworkspace
[!NOTE]
If you made changes to
app.json
or any other assets, you should re-runpod install
to make sure that the changes are included in the Xcode project.
macOS
Bundle the JS code and assets by running:
Yarn:
yarn build:macos
npm:
npm run build:macos
If you're going to use the development server, you can skip this step.
Before you can run the macOS app, you must first install its native dependencies:
pod install --project-directory=macos
This command is also responsible for generating the Xcode project. To start the macOS app, run:
Yarn:
yarn macos
npm:
npm run macos
Alternatively, you can also run the app within Xcode by opening the Xcode workspace:
open macos/Sample.xcworkspace
[!NOTE]
If you made changes to
app.json
or any other assets, you should re-runpod install
to make sure that the changes are included in the Xcode project.
Windows
Bundle the JS code and assets by running:
Yarn:
yarn build:windows
npm:
npm run build:windows
Before you can run the Windows app, you must first generate the project:
npx install-windows-test-app --use-nuget
To start the Windows app, run:
Yarn:
yarn windows
npm:
npm run windows
Alternatively, you can also run the app within Visual Studio by opening the solution file:
start windows/Sample.sln
If you choose to use Visual Studio, make sure the target platform is set to
x64
. It is usually set to ARM
by default.
[!NOTE]
If you made changes to
app.json
or any other assets, you should re-runinstall-windows-test-app
to make sure that the changes are included in the Visual Studio project.