Weakly capture the bridge in callback methods

Summary: Callback blocks are frequently held onto by modules, e.g. for animation the `RCTFrameAnimation` holds onto its callback method. This causes a bunch of retain cycles since the module will be strongly held onto by the bridge.

Reviewed By: Megra

Differential Revision: D7492136

fbshipit-source-id: 708e61ffe7bf0dcffaebc056ab861b9023ffc1df
This commit is contained in:
Mehdi Mulani 2018-04-05 14:32:43 -07:00 committed by Facebook Github Bot
parent 6be5d7827b
commit 52a3443e98

View File

@ -213,7 +213,7 @@ RCT_EXTERN_C_END
#endif
#define RCT_RETAINED_ARG_BLOCK(_logic) \
[argumentBlocks addObject:^(__unused RCTBridge *bridge, NSUInteger index, id json) { \
[argumentBlocks addObject:^(__unused __weak RCTBridge *bridge, NSUInteger index, id json) { \
_logic \
[invocation setArgument:&value atIndex:(index) + 2]; \
if (value) { \