Skip to content

Commit

Permalink
Improved type definitions
Browse files Browse the repository at this point in the history
Closes #4
  • Loading branch information
Alessio Cancian committed Mar 10, 2021
1 parent c2e3d12 commit f09ce5d
Showing 1 changed file with 44 additions and 13 deletions.
57 changes: 44 additions & 13 deletions lib/ts/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,52 @@
import { Component } from 'react';

interface Props {
options: (string | React.ReactNode)[];
onPress: (index: number) => void;
title?: string;
message?: string;
tintColor?: string;
cancelButtonIndex?: number;
destructiveButtonIndex?: number;
styles?: object;
import React, { Component } from 'react';
import { TextStyle, ViewStyle } from 'react-native';

type Props = {
options: string[];
onPress: (index: number) => void;
title?: string;
message?: string;
tintColor?: string;
cancelButtonIndex?: number;
destructiveButtonIndex?: number;
/**
* Only for Android or ActionSheetCustom
*/
styles?: {
titleBox?: ViewStyle,
titleText?: TextStyle,

messageBox?: ViewStyle,
messageText?: TextStyle,

buttonText?: TextStyle,
buttonBox?: ViewStyle,
cancelButtonBox?: ViewStyle,

overlay?: TextStyle,
wrapper?: ViewStyle,
body?: ViewStyle,
};
}

type ActionSheetProps = Props & {
/**
* iOS only, change default theme
* @default system theme color
*/
userInterfaceStyle?: "light" | "dark"
}

export default class ActionSheet extends Component<Props> {
public show: () => void;
export default class ActionSheet extends Component<ActionSheetProps> {
public show: () => void;
}

type ActionSheetCustomProps = Props | {
title?: string | React.ReactNode
message?: string | React.ReactNode
options: (string | React.ReactChild)[]
}

export class ActionSheetCustom extends Component<ActionSheetCustomProps> {
public show: () => void;
}

0 comments on commit f09ce5d

Please sign in to comment.