Add type definitions for rn-swipeable-panel (#45519)

This commit is contained in:
Enes 2020-06-21 11:03:54 +03:00 committed by GitHub
parent 33dc44bb1d
commit 9d19cf11e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 122 additions and 0 deletions

87
types/rn-swipeable-panel/index.d.ts vendored Normal file
View File

@ -0,0 +1,87 @@
// Type definitions for rn-swipeable-panel 1.1
// Project: https://github.com/enesozturk/rn-swipeable-panel
// Definitions by: Enes Öztürk <https://github.com/enesozturk>
// Definitions: https://github.com/DefinitelyTyped/types/rn-swipeable-panel
import * as React from 'react';
export interface SwipeablePanelProps extends React.Props<SwipeablePanel> {
/**
* Required prop for panels actual state. Set true if you want to open panel
*/
isActive: boolean;
/**
* Set true if you want to show close button
*/
showCloseButton?: boolean;
/**
* Set true if you want to make full with panel
*/
fullWidth?: boolean;
/**
* Set true if you want to disable black background opacity
*/
noBackgroundOpacity?: boolean;
/**
* Use this prop to override panel style
*/
style?: object;
/**
* Use this prop to override close button background style
*/
closeRootStyle?: object;
/**
* Use this prop to override close button icon style
*/
closeIconStyle?: object;
/**
* Set true if you want to close panel by touching outside
*/
closeOnTouchOutside?: boolean;
/**
* Set true if you want to let panel open just large mode
*/
onlyLarge?: boolean;
/**
* Set true if you want to let panel open just small mode
*/
onlySmall?: boolean;
/**
* Set true if you want to open panel large by default
*/
openLarge?: boolean;
/**
* Set true if you want to remove gray bar
*/
noBar?: boolean;
/**
* Use this prop to override bar style
*/
barStyle?: object;
/**
* Set true if you want to make toucable outside of panel
*/
allowTouchOutside?: boolean;
// Event Handlers
/**
* Required prop to keep panel's state sync with your parent components'state. Will be fired when panel is closed. See the example project.
*/
onClose: () => void;
}
export default class SwipeablePanel extends React.Component<SwipeablePanelProps, any> {}

View File

@ -0,0 +1,10 @@
import * as React from 'react';
import SwipeablePanel from 'rn-swipeable-panel';
export const App: React.FC = () => {
const [isActive, setIsActive] = React.useState<boolean>(false);
const onClosePanel = () => setIsActive(false);
return <SwipeablePanel isActive={isActive} onClose={onClosePanel}></SwipeablePanel>;
};

View File

@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"jsx": "react",
"strictFunctionTypes": true
},
"files": ["index.d.ts", "rn-swipeable-panel-tests.tsx"]
}

View File

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