Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
react-native-yet-another-sortable
Advanced tools
Readme
A sortable scrollable grid / list component for React Native.
npm install react-native-yet-another-sortable --save
Check out example project.
import React, { useState, useCallback } from 'react';
import SortableGrid from 'react-native-yet-another-sortable';
const Example = () => {
const [data] = useState([
{ value: 0, key: 'key0' },
{ value: 1, key: 'key1' },
{ value: 2, key: 'key2' },
]);
const [order, setOrder] = useState(['key2', 'key1', 'key0']);
const renderItem = useCallback(({ value, color }) => (
<View style={{ flex: 1 }}>
<Text>{value}</Text>
</View>
), []);
return (
<View style={{ flex: 1 }}>
<SortableGrid
order={order}
data={data}
renderItem={renderItem}
onDeactivateDrag={setOrder}
/>
</View>
);
};
parameter | type | required | description |
---|---|---|---|
order | array of string keys | yes | array of data key properties used to determine entry order |
data | array of objects with key property | yes | array of items to be passed to renderItem |
rowHeight | number | no | row height |
columns | number | no | number of columns per row |
activationTreshold | number | no | time in ms required to activate drag on hold |
transitionDuration | number | no | time in ms required to move cell to its position on release |
renderItem | function | yes | render function for each entry, is passed a data item |
parameter | type | required | description |
---|---|---|---|
onActivateDrag | (key, grid) => void | no | Will execute after one holds the item for activateTreshold, before onGrantBlock |
onGrantBlock | (event, gestureState, grid) => void | no | Will execute on drag start |
onMoveBlock | (event, gestureState, grid) => void | no | Will execute on each move |
onReleaseBlock | (event, gestureState, grid) => void | no | Will execute on drag release |
onDeactivateDrag | (order, grid) => void | no | Will execute on active item drop, after onReleaseBlock, with new order as an argument |
parameter | type | required | description |
---|---|---|---|
inactive | boolean | no | Makes block not draggable |
key | string | yes | key used to order items |
In order to develop the application or build android .apk from the sources one should:
npm install
cd example
npm install
react-native start
adb connect 127.0.0.1:21503
adb reverse tcp:8081 tcp:8081
react-native run-android
, changes from src directory are picked automatically because of example's metro and babel configurations.PR are always welcome!
FAQs
Drag-and-drop sortable scrollable grid view for React Native.
The npm package react-native-yet-another-sortable receives a total of 58 weekly downloads. As such, react-native-yet-another-sortable popularity was classified as not popular.
We found that react-native-yet-another-sortable demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.