mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-02-05 22:47:48 +08:00
[RCTBridge] Clean up reload notification observer
Summary: After the RCTBatchedBridge refactor, the `-[NSNotificationCenter addObserver]` and `[removeObserver]` calls got divided between RCTBridge and RCTBatchedBridge. This diff does two things: - Moved `removeObserver` out of RTCBatchedBridge and into `-[RCTBridge invalidate]` - Moved `addObserver` from `bindKeys` to `setUp`. This is so that `-[RCTBridge reload]` will re-add the observer after invalidating and removing the observer cc @tadeuzagallo Closes https://github.com/facebook/react-native/pull/1212 Github Author: James Ide <ide@jameside.com> Test Plan: Imported from GitHub, without a `Test Plan:` line.
This commit is contained in:
committed by
Christopher Chedeau
parent
a0440daf98
commit
ba9ef00ab9
@@ -789,6 +789,7 @@ static id<RCTJavaScriptExecutor> _latestJSExecutor;
|
||||
* This runs only on the main thread, but crashes the subclass
|
||||
* RCTAssertMainThread();
|
||||
*/
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
[self invalidate];
|
||||
}
|
||||
|
||||
@@ -1174,7 +1175,6 @@ RCT_INNER_BRIDGE_ONLY(_invokeAndProcessModule:(NSString *)module method:(NSStrin
|
||||
|
||||
void (^mainThreadInvalidate)(void) = ^{
|
||||
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
[_mainDisplayLink invalidate];
|
||||
_mainDisplayLink = nil;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user