1- import React from 'react' ;
2- import NavigationController from '../../src/navigation-controller' ;
1+ import React from 'react'
2+ import NavigationController from '../../src/navigation-controller'
33
44const {
55 Transition
6- } = NavigationController ;
6+ } = NavigationController
77
88const colors = [
9- '#0074D9' , '#7FDBFF' , '#39CCCC' , '#2ECC40' , '#FFDC00' , '#FF851B' , '#FF4136' ,
9+ '#0074D9' , '#7FDBFF' , '#39CCCC' , '#2ECC40' , '#FFDC00' , '#FF851B' , '#FF4136' ,
1010 '#F012BE' , '#B10DC9'
11- ] ;
11+ ]
1212
13- function getColor ( ) {
14- const color = colors . shift ( ) ;
15- colors . push ( color ) ;
16- return color ;
13+ function getColor ( ) {
14+ const color = colors . shift ( )
15+ colors . push ( color )
16+ return color
1717}
1818
1919class View extends React . Component {
20- constructor ( props ) {
21- super ( props ) ;
22- const now = new Date ( ) ;
20+ constructor ( props ) {
21+ super ( props )
22+ const now = new Date ( )
2323 this . state = {
2424 counter : 0 ,
2525 color : getColor ( ) ,
2626 time : `${ now . getHours ( ) } :${ now . getMinutes ( ) } :${ now . getSeconds ( ) } `
27- } ;
27+ }
2828 }
29- incrementCounter ( ) {
29+ incrementCounter ( ) {
3030 this . setState ( {
3131 counter : this . state . counter + 1
32- } ) ;
32+ } )
3333 }
34- onNext ( ) {
35- const view = < View index = { this . props . index + 1 } /> ;
36- this . props . navigationController . pushView ( view , { } ) ;
34+ onNext ( ) {
35+ const view = < View index = { this . props . index + 1 } />
36+ this . props . navigationController . pushView ( view , { } )
3737 }
38- onBack ( ) {
38+ onBack ( ) {
3939 this . props . navigationController . popView ( {
4040 transition : this . props . modal ? Transition . type . REVEAL_DOWN : Transition . type . PUSH_RIGHT
41- } ) ;
41+ } )
4242 }
43- onModal ( ) {
44- const view = < View index = { this . props . index + 1 } modal = { true } /> ;
43+ onModal ( ) {
44+ const view = < View index = { this . props . index + 1 } modal />
4545 this . props . navigationController . pushView ( view , {
4646 transition : Transition . type . COVER_UP
47- } ) ;
47+ } )
4848 }
49- onPopToRoot ( ) {
49+ onPopToRoot ( ) {
5050 this . props . navigationController . popToRootView ( {
5151 transition : this . props . modal ? Transition . type . REVEAL_DOWN : Transition . type . PUSH_RIGHT
52- } ) ;
52+ } )
5353 }
54- render ( ) {
54+ render ( ) {
5555 return (
5656 < div
57- className = " ReactNavigationControllerViewContent"
58- style = { { background :this . state . color } } >
57+ className = ' ReactNavigationControllerViewContent'
58+ style = { { background : this . state . color } } >
5959 < header >
6060 { this . renderBackButton ( ) }
6161 { this . renderNextButton ( ) }
@@ -71,28 +71,28 @@ class View extends React.Component {
7171 { this . renderPopToRootButton ( ) }
7272 </ section >
7373 </ div >
74- ) ;
74+ )
7575 }
76- renderBackButton ( ) {
77- const text = this . props . modal ? 'Close' : 'Back' ;
76+ renderBackButton ( ) {
77+ const text = this . props . modal ? 'Close' : 'Back'
7878 return this . props . index === 1
7979 ? < div />
80- : < button onClick = { this . onBack . bind ( this ) } > { text } </ button > ;
80+ : < button onClick = { this . onBack . bind ( this ) } > { text } </ button >
8181 }
82- renderNextButton ( ) {
82+ renderNextButton ( ) {
8383 return this . props . modal === true
8484 ? < div />
85- : < button onClick = { this . onNext . bind ( this ) } > Next</ button > ;
85+ : < button onClick = { this . onNext . bind ( this ) } > Next</ button >
8686 }
87- renderPopToRootButton ( ) {
87+ renderPopToRootButton ( ) {
8888 return this . props . index === 1
8989 ? < div />
90- : < button onClick = { this . onPopToRoot . bind ( this ) } > Pop To Root</ button > ;
90+ : < button onClick = { this . onPopToRoot . bind ( this ) } > Pop To Root</ button >
9191 }
9292}
9393
94- View . defaultProps = {
94+ View . defaultProps = {
9595 index : 1
96- } ;
96+ }
9797
98- export default View ;
98+ export default View
0 commit comments