npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-swipeable-flat-list-2

v0.0.2

Published

A React Native component based on FlatList with rows that can be swiped open/close.

Downloads

16

Readme

npm npm

react-native-swipeable-flat-list

A React Native component, based on FlatList, implementing the ability for its rows to be swiped open/close.

Installation

npm install --save react-native-swipeable-flat-list

Usage

import {SwipeableFlatList} from 'react-native-swipeable-flat-list';

...

render() {
	const data = [
		{ key: 1, label: 'Label 1', leftLabel: 'Left 1', rightLabel: 'Right 1' },
		{ key: 2, label: 'Label 2', leftLabel: 'Left 2', rightLabel: 'Right 2' },
		{ key: 3, label: 'Label 3', leftLabel: 'Left 3', rightLabel: 'Right 3' },
		{ key: 4, label: 'Label 4', leftLabel: 'Left 4', rightLabel: 'Right 4' },
		{ key: 5, label: 'Label 5', leftLabel: 'Left 5', rightLabel: 'Right 5' },
	];
	return (
		<SwipeableFlatList
			data={data}
			renderItem={({ item }) => (
				<Text style={{ height: 48 }}>{item.label}</Text>
			)}
			renderLeft={({ item }) => (
				<Text style={{ width: 40 }}>{item.leftLabel}</Text>
			)}
			renderRight={({ item }) => (
				<Text style={{ width: 100 }}>{item.rightLabel}</Text>
			)}
			backgroundColor={'white'}
		/>
	)
}

Example

cd example
yarn
react-native run-*

NOTE: I haven't been able to test under iOS, yet.

API

SwipeableFlatList (component)

A FlatList that renders SwipeableListItems.

Props

data (required)

The data array passed to the FlatList.

type: arrayOf(object)

renderItem (required)

The render function for the main element of a SwipeableListItem, which lies above the left and/or the right element.

type: func

renderLeft

The render function for the left element of a SwipeableListItem, which is hidden beneath the main element and revealed on swiping to the right.

type: func

renderRight

The render function for the right element of a SwipeableListItem, which is hidden beneath the main element and revealed on swiping to the left.

type: func

itemBackgroundColor

The background color passed to the SwipeableListItem.

type: string default: #fff

style

The style prop passed to the underlying FlatList.

type: style

SwipeableListItem (component)

A ListItem to be used with SwipeableFlatList.

Props

item (required)

The main element, which lies above the left and/or the right element.

type: element

NOTE: The element's style.height has to be set in order to be able to set the height of the SwipeableListItem.

left

The left element, which is hidden beneath the main element and revealed on swiping to the right.

type: element

NOTE: The element's style.width has to be set in order for it to be able to open.

right

The right element, which is hidden beneath the main element and revealed on swiping to the left.

NOTE: The element's style.width has to be set in order for it to be able to open.

type: element

backgroundColor

The background color of the SwipeableListItem.

type: string default: #fff

swipeThreshold

The threshold (in px) which must be passed before the SwipeableListItem's PanResponder handles a horizontal swipe.

type: number default: 4

swipeOpenThresholdPercentage

The threshold percentage (0 - 100) of the corresponding hidden element's width (left/right) which must be passed in order to open.

type: number default: 20

swipeCloseThresholdPercentage

The threshold percentage (0 - 100) of the corresponding hidden element's width (left/right) which must be passed in order to close.

type: number default: 20

friction

The friction or "bounciness"/overshoot passed to the open/close spring animation. See Animated for further documentation.

type: number default: 9

tension

The tension or speed passed to the open/close spring animation. See Animated for further documentation.

type: number default: 40

onOpen

A callback called when the SwipeableListItem is swiped open.

type: func

onClose

A callback called when the SwipeableListItem is swiped close.

type: func

License

MIT