This repository was archived by the owner on Aug 10, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +67
-3
lines changed
components/SampleViewComponent Expand file tree Collapse file tree 5 files changed +67
-3
lines changed Original file line number Diff line number Diff line change 11import React from 'react'
22import { Provider } from "react-redux"
33import store from "./storage"
4- // import TopLevelComponent from './screens/StartScreen'
4+ import StartScreen from './screens/StartScreen'
55import Routing , { Router } from './routing'
66
77const 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 )
Original file line number Diff line number Diff 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 ,
Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 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 ) ;
You can’t perform that action at this time.
0 commit comments