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

Typescript Support #7

Open
emech-en opened this issue Apr 16, 2020 · 3 comments
Open

Typescript Support #7

emech-en opened this issue Apr 16, 2020 · 3 comments

Comments

@emech-en
Copy link

Great Component! Do you plan to support typescript?

@cawfree
Copy link
Owner

cawfree commented Apr 17, 2020

Thanks a lot, @emech-en!

There's no reason not to! The only issue is, I have very limited experience using TypeScript, so I wouldn't be best suited to perform the migration. I'd be more than happy to accept a Pull Request for TypeScript support, though.

It would be especially useful for me to see how a component I'm familiar with gets transformed into the TS equivalent.

Do you think you'd be up to it?

@centrual
Copy link

centrual commented Dec 3, 2020

Hello,

Here is it:

react-native-twitter-textview.d.ts

declare module 'react-native-twitter-textview' {
  import {FC} from 'react';
  import {GestureResponderEvent, TextStyle, ViewProps} from 'react-native';

  export interface ReactNativeTwitterTextviewProps extends Omit<ViewProps, 'children'>{
    children?: string | never[];
    extractHashtags?: boolean;
    extractMentions?: boolean;
    extractLinks?: boolean;
    extractEmails?: boolean;
    onPressHashtag?: (e: GestureResponderEvent, hashtag: string) => void;
    onPressMention?: (e: GestureResponderEvent, mention: string) => void;
    onPressLink?: (e: GestureResponderEvent, link: string) => string | void;
    onPressEmail?: (e: GestureResponderEvent, email: string) => string | void;
    hashtagStyle?: TextStyle;
    mentionStyle?: TextStyle;
    linkStyle?: TextStyle;
    emailStyle?: TextStyle;
  }

  const ReactNativeTwitterTextView: FC<ReactNativeTwitterTextviewProps>;
  export default ReactNativeTwitterTextView;
}

Have a great day.

@ggunti
Copy link

ggunti commented Jun 15, 2021

Instead Omit<ViewProps, 'children'> I think should be Omit<TextProps, 'children'>

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

No branches or pull requests

4 participants