@@ -161,23 +161,6 @@ export class ExRouteAdapter {
161161 }
162162}
163163
164- class ExNavigationBar extends Navigator . NavigationBar {
165- constructor ( props ) {
166- super ( props ) ;
167- this . state = { } ;
168- }
169- render ( ) {
170- const route = this . props . router . nextRoute || this . props . router . currentRoute ;
171- if ( route . props . hideNavBar === false ) {
172- return super . render ( ) ;
173- }
174- if ( this . props . router . props . hideNavBar || route . props . hideNavBar ) {
175- return null ;
176- }
177- return super . render ( ) ;
178- }
179- }
180-
181164export default class ExRouter extends React . Component {
182165 router : BaseRouter ;
183166
@@ -280,10 +263,29 @@ export default class ExRouter extends React.Component {
280263 this . setState ( { modal : null } ) ;
281264 }
282265
266+ onRefresh ( props :{ [ key : string ] : any } ) {
267+ this . setState ( props ) ;
268+ }
269+
283270 onActionSheet ( route : Route , props :{ [ key : string ] : any } ) {
284271 this . refs . actionsheet . showActionSheetWithOptions ( { ...route . props , ...props } , props . callback ) ;
285272 }
286273
274+ _renderNavigationBar ( props ) {
275+ const navBar = this . props . renderNavigationBar ? this . props . renderNavigationBar ( props ) :
276+ < Navigator . NavigationBar { ...props } />
277+
278+ const route = this . props . router . nextRoute || this . props . router . currentRoute ;
279+ if ( route . props . hideNavBar === false ) {
280+ return navBar ;
281+ }
282+ if ( this . props . router . props . hideNavBar || route . props . hideNavBar ) {
283+ return null ;
284+ }
285+ return navBar ;
286+
287+ }
288+
287289 render ( ) {
288290 const router = this . props . router ;
289291 if ( ! router ) {
@@ -301,13 +303,13 @@ export default class ExRouter extends React.Component {
301303 { header }
302304 < ExNavigator ref = "nav" initialRouteStack = { router . stack . map ( route => {
303305 const oldProps = router . routes [ route ] . props
304- router . routes [ route ] . props = { ...oldProps , ...parentProps ( this . props ) }
306+ router . routes [ route ] . props = { ...oldProps , ...parentProps ( this . props ) , ... this . state }
305307 return new ExRouteAdapter ( router . routes [ route ] )
306308 } ) }
307309 style = { styles . transparent }
308310 sceneStyle = { { paddingTop : 0 , backgroundColor :'transparent' } }
309- renderNavigationBar = { props => < ExNavigationBar { ...props } router = { router } /> }
310311 { ...this . props }
312+ renderNavigationBar = { props => this . _renderNavigationBar ( { ...props , ...this . state , router} ) }
311313 />
312314 { footer }
313315 { this . state . modal }
0 commit comments