Fix formatting and flow errors

This commit is contained in:
Brent Vatne
2018-08-02 12:07:58 -07:00
committed by satyajit.happy
parent 18fa1315cf
commit 6d7240f815
3 changed files with 9 additions and 14 deletions

View File

@@ -29,7 +29,7 @@ type State = {
transitioningFromIndex: ?number,
};
class MaterialTabView extends React.PureComponent<Props> {
class MaterialTabView extends React.PureComponent<Props, State> {
static defaultProps = {
// fix for https://github.com/react-native-community/react-native-tab-view/issues/312
initialLayout: Platform.select({
@@ -116,7 +116,7 @@ class MaterialTabView extends React.PureComponent<Props> {
_renderPanPager = props => <PagerPan {...props} />;
_handleAnimationEnd = () => {
const { lazy } = this.props;
const { lazy } = this.props;
if (lazy) {
this.setState({
@@ -181,12 +181,7 @@ class MaterialTabView extends React.PureComponent<Props> {
};
_renderScene = ({ route }) => {
const {
renderScene,
descriptors,
lazy,
optimizationsEnabled,
} = this.props;
const { renderScene, descriptors, lazy, optimizationsEnabled } = this.props;
if (lazy) {
const { loaded } = this.state;
@@ -194,7 +189,10 @@ class MaterialTabView extends React.PureComponent<Props> {
const index = routes.findIndex(({ key }) => key === route.key);
const { navigation } = descriptors[route.key];
const mustBeVisible = this._mustBeVisible({ index, focused: navigation.isFocused()});
const mustBeVisible = this._mustBeVisible({
index,
focused: navigation.isFocused(),
});
if (!loaded.includes(index) && !mustBeVisible) {
return <View />;

View File

@@ -29,7 +29,7 @@ export type InjectedProps = {
};
export default function createTabNavigator(TabView: React.ComponentType<*>) {
class NavigationView extends React.Component<*, State> {
class NavigationView extends React.Component<*, *> {
_renderScene = ({ route }) => {
const { screenProps, descriptors } = this.props;
const descriptor = descriptors[route.key];

View File

@@ -206,10 +206,7 @@ class TabBarBottom extends React.Component<Props> {
];
return (
<SafeAreaView
style={tabBarStyle}
forceInset={safeAreaInset}
>
<SafeAreaView style={tabBarStyle} forceInset={safeAreaInset}>
{routes.map((route, index) => {
const focused = index === navigation.state.index;
const scene = { route, focused };