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
This commit is contained in:
Samuel Susla 2022-10-14 09:12:00 -07:00 коммит произвёл Facebook GitHub Bot
Родитель 5359f1de12
Коммит 5580a22dad
1 изменённых файлов: 5 добавлений и 0 удалений

Просмотреть файл

@ -47,6 +47,11 @@
- (CGFloat)inputNodeValue
{
if (self.parentNodes == nil) {
RCTLogWarn(@"Animated.DiffClamp node has not been fully initialised.");
return 0;
}
RCTValueAnimatedNode *inputNode = (RCTValueAnimatedNode *)[self.parentNodes objectForKey:_inputNodeTag];
if (![inputNode isKindOfClass:[RCTValueAnimatedNode class]]) {
RCTLogError(@"Illegal node ID set as an input for Animated.DiffClamp node");