Merge pull request #27975 from iRoachie/react-navigation-material-bottom-tabs

Add types for react-navigation-material-bottom-tabs
This commit is contained in:
Ron Buckton 2018-08-08 15:24:43 -07:00 committed by GitHub
commit d1ebd24ebd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 76 additions and 0 deletions

View File

@ -0,0 +1,29 @@
// Type definitions for react-navigation-material-bottom-tabs 0.3
// Project: https://github.com/react-navigation/react-navigation-material-bottom-tab-navigator#readme
// Definitions by: Kyle Roach <https://github.com/iRoachie>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
import { StyleProp, TextStyle, ViewStyle } from 'react-native';
import {
NavigationContainer,
NavigationPathsConfig,
NavigationRouteConfigMap
} from 'react-navigation';
export interface TabConfig {
shifting?: boolean;
labeled?: boolean;
activeTintColor?: string;
inactiveTintColor?: string;
barStyle?: StyleProp<ViewStyle>;
initialRouteName?: string;
order?: string[];
paths?: NavigationPathsConfig;
backBehavior?: 'initialRoute' | 'none';
}
export function createMaterialBottomTabNavigator(
routeConfigMap: NavigationRouteConfigMap,
config?: TabConfig
): NavigationContainer;

View File

@ -0,0 +1,29 @@
import * as React from 'react';
import { View } from 'react-native';
import { createMaterialBottomTabNavigator } from 'react-navigation-material-bottom-tabs';
const Tab1 = () => <View />;
const Tab2 = () => <View />;
export default createMaterialBottomTabNavigator(
{
tab1: {
screen: Tab1
},
tab2: {
screen: Tab2
}
},
{
activeTintColor: 'blue',
inactiveTintColor: 'red',
labeled: false,
barStyle: {
backgroundColor: '#fff'
},
shifting: false,
initialRouteName: 'tab2',
order: ['tab2', 'tab1'],
backBehavior: 'none'
}
);

View File

@ -0,0 +1,17 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": ["es6"],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": ["../"],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"jsx": "react-native",
"strictFunctionTypes": true
},
"files": ["index.d.ts", "react-navigation-material-bottom-tabs-tests.tsx"]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }