-
Notifications
You must be signed in to change notification settings - Fork 262
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
58c60f9
commit c11450d
Showing
3 changed files
with
69 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters