Skip to content

Commit

Permalink
add development helper
Browse files Browse the repository at this point in the history
  • Loading branch information
joenoon committed May 13, 2016
1 parent 4d8d369 commit ea0a260
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
14 changes: 14 additions & 0 deletions Example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
## Example App

Normally, after a code change to react-native-router-flux src files,
you must remove the node_modules/react-native-router-flux directory
and npm install. The react-native packager wont follow symlinks.

To assist development, this command watches and rsyncs changes:

```
npm run sync-rnrf
```

Leave a terminal open running this command when running the Example
app and making react-native-router-flux src changes.
6 changes: 5 additions & 1 deletion Example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node_modules/react-native/packager/packager.sh"
"start": "node_modules/react-native/packager/packager.sh",
"sync-rnrf": "rm -rf ./node_modules/react-native-router-flux; sane '/usr/bin/rsync -v -a --exclude .git --exclude Example --exclude node_modules ../ ./node_modules/react-native-router-flux/' .. --glob='{**/*.json,**/*.js}'"
},
"dependencies": {
"react": "^15.0.2",
Expand All @@ -12,5 +13,8 @@
"react-native-drawer": "^2.2.2",
"react-native-modalbox": "^1.3.3",
"react-native-router-flux": "file:../"
},
"devDependencies": {
"sane": "^1.3.4"
}
}

11 comments on commit ea0a260

@Kerumen
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another solution was to rewrite all imports of RNRF in the Example to relative imports targeting the src folder.

@aksonov
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Kerumen good catch!

@aksonov
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Kerumen I can't make it work. import '../index' from Example instead of import 'react-native-router-flux' just doesn't work, seems packager doesn't see outer folders

@Kerumen
Copy link

@Kerumen Kerumen commented on ea0a260 May 13, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okey forgot the packager. It works for React projects.
I found this issue debating about symlinks (that can be a solution). There is also a --root flag on the packager. You can try to specify it to the root of the project, it should work then.

@aksonov
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But packager is being run automatically from Xcode run and i don't want to hack RN scripts, i just want to have workable solution out-of-box.

@Kerumen
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can start the packager from your terminal with react-native start [--root ..]. Then launch the build from Xcode. It will recognize the packager instance and use it.

@aksonov
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, but you probably can't imagine how many issues we will get from users when they will not be able to run Example out-of-box :)

@Kerumen
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, @joenoon's solution is better out-of-the-box then.

@joenoon
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also like that this is fairly portable. I've already referenced this command to get rnrf and other modules I'm working on locally into my own app which makes development so much easier. Its simply copy/paste the command, then change the paths, with no need to modify any source files.

@aksonov
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know why i see red border for Example project now?
simulator screen shot 13 may 2016 17 01 26

@joenoon
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aksonov yes, the red border is to visualize the edges of the view. I guess it doesn't need to be on Launch, but its very useful to demo the nav/tab hiding: Go to TabBar page > push new scene > try all the combos and notice the border of the view is correct. Previously it wasn't accounted for. The example app seemed fine before, but only because the content fit in the center of the page and didn't expose the problem.

Please sign in to comment.