Prepending root scope ID
Summary: Using just the scope identifier for the root component is not sufficient when it doesn't have a scope. Solve this by prepending the scope root identifier to the parent identifier. Reviewed By: fabiomassimo Differential Revision: D19600721 fbshipit-source-id: d90f9ffd7ae369c76316cebc4ef792626a4584b7
This commit is contained in:
committed by
Facebook Github Bot
parent
7964772f82
commit
67a1c27af2
@@ -25,5 +25,6 @@
|
|||||||
@property (nonatomic, readonly) CKFlexboxComponentChild flexboxChild;
|
@property (nonatomic, readonly) CKFlexboxComponentChild flexboxChild;
|
||||||
|
|
||||||
+ (instancetype)newFromRoot:(id<CKInspectableView>)root;
|
+ (instancetype)newFromRoot:(id<CKInspectableView>)root;
|
||||||
|
+ (instancetype)newFromRoot:(id<CKInspectableView>)root parentKey:(NSString *)parentKey;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -44,6 +44,10 @@ static CKFlexboxComponentChild findFlexboxLayoutParams(CKComponent *parent, CKCo
|
|||||||
@implementation SKComponentLayoutWrapper
|
@implementation SKComponentLayoutWrapper
|
||||||
|
|
||||||
+ (instancetype)newFromRoot:(id<CKInspectableView>)root {
|
+ (instancetype)newFromRoot:(id<CKInspectableView>)root {
|
||||||
|
return [self newFromRoot:root parentKey:@""];
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (instancetype)newFromRoot:(id<CKInspectableView>)root parentKey:(NSString *)parentKey {
|
||||||
const CKComponentLayout layout = [root mountedLayout];
|
const CKComponentLayout layout = [root mountedLayout];
|
||||||
// Check if there is a cached wrapper.
|
// Check if there is a cached wrapper.
|
||||||
if (layout.component) {
|
if (layout.component) {
|
||||||
@@ -59,7 +63,7 @@ static CKFlexboxComponentChild findFlexboxLayoutParams(CKComponent *parent, CKCo
|
|||||||
SKComponentLayoutWrapper *const wrapper =
|
SKComponentLayoutWrapper *const wrapper =
|
||||||
[[SKComponentLayoutWrapper alloc] initWithLayout:layout
|
[[SKComponentLayoutWrapper alloc] initWithLayout:layout
|
||||||
position:CGPointMake(0, 0)
|
position:CGPointMake(0, 0)
|
||||||
parentKey:[NSString stringWithFormat: @"%d.", component.treeNode.nodeIdentifier]
|
parentKey:[NSString stringWithFormat: @"%@%d.", parentKey, component.treeNode.nodeIdentifier]
|
||||||
reuseWrapper:reuseWrapper
|
reuseWrapper:reuseWrapper
|
||||||
rootNode: root];
|
rootNode: root];
|
||||||
// Cache the result.
|
// Cache the result.
|
||||||
|
|||||||
@@ -32,7 +32,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (id)childForNode:(CKComponentRootView *)node atIndex:(NSUInteger)index {
|
- (id)childForNode:(CKComponentRootView *)node atIndex:(NSUInteger)index {
|
||||||
return [SKComponentLayoutWrapper newFromRoot:node];
|
auto const attachState = CKGetAttachStateForView(node);
|
||||||
|
return [SKComponentLayoutWrapper newFromRoot:node
|
||||||
|
parentKey:[NSString stringWithFormat:@"%d.", attachState.scopeIdentifier]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setHighlighted:(BOOL)highlighted forNode:(CKComponentRootView *)node {
|
- (void)setHighlighted:(BOOL)highlighted forNode:(CKComponentRootView *)node {
|
||||||
|
|||||||
Reference in New Issue
Block a user