Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define Types #3

Open
esthor opened this issue May 23, 2020 · 2 comments
Open

Define Types #3

esthor opened this issue May 23, 2020 · 2 comments
Labels
enhancement New feature or request

Comments

@esthor
Copy link
Owner

esthor commented May 23, 2020

Add types throughout the SwipeableFlatList and SwipeableRow. Probably also define/export them in a d.ts.

@esthor esthor added the enhancement New feature or request label May 23, 2020
@thomashagstrom
Copy link

thomashagstrom commented Apr 1, 2021

Really easy to add types too. Just extend FlatListProps. Here's a working definition:

types/reactnative-swipeable-list/index.d.ts

/// <reference types="node" />
/// <reference types="react"/>
/// <reference types="react-native"/>

declare module 'react-native-swipeable-list' {
  import React from 'react';
  import {FlatListProps} from 'react-native';

  interface SwipeableFlatListProps<ItemT> extends FlatListProps<ItemT> {
    maxSwipeDistance?: number;
    shouldBounceOnMount?: boolean;
    renderQuickActions: ({index: number, item: ItemT}) => React.ReactNode;
  }

  class SwipeableFlatList<ItemT = any> extends React.Component<
    SwipeableFlatListProps<ItemT>
  > {}

  export = SwipeableFlatList;
}

@esthor
Copy link
Owner Author

esthor commented Apr 4, 2021

Thank you @thomashagstrom !! Would you like to open the PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants