Skip to content

Commit

Permalink
add compiled OverlayNavigator
Browse files Browse the repository at this point in the history
  • Loading branch information
aksonov committed Jul 25, 2017
1 parent 36a5296 commit 0b050cf
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"react-native": "0.44.0",
"react-native-button": "^2.0.0",
"react-native-message-bar": "^1.6.0",
"react-native-router-flux": "github:aksonov/react-native-router-flux#bff0a814e011588553ea986360cacbec4a425292",
"react-native-router-flux": "github:aksonov/react-native-router-flux#36a5296d9fa4f7d0f509127936d1446483e185c9",
"react-navigation": "^1.0.0-beta.11"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions Example/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3237,9 +3237,9 @@ react-native-message-bar@^1.6.0:
version "1.6.0"
resolved "https://registry.yarnpkg.com/react-native-message-bar/-/react-native-message-bar-1.6.0.tgz#79623e89655475216927090771b0238616b6f1c7"

"react-native-router-flux@github:aksonov/react-native-router-flux#bff0a814e011588553ea986360cacbec4a425292":
"react-native-router-flux@github:aksonov/react-native-router-flux#36a5296d9fa4f7d0f509127936d1446483e185c9":
version "4.0.0-beta.13"
resolved "https://codeload.github.com/aksonov/react-native-router-flux/tar.gz/bff0a814e011588553ea986360cacbec4a425292"
resolved "https://codeload.github.com/aksonov/react-native-router-flux/tar.gz/36a5296d9fa4f7d0f509127936d1446483e185c9"
dependencies:
mobx "^3.1.16"
mobx-react "^4.2.1"
Expand Down
50 changes: 50 additions & 0 deletions dist/OverlayNavigator.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
Object.defineProperty(exports,"__esModule",{value:true});var _jsxFileName='src/OverlayNavigator.js';

var _react=require('react');var _react2=_interopRequireDefault(_react);
var _reactNavigation=require('react-navigation');
var _reactNative=require('react-native');function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}

var OverlayNavigator=function OverlayNavigator(
routeConfigs)

{var tabsConfig=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};
var router=(0,_reactNavigation.TabRouter)(routeConfigs,tabsConfig);

var navigator=(0,_reactNavigation.createNavigator)(
router,
routeConfigs,
tabsConfig,
'react-navigation/STACK')(
function(_ref){var navigation=_ref.navigation;var
state=navigation.state,dispatch=navigation.dispatch;var
routes=state.routes;


var Component=routeConfigs[tabsConfig.initialRouteName].screen;
var initialIndex=0;
for(var i=0;i<routes.length;i++){
var route=routes[i];
if(route.routeName===tabsConfig.initialRouteName){
initialIndex=i;
}
}
var initialRouteName=tabsConfig.initialRouteName||routes[initialIndex].routeName;
var overlays=[];
for(var _i=0;_i<tabsConfig.order.length;_i++){
var routeName=tabsConfig.order[_i];
if(initialRouteName!==routeName){
var Overlay=routeConfigs[routeName].screen;
overlays.push(_react2.default.createElement(Overlay,{key:routeName,navigation:{dispatch:dispatch,state:state},__source:{fileName:_jsxFileName,lineNumber:37}}));
}
}
var ContentComponent=tabsConfig.contentComponent||_reactNative.View;
return _react2.default.createElement(ContentComponent,{style:{flex:1},__source:{fileName:_jsxFileName,lineNumber:41}},
_react2.default.createElement(Component,{navigation:{dispatch:dispatch,state:routes[initialIndex]},__source:{fileName:_jsxFileName,lineNumber:42}}),
overlays);

});

return(0,_reactNavigation.createNavigationContainer)(navigator,tabsConfig.containerOptions);
};exports.default=

OverlayNavigator;

0 comments on commit 0b050cf

Please sign in to comment.