Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 29 additions & 6 deletions docs/_getting-started-linux-android.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import RemoveGlobalCLI from './\_remove-global-cli.md';
import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import constants from '@site/core/TabsConstants';

## Installing dependencies

Expand Down Expand Up @@ -127,29 +128,51 @@ Click "Next" then "Finish" to create your AVD. At this point you should be able

First, you will need to start Metro, the JavaScript bundler that ships with React Native. Metro "takes in an entry file and various options, and returns a single JavaScript file that includes all your code and its dependencies."—[Metro Docs](https://facebook.github.io/metro/docs/concepts)

To start Metro, run `npx react-native start` inside your React Native project folder:
To start Metro, run following command inside your React Native project folder:

<Tabs groupId="package-manager" queryString defaultValue={constants.defaultPackageManager} values={constants.packageManagers}>
<TabItem value="npm">

```shell
npx react-native start
npm start
Comment thread
Pranav-yadav marked this conversation as resolved.
```

`react-native start` starts Metro Bundler.
</TabItem>
<TabItem value="yarn">

> If you use the Yarn package manager, you can use `yarn` instead of `npx` when running React Native commands inside an existing project.
```shell
yarn start
```

</TabItem>
</Tabs>

> If you're familiar with web development, Metro is a lot like webpack—for React Native apps. Unlike Kotlin or Java, JavaScript isn't compiled—and neither is React Native. Bundling isn't the same as compiling, but it can help improve startup performance and translate some platform-specific JavaScript into more widely supported JavaScript.

<h3>Step 2: Start your application</h3>

Let Metro Bundler run in its own terminal. Open a new terminal inside your React Native project folder. Run the following:

<Tabs groupId="package-manager" queryString defaultValue={constants.defaultPackageManager} values={constants.packageManagers}>
<TabItem value="npm">

```shell
npx react-native run-android
npm run android
```

</TabItem>
<TabItem value="yarn">

```shell
yarn android
```

</TabItem>
</Tabs>

If everything is set up correctly, you should see your new app running in your Android emulator shortly.

`npx react-native run-android` is one way to run your app - you can also run it directly from within Android Studio.
This is one way to run your app - you can also run it directly from within Android Studio.

> If you can't get this to work, see the [Troubleshooting](troubleshooting.md) page.

Expand Down
35 changes: 28 additions & 7 deletions docs/_getting-started-macos-android.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import RemoveGlobalCLI from './\_remove-global-cli.md';
import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import constants from '@site/core/TabsConstants';

## Installing dependencies

Expand Down Expand Up @@ -142,31 +143,51 @@ Click "Next" then "Finish" to create your AVD. At this point you should be able

First, you will need to start Metro, the JavaScript bundler that ships with React Native. Metro "takes in an entry file and various options, and returns a single JavaScript file that includes all your code and its dependencies."—[Metro Docs](https://facebook.github.io/metro/docs/concepts)

To start Metro, run `npx react-native start` inside your React Native project folder:
To start Metro, run following command inside your React Native project folder:

<Tabs groupId="package-manager" queryString defaultValue={constants.defaultPackageManager} values={constants.packageManagers}>
<TabItem value="npm">

```shell
npx react-native start
npm start
```

`react-native start` starts Metro Bundler.
</TabItem>
<TabItem value="yarn">

> If you use the Yarn package manager, you can use `yarn` instead of `npx` when running React Native commands inside an existing project.
```shell
yarn start
```

</TabItem>
</Tabs>

> If you're familiar with web development, Metro is a lot like webpack—for React Native apps. Unlike Kotlin or Java, JavaScript isn't compiled—and neither is React Native. Bundling isn't the same as compiling, but it can help improve startup performance and translate some platform-specific JavaScript into more widely supported JavaScript.

<h3>Step 2: Start your application</h3>

Let Metro Bundler run in its own terminal. Open a new terminal inside your React Native project folder. Run the following:
<Tabs groupId="package-manager" queryString defaultValue={constants.defaultPackageManager} values={constants.packageManagers}>
<TabItem value="npm">

```shell
npx react-native run-android
npm run android
```

</TabItem>
<TabItem value="yarn">

```shell
yarn android
```

</TabItem>
</Tabs>

If everything is set up correctly, you should see your new app running in your Android emulator shortly.

![AwesomeProject on Android](/docs/assets/GettingStartedAndroidSuccessMacOS.png)

`npx react-native run-android` is one way to run your app - you can also run it directly from within Android Studio.
This is one way to run your app - you can also run it directly from within Android Studio.

> If you can't get this to work, see the [Troubleshooting](troubleshooting.md) page.

Expand Down
35 changes: 29 additions & 6 deletions docs/_getting-started-macos-ios.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import RemoveGlobalCLI from './\_remove-global-cli.md';
import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import constants from '@site/core/TabsConstants';

## Installing dependencies

Expand Down Expand Up @@ -105,31 +106,53 @@ You might also want to ensure that all "shell script build phase" of your Xcode

First, you will need to start Metro, the JavaScript bundler that ships with React Native. Metro "takes in an entry file and various options, and returns a single JavaScript file that includes all your code and its dependencies."—[Metro Docs](https://facebook.github.io/metro/docs/concepts)

To start Metro, run `npx react-native start` inside your React Native project folder:
To start Metro, run following command inside your React Native project folder:

<Tabs groupId="package-manager" queryString defaultValue={constants.defaultPackageManager} values={constants.packageManagers}>
<TabItem value="npm">

```shell
npx react-native start
npm start
```

`react-native start` starts Metro Bundler.
</TabItem>
<TabItem value="yarn">

> If you use the Yarn package manager, you can use `yarn` instead of `npx` when running React Native commands inside an existing project.
```shell
yarn start
```

</TabItem>
</Tabs>

> If you're familiar with web development, Metro is a lot like webpack—for React Native apps. Unlike Swift or Objective-C, JavaScript isn't compiled—and neither is React Native. Bundling isn't the same as compiling, but it can help improve startup performance and translate some platform-specific JavaScript into more widely supported JavaScript.

### Step 2: Start your application

Let Metro Bundler run in its own terminal. Open a new terminal inside your React Native project folder. Run the following:

<Tabs groupId="package-manager" queryString defaultValue={constants.defaultPackageManager} values={constants.packageManagers}>
<TabItem value="npm">

```shell
npx react-native run-ios
npm run ios
```

</TabItem>
<TabItem value="yarn">

```shell
yarn ios
```

</TabItem>
</Tabs>

You should see your new app running in the iOS Simulator shortly.

![AwesomeProject on iOS](/docs/assets/GettingStartediOSSuccess.png)

`npx react-native run-ios` is one way to run your app. You can also run it directly from within Xcode.
This is one way to run your app. You can also run it directly from within Xcode.

> If you can't get this to work, see the [Troubleshooting](troubleshooting.md) page.

Expand Down
35 changes: 29 additions & 6 deletions docs/_getting-started-windows-android.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import RemoveGlobalCLI from './\_remove-global-cli.md';
import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import constants from '@site/core/TabsConstants';

<h2>Installing dependencies</h2>

Expand Down Expand Up @@ -158,31 +159,53 @@ Click "Next" then "Finish" to create your AVD. At this point you should be able

First, you will need to start Metro, the JavaScript bundler that ships with React Native. Metro "takes in an entry file and various options, and returns a single JavaScript file that includes all your code and its dependencies."—[Metro Docs](https://facebook.github.io/metro/docs/concepts)

To start Metro, run `npx react-native start` inside your React Native project folder:
To start Metro, run following command inside your React Native project folder:

<Tabs groupId="package-manager" queryString defaultValue={constants.defaultPackageManager} values={constants.packageManagers}>
<TabItem value="npm">

```shell
npx react-native start
npm start
```

`react-native start` starts Metro Bundler.
</TabItem>
<TabItem value="yarn">

> If you use the Yarn package manager, you can use `yarn` instead of `npx` when running React Native commands inside an existing project.
```shell
yarn start
```

</TabItem>
</Tabs>

> If you're familiar with web development, Metro is a lot like webpack—for React Native apps. Unlike Kotlin or Java, JavaScript isn't compiled—and neither is React Native. Bundling isn't the same as compiling, but it can help improve startup performance and translate some platform-specific JavaScript into more widely supported JavaScript.

<h3>Step 2: Start your application</h3>

Let Metro Bundler run in its own terminal. Open a new terminal inside your React Native project folder. Run the following:

<Tabs groupId="package-manager" queryString defaultValue={constants.defaultPackageManager} values={constants.packageManagers}>
<TabItem value="npm">

```shell
npx react-native run-android
npm run android
```

</TabItem>
<TabItem value="yarn">

```shell
yarn android
```

</TabItem>
</Tabs>

If everything is set up correctly, you should see your new app running in your Android emulator shortly.

![AwesomeProject on Android](/docs/assets/GettingStartedAndroidSuccessWindows.png)

`npx react-native run-android` is one way to run your app - you can also run it directly from within Android Studio.
This is one way to run your app - you can also run it directly from within Android Studio.

> If you can't get this to work, see the [Troubleshooting](troubleshooting.md) page.

Expand Down
59 changes: 51 additions & 8 deletions docs/_integration-with-existing-apps-java.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import constants from '@site/core/TabsConstants';

## Key Concepts

The keys to integrating React Native components into your Android application are to:
Expand Down Expand Up @@ -26,29 +28,53 @@ Go to the root directory for your project and create a new `package.json` file w
"version": "0.0.1",
"private": true,
"scripts": {
"start": "yarn react-native start"
"start": "react-native start"
}
}
```

Next, make sure you have [installed the yarn package manager](https://yarnpkg.com/lang/en/docs/install/).
Next, install the `react` and `react-native` packages. Open a terminal or command prompt, then navigate to the directory with your `package.json` file and run:

<Tabs groupId="package-manager" queryString defaultValue={constants.defaultPackageManager} values={constants.packageManagers}>
<TabItem value="npm">

```shell
npm install react-native
```

Install the `react` and `react-native` packages. Open a terminal or command prompt, then navigate to the directory with your `package.json` file and run:
</TabItem>
<TabItem value="yarn">

```shell
$ yarn add react-native
yarn add react-native
```

</TabItem>
</Tabs>

This will print a message similar to the following (scroll up in the yarn output to see it):

> warning "react-native@0.70.5" has unmet peer dependency "react@18.1.0"

This is OK, it means we also need to install React:

<Tabs groupId="package-manager" queryString defaultValue={constants.defaultPackageManager} values={constants.packageManagers}>
<TabItem value="npm">

```shell
npm install react@version_printed_above
```

</TabItem>
<TabItem value="yarn">

```shell
$ yarn add react@version_printed_above
yarn add react@version_printed_above
```

</TabItem>
</Tabs>

Yarn has created a new `/node_modules` folder. This folder stores all the JavaScript dependencies required to build your project.

Add `node_modules/` to your `.gitignore` file.
Expand Down Expand Up @@ -122,11 +148,15 @@ apply from: file("../../node_modules/@react-native-community/cli-platform-androi

Next, make sure you have the Internet permission in your `AndroidManifest.xml`:

<uses-permission android:name="android.permission.INTERNET" />
```xml
<uses-permission android:name="android.permission.INTERNET" />
```

If you need to access to the `DevSettingsActivity` add to your `AndroidManifest.xml`:

<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
```xml
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
```

This is only used in dev mode when reloading JavaScript from the development server, so you can strip this in release builds if you need to.

Expand Down Expand Up @@ -365,10 +395,23 @@ You have now done all the basic steps to integrate React Native with your curren

To run your app, you need to first start the development server. To do this, run the following command in the root directory of your React Native project:

<Tabs groupId="package-manager" queryString defaultValue={constants.defaultPackageManager} values={constants.packageManagers}>
<TabItem value="npm">

```shell
$ yarn start
npm start
```

</TabItem>
<TabItem value="yarn">

```shell
yarn start
```

</TabItem>
</Tabs>

##### 2. Run the app

Now build and run your Android app as normal.
Expand Down
Loading