Skip to content

Instantly share code, notes, and snippets.

@jehartzog
Created July 19, 2020 16:19
Show Gist options
  • Save jehartzog/c9b2f35994c756f80332474841386d9c to your computer and use it in GitHub Desktop.
Save jehartzog/c9b2f35994c756f80332474841386d9c to your computer and use it in GitHub Desktop.
Patch Pressable to remove initial delay
diff --git a/node_modules/react-native/Libraries/Pressability/Pressability.js b/node_modules/react-native/Libraries/Pressability/Pressability.js
index 37555d5..82190ed 100644
--- a/node_modules/react-native/Libraries/Pressability/Pressability.js
+++ b/node_modules/react-native/Libraries/Pressability/Pressability.js
@@ -277,14 +277,14 @@ const isTerminalSignal = signal =>
signal === 'RESPONDER_TERMINATED' || signal === 'RESPONDER_RELEASE';
const DEFAULT_LONG_PRESS_DELAY_MS = 370; // 500 - 130
-const DEFAULT_PRESS_DELAY_MS = 130;
+const DEFAULT_PRESS_DELAY_MS = 0;
const DEFAULT_PRESS_RECT_OFFSETS = {
bottom: 30,
left: 20,
right: 20,
top: 20,
};
-const DEFAULT_MIN_PRESS_DURATION = 130;
+const DEFAULT_MIN_PRESS_DURATION = 0;
/**
* Pressability implements press handling capabilities.
@manuelpaulo
Copy link

Why was DEFAULT_PRESS_DELAY_MS set to 0?

Now ripple effect is always being triggered when scrolling a selectable listview of items.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment