mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-03-26 07:04:05 +08:00
[ReactNative] Properly pause frame update observers when idle
Summary: @public `RCTDispatchEvent` and `RCTTiming` weren't being paused when there wasn't any work left to be done. Test Plan: Run the timers example - check everything still works as expected Test the ListView paging example - check scroll events are still fired as expected Launch UIExplorer, let it idle, and put a break point on `-[RCTBridge dispatchBlock:moduleID:]`, it should never fire.
This commit is contained in:
@@ -155,6 +155,10 @@ RCT_IMPORT_METHOD(RCTJSTimers, callTimers)
|
||||
if ([timersToCall count] > 0) {
|
||||
[_bridge enqueueJSCall:@"RCTJSTimers.callTimers" args:@[timersToCall]];
|
||||
}
|
||||
|
||||
if (_timers.count == 0) {
|
||||
[self stopTimers];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user