diff --git a/types/react-native-navbar/index.d.ts b/types/react-native-navbar/index.d.ts new file mode 100644 index 0000000000..5c21ea38e8 --- /dev/null +++ b/types/react-native-navbar/index.d.ts @@ -0,0 +1,41 @@ +// Type definitions for react-native-navbar 2.1 +// Project: https://github.com/react-native-community/react-native-navbar +// Definitions by: Ryo Kikuchi +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +import * as React from 'react'; +import { ViewStyle, TextProps } from 'react-native'; + +export interface NavigationBarButton { + title: string; + style?: ViewStyle; + handler?: () => void; + disable?: boolean; +} + +export interface NavigationBarTitle { + title: string; + tintColor?: string; + ellipsizeMode?: TextProps["ellipsizeMode"]; + numberOfLines?: number; +} + +export interface StatusBar { + style?: 'light-content' | 'default'; + hidden?: boolean; + tintColor?: string; + hideAnimation?: 'fade' | 'slide' | 'none'; + showAnimation?: 'fade' | 'slide' | 'none'; +} + +export interface NavigationBarProps { + style?: ViewStyle; + tintColor?: string; + statusBar?: StatusBar; + leftButton?: NavigationBarButton | React.ReactElement | null; + rightButton?: NavigationBarButton | React.ReactElement | null; + title?: NavigationBarTitle | React.ReactElement | null; +} + +export default class NavigationBar extends React.Component {} diff --git a/types/react-native-navbar/react-native-navbar-tests.tsx b/types/react-native-navbar/react-native-navbar-tests.tsx new file mode 100644 index 0000000000..254f1862ed --- /dev/null +++ b/types/react-native-navbar/react-native-navbar-tests.tsx @@ -0,0 +1,19 @@ +import * as React from "react"; +import { View, Text } from "react-native"; +import NavigationBar from "react-native-navbar"; + +class NavigationBarTest extends React.Component { + render() { + return ( + + { console.log("Back"); }, + }} + rightButton={Next} + title={null} + /> + + ); + } +} diff --git a/types/react-native-navbar/tsconfig.json b/types/react-native-navbar/tsconfig.json new file mode 100644 index 0000000000..3648bb0377 --- /dev/null +++ b/types/react-native-navbar/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "jsx": "react-native", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "react-native-navbar-tests.tsx" + ] +} diff --git a/types/react-native-navbar/tslint.json b/types/react-native-navbar/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-native-navbar/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }