From c8ead965cfa5d4759ab8ad7a67cc9eaef074cd46 Mon Sep 17 00:00:00 2001 From: Gabriel de Oliveira Rohden Date: Sun, 18 Aug 2019 20:21:36 -0300 Subject: [PATCH] Add generic types to improve type safety --- src/Modalize.tsx | 5 +++-- src/Options.ts | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Modalize.tsx b/src/Modalize.tsx index 33527c74..edd92f4b 100644 --- a/src/Modalize.tsx +++ b/src/Modalize.tsx @@ -13,7 +13,8 @@ const AnimatedFlatList = Animated.createAnimatedComponent(FlatList); const AnimatedSectionList = Animated.createAnimatedComponent(SectionList); const THRESHOLD = 150; -export default class Modalize extends React.Component { +export default class Modalize + extends React.Component, IState> { static defaultProps = { handlePosition: 'outside', @@ -47,7 +48,7 @@ export default class Modalize extends React.Component { private modalOverlayTap: React.RefObject = React.createRef(); private willCloseModalize: boolean = false; - constructor(props: IProps) { + constructor(props: IProps) { super(props); const fullHeight = isIos() ? screenHeight : screenHeight - 10; diff --git a/src/Options.ts b/src/Options.ts index 5781673e..a44522a2 100644 --- a/src/Options.ts +++ b/src/Options.ts @@ -19,7 +19,7 @@ export interface IConfigProps { spring: ISpringProps; } -export interface IProps { +export interface IProps { /** * A React component that will define the content of the modal. */ @@ -117,12 +117,12 @@ export interface IProps { /* * An object to pass any of the react-native FlatList's props. */ - flatListProps?: FlatListProps; + flatListProps?: FlatListProps; /* * An object to pass any of the react-native SectionList's props. */ - sectionListProps?: SectionListProps; + sectionListProps?: SectionListProps; /** * A header component outside of the ScrollView, on top of the modal.