mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Add type definition for react-native-navbar (#27412)
This commit is contained in:
parent
f109e22895
commit
642a64efbf
41
types/react-native-navbar/index.d.ts
vendored
Normal file
41
types/react-native-navbar/index.d.ts
vendored
Normal file
@ -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 <https://github.com/ryokik>
|
||||
// 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<any> | null;
|
||||
rightButton?: NavigationBarButton | React.ReactElement<any> | null;
|
||||
title?: NavigationBarTitle | React.ReactElement<any> | null;
|
||||
}
|
||||
|
||||
export default class NavigationBar extends React.Component<NavigationBarProps> {}
|
||||
19
types/react-native-navbar/react-native-navbar-tests.tsx
Normal file
19
types/react-native-navbar/react-native-navbar-tests.tsx
Normal file
@ -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 (
|
||||
<View>
|
||||
<NavigationBar tintColor={'red'} leftButton={{
|
||||
title: "Back",
|
||||
handler: () => { console.log("Back"); },
|
||||
}}
|
||||
rightButton={<Text>Next</Text>}
|
||||
title={null}
|
||||
/>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
24
types/react-native-navbar/tsconfig.json
Normal file
24
types/react-native-navbar/tsconfig.json
Normal file
@ -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"
|
||||
]
|
||||
}
|
||||
1
types/react-native-navbar/tslint.json
Normal file
1
types/react-native-navbar/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user