react-native/React/Fabric/Mounting/MountItems/RCTUpdateLocalDataMountItem.mm
Valentin Shergin 9f46f425f4 Fabric: Managing LocalData instances in mounting pipeline
Summary: Managing and transmitting LocalData object to native views.

Reviewed By: mdvacca

Differential Revision: D7738580

fbshipit-source-id: c889da58d3afe7ac14f411576afe659bd079f641
2018-04-26 18:03:07 -07:00

40 lines
998 B
Plaintext

/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import "RCTUpdateLocalDataMountItem.h"
#import "RCTComponentViewRegistry.h"
using namespace facebook::react;
@implementation RCTUpdateLocalDataMountItem {
ReactTag _tag;
SharedLocalData _oldLocalData;
SharedLocalData _newLocalData;
}
- (instancetype)initWithTag:(ReactTag)tag
oldLocalData:(facebook::react::SharedLocalData)oldLocalData
newLocalData:(facebook::react::SharedLocalData)newLocalData
{
if (self = [super init]) {
_tag = tag;
_oldLocalData = oldLocalData;
_newLocalData = newLocalData;
}
return self;
}
- (void)executeWithRegistry:(RCTComponentViewRegistry *)registry
{
UIView<RCTComponentViewProtocol> *componentView = [registry componentViewByTag:_tag];
[componentView updateLocalData:_newLocalData oldLocalData:_oldLocalData];
}
@end