Skip to main content

Build and debug React Native iOS apps on Windows

Build, install and debug the native side on Windows while Metro runs the JavaScript as usual.

Build the iOS side of a React Native project on Windows and debug it on your iPhone. Run Metro for the JS as usual, and set breakpoints in native code. Build scripts in your project that call xcodebuild work without changes. See xcodebuild and xcrun compatibility.

Steps

1

Set up React Native

Install Node.js as described on the React Native website. Open a new terminal and check that this prints a version.

> node --version
2

Create a project

To use an existing project, open its root folder in VS Code with File > Open Folder…, or drag the folder into VS Code. Otherwise, create one.

Use either of these

  • VS Code extension

    Run KXBuild: New Project from the Command Palette and pick the "React Native App" template.

  • Command line

    Keep the parent path short, because the dependency folders nest deeply.

    > kxbuild project create -t react_native_app -n rnhello -o D:\work
3

Run doctor

Do this first whenever you open a project for the first time. Doctor checks your React Native setup and prepares the iOS project.

Use either of these

After doctor, install the native dependencies in the ios folder. See CocoaPods.

ios> pod install
4

Write code

Write JS and TypeScript in VS Code as usual, and Metro reloads when you save. KXBuild provides completion and go to definition for the native code under ios/.

5

Debug

In a second terminal, run npx react-native start in the project folder. Then select your device and press F5. Debug native breakpoints in VS Code and JS breakpoints in the Metro / Hermes debugger. The two work independently.

6

Release

Build with the Release configuration. The JS is bundled into the app, and the .ipa is written to the ios folder. To upload it to App Store Connect, see Release and App Store submission.

Use either of these

  • VS Code extension

    Switch the configuration to Release in the Build configuration node of the KXBuild view, then run KXBuild: Build from the Command Palette.

  • Command line
    > kxbuild build .\ios\rnhello.xcworkspace -c Release

Next steps

Don't see your framework?

kxbuild is a general-purpose build toolchain, so if your framework produces an Xcode project, KXBuild can build it. The list above covers common cases only. Tell us about your setup.