Skip to content

Commit feb7089

Browse files
committed
new version
1 parent 003f347 commit feb7089

File tree

4 files changed

+13
-39
lines changed

4 files changed

+13
-39
lines changed

Counter/app/containers/app.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { Component } from 'react-native';
22
import { createStore, applyMiddleware, combineReducers } from 'redux';
3-
import { Provider } from 'react-redux/native';
3+
import { Provider } from 'react-redux';
44
import thunk from 'redux-thunk';
55

66
import * as reducers from '../reducers';
@@ -14,7 +14,7 @@ export default class App extends Component {
1414
render() {
1515
return (
1616
<Provider store={store}>
17-
{() => <CounterApp />}
17+
<CounterApp />
1818
</Provider>
1919
);
2020
}

Counter/app/containers/counterApp.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import React, { Component } from 'react-native';
44
import {bindActionCreators} from 'redux';
55
import Counter from '../components/counter';
66
import * as counterActions from '../actions/counterActions';
7-
import { connect } from 'react-redux/native';
7+
import { connect } from 'react-redux';
88

99
// @connect(state => ({
1010
// state: state.counter

Counter/package.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@
44
"private": true,
55
"scripts": {
66
"start": "react-native start",
7-
"clean": "cd node_modules; find . -name .babelrc | grep -v packager | xargs rm"
7+
"postinstall": "npm run step1; npm run step2",
8+
"step1": "rm -rf node_modules/react-native/node_modules/react; rm -rf node_modules/react-native/node_modules/fbjs; rm -rf node_modules/react/node_modules/fbjs",
9+
"step2": "cd node_modules; find . -name .babelrc | grep -v packager | xargs rm"
810
},
911
"dependencies": {
10-
"react": "0.14.3",
11-
"react-native": "0.16.0",
12-
"react-redux": "3.1.2",
12+
"fbjs": "^0.6.1",
13+
"react-native": "0.18.0-rc",
14+
"react-redux": "4.0.6",
1315
"redux": "3.0.5",
1416
"redux-thunk": "1.0.0"
1517
}

README.md

Lines changed: 4 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,11 @@
1-
## Example Project using React-Native 0.16 and Redux 3.0.4
1+
## Example Project using React-Native 0.18.-rc and Redux 3.0.4 and React-Redux 4.0.5
22

33
This is a repo for starting a react-native app using Redux.
44

5-
There are some issues which they need to be addressed in the future:
6-
- React-Native >= 0.16 use Babel 6 which doesn't support `Decorator` until T2645 lands in Babel. So for binding your `connect` use the old style.
5+
### Usage
76

7+
clone the project and run `npm install`.
88

9-
instead of this:
10-
11-
```js
12-
@connect(state => ({
13-
state: state.counter
14-
}))
15-
class CounterApp extends Component {
16-
17-
}
18-
19-
export CounterApp;
20-
```
21-
22-
use this:
23-
24-
```js
25-
class CounterApp extends Component {
26-
27-
}
28-
29-
export default connect(state => ({
30-
state: state.counter
31-
}))(CounterApp);
32-
```
33-
34-
- Babel 6 doesn't like old .babelrc and you need to clean all .babelrc in your `node_modules`. I have provided a simple `bash script` to clean all `.babelrc` files.
35-
36-
once you install packages using `npm install`, make sure to run `npm run clean` to remove all `.babelrc` inside `node_modules`.
37-
9+
I have to do couple of cleanup after `npm install` you can follow up on this [react-redux issue](https://github.com/rackt/react-redux/issues/236)
3810

3911
Cheers,

0 commit comments

Comments
 (0)