react-native-gesture-handler 2.4.0 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. package/README.md +3 -2
  2. package/android/build.gradle +28 -4
  3. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandler.kt +9 -5
  4. package/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandlerOrchestrator.kt +6 -1
  5. package/android/lib/src/main/java/com/swmansion/gesturehandler/NativeViewGestureHandler.kt +103 -22
  6. package/android/lib/src/main/java/com/swmansion/gesturehandler/PanGestureHandler.kt +29 -2
  7. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.kt +74 -84
  8. package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.kt +4 -0
  9. package/android/src/main/jni/Android.mk +1 -2
  10. package/android/src/paper/java/com/facebook/react/viewmanagers/RNGestureHandlerButtonManagerDelegate.java +12 -9
  11. package/android/src/paper/java/com/facebook/react/viewmanagers/RNGestureHandlerButtonManagerInterface.java +1 -0
  12. package/ios/Handlers/RNFlingHandler.m +43 -1
  13. package/ios/Handlers/{RNNativeViewHandler.m → RNNativeViewHandler.mm} +13 -1
  14. package/ios/Handlers/RNPanHandler.m +27 -0
  15. package/ios/RNGestureHandler.h +1 -0
  16. package/ios/RNGestureHandler.m +22 -4
  17. package/ios/RNGestureHandlerManager.mm +10 -2
  18. package/ios/RNGestureHandlerModule.mm +4 -1
  19. package/ios/RNManualActivationRecognizer.m +10 -3
  20. package/ios/RNRootViewGestureRecognizer.m +12 -1
  21. package/lib/commonjs/RNGestureHandlerModule.macos.js +81 -0
  22. package/lib/commonjs/RNGestureHandlerModule.macos.js.map +1 -0
  23. package/lib/commonjs/components/DrawerLayout.js +38 -11
  24. package/lib/commonjs/components/DrawerLayout.js.map +1 -1
  25. package/lib/commonjs/components/GestureButtons.js.map +1 -1
  26. package/lib/commonjs/components/touchables/GenericTouchable.js +4 -1
  27. package/lib/commonjs/components/touchables/GenericTouchable.js.map +1 -1
  28. package/lib/commonjs/fabric/RNGestureHandlerButtonNativeComponent.js.map +1 -1
  29. package/lib/commonjs/handlers/ForceTouchGestureHandler.js +2 -1
  30. package/lib/commonjs/handlers/ForceTouchGestureHandler.js.map +1 -1
  31. package/lib/commonjs/handlers/PanGestureHandler.js +1 -1
  32. package/lib/commonjs/handlers/PanGestureHandler.js.map +1 -1
  33. package/lib/commonjs/handlers/PressabilityDebugView.js +14 -0
  34. package/lib/commonjs/handlers/PressabilityDebugView.js.map +1 -0
  35. package/lib/commonjs/handlers/PressabilityDebugView.web.js +12 -0
  36. package/lib/commonjs/handlers/PressabilityDebugView.web.js.map +1 -0
  37. package/lib/commonjs/handlers/createHandler.js +25 -11
  38. package/lib/commonjs/handlers/createHandler.js.map +1 -1
  39. package/lib/commonjs/handlers/gestureHandlerCommon.js.map +1 -1
  40. package/lib/commonjs/handlers/gestures/GestureDetector.js +83 -63
  41. package/lib/commonjs/handlers/gestures/GestureDetector.js.map +1 -1
  42. package/lib/commonjs/handlers/gestures/gesture.js +13 -2
  43. package/lib/commonjs/handlers/gestures/gesture.js.map +1 -1
  44. package/lib/commonjs/handlers/gestures/gestureStateManager.js +13 -9
  45. package/lib/commonjs/handlers/gestures/gestureStateManager.js.map +1 -1
  46. package/lib/commonjs/handlers/gestures/panGesture.js +5 -0
  47. package/lib/commonjs/handlers/gestures/panGesture.js.map +1 -1
  48. package/lib/commonjs/mocks.js +2 -0
  49. package/lib/commonjs/mocks.js.map +1 -1
  50. package/lib/commonjs/utils.js +6 -3
  51. package/lib/commonjs/utils.js.map +1 -1
  52. package/lib/commonjs/web/utils.js.map +1 -1
  53. package/lib/module/RNGestureHandlerModule.macos.js +57 -0
  54. package/lib/module/RNGestureHandlerModule.macos.js.map +1 -0
  55. package/lib/module/components/DrawerLayout.js +38 -11
  56. package/lib/module/components/DrawerLayout.js.map +1 -1
  57. package/lib/module/components/GestureButtons.js.map +1 -1
  58. package/lib/module/components/touchables/GenericTouchable.js +4 -1
  59. package/lib/module/components/touchables/GenericTouchable.js.map +1 -1
  60. package/lib/module/fabric/RNGestureHandlerButtonNativeComponent.js.map +1 -1
  61. package/lib/module/handlers/ForceTouchGestureHandler.js +1 -1
  62. package/lib/module/handlers/ForceTouchGestureHandler.js.map +1 -1
  63. package/lib/module/handlers/PanGestureHandler.js +1 -1
  64. package/lib/module/handlers/PanGestureHandler.js.map +1 -1
  65. package/lib/module/handlers/PressabilityDebugView.js +3 -0
  66. package/lib/module/handlers/PressabilityDebugView.js.map +1 -0
  67. package/lib/module/handlers/PressabilityDebugView.web.js +5 -0
  68. package/lib/module/handlers/PressabilityDebugView.web.js.map +1 -0
  69. package/lib/module/handlers/createHandler.js +26 -12
  70. package/lib/module/handlers/createHandler.js.map +1 -1
  71. package/lib/module/handlers/gestureHandlerCommon.js.map +1 -1
  72. package/lib/module/handlers/gestures/GestureDetector.js +83 -63
  73. package/lib/module/handlers/gestures/GestureDetector.js.map +1 -1
  74. package/lib/module/handlers/gestures/gesture.js +13 -2
  75. package/lib/module/handlers/gestures/gesture.js.map +1 -1
  76. package/lib/module/handlers/gestures/gestureStateManager.js +13 -9
  77. package/lib/module/handlers/gestures/gestureStateManager.js.map +1 -1
  78. package/lib/module/handlers/gestures/panGesture.js +5 -0
  79. package/lib/module/handlers/gestures/panGesture.js.map +1 -1
  80. package/lib/module/mocks.js +2 -0
  81. package/lib/module/mocks.js.map +1 -1
  82. package/lib/module/utils.js +2 -1
  83. package/lib/module/utils.js.map +1 -1
  84. package/lib/module/web/utils.js.map +1 -1
  85. package/lib/typescript/RNGestureHandlerModule.macos.d.ts +34 -0
  86. package/lib/typescript/RNGestureHandlerModule.web.d.ts +1 -1
  87. package/lib/typescript/components/DrawerLayout.d.ts +3 -0
  88. package/lib/typescript/components/GestureButtons.d.ts +6 -0
  89. package/lib/typescript/fabric/RNGestureHandlerButtonNativeComponent.d.ts +1 -0
  90. package/lib/typescript/handlers/ForceTouchGestureHandler.d.ts +2 -2
  91. package/lib/typescript/handlers/PanGestureHandler.d.ts +2 -1
  92. package/lib/typescript/handlers/PressabilityDebugView.d.ts +1 -0
  93. package/lib/typescript/handlers/PressabilityDebugView.web.d.ts +1 -0
  94. package/lib/typescript/handlers/gestureHandlerCommon.d.ts +1 -0
  95. package/lib/typescript/handlers/gestures/GestureDetector.d.ts +2 -1
  96. package/lib/typescript/handlers/gestures/gesture.d.ts +3 -0
  97. package/lib/typescript/handlers/gestures/panGesture.d.ts +1 -0
  98. package/lib/typescript/mocks.d.ts +1 -0
  99. package/lib/typescript/web/NodeManager.d.ts +2 -2
  100. package/package.json +1 -1
  101. package/src/RNGestureHandlerModule.macos.ts +62 -0
  102. package/src/components/DrawerLayout.tsx +34 -10
  103. package/src/components/GestureButtons.tsx +7 -0
  104. package/src/components/touchables/GenericTouchable.tsx +1 -0
  105. package/src/fabric/RNGestureHandlerButtonNativeComponent.ts +1 -0
  106. package/src/handlers/ForceTouchGestureHandler.ts +3 -2
  107. package/src/handlers/PanGestureHandler.ts +2 -0
  108. package/src/handlers/PressabilityDebugView.tsx +2 -0
  109. package/src/handlers/PressabilityDebugView.web.tsx +4 -0
  110. package/src/handlers/{createHandler.ts → createHandler.tsx} +32 -17
  111. package/src/handlers/gestureHandlerCommon.ts +2 -0
  112. package/src/handlers/gestures/GestureDetector.tsx +107 -81
  113. package/src/handlers/gestures/gesture.ts +16 -0
  114. package/src/handlers/gestures/gestureStateManager.ts +13 -8
  115. package/src/handlers/gestures/panGesture.ts +5 -0
  116. package/src/mocks.ts +2 -0
  117. package/src/utils.ts +3 -1
  118. package/src/web/utils.ts +1 -1
  119. package/ios/RNGestureHandler.xcodeproj/project.xcworkspace/xcuserdata/jakubpiasecki.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  120. package/ios/RNGestureHandler.xcodeproj/xcuserdata/jakubpiasecki.xcuserdatad/xcschemes/xcschememanagement.plist +0 -19
