From 42b28b32158b344850836e23337bc13f556eb4e1 Mon Sep 17 00:00:00 2001 From: Max Schmeling Date: Thu, 20 Dec 2018 21:31:35 -0600 Subject: [PATCH 1/2] Adds and exports ButtonType enum for type prop --- index.d.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/index.d.ts b/index.d.ts index e8364b7b..ee1a8a20 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,13 +1,20 @@ import * as React from 'react'; declare module 'react-native-swipeout' { + export enum ButtonType { + DEFAULT = "default", + DELETE = "delete", + PRIMARY = "primary", + SECONDARY = "secondary" + } + export interface SwipeoutButtonProperties { backgroundColor?: string; color?: string; component?: JSX.Element; onPress?(): void; text?: React.ReactNode; - type?: 'default'|'delete'|'primary'|'secondary'; + type?: ButtonType; underlayColor?: string; disabled?: boolean; } From 2cecf97534becf126505d2553943b1013eb985c4 Mon Sep 17 00:00:00 2001 From: Max Schmeling Date: Thu, 20 Dec 2018 22:06:46 -0600 Subject: [PATCH 2/2] Changes ButtonType usage to be backward compatible --- index.d.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/index.d.ts b/index.d.ts index ee1a8a20..d20d37a9 100644 --- a/index.d.ts +++ b/index.d.ts @@ -2,10 +2,10 @@ import * as React from 'react'; declare module 'react-native-swipeout' { export enum ButtonType { - DEFAULT = "default", - DELETE = "delete", - PRIMARY = "primary", - SECONDARY = "secondary" + default = "default", + delete = "delete", + primary = "primary", + secondary = "secondary" } export interface SwipeoutButtonProperties { @@ -14,7 +14,7 @@ declare module 'react-native-swipeout' { component?: JSX.Element; onPress?(): void; text?: React.ReactNode; - type?: ButtonType; + type?: ButtonType | keyof typeof ButtonType; underlayColor?: string; disabled?: boolean; }