npm.io
1.1.7 • Published 2 months ago

@types/react-native-platform-touchable

Licence
MIT
Version
1.1.7
Deps
2
Size
6 kB
Vulns
0
Weekly
0
Stars
51.5K

Installation

npm install --save @types/react-native-platform-touchable

Summary

This package contains type definitions for react-native-platform-touchable (https://github.com/react-native-community/react-native-platform-touchable).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-native-platform-touchable.

index.d.ts

import * as React from "react";
import { TouchableWithoutFeedbackProps } from "react-native";

// These were removed from react-native's bundled types; they mirror the
// TouchableNativeFeedback background values this library accepts and returns.
export interface ThemeAttributeBackgroundPropType {
    type: "ThemeAttrAndroid";
    attribute: "selectableItemBackground" | "selectableItemBackgroundBorderless";
}

export interface RippleBackgroundPropType {
    type: "RippleAndroid";
    color?: number | null | undefined;
    borderless?: boolean | undefined;
}

export type BackgroundPropType = ThemeAttributeBackgroundPropType | RippleBackgroundPropType;

export interface PlatformTouchableProps extends TouchableWithoutFeedbackProps {
    // TouchableOpacity (default iOS)
    activeOpacity?: number | undefined;
    // TouchableNativeFeedback (default Android)
    background?: BackgroundPropType | undefined;
    foreground?: BackgroundPropType | undefined;
    // TouchableHighlight
    underlayColor?: string | undefined;
    onHideUnderlay?: (() => void) | undefined;
    onShowUnderlay?: (() => void) | undefined;
}

export class Touchable extends React.Component<PlatformTouchableProps> {
    // TouchableOpacity (default iOS)
    setOpacityTo: (value: number) => void;
    // TouchableNativeFeedback (default Android)
    static SelectableBackground(): ThemeAttributeBackgroundPropType;
    static SelectableBackgroundBorderless(): ThemeAttributeBackgroundPropType;
    static Ripple(color: string, borderless?: boolean): RippleBackgroundPropType;
    static canUseNativeForeground(): boolean;
}

export default Touchable;

Additional Details

Credits

These definitions were written by Toni Granados, and Joel Nordström.