mirror of
https://github.com/chenasraf/DefinitelyTyped.git
synced 2026-05-18 01:49:01 +00:00
[react-native-draggable-flatlist] Remove, bundles its own types (#53372)
This commit is contained in:
@@ -3894,6 +3894,10 @@
|
||||
"libraryName": "react-native-document-picker",
|
||||
"asOfVersion": "3.1.0"
|
||||
},
|
||||
"react-native-draggable-flatlist": {
|
||||
"libraryName": "react-native-draggable-flatlist",
|
||||
"asOfVersion": "2.0.0"
|
||||
},
|
||||
"react-native-elements": {
|
||||
"libraryName": "react-native-elements",
|
||||
"asOfVersion": "0.18.0"
|
||||
|
||||
59
types/react-native-draggable-flatlist/index.d.ts
vendored
59
types/react-native-draggable-flatlist/index.d.ts
vendored
@@ -1,59 +0,0 @@
|
||||
// Type definitions for react-native-draggable-flatlist 1.1
|
||||
// Project: https://github.com/computerjazz/react-native-draggable-flatlist#readme
|
||||
// Definitions by: Stack Builders <https://github.com/stackbuilders>
|
||||
// Esteban Ibarra <https://github.com/ibarrae>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
import { VirtualizedListWithoutRenderItemProps } from "react-native";
|
||||
import { Component } from "react";
|
||||
|
||||
export interface RenderItemInfo<ItemR> {
|
||||
item: ItemR;
|
||||
index: number;
|
||||
move: () => void;
|
||||
moveEnd: () => void;
|
||||
isActive: boolean;
|
||||
}
|
||||
|
||||
export interface OnMoveEndInfo<ItemM> {
|
||||
data: ReadonlyArray<ItemM> | null;
|
||||
to: number;
|
||||
from: number;
|
||||
row: ItemM;
|
||||
}
|
||||
|
||||
interface DraggableFlatListProps<Item> extends VirtualizedListWithoutRenderItemProps<Item> {
|
||||
/**
|
||||
* Items to be rendered.
|
||||
*/
|
||||
data: ReadonlyArray<Item> | null;
|
||||
|
||||
/**
|
||||
* Function that returns updated ordering of data
|
||||
*/
|
||||
onMoveEnd?: (info: OnMoveEndInfo<Item>) => void;
|
||||
|
||||
/**
|
||||
* Function that is called when row becomes active.
|
||||
*/
|
||||
onMoveBegin?: (index: number) => void;
|
||||
|
||||
/**
|
||||
* Sets where scrolling begins.
|
||||
*
|
||||
* Default is 5
|
||||
*/
|
||||
scrollPercent?: number;
|
||||
|
||||
/**
|
||||
* Function that calls move when the row should become active (in an onPress, onLongPress, etc). Calls moveEnd when the gesture is complete (in onPressOut).
|
||||
*/
|
||||
renderItem: (info: RenderItemInfo<Item>) => React.ReactElement | null;
|
||||
}
|
||||
|
||||
declare class DraggableFlatList<Item> extends Component<DraggableFlatListProps<Item>> {
|
||||
constructor(props: DraggableFlatListProps<Item>);
|
||||
}
|
||||
|
||||
export default DraggableFlatList;
|
||||
@@ -1,44 +0,0 @@
|
||||
import * as React from 'react';
|
||||
import { TouchableOpacity, Text } from 'react-native';
|
||||
import DraggableFlatList, { RenderItemInfo } from 'react-native-draggable-flatlist';
|
||||
|
||||
interface Item {
|
||||
name: string;
|
||||
mail: string;
|
||||
}
|
||||
|
||||
class Example extends React.Component {
|
||||
state = {
|
||||
data: [
|
||||
{ name: 'Esteban', mail: 'foo@foo.com' },
|
||||
{ name: 'Xavier', mail: 'foo2@foo.com' },
|
||||
]
|
||||
};
|
||||
|
||||
renderItem({ item, index, move, moveEnd, isActive }: RenderItemInfo<Item>) {
|
||||
return (
|
||||
<TouchableOpacity
|
||||
onLongPress={move}
|
||||
onPressOut={moveEnd}
|
||||
>
|
||||
<Text>{index}</Text>
|
||||
<Text>{item.name}</Text>
|
||||
<Text>{item.mail}</Text>
|
||||
</TouchableOpacity>
|
||||
);
|
||||
}
|
||||
|
||||
render() {
|
||||
const { data } = this.state;
|
||||
return (
|
||||
<DraggableFlatList
|
||||
data={data}
|
||||
renderItem={this.renderItem}
|
||||
keyExtractor={(_item, index) => `draggable-item-${index}`}
|
||||
scrollPercent={10}
|
||||
onMoveEnd={({ data }) => this.setState({ data })}
|
||||
ListFooterComponent={<Text>{'Hello'}</Text>}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"jsx": "react-native"
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"react-native-draggable-flatlist-tests.tsx"
|
||||
]
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user