@@ -10,6 +10,7 @@ const attachGestureHandler = NOOP;
10
10
  const createGestureHandler = NOOP;
11
11
  const dropGestureHandler = NOOP;
12
12
  const updateGestureHandler = NOOP;
13
+ const flushOperations = NOOP;
13
14
  const NativeViewGestureHandler = View;
14
15
  const TapGestureHandler = View;
15
16
  const ForceTouchGestureHandler = View;
@@ -47,6 +48,7 @@ export default {
47
48
  createGestureHandler,
48
49
  dropGestureHandler,
49
50
  updateGestureHandler,
51
+ flushOperations,
50
52
  // probably can be removed
51
53
  Directions,
52
54
  State
@@ -1 +1 @@
1
- {"version":3,"sources":["mocks.ts"],"names":["TouchableHighlight","TouchableNativeFeedback","TouchableOpacity","TouchableWithoutFeedback","ScrollView","FlatList","Switch","TextInput","DrawerLayoutAndroid","View","State","Directions","NOOP","PanGestureHandler","attachGestureHandler","createGestureHandler","dropGestureHandler","updateGestureHandler","NativeViewGestureHandler","TapGestureHandler","ForceTouchGestureHandler","LongPressGestureHandler","PinchGestureHandler","RotationGestureHandler","FlingGestureHandler","RawButton","BaseButton","RectButton","BorderlessButton"],"mappings":"AAAA,SACEA,kBADF,EAEEC,uBAFF,EAGEC,gBAHF,EAIEC,wBAJF,EAKEC,UALF,EAMEC,QANF,EAOEC,MAPF,EAQEC,SARF,EASEC,mBATF,EAUEC,IAVF,QAWO,cAXP;AAYA,SAASC,KAAT,QAAsB,SAAtB;AACA,SAASC,UAAT,QAA2B,cAA3B;;AAEA,MAAMC,IAAI,GAAG,MAAM,CACjB;AACD,CAFD;;AAGA,MAAMC,iBAAiB,GAAGJ,IAA1B;AACA,MAAMK,oBAAoB,GAAGF,IAA7B;AACA,MAAMG,oBAAoB,GAAGH,IAA7B;AACA,MAAMI,kBAAkB,GAAGJ,IAA3B;AACA,MAAMK,oBAAoB,GAAGL,IAA7B;AACA,MAAMM,wBAAwB,GAAGT,IAAjC;AACA,MAAMU,iBAAiB,GAAGV,IAA1B;AACA,MAAMW,wBAAwB,GAAGX,IAAjC;AACA,MAAMY,uBAAuB,GAAGZ,IAAhC;AACA,MAAMa,mBAAmB,GAAGb,IAA5B;AACA,MAAMc,sBAAsB,GAAGd,IAA/B;AACA,MAAMe,mBAAmB,GAAGf,IAA5B;AACA,MAAMgB,SAAS,GAAGxB,uBAAlB;AACA,MAAMyB,UAAU,GAAGzB,uBAAnB;AACA,MAAM0B,UAAU,GAAG1B,uBAAnB;AACA,MAAM2B,gBAAgB,GAAG3B,uBAAzB;AAEA,eAAe;AACbD,EAAAA,kBADa;AAEbC,EAAAA,uBAFa;AAGbC,EAAAA,gBAHa;AAIbC,EAAAA,wBAJa;AAKbC,EAAAA,UALa;AAMbC,EAAAA,QANa;AAObC,EAAAA,MAPa;AAQbC,EAAAA,SARa;AASbC,EAAAA,mBATa;AAUbU,EAAAA,wBAVa;AAWbC,EAAAA,iBAXa;AAYbC,EAAAA,wBAZa;AAabC,EAAAA,uBAba;AAcbC,EAAAA,mBAda;AAebC,EAAAA,sBAfa;AAgBbC,EAAAA,mBAhBa;AAiBbC,EAAAA,SAjBa;AAkBbC,EAAAA,UAlBa;AAmBbC,EAAAA,UAnBa;AAoBbC,EAAAA,gBApBa;AAqBbf,EAAAA,iBArBa;AAsBbC,EAAAA,oBAtBa;AAuBbC,EAAAA,oBAvBa;AAwBbC,EAAAA,kBAxBa;AAyBbC,EAAAA,oBAzBa;AA0Bb;AACAN,EAAAA,UA3Ba;AA4BbD,EAAAA;AA5Ba,CAAf","sourcesContent":["import {\n TouchableHighlight,\n TouchableNativeFeedback,\n TouchableOpacity,\n TouchableWithoutFeedback,\n ScrollView,\n FlatList,\n Switch,\n TextInput,\n DrawerLayoutAndroid,\n View,\n} from 'react-native';\nimport { State } from './State';\nimport { Directions } from './Directions';\n\nconst NOOP = () => {\n // do nothing\n};\nconst PanGestureHandler = View;\nconst attachGestureHandler = NOOP;\nconst createGestureHandler = NOOP;\nconst dropGestureHandler = NOOP;\nconst updateGestureHandler = NOOP;\nconst NativeViewGestureHandler = View;\nconst TapGestureHandler = View;\nconst ForceTouchGestureHandler = View;\nconst LongPressGestureHandler = View;\nconst PinchGestureHandler = View;\nconst RotationGestureHandler = View;\nconst FlingGestureHandler = View;\nconst RawButton = TouchableNativeFeedback;\nconst BaseButton = TouchableNativeFeedback;\nconst RectButton = TouchableNativeFeedback;\nconst BorderlessButton = TouchableNativeFeedback;\n\nexport default {\n TouchableHighlight,\n TouchableNativeFeedback,\n TouchableOpacity,\n TouchableWithoutFeedback,\n ScrollView,\n FlatList,\n Switch,\n TextInput,\n DrawerLayoutAndroid,\n NativeViewGestureHandler,\n TapGestureHandler,\n ForceTouchGestureHandler,\n LongPressGestureHandler,\n PinchGestureHandler,\n RotationGestureHandler,\n FlingGestureHandler,\n RawButton,\n BaseButton,\n RectButton,\n BorderlessButton,\n PanGestureHandler,\n attachGestureHandler,\n createGestureHandler,\n dropGestureHandler,\n updateGestureHandler,\n // probably can be removed\n Directions,\n State,\n} as const;\n"]}
1
+ {"version":3,"sources":["mocks.ts"],"names":["TouchableHighlight","TouchableNativeFeedback","TouchableOpacity","TouchableWithoutFeedback","ScrollView","FlatList","Switch","TextInput","DrawerLayoutAndroid","View","State","Directions","NOOP","PanGestureHandler","attachGestureHandler","createGestureHandler","dropGestureHandler","updateGestureHandler","flushOperations","NativeViewGestureHandler","TapGestureHandler","ForceTouchGestureHandler","LongPressGestureHandler","PinchGestureHandler","RotationGestureHandler","FlingGestureHandler","RawButton","BaseButton","RectButton","BorderlessButton"],"mappings":"AAAA,SACEA,kBADF,EAEEC,uBAFF,EAGEC,gBAHF,EAIEC,wBAJF,EAKEC,UALF,EAMEC,QANF,EAOEC,MAPF,EAQEC,SARF,EASEC,mBATF,EAUEC,IAVF,QAWO,cAXP;AAYA,SAASC,KAAT,QAAsB,SAAtB;AACA,SAASC,UAAT,QAA2B,cAA3B;;AAEA,MAAMC,IAAI,GAAG,MAAM,CACjB;AACD,CAFD;;AAGA,MAAMC,iBAAiB,GAAGJ,IAA1B;AACA,MAAMK,oBAAoB,GAAGF,IAA7B;AACA,MAAMG,oBAAoB,GAAGH,IAA7B;AACA,MAAMI,kBAAkB,GAAGJ,IAA3B;AACA,MAAMK,oBAAoB,GAAGL,IAA7B;AACA,MAAMM,eAAe,GAAGN,IAAxB;AACA,MAAMO,wBAAwB,GAAGV,IAAjC;AACA,MAAMW,iBAAiB,GAAGX,IAA1B;AACA,MAAMY,wBAAwB,GAAGZ,IAAjC;AACA,MAAMa,uBAAuB,GAAGb,IAAhC;AACA,MAAMc,mBAAmB,GAAGd,IAA5B;AACA,MAAMe,sBAAsB,GAAGf,IAA/B;AACA,MAAMgB,mBAAmB,GAAGhB,IAA5B;AACA,MAAMiB,SAAS,GAAGzB,uBAAlB;AACA,MAAM0B,UAAU,GAAG1B,uBAAnB;AACA,MAAM2B,UAAU,GAAG3B,uBAAnB;AACA,MAAM4B,gBAAgB,GAAG5B,uBAAzB;AAEA,eAAe;AACbD,EAAAA,kBADa;AAEbC,EAAAA,uBAFa;AAGbC,EAAAA,gBAHa;AAIbC,EAAAA,wBAJa;AAKbC,EAAAA,UALa;AAMbC,EAAAA,QANa;AAObC,EAAAA,MAPa;AAQbC,EAAAA,SARa;AASbC,EAAAA,mBATa;AAUbW,EAAAA,wBAVa;AAWbC,EAAAA,iBAXa;AAYbC,EAAAA,wBAZa;AAabC,EAAAA,uBAba;AAcbC,EAAAA,mBAda;AAebC,EAAAA,sBAfa;AAgBbC,EAAAA,mBAhBa;AAiBbC,EAAAA,SAjBa;AAkBbC,EAAAA,UAlBa;AAmBbC,EAAAA,UAnBa;AAoBbC,EAAAA,gBApBa;AAqBbhB,EAAAA,iBArBa;AAsBbC,EAAAA,oBAtBa;AAuBbC,EAAAA,oBAvBa;AAwBbC,EAAAA,kBAxBa;AAyBbC,EAAAA,oBAzBa;AA0BbC,EAAAA,eA1Ba;AA2Bb;AACAP,EAAAA,UA5Ba;AA6BbD,EAAAA;AA7Ba,CAAf","sourcesContent":["import {\n TouchableHighlight,\n TouchableNativeFeedback,\n TouchableOpacity,\n TouchableWithoutFeedback,\n ScrollView,\n FlatList,\n Switch,\n TextInput,\n DrawerLayoutAndroid,\n View,\n} from 'react-native';\nimport { State } from './State';\nimport { Directions } from './Directions';\n\nconst NOOP = () => {\n // do nothing\n};\nconst PanGestureHandler = View;\nconst attachGestureHandler = NOOP;\nconst createGestureHandler = NOOP;\nconst dropGestureHandler = NOOP;\nconst updateGestureHandler = NOOP;\nconst flushOperations = NOOP;\nconst NativeViewGestureHandler = View;\nconst TapGestureHandler = View;\nconst ForceTouchGestureHandler = View;\nconst LongPressGestureHandler = View;\nconst PinchGestureHandler = View;\nconst RotationGestureHandler = View;\nconst FlingGestureHandler = View;\nconst RawButton = TouchableNativeFeedback;\nconst BaseButton = TouchableNativeFeedback;\nconst RectButton = TouchableNativeFeedback;\nconst BorderlessButton = TouchableNativeFeedback;\n\nexport default {\n TouchableHighlight,\n TouchableNativeFeedback,\n TouchableOpacity,\n TouchableWithoutFeedback,\n ScrollView,\n FlatList,\n Switch,\n TextInput,\n DrawerLayoutAndroid,\n NativeViewGestureHandler,\n TapGestureHandler,\n ForceTouchGestureHandler,\n LongPressGestureHandler,\n PinchGestureHandler,\n RotationGestureHandler,\n FlingGestureHandler,\n RawButton,\n BaseButton,\n RectButton,\n BorderlessButton,\n PanGestureHandler,\n attachGestureHandler,\n createGestureHandler,\n dropGestureHandler,\n updateGestureHandler,\n flushOperations,\n // probably can be removed\n Directions,\n State,\n} as const;\n"]}
@@ -1,4 +1,5 @@
1
- import { version as rnVersion } from 'react-native/package.json';
1
+ import pack from 'react-native/package.json';
2
+ const rnVersion = pack.version;
2
3
  export function toArray(object) {
3
4
  if (!Array.isArray(object)) {
4
5
  return [object];
@@ -1 +1 @@
1
- {"version":3,"sources":["utils.ts"],"names":["version","rnVersion","toArray","object","Array","isArray","withPrevAndCurrent","array","mapFn","previousArr","currentArr","transformedArr","forEach","current","i","previous","transformed","push","hasProperty","key","Object","prototype","hasOwnProperty","call","isJestEnv","global","process","env","JEST_WORKER_ID","tagMessage","msg","isFabric","nativeFabricUIManager","shouldUseCodegenNativeComponent","majorStr","minorStr","split","major","Number","parseInt","minor","isRemoteDebuggingEnabled","nativeCallSyncHook","__REMOTEDEV__"],"mappings":"AAAA,SAASA,OAAO,IAAIC,SAApB,QAAqC,2BAArC;AAEA,OAAO,SAASC,OAAT,CAAoBC,MAApB,EAA0C;AAC/C,MAAI,CAACC,KAAK,CAACC,OAAN,CAAcF,MAAd,CAAL,EAA4B;AAC1B,WAAO,CAACA,MAAD,CAAP;AACD;;AAED,SAAOA,MAAP;AACD;AAMD,OAAO,SAASG,kBAAT,CACLC,KADK,EAELC,KAFK,EAGU;AACf,QAAMC,WAAmC,GAAG,CAAC,IAAD,CAA5C;AACA,QAAMC,UAAU,GAAG,CAAC,GAAGH,KAAJ,CAAnB;AACA,QAAMI,cAA6B,GAAG,EAAtC;AACAD,EAAAA,UAAU,CAACE,OAAX,CAAmB,CAACC,OAAD,EAAUC,CAAV,KAAgB;AACjC,UAAMC,QAAQ,GAAGN,WAAW,CAACK,CAAD,CAA5B;AACA,UAAME,WAAW,GAAGR,KAAK,CAACO,QAAD,EAAWF,OAAX,CAAzB;AACAJ,IAAAA,WAAW,CAACQ,IAAZ,CAAiBD,WAAjB;AACAL,IAAAA,cAAc,CAACM,IAAf,CAAoBD,WAApB;AACD,GALD;AAMA,SAAOL,cAAP;AACD,C,CAED;;AACA,OAAO,SAASO,WAAT,CAAqBf,MAArB,EAAqCgB,GAArC,EAAkD;AACvD,SAAOC,MAAM,CAACC,SAAP,CAAiBC,cAAjB,CAAgCC,IAAhC,CAAqCpB,MAArC,EAA6CgB,GAA7C,CAAP;AACD;AAED,OAAO,SAASK,SAAT,GAA8B;AACnC;AACA,SAAON,WAAW,CAACO,MAAD,EAAS,SAAT,CAAX,IAAkC,CAAC,CAACC,OAAO,CAACC,GAAR,CAAYC,cAAvD;AACD;AAED,OAAO,SAASC,UAAT,CAAoBC,GAApB,EAAiC;AACtC,SAAQ,kCAAiCA,GAAI,EAA7C;AACD,C,CAED;AACA;;AACA,OAAO,SAASC,QAAT,GAA6B;AAAA;;AAClC;AACA,SAAO,CAAC,aAACN,MAAD,oCAAC,QAAQO,qBAAT,CAAR;AACD;AAED,OAAO,SAASC,+BAAT,GAAoD;AACzD,QAAM,CAACC,QAAD,EAAWC,QAAX,IAAuBlC,SAAS,CAACmC,KAAV,CAAgB,GAAhB,CAA7B;AACA,QAAMC,KAAK,GAAGC,MAAM,CAACC,QAAP,CAAgBL,QAAhB,CAAd;AACA,QAAMM,KAAK,GAAGF,MAAM,CAACC,QAAP,CAAgBJ,QAAhB,CAAd,CAHyD,CAKzD;;AACA,SAAOK,KAAK,IAAI,EAAT,IAAeH,KAAK,GAAG,CAA9B;AACD;AAED,OAAO,SAASI,wBAAT,GAA6C;AAClD;AACA;AACA,SAAO,CAAEhB,MAAD,CAAgBiB,kBAAjB,IAAwCjB,MAAD,CAAgBkB,aAA9D;AACD","sourcesContent":["import { version as rnVersion } from 'react-native/package.json';\n\nexport function toArray<T>(object: T | T[]): T[] {\n if (!Array.isArray(object)) {\n return [object];\n }\n\n return object;\n}\n\nexport type withPrevAndCurrentMapFn<T, Transformed> = (\n previous: Transformed | null,\n current: T\n) => Transformed;\nexport function withPrevAndCurrent<T, Transformed>(\n array: T[],\n mapFn: withPrevAndCurrentMapFn<T, Transformed>\n): Transformed[] {\n const previousArr: (null | Transformed)[] = [null];\n const currentArr = [...array];\n const transformedArr: Transformed[] = [];\n currentArr.forEach((current, i) => {\n const previous = previousArr[i];\n const transformed = mapFn(previous, current);\n previousArr.push(transformed);\n transformedArr.push(transformed);\n });\n return transformedArr;\n}\n\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport function hasProperty(object: object, key: string) {\n return Object.prototype.hasOwnProperty.call(object, key);\n}\n\nexport function isJestEnv(): boolean {\n // @ts-ignore Do not use `@types/node` because it will prioritise Node types over RN types which breaks the types (ex. setTimeout) in React Native projects.\n return hasProperty(global, 'process') && !!process.env.JEST_WORKER_ID;\n}\n\nexport function tagMessage(msg: string) {\n return `[react-native-gesture-handler] ${msg}`;\n}\n\n// helper method to check whether Fabric is enabled, however global.nativeFabricUIManager\n// may not be initialized before the first render\nexport function isFabric(): boolean {\n // @ts-expect-error nativeFabricUIManager is not yet included in the RN types\n return !!global?.nativeFabricUIManager;\n}\n\nexport function shouldUseCodegenNativeComponent(): boolean {\n const [majorStr, minorStr] = rnVersion.split('.');\n const major = Number.parseInt(majorStr);\n const minor = Number.parseInt(minorStr);\n\n // use codegenNativeComponent starting with RN 0.68\n return minor >= 68 || major > 0;\n}\n\nexport function isRemoteDebuggingEnabled(): boolean {\n // react-native-reanimated checks if in remote debugging in the same way\n // @ts-ignore global is available but node types are not included\n return !(global as any).nativeCallSyncHook || (global as any).__REMOTEDEV__;\n}\n"]}
1
+ {"version":3,"sources":["utils.ts"],"names":["pack","rnVersion","version","toArray","object","Array","isArray","withPrevAndCurrent","array","mapFn","previousArr","currentArr","transformedArr","forEach","current","i","previous","transformed","push","hasProperty","key","Object","prototype","hasOwnProperty","call","isJestEnv","global","process","env","JEST_WORKER_ID","tagMessage","msg","isFabric","nativeFabricUIManager","shouldUseCodegenNativeComponent","majorStr","minorStr","split","major","Number","parseInt","minor","isRemoteDebuggingEnabled","nativeCallSyncHook","__REMOTEDEV__"],"mappings":"AAAA,OAAOA,IAAP,MAAiB,2BAAjB;AAEA,MAAMC,SAAS,GAAGD,IAAI,CAACE,OAAvB;AAEA,OAAO,SAASC,OAAT,CAAoBC,MAApB,EAA0C;AAC/C,MAAI,CAACC,KAAK,CAACC,OAAN,CAAcF,MAAd,CAAL,EAA4B;AAC1B,WAAO,CAACA,MAAD,CAAP;AACD;;AAED,SAAOA,MAAP;AACD;AAMD,OAAO,SAASG,kBAAT,CACLC,KADK,EAELC,KAFK,EAGU;AACf,QAAMC,WAAmC,GAAG,CAAC,IAAD,CAA5C;AACA,QAAMC,UAAU,GAAG,CAAC,GAAGH,KAAJ,CAAnB;AACA,QAAMI,cAA6B,GAAG,EAAtC;AACAD,EAAAA,UAAU,CAACE,OAAX,CAAmB,CAACC,OAAD,EAAUC,CAAV,KAAgB;AACjC,UAAMC,QAAQ,GAAGN,WAAW,CAACK,CAAD,CAA5B;AACA,UAAME,WAAW,GAAGR,KAAK,CAACO,QAAD,EAAWF,OAAX,CAAzB;AACAJ,IAAAA,WAAW,CAACQ,IAAZ,CAAiBD,WAAjB;AACAL,IAAAA,cAAc,CAACM,IAAf,CAAoBD,WAApB;AACD,GALD;AAMA,SAAOL,cAAP;AACD,C,CAED;;AACA,OAAO,SAASO,WAAT,CAAqBf,MAArB,EAAqCgB,GAArC,EAAkD;AACvD,SAAOC,MAAM,CAACC,SAAP,CAAiBC,cAAjB,CAAgCC,IAAhC,CAAqCpB,MAArC,EAA6CgB,GAA7C,CAAP;AACD;AAED,OAAO,SAASK,SAAT,GAA8B;AACnC;AACA,SAAON,WAAW,CAACO,MAAD,EAAS,SAAT,CAAX,IAAkC,CAAC,CAACC,OAAO,CAACC,GAAR,CAAYC,cAAvD;AACD;AAED,OAAO,SAASC,UAAT,CAAoBC,GAApB,EAAiC;AACtC,SAAQ,kCAAiCA,GAAI,EAA7C;AACD,C,CAED;AACA;;AACA,OAAO,SAASC,QAAT,GAA6B;AAAA;;AAClC;AACA,SAAO,CAAC,aAACN,MAAD,oCAAC,QAAQO,qBAAT,CAAR;AACD;AAED,OAAO,SAASC,+BAAT,GAAoD;AACzD,QAAM,CAACC,QAAD,EAAWC,QAAX,IAAuBnC,SAAS,CAACoC,KAAV,CAAgB,GAAhB,CAA7B;AACA,QAAMC,KAAK,GAAGC,MAAM,CAACC,QAAP,CAAgBL,QAAhB,CAAd;AACA,QAAMM,KAAK,GAAGF,MAAM,CAACC,QAAP,CAAgBJ,QAAhB,CAAd,CAHyD,CAKzD;;AACA,SAAOK,KAAK,IAAI,EAAT,IAAeH,KAAK,GAAG,CAA9B;AACD;AAED,OAAO,SAASI,wBAAT,GAA6C;AAClD;AACA;AACA,SAAO,CAAEhB,MAAD,CAAgBiB,kBAAjB,IAAwCjB,MAAD,CAAgBkB,aAA9D;AACD","sourcesContent":["import pack from 'react-native/package.json';\n\nconst rnVersion = pack.version;\n\nexport function toArray<T>(object: T | T[]): T[] {\n if (!Array.isArray(object)) {\n return [object];\n }\n\n return object;\n}\n\nexport type withPrevAndCurrentMapFn<T, Transformed> = (\n previous: Transformed | null,\n current: T\n) => Transformed;\nexport function withPrevAndCurrent<T, Transformed>(\n array: T[],\n mapFn: withPrevAndCurrentMapFn<T, Transformed>\n): Transformed[] {\n const previousArr: (null | Transformed)[] = [null];\n const currentArr = [...array];\n const transformedArr: Transformed[] = [];\n currentArr.forEach((current, i) => {\n const previous = previousArr[i];\n const transformed = mapFn(previous, current);\n previousArr.push(transformed);\n transformedArr.push(transformed);\n });\n return transformedArr;\n}\n\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport function hasProperty(object: object, key: string) {\n return Object.prototype.hasOwnProperty.call(object, key);\n}\n\nexport function isJestEnv(): boolean {\n // @ts-ignore Do not use `@types/node` because it will prioritise Node types over RN types which breaks the types (ex. setTimeout) in React Native projects.\n return hasProperty(global, 'process') && !!process.env.JEST_WORKER_ID;\n}\n\nexport function tagMessage(msg: string) {\n return `[react-native-gesture-handler] ${msg}`;\n}\n\n// helper method to check whether Fabric is enabled, however global.nativeFabricUIManager\n// may not be initialized before the first render\nexport function isFabric(): boolean {\n // @ts-expect-error nativeFabricUIManager is not yet included in the RN types\n return !!global?.nativeFabricUIManager;\n}\n\nexport function shouldUseCodegenNativeComponent(): boolean {\n const [majorStr, minorStr] = rnVersion.split('.');\n const major = Number.parseInt(majorStr);\n const minor = Number.parseInt(minorStr);\n\n // use codegenNativeComponent starting with RN 0.68\n return minor >= 68 || major > 0;\n}\n\nexport function isRemoteDebuggingEnabled(): boolean {\n // react-native-reanimated checks if in remote debugging in the same way\n // @ts-ignore global is available but node types are not included\n return !(global as any).nativeCallSyncHook || (global as any).__REMOTEDEV__;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["utils.ts"],"names":["isnan","v","Number","isNaN","isValidNumber","TEST_MIN_IF_NOT_NAN","value","limit","VEC_LEN_SQ","x","y","TEST_MAX_IF_NOT_NAN","max","fireAfterInterval","method","interval","setTimeout"],"mappings":"AAAA;AACA,OAAO,MAAMA,KAAK,GAAIC,CAAD,IAAgBC,MAAM,CAACC,KAAP,CAAaF,CAAb,CAA9B,C,CAEP;;AACA,OAAO,MAAMG,aAAa,GAAIH,CAAD,IAC3B,OAAOA,CAAP,KAAa,QAAb,IAAyB,CAACC,MAAM,CAACC,KAAP,CAAaF,CAAb,CADrB;AAGP,OAAO,MAAMI,mBAAmB,GAAG,CAACC,KAAD,EAAgBC,KAAhB,KACjC,CAACP,KAAK,CAACO,KAAD,CAAN,KACEA,KAAK,GAAG,CAAR,IAAaD,KAAK,IAAIC,KAAvB,IAAkCA,KAAK,IAAI,CAAT,IAAcD,KAAK,IAAIC,KAD1D,CADK;AAGP,OAAO,MAAMC,UAAU,GAAG,CAAC;AAAEC,EAAAA,CAAC,GAAG,CAAN;AAASC,EAAAA,CAAC,GAAG;AAAb,IAAmB,EAApB,KAA2BD,CAAC,GAAGA,CAAJ,GAAQC,CAAC,GAAGA,CAA1D;AACP,OAAO,MAAMC,mBAAmB,GAAG,CAACL,KAAD,EAAgBM,GAAhB,KACjC,CAACZ,KAAK,CAACY,GAAD,CAAN,KAAiBA,GAAG,GAAG,CAAN,IAAWN,KAAK,GAAGM,GAApB,IAA6BA,GAAG,IAAI,CAAP,IAAYN,KAAK,GAAGM,GAAjE,CADK;AAGP,OAAO,SAASC,iBAAT,CACLC,MADK,EAELC,QAFK,EAGL;AACA,MAAI,CAACA,QAAL,EAAe;AACbD,IAAAA,MAAM;AACN,WAAO,IAAP;AACD;;AACD,SAAOE,UAAU,CAAC,MAAMF,MAAM,EAAb,EAAiBC,QAAjB,CAAjB;AACD","sourcesContent":["// TODO(TS) remove if not necessary after rewrite\nexport const isnan = (v: unknown) => Number.isNaN(v);\n\n// TODO(TS) remove if not necessary after rewrite\nexport const isValidNumber = (v: unknown) =>\n typeof v === 'number' && !Number.isNaN(v);\n\nexport const TEST_MIN_IF_NOT_NAN = (value: number, limit: number): boolean =>\n !isnan(limit) &&\n ((limit < 0 && value <= limit) || (limit >= 0 && value >= limit));\nexport const VEC_LEN_SQ = ({ x = 0, y = 0 } = {}) => x * x + y * y;\nexport const TEST_MAX_IF_NOT_NAN = (value: number, max: number) =>\n !isnan(max) && ((max < 0 && value < max) || (max >= 0 && value > max));\n\nexport function fireAfterInterval(\n method: () => void,\n interval?: number | boolean\n) {\n if (!interval) {\n method();\n return null;\n }\n return setTimeout(() => method(), interval);\n}\n"]}
1
+ {"version":3,"sources":["utils.ts"],"names":["isnan","v","Number","isNaN","isValidNumber","TEST_MIN_IF_NOT_NAN","value","limit","VEC_LEN_SQ","x","y","TEST_MAX_IF_NOT_NAN","max","fireAfterInterval","method","interval","setTimeout"],"mappings":"AAAA;AACA,OAAO,MAAMA,KAAK,GAAIC,CAAD,IAAgBC,MAAM,CAACC,KAAP,CAAaF,CAAb,CAA9B,C,CAEP;;AACA,OAAO,MAAMG,aAAa,GAAIH,CAAD,IAC3B,OAAOA,CAAP,KAAa,QAAb,IAAyB,CAACC,MAAM,CAACC,KAAP,CAAaF,CAAb,CADrB;AAGP,OAAO,MAAMI,mBAAmB,GAAG,CAACC,KAAD,EAAgBC,KAAhB,KACjC,CAACP,KAAK,CAACO,KAAD,CAAN,KACEA,KAAK,GAAG,CAAR,IAAaD,KAAK,IAAIC,KAAvB,IAAkCA,KAAK,IAAI,CAAT,IAAcD,KAAK,IAAIC,KAD1D,CADK;AAGP,OAAO,MAAMC,UAAU,GAAG,CAAC;AAAEC,EAAAA,CAAC,GAAG,CAAN;AAASC,EAAAA,CAAC,GAAG;AAAb,IAAmB,EAApB,KAA2BD,CAAC,GAAGA,CAAJ,GAAQC,CAAC,GAAGA,CAA1D;AACP,OAAO,MAAMC,mBAAmB,GAAG,CAACL,KAAD,EAAgBM,GAAhB,KACjC,CAACZ,KAAK,CAACY,GAAD,CAAN,KAAiBA,GAAG,GAAG,CAAN,IAAWN,KAAK,GAAGM,GAApB,IAA6BA,GAAG,IAAI,CAAP,IAAYN,KAAK,GAAGM,GAAjE,CADK;AAGP,OAAO,SAASC,iBAAT,CACLC,MADK,EAELC,QAFK,EAGL;AACA,MAAI,CAACA,QAAL,EAAe;AACbD,IAAAA,MAAM;AACN,WAAO,IAAP;AACD;;AACD,SAAOE,UAAU,CAAC,MAAMF,MAAM,EAAb,EAAiBC,QAAjB,CAAjB;AACD","sourcesContent":["// TODO(TS) remove if not necessary after rewrite\nexport const isnan = (v: unknown) => Number.isNaN(v);\n\n// TODO(TS) remove if not necessary after rewrite\nexport const isValidNumber = (v: unknown) =>\n typeof v === 'number' && !Number.isNaN(v);\n\nexport const TEST_MIN_IF_NOT_NAN = (value: number, limit: number): boolean =>\n !isnan(limit) &&\n ((limit < 0 && value <= limit) || (limit >= 0 && value >= limit));\nexport const VEC_LEN_SQ = ({ x = 0, y = 0 } = {}) => x * x + y * y;\nexport const TEST_MAX_IF_NOT_NAN = (value: number, max: number) =>\n !isnan(max) && ((max < 0 && value < max) || (max >= 0 && value > max));\n\nexport function fireAfterInterval(\n method: () => void,\n interval?: number | boolean\n) {\n if (!interval) {\n method();\n return null;\n }\n return setTimeout(() => method(), interval as number);\n}\n"]}
@@ -0,0 +1,34 @@
1
+ import { ActionType } from './ActionType';
2
+ import FlingGestureHandler from './web/FlingGestureHandler';
3
+ import LongPressGestureHandler from './web/LongPressGestureHandler';
4
+ import NativeViewGestureHandler from './web/NativeViewGestureHandler';
5
+ import PanGestureHandler from './web/PanGestureHandler';
6
+ import PinchGestureHandler from './web/PinchGestureHandler';
7
+ import RotationGestureHandler from './web/RotationGestureHandler';
8
+ import TapGestureHandler from './web/TapGestureHandler';
9
+ export declare const Gestures: {
10
+ PanGestureHandler: typeof PanGestureHandler;
11
+ RotationGestureHandler: typeof RotationGestureHandler;
12
+ PinchGestureHandler: typeof PinchGestureHandler;
13
+ TapGestureHandler: typeof TapGestureHandler;
14
+ NativeViewGestureHandler: typeof NativeViewGestureHandler;
15
+ LongPressGestureHandler: typeof LongPressGestureHandler;
16
+ FlingGestureHandler: typeof FlingGestureHandler;
17
+ };
18
+ declare const _default: {
19
+ Direction: {
20
+ RIGHT: number;
21
+ LEFT: number;
22
+ UP: number;
23
+ DOWN: number;
24
+ };
25
+ handleSetJSResponder(): void;
26
+ handleClearJSResponder(): void;
27
+ createGestureHandler<T>(handlerName: keyof typeof Gestures, handlerTag: number, config: T): void;
28
+ attachGestureHandler(handlerTag: number, newView: number, _actionType: ActionType, propsRef: React.RefObject<unknown>): void;
29
+ updateGestureHandler(handlerTag: number, newConfig: any): void;
30
+ getGestureHandlerNode(handlerTag: number): LongPressGestureHandler | NativeViewGestureHandler | PanGestureHandler | RotationGestureHandler | PinchGestureHandler | TapGestureHandler | FlingGestureHandler;
31
+ dropGestureHandler(handlerTag: number): void;
32
+ flushOperations(): void;
33
+ };
34
+ export default _default;
@@ -27,7 +27,7 @@ declare const _default: {
27
27
  createGestureHandler<T>(handlerName: keyof typeof Gestures, handlerTag: number, config: T): void;
28
28
  attachGestureHandler(handlerTag: number, newView: number, _actionType: ActionType, propsRef: React.RefObject<unknown>): void;
29
29
  updateGestureHandler(handlerTag: number, newConfig: any): void;
30
- getGestureHandlerNode(handlerTag: number): PanGestureHandler | RotationGestureHandler | PinchGestureHandler | TapGestureHandler | NativeViewGestureHandler | LongPressGestureHandler | FlingGestureHandler;
30
+ getGestureHandlerNode(handlerTag: number): LongPressGestureHandler | NativeViewGestureHandler | PanGestureHandler | RotationGestureHandler | PinchGestureHandler | TapGestureHandler | FlingGestureHandler;
31
31
  dropGestureHandler(handlerTag: number): void;
32
32
  flushOperations(): void;
33
33
  };
@@ -78,12 +78,15 @@ export interface DrawerLayoutProps {
78
78
  enableTrackpadTwoFingerGesture?: boolean;
79
79
  onDrawerSlide?: (position: number) => void;
80
80
  onGestureRef?: (ref: PanGestureHandler) => void;
81
+ children?: React.ReactNode | ((openValue?: Animated.AnimatedInterpolation) => React.ReactNode);
81
82
  }
82
83
  export declare type DrawerLayoutState = {
83
84
  dragX: Animated.Value;
84
85
  touchX: Animated.Value;
85
86
  drawerTranslation: Animated.Value;
86
87
  containerWidth: number;
88
+ drawerState: DrawerState;
89
+ drawerOpened: boolean;
87
90
  };
88
91
  export declare type DrawerMovementOption = {
89
92
  velocity?: number;
@@ -31,6 +31,12 @@ export interface RawButtonProps extends NativeViewGestureHandlerProps {
31
31
  * Defines whether the ripple animation should be drawn on the foreground of the view.
32
32
  */
33
33
  foreground?: boolean;
34
+ /**
35
+ * Android only.
36
+ *
37
+ * Set this to true if you don't want the system to play sound when the button is pressed.
38
+ */
39
+ touchSoundDisabled?: boolean;
34
40
  }
35
41
  export interface BaseButtonProps extends RawButtonProps {
36
42
  /**
@@ -8,6 +8,7 @@ interface NativeProps extends ViewProps {
8
8
  enabled?: WithDefault<boolean, true>;
9
9
  rippleColor?: ColorValue;
10
10
  rippleRadius?: Int32;
11
+ touchSoundDisabled?: WithDefault<boolean, false>;
11
12
  }
12
13
  declare const _default: HostComponent<NativeProps>;
13
14
  export default _default;
@@ -1,7 +1,7 @@
1
- import React from 'react';
1
+ import React, { PropsWithChildren } from 'react';
2
2
  import { BaseGestureHandlerProps } from './gestureHandlerCommon';
3
3
  export declare const forceTouchGestureHandlerProps: readonly ["minForce", "maxForce", "feedbackOnActivation"];
4
- declare class ForceTouchFallback extends React.Component {
4
+ declare class ForceTouchFallback extends React.Component<PropsWithChildren<unknown>> {
5
5
  static forceTouchAvailable: boolean;
6
6
  componentDidMount(): void;
7
7
  render(): React.ReactNode;
@@ -1,5 +1,5 @@
1
1
  import { BaseGestureHandlerProps } from './gestureHandlerCommon';
2
- export declare const panGestureHandlerProps: readonly ["activeOffsetY", "activeOffsetX", "failOffsetY", "failOffsetX", "minDist", "minVelocity", "minVelocityX", "minVelocityY", "minPointers", "maxPointers", "avgTouches", "enableTrackpadTwoFingerGesture"];
2
+ export declare const panGestureHandlerProps: readonly ["activeOffsetY", "activeOffsetX", "failOffsetY", "failOffsetX", "minDist", "minVelocity", "minVelocityX", "minVelocityY", "minPointers", "maxPointers", "avgTouches", "enableTrackpadTwoFingerGesture", "activateAfterLongPress"];
3
3
  export declare const panGestureHandlerCustomNativeProps: readonly ["activeOffsetYStart", "activeOffsetYEnd", "activeOffsetXStart", "activeOffsetXEnd", "failOffsetYStart", "failOffsetYEnd", "failOffsetXStart", "failOffsetXEnd"];
4
4
  export declare type PanGestureHandlerEventPayload = {
5
5
  /**
@@ -82,6 +82,7 @@ interface CommonPanProperties {
82
82
  minVelocity?: number;
83
83
  minVelocityX?: number;
84
84
  minVelocityY?: number;
85
+ activateAfterLongPress?: number;
85
86
  }
86
87
  export interface PanGestureConfig extends CommonPanProperties {
87
88
  activeOffsetYStart?: number;
@@ -0,0 +1 @@
1
+ export { PressabilityDebugView } from 'react-native/Libraries/Pressability/PressabilityDebug';
@@ -0,0 +1 @@
1
+ export declare function PressabilityDebugView(): null;
@@ -54,6 +54,7 @@ export declare type BaseGestureHandlerProps<ExtraEventPayloadT extends Record<st
54
54
  onEnded?: (event: HandlerStateChangeEvent) => void;
55
55
  onGestureEvent?: (event: GestureEvent<ExtraEventPayloadT>) => void;
56
56
  onHandlerStateChange?: (event: HandlerStateChangeEvent<ExtraEventPayloadT>) => void;
57
+ children?: React.ReactNode;
57
58
  };
58
59
  export declare function filterConfig(props: Record<string, unknown>, validProps: string[], defaults?: Record<string, unknown>): {
59
60
  [x: string]: unknown;
@@ -11,6 +11,7 @@ export declare type GestureConfigReference = {
11
11
  };
12
12
  interface GestureDetectorProps {
13
13
  gesture?: ComposedGesture | GestureType;
14
+ children?: React.ReactNode;
14
15
  }
15
- export declare const GestureDetector: React.FunctionComponent<GestureDetectorProps>;
16
+ export declare const GestureDetector: (props: GestureDetectorProps) => JSX.Element;
16
17
  export {};
@@ -22,6 +22,7 @@ export interface BaseGestureConfig extends CommonGestureConfig, Record<string, u
22
22
  }
23
23
  declare type TouchEventHandlerType = (event: GestureTouchEvent, stateManager: GestureStateManagerType) => void;
24
24
  export declare type HandlerCallbacks<EventPayloadT extends Record<string, unknown>> = {
25
+ gestureId: number;
25
26
  handlerTag: number;
26
27
  onBegin?: (event: GestureStateChangeEvent<EventPayloadT>) => void;
27
28
  onStart?: (event: GestureStateChangeEvent<EventPayloadT>) => void;
@@ -68,10 +69,12 @@ export declare abstract class Gesture {
68
69
  abstract prepare(): void;
69
70
  }
70
71
  export declare abstract class BaseGesture<EventPayloadT extends Record<string, unknown>> extends Gesture {
72
+ private gestureId;
71
73
  handlerTag: number;
72
74
  handlerName: string;
73
75
  config: BaseGestureConfig;
74
76
  handlers: HandlerCallbacks<EventPayloadT>;
77
+ constructor();
75
78
  private addDependency;
76
79
  withRef(ref: React.MutableRefObject<GestureType | undefined>): this;
77
80
  protected isWorklet(callback: Function): boolean;
@@ -20,6 +20,7 @@ export declare class PanGesture extends ContinousBaseGesture<PanGestureHandlerEv
20
20
  minVelocityY(velocity: number): this;
21
21
  averageTouches(value: boolean): this;
22
22
  enableTrackpadTwoFingerGesture(value: boolean): this;
23
+ activateAfterLongPress(duration: number): this;
23
24
  onChange(callback: (event: GestureUpdateEvent<PanGestureHandlerEventPayload & PanGestureChangeEventPayload>) => void): this;
24
25
  }
25
26
  export declare type PanGestureType = InstanceType<typeof PanGesture>;
@@ -25,6 +25,7 @@ declare const _default: {
25
25
  readonly createGestureHandler: () => void;
26
26
  readonly dropGestureHandler: () => void;
27
27
  readonly updateGestureHandler: () => void;
28
+ readonly flushOperations: () => void;
28
29
  readonly Directions: {
29
30
  readonly RIGHT: 1;
30
31
  readonly LEFT: 2;
@@ -1,8 +1,8 @@
1
1
  import { ValueOf } from '../typeUtils';
2
2
  import { Gestures } from '../RNGestureHandlerModule.web';
3
- export declare function getHandler(tag: number): import("./PanGestureHandler").default | import("./RotationGestureHandler").default | import("./PinchGestureHandler").default | import("./TapGestureHandler").default | import("./NativeViewGestureHandler").default | import("./LongPressGestureHandler").default | import("./FlingGestureHandler").default;
3
+ export declare function getHandler(tag: number): import("./LongPressGestureHandler").default | import("./NativeViewGestureHandler").default | import("./PanGestureHandler").default | import("./RotationGestureHandler").default | import("./PinchGestureHandler").default | import("./TapGestureHandler").default | import("./FlingGestureHandler").default;
4
4
  export declare function createGestureHandler(handlerTag: number, handler: InstanceType<ValueOf<typeof Gestures>>): void;
5
5
  export declare function dropGestureHandler(handlerTag: number): void;
6
6
  export declare function getNodes(): {
7
- [x: number]: import("./PanGestureHandler").default | import("./RotationGestureHandler").default | import("./PinchGestureHandler").default | import("./TapGestureHandler").default | import("./NativeViewGestureHandler").default | import("./LongPressGestureHandler").default | import("./FlingGestureHandler").default;
7
+ [x: number]: import("./LongPressGestureHandler").default | import("./NativeViewGestureHandler").default | import("./PanGestureHandler").default | import("./RotationGestureHandler").default | import("./PinchGestureHandler").default | import("./TapGestureHandler").default | import("./FlingGestureHandler").default;
8
8
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-gesture-handler",
3
- "version": "2.4.0",
3
+ "version": "2.5.0",
4
4
  "description": "Experimental implementation of a new declarative API for gesture handling in react-native",
5
5
  "scripts": {
6
6
  "prepare": "bob build",
@@ -0,0 +1,62 @@
1
+ import { ActionType } from './ActionType';
2
+ import { Direction } from './web/constants';
3
+ import FlingGestureHandler from './web/FlingGestureHandler';
4
+ import LongPressGestureHandler from './web/LongPressGestureHandler';
5
+ import NativeViewGestureHandler from './web/NativeViewGestureHandler';
6
+ import * as NodeManager from './web/NodeManager';
7
+ import PanGestureHandler from './web/PanGestureHandler';
8
+ import PinchGestureHandler from './web/PinchGestureHandler';
9
+ import RotationGestureHandler from './web/RotationGestureHandler';
10
+ import TapGestureHandler from './web/TapGestureHandler';
11
+
12
+ export const Gestures = {
13
+ PanGestureHandler,
14
+ RotationGestureHandler,
15
+ PinchGestureHandler,
16
+ TapGestureHandler,
17
+ NativeViewGestureHandler,
18
+ LongPressGestureHandler,
19
+ FlingGestureHandler,
20
+ // ForceTouchGestureHandler,
21
+ };
22
+
23
+ export default {
24
+ Direction,
25
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
26
+ handleSetJSResponder() {},
27
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
28
+ handleClearJSResponder() {},
29
+ createGestureHandler<T>(
30
+ handlerName: keyof typeof Gestures,
31
+ handlerTag: number,
32
+ config: T
33
+ ) {
34
+ //TODO(TS) extends config
35
+ if (!(handlerName in Gestures))
36
+ throw new Error(
37
+ `react-native-gesture-handler: ${handlerName} is not supported on macos.`
38
+ );
39
+ const GestureClass = Gestures[handlerName];
40
+ NodeManager.createGestureHandler(handlerTag, new GestureClass());
41
+ this.updateGestureHandler(handlerTag, config);
42
+ },
43
+ attachGestureHandler(
44
+ handlerTag: number,
45
+ newView: number,
46
+ _actionType: ActionType,
47
+ propsRef: React.RefObject<unknown>
48
+ ) {
49
+ NodeManager.getHandler(handlerTag).setView(newView, propsRef);
50
+ },
51
+ updateGestureHandler(handlerTag: number, newConfig: any) {
52
+ NodeManager.getHandler(handlerTag).updateGestureConfig(newConfig);
53
+ },
54
+ getGestureHandlerNode(handlerTag: number) {
55
+ return NodeManager.getHandler(handlerTag);
56
+ },
57
+ dropGestureHandler(handlerTag: number) {
58
+ NodeManager.dropGestureHandler(handlerTag);
59
+ },
60
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
61
+ flushOperations() {},
62
+ };
@@ -148,6 +148,11 @@ export interface DrawerLayoutProps {
148
148
  onDrawerSlide?: (position: number) => void;
149
149
 
150
150
  onGestureRef?: (ref: PanGestureHandler) => void;
151
+
152
+ // implicit `children` prop has been removed in @types/react^18.0.0
153
+ children?:
154
+ | React.ReactNode
155
+ | ((openValue?: Animated.AnimatedInterpolation) => React.ReactNode);
151
156
  }
152
157
 
153
158
  export type DrawerLayoutState = {
@@ -155,6 +160,8 @@ export type DrawerLayoutState = {
155
160
  touchX: Animated.Value;
156
161
  drawerTranslation: Animated.Value;
157
162
  containerWidth: number;
163
+ drawerState: DrawerState;
164
+ drawerOpened: boolean;
158
165
  };
159
166
 
160
167
  export type DrawerMovementOption = {
@@ -189,6 +196,8 @@ export default class DrawerLayout extends Component<
189
196
  touchX,
190
197
  drawerTranslation,
191
198
  containerWidth: 0,
199
+ drawerState: IDLE,
200
+ drawerOpened: false,
192
201
  };
193
202
 
194
203
  this.updateAnimatedEvent(props, this.state);
@@ -349,6 +358,7 @@ export default class DrawerLayout extends Component<
349
358
  this.handleRelease({ nativeEvent });
350
359
  } else if (nativeEvent.state === State.ACTIVE) {
351
360
  this.emitStateChanged(DRAGGING, false);
361
+ this.setState({ drawerState: DRAGGING });
352
362
  if (this.props.keyboardDismissMode === 'on-drag') {
353
363
  Keyboard.dismiss();
354
364
  }
@@ -464,6 +474,7 @@ export default class DrawerLayout extends Component<
464
474
  const willShow = toValue !== 0;
465
475
  this.updateShowing(willShow);
466
476
  this.emitStateChanged(SETTLING, willShow);
477
+ this.setState({ drawerState: SETTLING });
467
478
  if (this.props.hideStatusBar) {
468
479
  StatusBar.setHidden(willShow, this.props.statusBarAnimation || 'slide');
469
480
  }
@@ -476,6 +487,12 @@ export default class DrawerLayout extends Component<
476
487
  }).start(({ finished }) => {
477
488
  if (finished) {
478
489
  this.emitStateChanged(IDLE, willShow);
490
+ this.setState({ drawerOpened: willShow });
491
+ if (this.state.drawerState !== DRAGGING) {
492
+ // it's possilbe that user started drag while the drawer
493
+ // was settling, don't override state in this case
494
+ this.setState({ drawerState: IDLE });
495
+ }
479
496
  if (willShow) {
480
497
  this.props.onDrawerOpen?.();
481
498
  } else {
@@ -516,11 +533,14 @@ export default class DrawerLayout extends Component<
516
533
  private renderOverlay = () => {
517
534
  /* Overlay styles */
518
535
  invariant(this.openValue, 'should be set');
519
- const overlayOpacity = this.openValue.interpolate({
520
- inputRange: [0, 1],
521
- outputRange: [0, 1],
522
- extrapolate: 'clamp',
523
- });
536
+ let overlayOpacity;
537
+
538
+ if (this.state.drawerState !== IDLE) {
539
+ overlayOpacity = this.openValue;
540
+ } else {
541
+ overlayOpacity = this.state.drawerOpened ? 1 : 0;
542
+ }
543
+
524
544
  const dynamicOverlayStyles = {
525
545
  opacity: overlayOpacity,
526
546
  backgroundColor: this.props.overlayColor,
@@ -579,11 +599,15 @@ export default class DrawerLayout extends Component<
579
599
  let drawerTranslateX: number | Animated.AnimatedInterpolation = 0;
580
600
  if (drawerSlide) {
581
601
  const closedDrawerOffset = fromLeft ? -drawerWidth! : drawerWidth!;
582
- drawerTranslateX = openValue.interpolate({
583
- inputRange: [0, 1],
584
- outputRange: [closedDrawerOffset, 0],
585
- extrapolate: 'clamp',
586
- });
602
+ if (this.state.drawerState !== IDLE) {
603
+ drawerTranslateX = openValue.interpolate({
604
+ inputRange: [0, 1],
605
+ outputRange: [closedDrawerOffset, 0],
606
+ extrapolate: 'clamp',
607
+ });
608
+ } else {
609
+ drawerTranslateX = this.state.drawerOpened ? 0 : closedDrawerOffset;
610
+ }
587
611
  }
588
612
  const drawerStyles: {
589
613
  transform: { translateX: number | Animated.AnimatedInterpolation }[];
@@ -56,6 +56,13 @@ export interface RawButtonProps extends NativeViewGestureHandlerProps {
56
56
  * Defines whether the ripple animation should be drawn on the foreground of the view.
57
57
  */
58
58
  foreground?: boolean;
59
+
60
+ /**
61
+ * Android only.
62
+ *
63
+ * Set this to true if you don't want the system to play sound when the button is pressed.
64
+ */
65
+ touchSoundDisabled?: boolean;
59
66
  }
60
67
 
61
68
  export interface BaseButtonProps extends RawButtonProps {
@@ -277,6 +277,7 @@ export default class GenericTouchable extends Component<
277
277
  shouldActivateOnStart={this.props.shouldActivateOnStart}
278
278
  disallowInterruption={this.props.disallowInterruption}
279
279
  testID={this.props.testID}
280
+ touchSoundDisabled={this.props.touchSoundDisabled ?? false}
280
281
  {...this.props.extraButtonProps}>
281
282
  <Animated.View {...coreProps} style={this.props.style}>
282
283
  {this.props.children}
@@ -22,6 +22,7 @@ interface NativeProps extends ViewProps {
22
22
  enabled?: WithDefault<boolean, true>;
23
23
  rippleColor?: ColorValue;
24
24
  rippleRadius?: Int32;
25
+ touchSoundDisabled?: WithDefault<boolean, false>;
25
26
  }
26
27
 
27
28
  export default codegenNativeComponent<NativeProps>('RNGestureHandlerButton');
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { PropsWithChildren } from 'react';
2
2
  import { tagMessage } from '../utils';
3
3
  import PlatformConstants from '../PlatformConstants';
4
4
  import createHandler from './createHandler';
@@ -13,7 +13,8 @@ export const forceTouchGestureHandlerProps = [
13
13
  'feedbackOnActivation',
14
14
  ] as const;
15
15
 
16
- class ForceTouchFallback extends React.Component {
16
+ // implicit `children` prop has been removed in @types/react^18.0.0
17
+ class ForceTouchFallback extends React.Component<PropsWithChildren<unknown>> {
17
18
  static forceTouchAvailable = false;
18
19
  componentDidMount() {
19
20
  console.warn(
@@ -17,6 +17,7 @@ export const panGestureHandlerProps = [
17
17
  'maxPointers',
18
18
  'avgTouches',
19
19
  'enableTrackpadTwoFingerGesture',
20
+ 'activateAfterLongPress',
20
21
  ] as const;
21
22
 
22
23
  export const panGestureHandlerCustomNativeProps = [
@@ -124,6 +125,7 @@ interface CommonPanProperties {
124
125
  minVelocity?: number;
125
126
  minVelocityX?: number;
126
127
  minVelocityY?: number;
128
+ activateAfterLongPress?: number;
127
129
  }
128
130
 
129
131
  export interface PanGestureConfig extends CommonPanProperties {
@@ -0,0 +1,2 @@
1
+ // @ts-ignore it's not exported so we need to import it from path
2
+ export { PressabilityDebugView } from 'react-native/Libraries/Pressability/PressabilityDebug';
@@ -0,0 +1,4 @@
1
+ // PressabilityDebugView is not implemented in react-native-web
2
+ export function PressabilityDebugView() {
3
+ return null;
4
+ }
@@ -1,7 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import {
3
3
  Platform,
4
- Touchable,
5
4
  UIManager,
6
5
  DeviceEventEmitter,
7
6
  EmitterSubscription,
@@ -28,6 +27,7 @@ import {
28
27
  import { ValueOf } from '../typeUtils';
29
28
  import { isFabric, isJestEnv } from '../utils';
30
29
  import { ActionType } from '../ActionType';
30
+ import { PressabilityDebugView } from './PressabilityDebugView';
31
31
 
32
32
  const UIManagerAny = UIManager as any;
33
33
 
@@ -148,6 +148,8 @@ type InternalEventHandlers = {
148
148
  onGestureHandlerStateChange?: (event: any) => void;
149
149
  };
150
150
 
151
+ const UNRESOLVED_REFS_RETRY_LIMIT = 1;
152
+
151
153
  // TODO(TS) - make sure that BaseGestureHandlerProps doesn't need other generic parameter to work with custom properties.
152
154
  export default function createHandler<
153
155
  T extends BaseGestureHandlerProps<U>,
@@ -198,7 +200,7 @@ export default function createHandler<
198
200
  'toggleElementInspector',
199
201
  () => {
200
202
  this.setState((_) => ({ allowTouches }));
201
- this.update();
203
+ this.update(UNRESOLVED_REFS_RETRY_LIMIT);
202
204
  }
203
205
  );
204
206
  }
@@ -211,7 +213,7 @@ export default function createHandler<
211
213
  // be resolved by then.
212
214
  this.updateEnqueued = setImmediate(() => {
213
215
  this.updateEnqueued = null;
214
- this.update();
216
+ this.update(UNRESOLVED_REFS_RETRY_LIMIT);
215
217
  });
216
218
  }
217
219
 
@@ -231,7 +233,7 @@ export default function createHandler<
231
233
  if (this.viewTag !== viewTag) {
232
234
  this.attachGestureHandler(viewTag as number); // TODO(TS) - check interaction between _viewTag & findNodeHandle
233
235
  }
234
- this.update();
236
+ this.update(UNRESOLVED_REFS_RETRY_LIMIT);
235
237
  }
236
238
 
237
239
  componentWillUnmount() {
@@ -361,14 +363,26 @@ export default function createHandler<
361
363
  scheduleFlushOperations();
362
364
  };
363
365
 
364
- private update() {
365
- const newConfig = filterConfig(
366
- transformProps ? transformProps(this.props) : this.props,
367
- [...allowedProps, ...customNativeProps],
368
- config
369
- );
370
- if (!deepEqual(this.config, newConfig)) {
371
- this.updateGestureHandler(newConfig);
366
+ private update(remainingTries: number) {
367
+ const props: HandlerProps<U> = this.props;
368
+
369
+ // When ref is set via a function i.e. `ref={(r) => refObject.current = r}` instead of
370
+ // `ref={refObject}` it's possible that it won't be resolved in time. Seems like trying
371
+ // again is easy enough fix.
372
+ if (hasUnresolvedRefs(props) && remainingTries > 0) {
373
+ this.updateEnqueued = setImmediate(() => {
374
+ this.updateEnqueued = null;
375
+ this.update(remainingTries - 1);
376
+ });
377
+ } else {
378
+ const newConfig = filterConfig(
379
+ transformProps ? transformProps(this.props) : this.props,
380
+ [...allowedProps, ...customNativeProps],
381
+ config
382
+ );
383
+ if (!deepEqual(this.config, newConfig)) {
384
+ this.updateGestureHandler(newConfig);
385
+ }
372
386
  }
373
387
  }
374
388
 
@@ -458,7 +472,7 @@ export default function createHandler<
458
472
  const child: any = React.Children.only(this.props.children);
459
473
  let grandChildren = child.props.children;
460
474
  if (
461
- Touchable.TOUCH_TARGET_DEBUG &&
475
+ __DEV__ &&
462
476
  child.type &&
463
477
  (child.type === 'RNGestureHandlerButton' ||
464
478
  child.type.name === 'View' ||
@@ -466,10 +480,11 @@ export default function createHandler<
466
480
  ) {
467
481
  grandChildren = React.Children.toArray(grandChildren);
468
482
  grandChildren.push(
469
- Touchable.renderDebugView({
470
- color: 'mediumspringgreen',
471
- hitSlop: child.props.hitSlop,
472
- })
483
+ <PressabilityDebugView
484
+ key="pressabilityDebugView"
485
+ color="mediumspringgreen"
486
+ hitSlop={child.props.hitSlop}
487
+ />
473
488
  );
474
489
  }
475
490