Skip to content

Commit bf2cc69

Browse files
sammy-SCmohitcharkha
authored andcommitted
Prevent red box when DiffClampAnimatedNode is not fully initialised
Summary: changelog: [internal] `parentNodes` may be nil in case `DiffClampAnimatedNode` was not setup correctly. In this case, let's just noop and warn rather than throw redbox. This is not necessary but makes the code safer in world where native animated is invoked by new and old architecture at the same time (pre-bridgeless). Reviewed By: yungsters Differential Revision: D40381724 fbshipit-source-id: 6252f05951079649b810902559bfec9dd4f957d9
1 parent 04f473e commit bf2cc69

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Libraries/NativeAnimation/Nodes/RCTDiffClampAnimatedNode.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ - (void)performUpdate
4747

4848
- (CGFloat)inputNodeValue
4949
{
50+
if (self.parentNodes == nil) {
51+
RCTLogWarn(@"Animated.DiffClamp node has not been fully initialised.");
52+
return 0;
53+
}
54+
5055
RCTValueAnimatedNode *inputNode = (RCTValueAnimatedNode *)[self.parentNodes objectForKey:_inputNodeTag];
5156
if (![inputNode isKindOfClass:[RCTValueAnimatedNode class]]) {
5257
RCTLogError(@"Illegal node ID set as an input for Animated.DiffClamp node");

0 commit comments

Comments
 (0)