Skip to content
This repository was archived by the owner on Aug 10, 2023. It is now read-only.

Commit f151368

Browse files
author
Reinaldo Haynes
committed
Start screen & Sample view added.
1 parent 435f072 commit f151368

File tree

5 files changed

+67
-3
lines changed

5 files changed

+67
-3
lines changed

src/App.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react'
22
import { Provider } from "react-redux"
33
import store from "./storage"
4-
// import TopLevelComponent from './screens/StartScreen'
4+
import StartScreen from './screens/StartScreen'
55
import Routing, { Router } from './routing'
66

77
const Route = Routing.Route;
@@ -12,7 +12,7 @@ export default class App extends React.Component {
1212
return (
1313
<Provider store={store}>
1414
<Router>
15-
{/* <Route path='/' component={TopLevelComponent}/> */}
15+
<Route path='/' component={StartScreen}/>
1616
</Router>
1717
</Provider>
1818
)

src/actions/SampleAction.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ const somethingHappens = (payload) => {
1818
type: payload,
1919
data: { message: 'Action Success :)' }
2020
}
21-
break;
2221
default:
2322
return {
2423
type: payload,
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import React from 'react'
2+
import { View, Text } from 'react-native'
3+
4+
export default class SampleView extends React.Component {
5+
render() {
6+
return (
7+
<View>
8+
<Text>Hello World!</Text>
9+
</View>
10+
)
11+
}
12+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import React from 'react'
2+
3+
export default class SampleView extends React.Component {
4+
render() {
5+
return (
6+
<div>Hello World!</div>
7+
)
8+
}
9+
}

src/screens/StartScreen.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import React from 'react'
2+
import { connect } from "react-redux"
3+
import SampleAction from '../actions/SampleAction'
4+
import SampleView from '../components/SampleViewComponent'
5+
6+
class StartScreen extends React.Component {
7+
constructor(props, context) {
8+
super(props, context)
9+
10+
this.state = {
11+
text: {
12+
message: 'Welcome to the app!',
13+
dispatchMessage: 'Dispatch an action to:'
14+
},
15+
passActionValue: 1,
16+
failActionValue: 0
17+
}
18+
19+
this.passDispatchedAction = this.passDispatchedAction.bind(this)
20+
this.failDispatchedAction = this.failDispatchedAction.bind(this)
21+
}
22+
23+
passDispatchedAction() {
24+
this.props.dispatch(SampleAction(this.state.passActionValue))
25+
}
26+
27+
failDispatchedAction() {
28+
this.props.dispatch(SampleAction(this.state.failActionValue))
29+
}
30+
31+
render() {
32+
return (
33+
<SampleView />
34+
)
35+
}
36+
}
37+
38+
function mapStateToProps(state) {
39+
return ({
40+
SampleReducer: state.SampleReducer
41+
})
42+
}
43+
44+
export default connect(mapStateToProps)(StartScreen);

0 commit comments

Comments
 (0)