mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
e5a6655e71
Summary: ## Problem When self is nil, this may crash in RCTUIImageViewAnimated.m. ``` _displayLink = [CADisplayLink displayLinkWithTarget:[RCTWeakProxy weakProxyWithTarget:self] selector:selector(displayDidRefresh:)]; ``` ## Fix Replace `RCTWeakProxy` with a concrete class `RCTDisplayWeakRefreshable` that has the displayDidRefresh method, that calls the displayDidRefresh method in its weak target. ### Original Github Issue https://github.com/facebook/react-native/pull/28070#issuecomment-619295254 Changelog: [iOS] [Fixed] - Fix Animated image crash when CADisplayLink target in RCTWeakProxy is nil Reviewed By: shergin Differential Revision: D21419385 fbshipit-source-id: da7c3c38f81ea54f633da7f59359e07680ea2faf
23 lines
533 B
Objective-C
23 lines
533 B
Objective-C
/*
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
#import <Foundation/Foundation.h>
|
|
|
|
@protocol RCTDisplayRefreshable
|
|
|
|
- (void)displayDidRefresh:(CADisplayLink *)displayLink;
|
|
|
|
@end
|
|
|
|
@interface RCTDisplayWeakRefreshable : NSObject
|
|
|
|
@property (nonatomic, weak) id<RCTDisplayRefreshable> refreshable;
|
|
|
|
+ (CADisplayLink *)displayLinkWithWeakRefreshable:(id<RCTDisplayRefreshable>)refreshable;
|
|
|
|
@end
|