Skip to content

[ENHANCE] TypeScript compatibility 🧪 #1

@anthlasserre

Description

@anthlasserre

Hey @GeorgeHop and @dorkyboi congrats and thanks for this good work 💪🏼
I am using your library on a React Native TypeScript project.
I needed to type your library to enhance my project.

Can you confirm or update some types that can not be good ?
I plan to enhance your library with a new PR with it.

Thank you so much,
Cheers

declare module 'react-native-screens-swiper' {
  import React, { ComponentProps } from 'react';
  import { FlatListProps, TextStyle, ViewStyle } from 'react-native';

  export interface SwiperDataType {
    tabLabel: string;
    component: React.ReactNode;
    props?: ComponentProps;
  }

  export interface SwiperStyle {
    pillContainer?: ViewStyle;
    pillButton?: ViewStyle;
    pillActive?: ViewStyle;
    pillLabel?: TextStyle;
    activeLabel?: TextStyle;
    borderActive?: ViewStyle;
    pillsOverflow?: ViewStyle;
  }

  export interface SwiperProps extends FlatListProps {
    style?: SwiperStyle;
    data: SwiperDataType[];
    isStaticPills?: boolean;
    stickyHeaderEnabled?: boolean;
    scrollableContainer?: boolean;
    stickyHeaderIndex?: number;
  }

  export default class Swiper extends React.Component<SwiperProps, any> {}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions