mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-23 03:50:11 +08:00
Native Animated - Allow events that are dispatched from any thread
Summary: Instead of preventing events from working when not on the UI Thread we can just dispatch to it instead. **Test plan** Tested manually that animated events still work in RNTester Closes https://github.com/facebook/react-native/pull/15953 Differential Revision: D5909816 Pulled By: shergin fbshipit-source-id: 48d02b6aa9f2bc3bcb638e8852fccaac3f205276
This commit is contained in:
committed by
Facebook Github Bot
parent
b694f96762
commit
3cbc36138a
@@ -239,11 +239,11 @@ RCT_EXPORT_METHOD(removeAnimatedEventFromView:(nonnull NSNumber *)viewTag
|
||||
|
||||
- (void)eventDispatcherWillDispatchEvent:(id<RCTEvent>)event
|
||||
{
|
||||
// Native animated events only work for events dispatched from the main queue.
|
||||
if (!RCTIsMainQueue()) {
|
||||
return;
|
||||
}
|
||||
return [_nodesManager handleAnimatedEvent:event];
|
||||
// Events can be dispatched from any queue so we have to make sure handleAnimatedEvent
|
||||
// is run from the main queue.
|
||||
RCTExecuteOnMainQueue(^{
|
||||
[self->_nodesManager handleAnimatedEvent:event];
|
||||
});
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user