diff --git a/packages/docs/docs/grid/examples/handle.mdx b/packages/docs/docs/grid/examples/handle.mdx new file mode 100644 index 00000000..cba28041 --- /dev/null +++ b/packages/docs/docs/grid/examples/handle.mdx @@ -0,0 +1,79 @@ +--- +sidebar_position: 6 +description: '' +--- + +# Custom Handle + +## Description + +The **Custom Handle** example demonstrates how to use a custom item drag handle. + +## Usage + +### Source Code + +```tsx +import { faGripVertical } from '@fortawesome/free-solid-svg-icons'; +import { FontAwesomeIcon } from '@fortawesome/react-native-fontawesome'; +import { useCallback } from 'react'; +import { StyleSheet, Text, View } from 'react-native'; +import type { SortableGridRenderItem } from 'react-native-sortables'; +import Sortable from 'react-native-sortables'; + +const DATA = Array.from({ length: 8 }, (_, index) => `Item ${index + 1}`); + +export default function PlaygroundExample() { + const renderItem = useCallback>( + ({ item }) => ( + + {item} + {/* Wraps the handle component (an icon in this case) */} + + + + + ), + [] + ); + + return ( + + + + ); +} + +const styles = StyleSheet.create({ + card: { + alignItems: 'center', + backgroundColor: '#36877F', + borderRadius: 12, + flexDirection: 'row', + justifyContent: 'center', + padding: 24 + }, + container: { + padding: 16 + }, + text: { + color: 'white', + flex: 1, + fontWeight: 'bold' + } +}); +``` + +## Result + +import handleVideo from '@site/static/video/grid-custom-handle.mp4'; + +