Skip to content

Commit

Permalink
publish v1.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
calintamas committed Dec 7, 2020
1 parent 58c60f9 commit c11450d
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 22 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ Headers are one of:

- `Added`, `Changed`, `Removed` or `Fixed`.

## [1.4.1]

### Fixed

- Fix type declaration file, fixes [#109](https://github.com/calintamas/react-native-toast-message/issues/109)

## [1.4.0]

### Added
Expand Down
83 changes: 62 additions & 21 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,67 @@
import React from 'react';
import { ViewStyle, ImageSourcePropType } from 'react-native'

declare module 'react-native-toast-message' {
import React from 'react';
interface ObjectLiteral {
interface AnyObject {
[key: string]: any;
}
const Toast: {
show(options: {
type: 'success' | 'error' | 'info';
position?: 'top' | 'bottom';
text1?: string;
text2?: string;
visibilityTime?: number;
autoHide?: boolean;
topOffset?: number;
bottomOffset?: number;
props?: ObjectLiteral;
onShow?: () => {};
onHide?: () => {};
});
hide: (options?: { onHide: () => any }) => void;
setRef: (ref: any) => any;
} & React.ComponentType<{

export type ToastPosition = 'top' | 'bottom'

export interface BaseToastProps {
leadingIcon?: ImageSourcePropType,
trailingIcon?: ImageSourcePropType,
text1?: string,
text2?: string,
onPress?: () => void,
onTrailingIconPress?: () => void,
onLeadingIconPress?: () => void,
style?: ViewStyle,
leadingIconContainerStyle?: ViewStyle,
trailingIconContainerStyle?: ViewStyle,
leadingIconStyle?: ViewStyle,
trailingIconStyle?: ViewStyle,
contentContainerStyle?: ViewStyle,
text1Style?: ViewStyle,
text2Style?: ViewStyle,
activeOpacity?: number
}
export const BaseToast: React.FC<BaseToastProps>

export interface ToastProps {
ref: (ref: any) => any;
}>;
export default Toast;
config?: AnyObject,
style?: ViewStyle,
topOffset?: number,
bottomOffset?: number,
keyboardOffset?: number,
visibilityTime?: number,
autoHide?: boolean,
height?: number,
position?: ToastPosition,
type?: string
}

export default class Toast extends React.Component<ToastProps> {
static show(options: {
type: string,
position?: ToastPosition,
text1?: string,
text2?: string,
visibilityTime?: number,
autoHide?: boolean,
topOffset?: number,
bottomOffset?: number,
props?: AnyObject,
onShow?: () => void,
onHide?: () => void,
onPress?: () => void
}): void;

static hide(options?: {
onHide?: () => void
}): void;

static setRef(ref: any): any;
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-toast-message",
"version": "1.4.0",
"version": "1.4.1",
"description": "Toast message component for React Native",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit c11450d

Please sign in to comment.