react-native-test-app/CONTRIBUTING.md

4.8 KiB

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Commit Messages

This repository adheres to the conventional commit format via commitlint. Commit messages must match the pattern:

type(scope?): subject

Scope is optional. You can also specify multiple scopes using / or , as delimiters.

Following this is necessary to pass CI.

Additional Dependencies

Building the Example App

We use the Example app for most (if not all) development of react-native-test-app. Some platforms may require extra steps for the initial set up. Please follow the steps below, then jump to the appropriate section(s) for the final steps.

Open a terminal and navigate to your clone of this repository:

cd react-native-test-app

The first thing we have to do is to install the npm dependencies:

yarn

Once Yarn is done installing dependencies, we need to navigate to the example folder:

cd example

Now we should be ready to start the app. Jump to the appropriate section below for further instructions.

Android

To start the Android app, run:

yarn android

Alternatively, you can also run the app within Android Studio by pointing it to the android folder.

iOS

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 ios

Alternatively, you can also run the app within Xcode by opening the Xcode workspace:

open ios/Example.xcworkspace

Note: If you made changes to app.json or any other assets, you should re-run pod install to make sure that the changes are included in the Xcode project.

macOS

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 macos

Alternatively, you can also run the app within Xcode by opening the Xcode workspace:

open macos/Example.xcworkspace

Note: If you made changes to app.json or any other assets, you should re-run pod install to make sure that the changes are included in the Xcode project.

Windows

Before you can run the Windows app, you must first generate it:

npx install-windows-test-app --use-nuget

To start the Windows app, run:

yarn windows

Alternatively, you can also run the app within Visual Studio by opening the solution file:

start windows/Example.sln

If you choose to use Visual Studio, remember to first set the target platform to x64. It is set to ARM by default.

Note: If you made changes to app.json or any other assets, you should re-run install-windows-test-app to make sure that the changes are included in the Visual Studio project.

Adding New Files

When adding new files, please make sure they are published (or not if it's for internal use only). To get a list of files that get published, you can run:

npm pack --dry-run --verbose

If your files are missing, you can modify the files section in package.json.

Testing Specific React Native Versions

react-native-test-app supports multiple versions of React Native. Use set-react-version to set the version, e.g. to use 0.68:

npm run set-react-version 0.68

This will modify both package.json and example/package.json to use packages that are compatible with specified React Native version.

To avoid issues, remember to clear out node_modules folders before you run yarn:

yarn clean
yarn