{"id":15293962,"url":"https://github.com/enzomanuelmangano/pressto","last_synced_at":"2025-04-12T21:33:52.127Z","repository":{"id":257742057,"uuid":"858683181","full_name":"enzomanuelmangano/pressto","owner":"enzomanuelmangano","description":"Your React Native app deserves better tapping interactions.","archived":false,"fork":false,"pushed_at":"2025-04-12T01:58:35.000Z","size":1502,"stargazers_count":153,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-12T02:52:23.670Z","etag":null,"topics":["pressables","react-native","react-native-gesture-handler","react-native-reanimated"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/enzomanuelmangano.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"custom":"https://patreon.com/reactiive"}},"created_at":"2024-09-17T10:57:24.000Z","updated_at":"2025-03-17T08:10:56.000Z","dependencies_parsed_at":"2024-09-18T11:42:29.634Z","dependency_job_id":"4b4f0c59-c9bf-462a-b45a-ec54942e2a93","html_url":"https://github.com/enzomanuelmangano/pressto","commit_stats":{"total_commits":34,"total_committers":2,"mean_commits":17.0,"dds":"0.11764705882352944","last_synced_commit":"397bbfa274e4f884c62d81ce32ead0f728481687"},"previous_names":["enzomanuelmangano/pressables","enzomanuelmangano/pressto"],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enzomanuelmangano%2Fpressto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enzomanuelmangano%2Fpressto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enzomanuelmangano%2Fpressto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enzomanuelmangano%2Fpressto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/enzomanuelmangano","download_url":"https://codeload.github.com/enzomanuelmangano/pressto/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248636816,"owners_count":21137527,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["pressables","react-native","react-native-gesture-handler","react-native-reanimated"],"created_at":"2024-09-30T16:54:28.206Z","updated_at":"2025-04-12T21:33:52.087Z","avatar_url":"https://github.com/enzomanuelmangano.png","language":"TypeScript","funding_links":["https://patreon.com/reactiive"],"categories":["TypeScript"],"sub_categories":[],"readme":"https://github.com/user-attachments/assets/c857eb8d-3ce7-4afe-b2dd-e974560684d8\n\nThe fastest way to improve your React Native app is by using tap gestures.\nThat's why I've created **pressto**, a super-simple package to help you get started.\n\nThe package is built on top of the Tap Gesture from [react-native-gesture-handler](https://docs.swmansion.com/react-native-gesture-handler/) to handle the resulting gestures and animations on the main thread. It aims to replace your “TouchableOpacity”.\n\n## Installation\n\n```sh\nyarn add pressto react-native-reanimated react-native-gesture-handler\n```\n\nOr with Expo\n\n```sh\nnpx expo install pressto react-native-reanimated react-native-gesture-handler\n```\n\n## Features\n\n- Pre-built animated pressable components: `PressableScale` and `PressableOpacity`\n- Easy creation of custom animated pressables with `createAnimatedPressable`\n- Configurable animation types and durations\n\n## Usage\n\n### Use basic Pressables: PressableScale and PressableOpacity\n\n```jsx\nimport React from 'react';\nimport { StyleSheet, View } from 'react-native';\nimport { PressableOpacity, PressableScale } from 'pressto';\n\nfunction BasicPressablesExample() {\n  return (\n    \u003cView style={styles.container}\u003e\n      \u003cPressableScale style={styles.box} onPress={() =\u003e console.log('scale')} /\u003e\n      \u003cPressableOpacity\n        style={styles.box}\n        onPress={() =\u003e console.log('opacity')}\n      /\u003e\n    \u003c/View\u003e\n  );\n}\n```\n\n### Create a custom Pressable with createAnimatedPressable\n\n```jsx\nimport { createAnimatedPressable } from 'pressto';\n\nconst PressableRotate = createAnimatedPressable((progress) =\u003e {\n  'worklet';\n  return {\n    transform: [{ rotate: `${(progress.value * Math.PI) / 4}rad` }],\n  };\n});\n\nfunction CustomPressableExample() {\n  return (\n    \u003cView style={styles.container}\u003e\n      \u003cPressableRotate\n        style={styles.box}\n        onPress={() =\u003e console.log('rotate')}\n      /\u003e\n    \u003c/View\u003e\n  );\n}\n```\n\n### Use the PressablesConfig\n\n```jsx\nimport React from 'react';\nimport { gestureHandlerRootHOC } from 'react-native-gesture-handler';\nimport { PressablesConfig } from 'pressto';\n\nfunction App() {\n  return (\n    \u003cView style={styles.container}\u003e\n      \u003cPressableRotate\n        style={styles.box}\n        onPress={() =\u003e console.log('rotate')}\n      /\u003e\n      \u003cPressableScale style={styles.box} onPress={() =\u003e console.log('scale')} /\u003e\n      \u003cPressableOpacity\n        style={styles.box}\n        onPress={() =\u003e console.log('opacity')}\n      /\u003e\n    \u003c/View\u003e\n  );\n}\n\nexport default () =\u003e (\n  \u003cPressablesConfig\n    animationType=\"spring\"\n    config={{ mass: 2 }}\n    globalHandlers={{\n      onPress: () =\u003e {\n        console.log('you can call haptics here');\n      },\n    }}\n  \u003e\n    \u003cApp /\u003e\n  \u003c/PressablesConfig\u003e\n);\n```\n\n## API\n\n### PressableScale\n\nA pressable component that scales when pressed.\n\n### PressableOpacity\n\nA pressable component that changes opacity when pressed.\n\n### createAnimatedPressable\n\nA function to create custom animated pressables. It takes a worklet function that defines how the component should animate based on the press progress.\n\n### PressablesConfig\n\nA component to configure global settings for all pressable components within its children.\n\n## Use with ScrollView and FlatList/FlashList\n\n`pressto` provides an optional custom scroll render component that enhances the scrolling experience when used with pressable components.\n\n```jsx\nimport { renderScrollComponent } from 'pressto';\nimport { FlatList } from 'react-native';\n\nfunction App() {\n  return (\n    // This works with all the lists that support the renderScrollComponent prop\n    \u003cFlatList\n      renderScrollComponent={renderScrollComponent}\n      data={data}\n      renderItem={({ item }) =\u003e \u003cPressableRotate style={styles.box} /\u003e}\n    /\u003e\n  );\n}\n```\n\nThe `renderScrollComponent` function wraps the scroll view with additional functionality in order to allow smoother interactions between scrolling and pressable components, preventing unwanted activations during scroll gestures.\nApplying the renderScrollComponent from `pressto` means that the tap gesture will be delayed for a short amount of time to understand if the tap gesture is a scroll or a tap gesture.\n\n## Contributing\n\nContributions are welcome! Please see our [contributing guide](CONTRIBUTING.md) for more details.\n\n## License\n\nMIT\n\n---\n\nMade with ❤️ using [create-react-native-library](https://github.com/callstack/react-native-builder-bob)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenzomanuelmangano%2Fpressto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fenzomanuelmangano%2Fpressto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenzomanuelmangano%2Fpressto/lists"}