Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX NavigationTypeDefinition import and some eslint errors #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions NavigationAbstractPanResponder.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ const PanResponder = require('react-native').PanResponder;

const invariant = require('fbjs/lib/invariant');

import type {
import type {
NavigationPanPanHandlers,
} from 'NavigationTypeDefinition';
} from './NavigationTypeDefinition';

const EmptyPanHandlers = {
onMoveShouldSetPanResponder: null,
Expand Down
6 changes: 3 additions & 3 deletions NavigationAnimatedValueSubscription.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
*/
'use strict';

import type {
NavigationAnimatedValue
} from 'NavigationTypeDefinition';
import type {
NavigationAnimatedValue,
} from './NavigationTypeDefinition';

class NavigationAnimatedValueSubscription {
_value: NavigationAnimatedValue;
Expand Down
4 changes: 2 additions & 2 deletions NavigationAnimatedView.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import type {
NavigationParentState,
NavigationScene,
NavigationSceneRenderer,
} from 'NavigationTypeDefinition';
} from './NavigationTypeDefinition';

type Props = {
applyAnimation: NavigationAnimationSetter,
Expand All @@ -44,7 +44,7 @@ type State = {
scenes: Array<NavigationScene>,
};

const {PropTypes} = React;
const { PropTypes } = React;

function applyDefaultAnimation(
position: NavigationAnimatedValue,
Expand Down
8 changes: 4 additions & 4 deletions NavigationCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ const ReactComponentWithPureRenderMixin = require('react-addons-pure-render-mixi
const StyleSheet = require('react-native').StyleSheet;
const View = require('react-native').View;

import type {
import type {
NavigationPanPanHandlers,
NavigationSceneRenderer,
NavigationSceneRendererProps,
} from 'NavigationTypeDefinition';
} from './NavigationTypeDefinition';

type SceneViewProps = {
type SceneViewProps = {
sceneRenderer: NavigationSceneRenderer,
sceneRendererProps: NavigationSceneRendererProps,
};
Expand All @@ -64,7 +64,7 @@ type Props = NavigationSceneRendererProps & {
style: any,
};

const {PropTypes} = React;
const { PropTypes } = React;

class SceneView extends React.Component<any, SceneViewProps, any> {

Expand Down
10 changes: 5 additions & 5 deletions NavigationCardStack.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,18 @@ const StyleSheet = require('react-native').StyleSheet;

const emptyFunction = require('fbjs/lib/emptyFunction');

const {PropTypes} = React;
const {Directions} = NavigationCardStackPanResponder;
const { PropTypes } = React;
const { Directions } = NavigationCardStackPanResponder;

import type {
NavigationParentState,
NavigationSceneRenderer,
NavigationSceneRendererProps,
} from 'NavigationTypeDefinition';
} from './NavigationTypeDefinition';

import type {
NavigationGestureDirection,
} from 'NavigationCardStackPanResponder';
} from './NavigationCardStackPanResponder';

type Props = {
direction: NavigationGestureDirection,
Expand Down Expand Up @@ -140,7 +140,7 @@ class NavigationCardStack extends React.Component<DefaultProps, Props, void> {
return (
<NavigationCard
{...props}
key={'card_' + props.scene.key}
key={`card_ ${props.scene.key}`}
panHandlers={panHandlers}
renderScene={this.props.renderScene}
style={style}
Expand Down
4 changes: 2 additions & 2 deletions NavigationCardStackPanResponder.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const clamp = require('clamp');
import type {
NavigationPanPanHandlers,
NavigationSceneRendererProps,
} from 'NavigationTypeDefinition';
} from './NavigationTypeDefinition';

/**
* The duration of the card animation in milliseconds.
Expand Down Expand Up @@ -69,7 +69,7 @@ const Actions = {
// The gesture to navigate backward.
// This is done by swiping from the left to the right or from the top to the
// bottom.
BACK: {type: 'back'},
BACK: { type: 'back' },
};

/**
Expand Down
4 changes: 2 additions & 2 deletions NavigationCardStackStyleInterpolator.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
*/
'use strict';

import type {
import type {
NavigationSceneRendererProps,
} from 'NavigationTypeDefinition';
} from './NavigationTypeDefinition';

/**
* Utility that builds the style for the card in the cards stack.
Expand Down
4 changes: 2 additions & 2 deletions NavigationFindReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

import type {
NavigationState,
NavigationReducer
} from 'NavigationTypeDefinition';
NavigationReducer,
} from './NavigationTypeDefinition';

function NavigationFindReducer(
reducers: Array<NavigationReducer>,
Expand Down
4 changes: 2 additions & 2 deletions NavigationHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ const {
View,
} = ReactNative;

import type {
import type {
NavigationSceneRenderer,
NavigationSceneRendererProps,
NavigationStyleInterpolator,
} from 'NavigationTypeDefinition';
} from './NavigationTypeDefinition';

type DefaultProps = {
renderLeftComponent: NavigationSceneRenderer,
Expand Down
6 changes: 3 additions & 3 deletions NavigationHeaderBackButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const NavigationHeaderBackButton = (props: Props) => (
);

NavigationHeaderBackButton.propTypes = {
onNavigate: React.PropTypes.func.isRequired
onNavigate: React.PropTypes.func.isRequired,
};

const styles = StyleSheet.create({
Expand All @@ -53,8 +53,8 @@ const styles = StyleSheet.create({
height: 24,
width: 24,
margin: Platform.OS === 'ios' ? 10 : 16,
resizeMode: 'contain'
}
resizeMode: 'contain',
},
});

module.exports = NavigationContainer.create(NavigationHeaderBackButton);
36 changes: 18 additions & 18 deletions NavigationHeaderStyleInterpolator.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
'use strict';


import type {
import type {
NavigationSceneRendererProps,
} from 'NavigationTypeDefinition';
} from './NavigationTypeDefinition';

/**
* Utility that builds the style for the navigation header.
Expand All @@ -49,42 +49,42 @@ import type {
*/

function forLeft(props: NavigationSceneRendererProps): Object {
const {position, scene} = props;
const {index} = scene;
const { position, scene } = props;
const { index } = scene;
return {
opacity: position.interpolate({
inputRange: [ index - 1, index, index + 1 ],
outputRange: [ 0, 1, 0 ],
inputRange: [index - 1, index, index + 1],
outputRange: [0, 1, 0],
}),
};
}

function forCenter(props: NavigationSceneRendererProps): Object {
const {position, scene} = props;
const {index} = scene;
const { position, scene } = props;
const { index } = scene;
return {
opacity:position.interpolate({
inputRange: [ index - 1, index, index + 1 ],
outputRange: [ 0, 1, 0 ],
opacity: position.interpolate({
inputRange: [index - 1, index, index + 1],
outputRange: [0, 1, 0],
}),
transform: [
{
translateX: position.interpolate({
inputRange: [ index - 1, index + 1 ],
outputRange: [ 200, -200 ],
inputRange: [index - 1, index + 1],
outputRange: [200, -200],
}),
}
},
],
};
}

function forRight(props: NavigationSceneRendererProps): Object {
const {position, scene} = props;
const {index} = scene;
const { position, scene } = props;
const { index } = scene;
return {
opacity: position.interpolate({
inputRange: [ index - 1, index, index + 1 ],
outputRange: [ 0, 1, 0 ],
inputRange: [index - 1, index, index + 1],
outputRange: [0, 1, 0],
}),
};
}
Expand Down
12 changes: 6 additions & 6 deletions NavigationHeaderTitle.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ type Props = {
}

const NavigationHeaderTitle = ({ children, style, textStyle, viewProps }: Props) => (
<View style={[ styles.title, style ]} {...viewProps}>
<Text style={[ styles.titleText, textStyle ]}>{children}</Text>
<View style={[styles.title, style]} {...viewProps}>
<Text style={[styles.titleText, textStyle]}>{children}</Text>
</View>
);

Expand All @@ -55,22 +55,22 @@ const styles = StyleSheet.create({
flex: 1,
flexDirection: 'row',
alignItems: 'center',
marginHorizontal: 16
marginHorizontal: 16,
},

titleText: {
flex: 1,
fontSize: 18,
fontWeight: '500',
color: 'rgba(0, 0, 0, .9)',
textAlign: Platform.OS === 'ios' ? 'center' : 'left'
}
textAlign: Platform.OS === 'ios' ? 'center' : 'left',
},
});

NavigationHeaderTitle.propTypes = {
children: React.PropTypes.string.isRequired,
style: View.propTypes.style,
textStyle: Text.propTypes.style
textStyle: Text.propTypes.style,
};

module.exports = NavigationHeaderTitle;
18 changes: 9 additions & 9 deletions NavigationLegacyNavigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,25 @@ const NavigationAnimatedValueSubscription = require('./NavigationAnimatedValueSu
const NavigationAnimatedView = require('./NavigationAnimatedView');
const NavigationCard = require('./NavigationCard');
const NavigationCardStackStyleInterpolator = require('./NavigationCardStackStyleInterpolator');
const NavigationContext = require('./NavigationContext');
const NavigationLegacyNavigatorRouteStack = require('./NavigationLegacyNavigatorRouteStack');
const NavigationCardStackPanResponder = require('./NavigationCardStackPanResponder');
const NavigationPagerPanResponder = require('./NavigationPagerPanResponder');
const NavigationPagerStyleInterpolator = require('./NavigationPagerStyleInterpolator');
const NavigatorBreadcrumbNavigationBar = require('./NavigatorBreadcrumbNavigationBar');
const NavigatorNavigationBar = require('./NavigatorNavigationBar');
const NavigatorSceneConfigs = require('./NavigatorSceneConfigs');
const NavigationContext = require('./NavigationContext');
const React = require('react');
const ReactComponentWithPureRenderMixin = require('react-addons-pure-render-mixin');

import type {
import type {
NavigationActionCaller,
NavigationAnimatedValue,
NavigationAnimationSetter,
NavigationParentState,
NavigationSceneRenderer,
NavigationSceneRendererProps,
} from 'NavigationTypeDefinition';
} from './NavigationTypeDefinition';

type Props = {
configureScene: any,
Expand Down Expand Up @@ -262,7 +262,7 @@ class NavigationLegacyNavigator extends React.Component<any, Props, State> {
this._onPositionChange,
);

const {navigationBar, navigationBarNavigator} = this.props;
const { navigationBar, navigationBarNavigator } = this.props;
if (!navigationBar) {
return null;
}
Expand All @@ -279,12 +279,12 @@ class NavigationLegacyNavigator extends React.Component<any, Props, State> {
}

_renderCard(props: NavigationSceneRendererProps): ReactElement {
const {scene} = props;
const {configureScene} = this.props;
const { scene } = props;
const { configureScene } = this.props;

// Default getters for style and pan responders.
let styleGetter = NavigationCardStackStyleInterpolator.forHorizontal;
let panResponderGetter = NavigationCardStackPanResponder.forHorizontal;
let panResponderGetter = NavigationCardStackPanResponder.forHorizontal;

if (configureScene) {
const route = RouteStack.getRouteByNavigationState(scene.navigationState);
Expand Down Expand Up @@ -326,7 +326,7 @@ class NavigationLegacyNavigator extends React.Component<any, Props, State> {
}

_renderScene(props: NavigationSceneRendererProps): ReactElement {
const {navigationState} = props.scene;
const { navigationState } = props.scene;
const route = RouteStack.getRouteByNavigationState(navigationState);
return this.props.renderScene(route, this);
}
Expand All @@ -351,7 +351,7 @@ class NavigationLegacyNavigator extends React.Component<any, Props, State> {

_onNavigationBarRef(navigationBarRef: any): void {
this._navigationBarRef = navigationBarRef;
const {navigationBar} = this.props;
const { navigationBar } = this.props;
if (navigationBar && typeof navigationBar.ref === 'function') {
navigationBar.ref(navigationBarRef);
}
Expand Down
2 changes: 1 addition & 1 deletion NavigationLegacyNavigatorRouteStack.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const invariant = require('fbjs/lib/invariant');
import type {
NavigationState,
NavigationParentState,
} from 'NavigationTypeDefinition';
} from './NavigationTypeDefinition';

type IterationCallback = (route: any, index: number, key: string) => void;

Expand Down
9 changes: 4 additions & 5 deletions NavigationPagerPanResponder.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@ const clamp = require('clamp');
import type {
NavigationPanPanHandlers,
NavigationSceneRendererProps,
} from 'NavigationTypeDefinition';
} from './NavigationTypeDefinition';

import type {
NavigationGestureDirection,
} from 'NavigationCardStackPanResponder';

} from './NavigationCardStackPanResponder';


/**
Expand All @@ -44,8 +43,8 @@ const {
* Primitive gesture actions.
*/
const Actions = {
JUMP_BACK: {type: 'jump_back'},
JUMP_FORWARD: {type: 'jump_forward'},
JUMP_BACK: { type: 'jump_back' },
JUMP_FORWARD: { type: 'jump_forward' },
};

/**
Expand Down
Loading