Skip to content

Commit

Permalink
fix: fixed type declarations of Notifier and NotifierRoot
Browse files Browse the repository at this point in the history
  • Loading branch information
seniv committed Feb 19, 2021
1 parent 830eb0e commit e9de5f0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/Notifier.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ export class NotifierRoot extends React.PureComponent<ShowNotificationParams, St
this.onStartHiding();
}

public showNotification<Component extends React.ElementType = typeof NotificationComponent>(
functionParams: ShowNotificationParams<Component>
public showNotification<ComponentType extends React.ElementType = typeof NotificationComponent>(
functionParams: ShowNotificationParams<ComponentType>
) {
const params = {
...this.props,
Expand Down
10 changes: 5 additions & 5 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export interface ShowParams {

export type QueueMode = 'immediate' | 'next' | 'standby' | 'reset';

export interface ShowNotificationParams<Component extends ElementType = ElementType>
export interface ShowNotificationParams<ComponentType extends ElementType = ElementType>
extends ShowParams {
/** Title of notification. __Passed to `Component`.__
* @default null */
Expand All @@ -78,11 +78,11 @@ export interface ShowNotificationParams<Component extends ElementType = ElementT

/** Component of the notification body. You can use one of the [built-in components](https://github.com/seniv/react-native-notifier#components), or your [custom component](https://github.com/seniv/react-native-notifier#custom-component).
* @default NotifierComponents.Notification */
Component?: Component;
Component?: ComponentType;

/** Additional props that are passed to `Component`. See all available props of built-in components in the [components section](https://github.com/seniv/react-native-notifier#components)
* @default {} */
componentProps?: Omit<React.ComponentPropsWithoutRef<Component>, 'title' | 'description'>;
componentProps?: Omit<React.ComponentProps<ComponentType>, 'title' | 'description'>;

/** Determines the order in which notifications are shown. Read more in the [Queue Mode](https://github.com/seniv/react-native-notifier#queue-mode) section.
* @default 'reset' */
Expand All @@ -98,8 +98,8 @@ export interface StateInterface {
}

export interface NotifierInterface {
showNotification<Component extends ElementType = typeof NotificationComponent>(
params: ShowNotificationParams<Component>
showNotification<ComponentType extends ElementType = typeof NotificationComponent>(
params: ShowNotificationParams<ComponentType>
): void;
hideNotification(onHidden?: Animated.EndCallback): void;
clearQueue(hideDisplayedNotification?: boolean): void;
Expand Down

0 comments on commit e9de5f0

Please sign in to comment.