You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This will copy the `package.json`[file from the Community template](https://github.com/react-native-community/template/blob/0.78-stable/template/package.json) to your project.
40
+
This will copy the `package.json`<RNTemplateRepoLinkhref="template/package.json">file from the Community template</RNTemplateRepoLink> to your project.
36
41
37
42
Next, install the NPM packages by running:
38
43
@@ -55,7 +60,7 @@ yarn install
55
60
56
61
Installation process has created a new `node_modules` folder. This folder stores all the JavaScript dependencies required to build your project.
57
62
58
-
Add `node_modules/` to your `.gitignore` file (here the [Community default one](https://github.com/react-native-community/template/blob/0.78-stable/template/_gitignore)).
63
+
Add `node_modules/` to your `.gitignore` file (here the <RNTemplateRepoLinkhref="template/_gitignore">Community default one</RNTemplateRepoLink>).
59
64
60
65
### 3. Install Development tools
61
66
@@ -86,9 +91,9 @@ To configure CocoaPods, we need two files:
86
91
87
92
For the **Gemfile**, go to the root directory of your project and run this command
Please use the Community Template as a reference point for the [Gemfile](https://github.com/react-native-community/template/blob/0.78-stable/template/Gemfile) and for the [Podfile](https://github.com/react-native-community/template/blob/0.78-stable/template/ios/Podfile).
120
+
Please use the Community Template as a reference point for the <RNTemplateRepoLinkhref="template/Gemfile">Gemfile</RNTemplateRepoLink> and for the <RNTemplateRepoLinkhref="template/ios/Podfile">Podfile</RNTemplateRepoLink>.
116
121
117
122
:::note
118
-
Remember to change [this line](https://github.com/react-native-community/template/blob/0.78-stable/template/ios/Podfile#L17).
123
+
Remember to change <RNTemplateRepoLinkhref="template/ios/Podfile#L17">this line</RNTemplateRepoLink>.
119
124
:::
120
125
121
126
Now, we need to run a couple of extra commands to install the Ruby gems and the Pods.
@@ -140,7 +145,7 @@ First, create an empty `index.js` file in the root of your React Native project.
140
145
141
146
`index.js` is the starting point for React Native applications, and it is always required. It can be a small file that `import`s other file that are part of your React Native component or application, or it can contain all the code that is needed for it.
142
147
143
-
Our `index.js` should look as follows (here the [Community template file as reference](https://github.com/react-native-community/template/blob/0.78-stable/template/index.js)):
148
+
Our `index.js` should look as follows (here the <RNTemplateRepoLinkhref="template/index.js">Community template file as reference</RNTemplateRepoLink>):
Let's create an `App.tsx` file. This is a [TypeScript](https://www.typescriptlang.org/) file that can have [JSX](<https://en.wikipedia.org/wiki/JSX_(JavaScript)>) expressions. It contains the root React Native component that we will integrate into our iOS application ([link](https://github.com/react-native-community/template/blob/0.78-stable/template/App.tsx)):
159
+
Let's create an `App.tsx` file. This is a [TypeScript](https://www.typescriptlang.org/) file that can have [JSX](<https://en.wikipedia.org/wiki/JSX_(JavaScript)>) expressions. It contains the root React Native component that we will integrate into our iOS application (<RNTemplateRepoLinkhref="template/App.tsx">link</RNTemplateRepoLink>):
You can checkout the [metro.config.js file](https://github.com/react-native-community/template/blob/0.78-stable/template/metro.config.js) from the Community template file as reference.
468
+
You can checkout the <RNTemplateRepoLinkhref="template/metro.config.js">`metro.config.js` file</RNTemplateRepoLink> from the Community template file as reference.
464
469
465
470
Then, you need to create a `.watchmanconfig` file in the root of your project. The file must contain an empty json object:
466
471
467
472
```sh
468
473
echo {} > .watchmanconfig
469
474
```
470
475
471
-
Once you have the configurations file in place, you can run the bundler. Run the following command in the root directory of your project:
476
+
Once you have the configuration file in place, you can run the bundler. Run the following command in the root directory of your project:
This will copy the `package.json`[file from the Community template](https://github.com/react-native-community/template/blob/0.75-stable/template/package.json) to your project.
40
+
This will copy the `package.json`<RNTemplateRepoLinkhref="template/package.json">file from the Community template</RNTemplateRepoLink> to your project.
36
41
37
42
Next, install the NPM packages by running:
38
43
@@ -55,15 +60,15 @@ yarn install
55
60
56
61
Installation process has created a new `node_modules` folder. This folder stores all the JavaScript dependencies required to build your project.
57
62
58
-
Add `node_modules/` to your `.gitignore` file (here the [Community default one](https://github.com/react-native-community/template/blob/0.75-stable/template/_gitignore)).
63
+
Add `node_modules/` to your `.gitignore` file (here the <RNTemplateRepoLinkhref="template/_gitignore">Community default one</RNTemplateRepoLink>).
59
64
60
65
## 3. Adding React Native to your app
61
66
62
67
### Configuring Gradle
63
68
64
69
React Native uses the React Native Gradle Plugin to configure your dependencies and project setup.
65
70
66
-
First, let's edit your `settings.gradle` file by adding those lines (as suggested from the [Community template](https://github.com/react-native-community/template/blob/0.77-stable/template/android/settings.gradle)):
71
+
First, let's edit your `settings.gradle` file by adding those lines (as suggested from the <RNTemplateRepoLinkhref="template/android/settings.gradle">Community template</RNTemplateRepoLink>):
67
72
68
73
```groovy
69
74
// Configures the React Native Gradle Settings plugin used for autolinking
Then you need to open your top level `build.gradle` and include this line (as suggested from the [Community template](https://github.com/react-native-community/template/blob/0.77-stable/template/android/build.gradle)):
86
+
Then you need to open your top level `build.gradle` and include this line (as suggested from the <RNTemplateRepoLinkhref="template/android/build.gradle">Community template</RNTemplateRepoLink>):
82
87
83
88
```diff
84
89
buildscript {
@@ -94,7 +99,7 @@ buildscript {
94
99
```
95
100
96
101
This makes sure the React Native Gradle Plugin (RNGP) is available inside your project.
97
-
Finally, add those lines inside your Applications's `build.gradle` file (it's a different `build.gradle` file usually inside your `app` folder - you can use the [Community template file as reference](https://github.com/react-native-community/template/blob/0.77-stable/template/android/app/build.gradle)):
102
+
Finally, add those lines inside your Applications's `build.gradle` file (it's a different `build.gradle` file usually inside your `app` folder - you can use the <RNTemplateRepoLinkhref="template/android/build.gradle">Community template file as reference</RNTemplateRepoLink>):
98
103
99
104
```diff
100
105
apply plugin: "com.android.application"
@@ -118,7 +123,7 @@ dependencies {
118
123
+}
119
124
```
120
125
121
-
Finally, open your application `gradle.properties` files and add the following line (here the [Community template file as reference](https://github.com/react-native-community/template/blob/0.77-stable/template/android/gradle.properties)):
126
+
Finally, open your application `gradle.properties` files and add the following line (here the <RNTemplateRepoLinkhref="template/android/gradle.properties">Community template file as reference</RNTemplateRepoLink>):
@@ -155,7 +160,7 @@ Then you need to enable [cleartext traffic](https://developer.android.com/traini
155
160
</manifest>
156
161
```
157
162
158
-
As usual, here the AndroidManifest.xml file from the Community template to use as a reference: [main](https://github.com/react-native-community/template/blob/0.77-stable/template/android/app/src/main/AndroidManifest.xml) and [debug](https://github.com/react-native-community/template/blob/0.77-stable/template/android/app/src/debug/AndroidManifest.xml)
163
+
As usual, here the AndroidManifest.xml file from the Community template to use as a reference: <RNTemplateRepoLinkhref="template/android/app/src/main/AndroidManifest.xml">main</RNTemplateRepoLink> and <RNTemplateRepoLinkhref="template/android/app/src/debug/AndroidManifest.xml">debug</RNTemplateRepoLink>.
159
164
160
165
This is needed as your application will communicate with your local bundler, [Metro](https://metrobundler.dev/), via HTTP.
161
166
@@ -173,7 +178,7 @@ First, create an empty `index.js` file in the root of your React Native project.
173
178
174
179
`index.js` is the starting point for React Native applications, and it is always required. It can be a small file that `import`s other file that are part of your React Native component or application, or it can contain all the code that is needed for it.
175
180
176
-
Our index.js should look as follows (here the [Community template file as reference](https://github.com/react-native-community/template/blob/0.77-stable/template/index.js)):
181
+
Our index.js should look as follows (here the <RNTemplateRepoLinkhref="template/index.js">Community template file as reference</RNTemplateRepoLink>):
Let's create an `App.tsx` file. This is a [TypeScript](https://www.typescriptlang.org/) file that can have [JSX](<https://en.wikipedia.org/wiki/JSX_(JavaScript)>) expressions. It contains the root React Native component that we will integrate into our Android application ([link](https://github.com/react-native-community/template/blob/0.77-stable/template/App.tsx)):
192
+
Let's create an `App.tsx` file. This is a [TypeScript](https://www.typescriptlang.org/) file that can have [JSX](<https://en.wikipedia.org/wiki/JSX_(JavaScript)>) expressions. It contains the root React Native component that we will integrate into our Android application (<RNTemplateRepoLinkhref="template/App.tsx">link</RNTemplateRepoLink>):
As usual, here the [MainApplication.kt Community template file as reference](https://github.com/react-native-community/template/blob/0.77-stable/template/android/app/src/main/java/com/helloworld/MainApplication.kt)
376
+
As usual, here the <RNTemplateRepoLinkhref="template/android/app/src/main/java/com/helloworld/MainApplication.kt">`MainApplication.kt` Community template file as reference</RNTemplateRepoLink>.
372
377
373
378
#### Creating a `ReactActivity`
374
379
@@ -424,7 +429,7 @@ class MyReactActivity : ReactActivity() {
424
429
</TabItem>
425
430
</Tabs>
426
431
427
-
As usual, here the [MainActivity.kt Community template file as reference](https://github.com/react-native-community/template/blob/0.80-stable/template/android/app/src/main/java/com/helloworld/MainActivity.kt)
432
+
As usual, here the <RNTemplateRepoLinkhref="template/android/app/src/main/java/com/helloworld/MainActivity.kt">`MainActivity.kt` Community template file as reference</RNTemplateRepoLink>.
428
433
429
434
Whenever you create a new Activity, you need to add it to your `AndroidManifest.xml` file. You also need set the theme of `MyReactActivity` to `Theme.AppCompat.Light.NoActionBar` (or to any non-ActionBar theme) as otherwise your application will render an ActionBar on top of your React Native screen:
You can checkout the [metro.config.js file](https://github.com/react-native-community/template/blob/0.77-stable/template/metro.config.js) from the Community template file as reference.
466
+
You can checkout the <RNTemplateRepoLinkhref="template/metro.config.js">`metro.config.js` file</RNTemplateRepoLink> from the Community template file as reference.
462
467
463
-
Once you have the config file in place, you can run the bundler. Run the following command in the root directory of your project:
468
+
Once you have the configuration file in place, you can run the bundler. Run the following command in the root directory of your project:
**Codegen** is used to generate the glue-code for your custom modules or components. See the guides for Turbo Native Modules and Fabric Native Components for more details on how to create them.
import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import constants from '@site/core/TabsConstants';
6
+
import Tabs from '@theme/Tabs';
7
+
import TabItem from '@theme/TabItem';
8
+
import constants from '@site/core/TabsConstants';
9
+
import CodeBlock from '@theme/CodeBlock';
10
+
import {getCurrentVersion} from '@site/src/getCurrentVersion';
7
11
import {TurboNativeModulesAndroid, TurboNativeModulesIOS} from './\_turbo-native-modules-components';
8
12
9
13
# Native Modules
@@ -19,9 +23,9 @@ The basic steps are:
19
23
20
24
Lets work through each of these steps by building an example Turbo Native Module. The rest of this guide assume that you have created your application running the command:
0 commit comments