mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-04-29 12:55:21 +08:00
Fix lint and update snapshots
This commit is contained in:
@@ -28,9 +28,7 @@ class ResourceSavingSceneView extends React.PureComponent {
|
||||
const {
|
||||
isFocused,
|
||||
childNavigation,
|
||||
navigation,
|
||||
removeClippedSubviews,
|
||||
lazy,
|
||||
...rest
|
||||
} = this.props;
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ const WrappedSectionList = React.forwardRef((props, ref) => (
|
||||
/>
|
||||
));
|
||||
|
||||
// eslint-disable-next-line import/no-commonjs
|
||||
module.exports = {
|
||||
ScrollView: WrappedScrollView,
|
||||
FlatList: WrappedFlatList,
|
||||
|
||||
@@ -5,7 +5,7 @@ Object {
|
||||
"console": [MockFunction] {
|
||||
"calls": Array [
|
||||
Array [
|
||||
"You should only render one navigator explicitly in your app, and other navigators should by rendered by including them in that navigator. Full details at: https://reactnavigation.org/docs/common-mistakes.html#explicitly-rendering-more-than-one-navigator",
|
||||
"You should only render one navigator explicitly in your app, and other navigators should be rendered by including them in that navigator. Full details at: https://reactnavigation.org/docs/common-mistakes.html#explicitly-rendering-more-than-one-navigator",
|
||||
],
|
||||
],
|
||||
},
|
||||
|
||||
@@ -16,9 +16,7 @@ import {
|
||||
|
||||
function createStackNavigator(routeConfigMap, stackConfig = {}) {
|
||||
const router = StackRouter(routeConfigMap, stackConfig);
|
||||
return createAppContainer(
|
||||
createNavigator(SwitchView, router, stackConfig)
|
||||
);
|
||||
return createAppContainer(createNavigator(SwitchView, router, stackConfig));
|
||||
}
|
||||
|
||||
describe('NavigationContainer', () => {
|
||||
|
||||
@@ -21,7 +21,7 @@ function validateProps(props) {
|
||||
if (isStateful(props)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { navigation, screenProps, ...containerProps } = props;
|
||||
|
||||
const keys = Object.keys(containerProps);
|
||||
@@ -68,7 +68,7 @@ export default function createNavigationContainer(Component) {
|
||||
static router = Component.router;
|
||||
static navigationOptions = null;
|
||||
|
||||
static getDerivedStateFromProps(nextProps, prevState) {
|
||||
static getDerivedStateFromProps(nextProps) {
|
||||
validateProps(nextProps);
|
||||
return null;
|
||||
}
|
||||
@@ -118,6 +118,7 @@ export default function createNavigationContainer(Component) {
|
||||
return;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { navigation, screenProps, ...containerProps } = props;
|
||||
|
||||
const keys = Object.keys(containerProps);
|
||||
@@ -155,7 +156,6 @@ export default function createNavigationContainer(Component) {
|
||||
this._isStateful() &&
|
||||
!!process.env.REACT_NAV_LOGGING
|
||||
) {
|
||||
/* eslint-disable no-console */
|
||||
if (console.group) {
|
||||
console.group('Navigation Dispatch: ');
|
||||
console.log('Action: ', action);
|
||||
@@ -169,7 +169,6 @@ export default function createNavigationContainer(Component) {
|
||||
lastState: prevNav,
|
||||
});
|
||||
}
|
||||
/* eslint-enable no-console */
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -234,7 +233,9 @@ export default function createNavigationContainer(Component) {
|
||||
try {
|
||||
startupState = JSON.parse(startupStateJSON);
|
||||
_reactNavigationIsHydratingState = true;
|
||||
} catch (e) {}
|
||||
} catch (e) {
|
||||
/* do nothing */
|
||||
}
|
||||
}
|
||||
|
||||
// Pull state out of URL
|
||||
@@ -246,7 +247,10 @@ export default function createNavigationContainer(Component) {
|
||||
);
|
||||
if (urlAction) {
|
||||
!!process.env.REACT_NAV_LOGGING &&
|
||||
console.log('Applying Navigation Action for Initial URL:', url);
|
||||
console.log(
|
||||
'Applying Navigation Action for Initial URL:',
|
||||
parsedUrl
|
||||
);
|
||||
action = urlAction;
|
||||
startupState = Component.router.getStateForAction(
|
||||
urlAction,
|
||||
@@ -270,13 +274,14 @@ export default function createNavigationContainer(Component) {
|
||||
return;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line react/no-did-mount-set-state
|
||||
this.setState({ nav: startupState }, () => {
|
||||
_reactNavigationIsHydratingState = false;
|
||||
dispatchActions();
|
||||
});
|
||||
}
|
||||
|
||||
componentDidCatch(e, errorInfo) {
|
||||
componentDidCatch(e) {
|
||||
if (_reactNavigationIsHydratingState) {
|
||||
_reactNavigationIsHydratingState = false;
|
||||
console.warn(
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* eslint disable import/no-commonjs */
|
||||
/* eslint-disable import/no-commonjs */
|
||||
|
||||
module.exports = {
|
||||
get createAppContainer() {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
* will remain to ensure logic does not differ in production.
|
||||
*/
|
||||
|
||||
var validateFormat = function(format) {};
|
||||
var validateFormat = function() {};
|
||||
|
||||
if (__DEV__) {
|
||||
validateFormat = function(format) {
|
||||
@@ -44,4 +44,5 @@ function invariant(condition, format, a, b, c, d, e, f) {
|
||||
}
|
||||
}
|
||||
|
||||
// eslint-disable-next-line import/no-commonjs
|
||||
module.exports = invariant;
|
||||
|
||||
Reference in New Issue
Block a user