@@ -18,6 +18,47 @@ const propTypes = {
1818 willDisappear : PropTypes . bool ,
1919} ;
2020
21+ const styles = StyleSheet . create ( {
22+ navbar : {
23+ position : 'absolute' ,
24+ top : 0 ,
25+ left : 0 ,
26+ right : 0 ,
27+ height : Styles . NAV_BAR_HEIGHT ,
28+ justifyContent : 'center' ,
29+ alignItems : 'center' ,
30+ flexDirection : 'row' ,
31+ paddingTop : Styles . NAV_BAR_PADDING_TOP ,
32+ } ,
33+ navbarText : {
34+ color : 'white' ,
35+ fontSize : 17 ,
36+ margin : 10 ,
37+ marginTop : Styles . NAV_BAR_TEXT_MARGIN_TOP ,
38+ marginBottom : Styles . NAV_BAR_TEXT_MARGIN_TOP ,
39+ fontWeight : '600' ,
40+ textAlign : Styles . NAV_BAR_TEXT_ALIGN ,
41+ alignItems : 'center' ,
42+ } ,
43+ corner : {
44+ flex : 1 ,
45+ justifyContent : 'center' ,
46+ } ,
47+
48+ alignLeft : {
49+ alignItems : 'flex-start' ,
50+ } ,
51+ alignRight : {
52+ alignItems : 'flex-end' ,
53+ } ,
54+ buttonTextLeft : {
55+ marginLeft : 10 ,
56+ } ,
57+ buttonTextRight : {
58+ marginRight : 10 ,
59+ } ,
60+ } ) ;
61+
2162class NavBarContent extends React . Component {
2263 constructor ( props ) {
2364 super ( props ) ;
@@ -29,47 +70,6 @@ class NavBarContent extends React.Component {
2970 this . state = {
3071 opacity : this . props . willDisappear ? new Animated . Value ( 1 ) : new Animated . Value ( 0 ) ,
3172 } ;
32-
33- this . styles = StyleSheet . create ( {
34- navbar : {
35- position : 'absolute' ,
36- top : 0 ,
37- left : 0 ,
38- right : 0 ,
39- height : Styles . NAV_BAR_HEIGHT ,
40- justifyContent : 'center' ,
41- alignItems : 'center' ,
42- flexDirection : 'row' ,
43- paddingTop : Styles . NAV_BAR_PADDING_TOP ,
44- } ,
45- navbarText : {
46- color : 'white' ,
47- fontSize : 17 ,
48- margin : 10 ,
49- marginTop : Styles . NAV_BAR_TEXT_MARGIN_TOP ,
50- marginBottom : Styles . NAV_BAR_TEXT_MARGIN_TOP ,
51- fontWeight : '600' ,
52- textAlign : Styles . NAV_BAR_TEXT_ALIGN ,
53- alignItems : 'center' ,
54- } ,
55- corner : {
56- flex : 1 ,
57- justifyContent : 'center' ,
58- } ,
59-
60- alignLeft : {
61- alignItems : 'flex-start' ,
62- } ,
63- alignRight : {
64- alignItems : 'flex-end' ,
65- } ,
66- buttonTextLeft : {
67- marginLeft : 10 ,
68- } ,
69- buttonTextRight : {
70- marginRight : 10 ,
71- } ,
72- } ) ;
7373 }
7474
7575 componentWillReceiveProps ( newProps ) {
@@ -147,7 +147,7 @@ class NavBarContent extends React.Component {
147147
148148 if ( Platform . OS === 'ios' || this . props . route . leftCorner || this . props . route . index > 0 ) {
149149 leftCorner = (
150- < View style = { [ this . styles . corner , this . styles . alignLeft ] } >
150+ < View style = { [ styles . corner , styles . alignLeft ] } >
151151 { leftCornerContent }
152152 </ View >
153153 ) ;
@@ -171,7 +171,7 @@ class NavBarContent extends React.Component {
171171
172172 if ( Platform . OS === 'ios' || this . props . route . rightCorner || this . props . rightCorner ) {
173173 rightCorner = (
174- < View style = { [ this . styles . corner , this . styles . alignRight ] } >
174+ < View style = { [ styles . corner , styles . alignRight ] } >
175175 { rightCornerContent }
176176 </ View >
177177 ) ;
@@ -186,7 +186,7 @@ class NavBarContent extends React.Component {
186186 titleContent = < TitleComponent { ...this . props . titleProps } /> ;
187187 } else {
188188 titleContent = (
189- < Text style = { [ this . styles . navbarText , this . props . titleStyle ] } numberOfLines = { 1 } >
189+ < Text style = { [ styles . navbarText , this . props . titleStyle ] } numberOfLines = { 1 } >
190190 { this . props . route . name }
191191 </ Text >
192192 ) ;
@@ -211,7 +211,7 @@ class NavBarContent extends React.Component {
211211 < Animated . View
212212 style = {
213213 [
214- this . styles . navbar ,
214+ styles . navbar ,
215215 transitionStyle ,
216216 this . props . route . headerStyle ,
217217 { borderBottomWidth : width , borderColor : color } ,
0 commit comments