halilb / react-native-textinput-effects

Text inputs with custom label and icon animations for iOS and android. Built with react native and inspired by Codrops.
MIT License
2.98k stars 291 forks source link

Typescript support #85

Closed tomzaku closed 4 years ago

halilb commented 5 years ago

This is a good idea. I'll try implementing this soon.

Braden1996 commented 5 years ago

Any updates on this? :)

Braden1996 commented 5 years ago

I made this, but didn't finish...

declare module "react-native-textinput-effects" {
  import {
    TextInputProps,
    ViewStyle,
    StyleProp,
    TextStyle,
    EasingFunction
  } from "react-native";

  interface CommonProps extends TextInputProps {
    label?: string;
    value?: string;
    defaultValue?: string;
    style?: StyleProp<ViewStyle>;
    inputStyle?: StyleProp<TextStyle>;
    labelStyle?: StyleProp<ViewStyle>;
    inputPadding?: number;
    easing?: EasingFunction;
    animationDuration?: number;
    useNativeDriver?: boolean;
    editable?: boolean;
    height?: number;
  }

  interface WithIconProps extends CommonProps {
    iconClass: React.ComponentClass<any, any>;
    iconName: string;
    iconColor?: string;
    iconSize?: number;
  }

  interface SaeProps extends WithIconProps {}
  class Sae extends React.Component<SaeProps> {
    labelHeight?: number;
  }

  interface FumiProps extends WithIconProps {
    iconWidth?: number;
    passiveIconColor?: WithIconProps["iconColor"];
  }
  class Fumi extends React.Component<FumiProps> {}
}
halilb commented 4 years ago

Types are added in version 0.6.1 thanks to #118