@types/react-native-tags
TypeScript icon, indicating that this package has built-in type declarations

2.2.5 • Public • Published

Installation

npm install --save @types/react-native-tags

Summary

This package contains type definitions for react-native-tags (https://github.com/peterp/react-native-tags#readme).

Details

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

index.d.ts

import * as React from "react";
import { TextStyle, ViewStyle } from "react-native";

interface RenderTag {
    tag: string;
    index: number;
    onPress(): void;
    deleteTagOnPress(): void;
    readonly: boolean;
}

interface TagPress {
    index: number;
    tagLabel: string;
    event(): void;
    deleted: boolean;
}

interface TextInputProps {
    placeholder: string;
}

interface TagsProps {
    /**
     * The input element's text
     */
    initialText?: string | undefined;
    /**
     * Initial tags
     * ```javascript
     * initialTags={["dog", "cat", "chicken"]}
     * ```
     */
    initialTags?: string[] | undefined;
    /**
     * Triggers new tag creation
     */
    createTagOnString?: string[] | undefined;
    createTagOnReturn?: boolean | undefined;
    /**
     * Fires when tags are added or removed
     * ```javascript
     * onChangeTags={(tags) => console.warn(tags)}
     * ```
     */
    onChangeTags?(tags: string[]): void;
    /**
     * Tags cannot be modified
     */
    readonly?: boolean | undefined;
    /**
     * The max number of tags that can be entered
     */
    maxNumberOfTags?: number | undefined;
    /**
     * Remove the tag when pressed
     */
    deleteTagOnPress?: boolean | undefined;
    /**
     * Manage the rendering of your own Tag
     * * tag - text of the tag
     * * index - position in the array of tags
     * * onPress - Removes the tag if deleteTagsOnPress and readonly is false
     * ```javascript
     * renderTag={({ tag, index, onPress }) => (
     *   <TouchableOpacity key={`${tag}-${index}`} onPress={onPress}>
     *     <Text>{tag}</Text>
     *   </TouchableOpacity>
     * )}
     * ```
     */
    renderTag(tag: RenderTag): void;
    /**
     * Fires when tags are pressed
     */
    onTagPress?: ((index: number, tagLabel: string, event: any, deleted: boolean) => void) | undefined;
    /**
     * Forward props to the textInput
     * ```javascript
     * textInputProps={{
     *   placeholder: "Any type of animal"
     * }}
     * ```
     */
    textInputProps?: TextInputProps | undefined;
    containerStyle?: ViewStyle | undefined;
    style?: ViewStyle | undefined;
    inputContainerStyle?: TextStyle | undefined;
    inputStyle?: TextStyle | undefined;
    tagContainerStyle?: ViewStyle | undefined;
    tagTextStyle?: TextStyle | undefined;
}

export {};
export default class Tags extends React.Component<TagsProps> {}

Additional Details

Credits

These definitions were written by IdaszakDaniel.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/react-native-tags

Weekly Downloads

125

Version

2.2.5

License

MIT

Unpacked Size

7.66 kB

Total Files

5

Last publish

Collaborators

  • types