react-native-twitter-textview
react-native-twitter-textview copied to clipboard
Typescript Support
Great Component! Do you plan to support typescript?
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?
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.
Instead Omit<ViewProps, 'children'>
I think should be Omit<TextProps, 'children'>