react-native-gesture-handler 3.0.0-beta.1 → 3.0.0-nightly-20260206-e99cf63a0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -109,7 +109,7 @@ class RNGestureHandlerDetectorView(context: Context) : ReactViewGroup(context) {
109
109
  }
110
110
 
111
111
  for (tag in handlersToDetach) {
112
- registry.detachHandler(tag)
112
+ registry.detachHandlerFromHostDetector(tag, this)
113
113
  nativeHandlers.remove(tag)
114
114
  attachedHandlers.remove(tag)
115
115
  }
@@ -134,7 +134,7 @@ class RNGestureHandlerDetectorView(context: Context) : ReactViewGroup(context) {
134
134
 
135
135
  for (child in virtualChildrenToDetach) {
136
136
  for (tag in attachedVirtualHandlers[child]!!) {
137
- registry.detachHandler(tag)
137
+ registry.detachHandlerFromHostDetector(tag, this)
138
138
  }
139
139
  attachedVirtualHandlers.remove(tag)
140
140
  }
@@ -182,7 +182,7 @@ class RNGestureHandlerDetectorView(context: Context) : ReactViewGroup(context) {
182
182
  ?: throw Exception("Tried to access a non-existent registry")
183
183
 
184
184
  for (tag in nativeHandlers) {
185
- registry.detachHandler(tag)
185
+ registry.detachHandlerFromHostDetector(tag, this)
186
186
  attachedHandlers.remove(tag)
187
187
  }
188
188
  }
@@ -197,13 +197,13 @@ class RNGestureHandlerDetectorView(context: Context) : ReactViewGroup(context) {
197
197
  ?: throw Exception("Tried to access a non-existent registry")
198
198
 
199
199
  for (tag in attachedHandlers.toMutableSet()) {
200
- registry.detachHandler(tag)
200
+ registry.detachHandlerFromHostDetector(tag, this)
201
201
  attachedHandlers.remove(tag)
202
202
  }
203
203
 
204
204
  for (child in attachedVirtualHandlers) {
205
205
  for (tag in child.value) {
206
- registry.detachHandler(tag)
206
+ registry.detachHandlerFromHostDetector(tag, this)
207
207
  }
208
208
  child.value.clear()
209
209
  }
@@ -78,8 +78,9 @@ class RNGestureHandlerRegistry : GestureHandlerRegistry {
78
78
  }
79
79
 
80
80
  @Synchronized
81
- fun detachHandler(handlerTag: Int) {
81
+ fun detachHandlerFromHostDetector(handlerTag: Int, hostDetectorView: RNGestureHandlerDetectorView?) {
82
82
  handlers[handlerTag]?.let {
83
+ if (it.hostDetectorView != hostDetectorView) return
83
84
  detachHandlerInternal(it)
84
85
  }
85
86
  }
@@ -47,16 +47,17 @@
47
47
  {
48
48
  if (newWindow == nil) {
49
49
  RNGestureHandlerManager *handlerManager = [RNGestureHandlerModule handlerManagerForModuleId:_moduleId];
50
- react_native_assert(handlerManager != nullptr && "Tried to access a non-existent handler manager")
51
- const auto &props = *std::static_pointer_cast<const RNGestureHandlerDetectorProps>(_props);
50
+ react_native_assert(handlerManager != nullptr && "Tried to access a non-existent handler manager");
51
+
52
+ const auto &props = *std::static_pointer_cast<const RNGestureHandlerDetectorProps>(_props);
52
53
 
53
54
  for (const auto handler : props.handlerTags) {
54
55
  NSNumber *handlerTag = [NSNumber numberWithInt:handler];
55
- [handlerManager.registry detachHandlerWithTag:handlerTag];
56
+ [handlerManager.registry detachHandlerWithTag:handlerTag fromHostDetector:self];
56
57
  }
57
58
  for (const auto &child : _attachedVirtualHandlers) {
58
59
  for (id handlerTag : child.second) {
59
- [handlerManager.registry detachHandlerWithTag:handlerTag];
60
+ [handlerManager.registry detachHandlerWithTag:handlerTag fromHostDetector:self];
60
61
  }
61
62
  }
62
63
  _attachedVirtualHandlers.clear();
@@ -190,9 +191,9 @@
190
191
  attachedHandlers:(NSMutableSet *)attachedHandlers
191
192
  {
192
193
  RNGestureHandlerManager *handlerManager = [RNGestureHandlerModule handlerManagerForModuleId:_moduleId];
193
- react_native_assert(handlerManager != nullptr && "Tried to access a non-existent handler manager")
194
+ react_native_assert(handlerManager != nullptr && "Tried to access a non-existent handler manager");
194
195
 
195
- NSMutableSet *handlersToDetach = [attachedHandlers mutableCopy];
196
+ NSMutableSet *handlersToDetach = [attachedHandlers mutableCopy];
196
197
 
197
198
  for (const int tag : handlerTags) {
198
199
  [handlersToDetach removeObject:@(tag)];
@@ -231,7 +232,7 @@
231
232
  }
232
233
 
233
234
  for (const id tag : handlersToDetach) {
234
- [handlerManager.registry detachHandlerWithTag:tag];
235
+ [handlerManager.registry detachHandlerWithTag:tag fromHostDetector:self];
235
236
  [attachedHandlers removeObject:tag];
236
237
  [_nativeHandlers removeObject:tag];
237
238
  }
@@ -262,9 +263,9 @@
262
263
  - (void)updateVirtualChildren:(const std::vector<RNGestureHandlerDetectorVirtualChildrenStruct> &)virtualChildren
263
264
  {
264
265
  RNGestureHandlerManager *handlerManager = [RNGestureHandlerModule handlerManagerForModuleId:_moduleId];
265
- react_native_assert(handlerManager != nullptr && "Tried to access a non-existent handler manager")
266
+ react_native_assert(handlerManager != nullptr && "Tried to access a non-existent handler manager");
266
267
 
267
- NSMutableSet *virtualChildrenToDetach = [NSMutableSet set];
268
+ NSMutableSet *virtualChildrenToDetach = [NSMutableSet set];
268
269
  for (const auto &child : _attachedVirtualHandlers) {
269
270
  [virtualChildrenToDetach addObject:@(child.first)];
270
271
  }
@@ -275,7 +276,7 @@
275
276
 
276
277
  for (const NSNumber *tag : virtualChildrenToDetach) {
277
278
  for (id handlerTag : _attachedVirtualHandlers[tag.intValue]) {
278
- [handlerManager.registry detachHandlerWithTag:handlerTag];
279
+ [handlerManager.registry detachHandlerWithTag:handlerTag fromHostDetector:self];
279
280
  }
280
281
  _attachedVirtualHandlers.erase(tag.intValue);
281
282
  }
@@ -325,7 +326,7 @@
325
326
  RNGestureHandlerManager *handlerManager = [RNGestureHandlerModule handlerManagerForModuleId:_moduleId];
326
327
 
327
328
  for (NSNumber *handlerTag in _nativeHandlers) {
328
- [[handlerManager registry] detachHandlerWithTag:handlerTag];
329
+ [[handlerManager registry] detachHandlerWithTag:handlerTag fromHostDetector:self];
329
330
  [_attachedHandlers removeObject:handlerTag];
330
331
  }
331
332
  }
@@ -17,6 +17,7 @@
17
17
  withActionType:(RNGestureHandlerActionType)actionType
18
18
  withHostDetector:(nullable RNGHUIView *)hostDetector;
19
19
  - (void)detachHandlerWithTag:(nonnull NSNumber *)handlerTag;
20
+ - (void)detachHandlerWithTag:(nonnull NSNumber *)handlerTag fromHostDetector:(nonnull RNGHUIView *)hostDetectorView;
20
21
  - (void)dropHandlerWithTag:(nonnull NSNumber *)handlerTag;
21
22
  - (void)dropAllHandlers;
22
23
 
@@ -48,9 +48,11 @@
48
48
  }
49
49
  }
50
50
 
51
- - (void)detachHandlerWithTag:(NSNumber *)handlerTag
51
+ - (void)detachHandlerWithTag:(NSNumber *)handlerTag fromHostDetector:(RNGHUIView *)hostDetectorView
52
52
  {
53
53
  RNGestureHandler *handler = _handlers[handlerTag];
54
+ if (handler.hostDetectorView != hostDetectorView)
55
+ return;
54
56
  [handler unbindFromView];
55
57
  }
56
58
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-gesture-handler",
3
- "version": "3.0.0-beta.1",
3
+ "version": "3.0.0-nightly-20260206-e99cf63a0",
4
4
  "description": "Declarative API exposing native platform touch and gesture system to React Native",
5
5
  "scripts": {
6
6
  "test": "jest",