Skip to content

Commit f3ddef0

Browse files
committed
Move ReactComponent out of Pods directory in EmbeddableApp
It doesn’t seem like a good practice to tell people to create their custom ReactComponent directory inside of the Pods/ directory. The Pods/ directory should be limited to CocoaPods installed content, and it’s not even accepted across the board to [check this stuff into git][1] Therefore, let’s tune the EmbeddableApp tutorial to instruct users to create a ReactComponent directory at the root of their project. From there, we’ll start the development server packager to source that directory as a JS files root. This change also improves starting this packager server, proxying the command through npm. [1]: https://github.com/github/gitignore/blob/5883804e6ceb0867e88dc8ca1c7585fa61e40797/Objective-C.gitignore#L20-L26
1 parent 48bcbec commit f3ddef0

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

docs/EmbeddedApp.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,9 @@ There are two pieces you’ll need to set up:
4141
1. The root JavaScript file that will contain your actual React Native app and other components
4242
- Wrapper Objective-C code that will load up your script and create a `RCTRootView` to display and manage your React Native components
4343

44-
First, enter React Native's pod root directory and create **index.ios.js** inside a directory `ReactComponent`.
44+
First, create a directory for your app’s React code and create a simple `index.ios.js` file:
4545

4646
```
47-
$ cd Pods/React
4847
$ mkdir ReactComponent
4948
$ touch index.ios.js
5049
```
@@ -134,10 +133,10 @@ rootView.frame = self.bounds;
134133
In root directory, we need to start React Native development server.
135134

136135
```
137-
$ ./Pods/React/packager/packager.sh --root ./ReactComponents
136+
(JS_DIR=`pwd`/ReactComponent; cd Pods/React; npm run start -- --root $JS_DIR)
138137
```
139138

140-
`--root` indicates the root of your React Native apps. Here we just have one **index.ios.js**. React Native development server will use packager to create a **index.ios.bundle**. Which can be access via `http://localhost:8081/index.ios.bundle`.
139+
This command will start up a React Native development server within our CocoaPods dependency to build our bundled script. The `--root` option indicates the root of your React Native apps – this will be our `ReactComponents` directory containing the single `index.ios.js` file. This running server will package up the `index.ios.bundle` file accessible via `http://localhost:8081/index.ios.bundle`.
141140

142141
## Compile And Run
143142

0 commit comments

Comments
 (0)