Skip to content

Commit

Permalink
eslint formatting, remove obsolete code
Browse files Browse the repository at this point in the history
  • Loading branch information
aksonov committed Jul 10, 2017
1 parent 66e713f commit e0391d6
Show file tree
Hide file tree
Showing 18 changed files with 555 additions and 1,269 deletions.
4 changes: 4 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ module.exports = {
rules: {
'react/forbid-prop-types': 0,
'no-console': 0,
'new-cap': 0,
'no-underscore-dangle': 0,
'no-use-before-define': 0,
'max-len': ["error", 180],
'import/no-unresolved': [
2,
{
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Change Log

## 4.0.0-beta.7

- Fix: Mobx enabled useStrict (#1994)
- Improvement: Support Actions.popTo(sceneName) (#1987)
- Fix: Support v3 syntax `panHandlers={null}` to disable gestures for back transition. You may also pass `gesturesEnabled={false}` (#2002)
- Fix: Support for renderTitle, drawerImage, navigationBarTitleImage, navigationBarTitleImageStyle props for `Scene` (#1991)
- Fix: Pass drawerPosition, drawerOptions, drawerWidth and other Scene params to react-navigation DrawerNavigator
- Fix: Pass all container scene props to StackNavigator config
- Fix: ESLint formatting

4 changes: 2 additions & 2 deletions dist/LightboxNavigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Object.defineProperty(exports,"__esModule",{value:true});var _jsxFileName='src/L

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};}function _objectWithoutProperties(obj,keys){var target={};for(var i in obj){if(keys.indexOf(i)>=0)continue;if(!Object.prototype.hasOwnProperty.call(obj,i))continue;target[i]=obj[i];}return target;}
var _reactNative=require('react-native');function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}

var LightboxNavigator=function LightboxNavigator(
routeConfigs)
Expand All @@ -15,7 +15,7 @@ router,
routeConfigs,
tabsConfig,
'react-navigation/STACK')(
function(_ref){var navigation=_ref.navigation,props=_objectWithoutProperties(_ref,['navigation']);var
function(_ref){var navigation=_ref.navigation;var
state=navigation.state,dispatch=navigation.dispatch;var
routes=state.routes,index=state.index;

Expand Down
490 changes: 10 additions & 480 deletions dist/NavBar.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/Reducer.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Object.defineProperty(exports,"__esModule",{value:true});exports.default=

createReducer;var _navigationStore=require('./navigationStore');var _navigationStore2=_interopRequireDefault(_navigationStore);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}function createReducer(params){
createReducer;var _navigationStore=require('./navigationStore');var _navigationStore2=_interopRequireDefault(_navigationStore);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}function createReducer(){
return function(state,action){return _navigationStore2.default._router.getStateForAction(action,state);};
}
65 changes: 26 additions & 39 deletions dist/Router.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Object.defineProperty(exports,"__esModule",{value:true});var _jsxFileName='src/Router.js';var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};var _react=require('react');var _react2=_interopRequireDefault(_react);
var _mobx=require('mobx');
var _native=require('mobx-react/native');
var _reactNative=require('react-native');
var _navigationStore=require('./navigationStore');var _navigationStore2=_interopRequireDefault(_navigationStore);
var _Scene=require('./Scene');var _Scene2=_interopRequireDefault(_Scene);
var _propTypes=require('prop-types');var _propTypes2=_interopRequireDefault(_propTypes);
var _Util=require('./Util');
var _reactNavigation=require('react-navigation');
var _NavBar=require('./NavBar');
Expand Down Expand Up @@ -53,19 +53,6 @@ var dontInheritKeys=[
'hideTabBar'];


function filterParam(data){
if(data.toString()!=='[object Object]'){
return{data:data};
}
var proto=(data||{}).constructor.name;

if(!data||proto!=='Object'){
return{};
}
return data;
}


function getValue(value,params){
return value instanceof Function?value(params):value;
}
Expand Down Expand Up @@ -94,15 +81,15 @@ headerStyle:getValue(navigationParams.headerStyle||headerStyle||navigationBarSty
headerBackImage:navigationParams.backButtonImage||backButtonImage});

if(NavBar){
res.header=function(data){return _react2.default.createElement(NavBar,_extends({navigation:navigation},data,params,{__source:{fileName:_jsxFileName,lineNumber:97}}));};
res.header=function(data){return _react2.default.createElement(NavBar,_extends({navigation:navigation},data,params,{__source:{fileName:_jsxFileName,lineNumber:84}}));};
}

if(panHandlers===null){
res.gesturesEnabled=false;
}

if(navigationBarTitleImage){
res.headerTitle=_react2.default.createElement(_reactNative.Image,{source:navigationBarTitleImage,style:navigationBarTitleImageStyle,__source:{fileName:_jsxFileName,lineNumber:105}});
res.headerTitle=_react2.default.createElement(_reactNative.Image,{source:navigationBarTitleImage,style:navigationBarTitleImageStyle,__source:{fileName:_jsxFileName,lineNumber:92}});
}

if(tabBarLabel){
Expand Down Expand Up @@ -145,26 +132,21 @@ function createWrapper(Component){
if(!Component){
return null;
}
return(0,_native.observer)(function(_ref3){var navigation=_ref3.navigation,props=_objectWithoutProperties(_ref3,['navigation']);
return _react2.default.createElement(Component,_extends({},props,{navigation:navigation},navigation.state.params,{name:navigation.state.routeName,__source:{fileName:_jsxFileName,lineNumber:149}}));
});
return(0,_native.observer)(function(_ref3){var navigation=_ref3.navigation,props=_objectWithoutProperties(_ref3,['navigation']);return _react2.default.createElement(Component,_extends({},props,{navigation:navigation},navigation.state.params,{name:navigation.state.routeName,__source:{fileName:_jsxFileName,lineNumber:135}}));});
}


var App=(0,_native.observer)(function(props){
var AppNavigator=props.navigator;
return(
_react2.default.createElement(AppNavigator,{navigation:(0,_reactNavigation.addNavigationHelpers)({
dispatch:_navigationStore2.default.dispatch,
state:_navigationStore2.default.state}),__source:{fileName:_jsxFileName,lineNumber:157}}));

_react2.default.createElement(AppNavigator,{navigation:(0,_reactNavigation.addNavigationHelpers)({dispatch:_navigationStore2.default.dispatch,state:_navigationStore2.default.state}),__source:{fileName:_jsxFileName,lineNumber:142}}));

});

function processScene(scene){var inheritProps=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var clones=arguments.length>2&&arguments[2]!==undefined?arguments[2]:[];
(0,_Util.assert)(scene.props,'props should be defined');
if(!scene.props.children){
return;
return null;
}
var res={};
var order=[];var _scene$props=
Expand All @@ -188,14 +170,13 @@ var children=!Array.isArray(parentProps.children)?[parentProps.children]:[].conc
if(!drawer&&!tabs){
children.push.apply(children,_toConsumableArray(clones));
}
var initialRouteName=void 0,initialRouteParams=void 0;var _loop=function _loop(
var initialRouteName=void 0;
var initialRouteParams=void 0;var _loop=function _loop(
child){
(0,_Util.assert)(child.key,'key should be defined for '+child);
var key=child.key;
var init=key===children[0].key;
if(reservedKeys.indexOf(key)!==-1){
throw'Scene name cannot be reserved word: '+child.key;
}var _child$props=
(0,_Util.assert)(reservedKeys.indexOf(key)===-1,'Scene name cannot be reserved word: '+child.key);var _child$props=
child.props,component=_child$props.component,_child$props$type=_child$props.type,type=_child$props$type===undefined?'push':_child$props$type,onEnter=_child$props.onEnter,onExit=_child$props.onExit,on=_child$props.on,failure=_child$props.failure,success=_child$props.success,props=_objectWithoutProperties(_child$props,['component','type','onEnter','onExit','on','failure','success']);
if(child.props.clone){
if(clones.indexOf(child)===-1){
Expand All @@ -212,10 +193,10 @@ _navigationStore2.default.states[key][transition]=props[transition];
}
delete props.children;
if(success){
_navigationStore2.default.states[key].success=success instanceof Function?success:function(props){console.log('Transition to state='+success);_navigationStore2.default[success](props);};
_navigationStore2.default.states[key].success=success instanceof Function?success:function(args){console.log('Transition to state='+success);_navigationStore2.default[success](args);};
}
if(failure){
_navigationStore2.default.states[key].failure=failure instanceof Function?failure:function(props){console.log('Transition to state='+failure);_navigationStore2.default[failure](props);};
_navigationStore2.default.states[key].failure=failure instanceof Function?failure:function(args){console.log('Transition to state='+failure);_navigationStore2.default[failure](args);};
}

var screen={
Expand All @@ -235,7 +216,8 @@ res[key]=screen;

props.init=true;
if(!_navigationStore2.default[key]){
_navigationStore2.default[key]=new Function('actions','props','type','return function '+key+'(params){ actions[type](\''+key+'\', props, params)}')(_navigationStore2.default,_extends({},commonProps,props),type);
_navigationStore2.default[key]=new Function('actions','props','type','return function '+
key+'(params){ actions[type](\''+key+'\', props, params)}')(_navigationStore2.default,_extends({},commonProps,props),type);
}

if((onEnter||on)&&!_navigationStore2.default[key+_Util.OnEnter]){
Expand All @@ -256,23 +238,28 @@ var mode=modal?'modal':'card';
if(lightbox){
return(0,_LightboxNavigator2.default)(res,{mode:mode,initialRouteParams:initialRouteParams,initialRouteName:initialRouteName,navigationOptions:createNavigationOptions(parentProps)});
}else if(tabs){
return(0,_reactNavigation.TabNavigator)(res,_extends({lazy:lazy,initialRouteName:initialRouteName,initialRouteParams:initialRouteParams,order:order},parentProps,{tabBarOptions:createTabBarOptions(parentProps),navigationOptions:createNavigationOptions(parentProps)}));
return(0,_reactNavigation.TabNavigator)(res,_extends({lazy:lazy,initialRouteName:initialRouteName,initialRouteParams:initialRouteParams,order:order},parentProps,{
tabBarOptions:createTabBarOptions(parentProps),navigationOptions:createNavigationOptions(parentProps)}));
}else if(drawer){
return(0,_reactNavigation.DrawerNavigator)(res,_extends({initialRouteName:initialRouteName,contentComponent:contentComponent,order:order,backBehavior:'none'},parentProps));
}else{
}
if(navigator){
return navigator(res,_extends({lazy:lazy,initialRouteName:initialRouteName,initialRouteParams:initialRouteParams,order:order},parentProps,{navigationOptions:createNavigationOptions(parentProps)}));
}else{
return(0,_reactNavigation.StackNavigator)(res,_extends({mode:mode,initialRouteParams:initialRouteParams,initialRouteName:initialRouteName},parentProps,{navigationOptions:createNavigationOptions(parentProps)}));
}
return(0,_reactNavigation.StackNavigator)(res,_extends({mode:mode,initialRouteParams:initialRouteParams,initialRouteName:initialRouteName},parentProps,{navigationOptions:createNavigationOptions(parentProps)}));
}
}exports.default=

function(_ref7){var createReducer=_ref7.createReducer,props=_objectWithoutProperties(_ref7,['createReducer']);
var Router=function Router(_ref7){var createReducer=_ref7.createReducer,props=_objectWithoutProperties(_ref7,['createReducer']);
var scene=props.children;
var AppNavigator=processScene(scene,props);
_navigationStore2.default.router=AppNavigator.router;
_navigationStore2.default.reducer=createReducer&&createReducer(props);

return _react2.default.createElement(App,{navigator:AppNavigator,__source:{fileName:_jsxFileName,lineNumber:277}});
};
return _react2.default.createElement(App,{navigator:AppNavigator,__source:{fileName:_jsxFileName,lineNumber:258}});
};
Router.propTypes={
createReducer:_propTypes2.default.func,
children:_propTypes2.default.element};exports.default=


Router;
10 changes: 2 additions & 8 deletions dist/Scene.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
Object.defineProperty(exports,"__esModule",{value:true});exports.default=undefined;var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor;};}();
Object.defineProperty(exports,"__esModule",{value:true});exports.default=







var _react=require('react');var _react2=_interopRequireDefault(_react);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return call&&(typeof call==="object"||typeof call==="function")?call:self;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass;}var _default=function(_React$Component){_inherits(_default,_React$Component);function _default(){_classCallCheck(this,_default);return _possibleConstructorReturn(this,(_default.__proto__||Object.getPrototypeOf(_default)).apply(this,arguments));}_createClass(_default,[{key:'render',value:function render()



{
return null;
}}]);return _default;}(_react2.default.Component);exports.default=_default;
function(){return null;};
5 changes: 1 addition & 4 deletions dist/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
Object.defineProperty(exports,"__esModule",{value:true});exports.Actions=exports.Scene=exports.Router=exports.Reducer=exports.navigationStore=exports.ActionConst=undefined;


var _ActionConst=require('./ActionConst');var ActionConst=_interopRequireWildcard(_ActionConst);
Object.defineProperty(exports,"__esModule",{value:true});exports.Actions=exports.Scene=exports.Router=exports.Reducer=exports.navigationStore=exports.ActionConst=undefined;var _ActionConst=require('./ActionConst');var ActionConst=_interopRequireWildcard(_ActionConst);
var _navigationStore=require('./navigationStore');var _navigationStore2=_interopRequireDefault(_navigationStore);
var _Reducer=require('./Reducer');var _Reducer2=_interopRequireDefault(_Reducer);
var _Router=require('./Router');var _Router2=_interopRequireDefault(_Router);
Expand Down
Loading

0 comments on commit e0391d6

Please sign in to comment.