Skip to content

Commit

Permalink
Fabric: Basic implementation of <View nativeId={...}>
Browse files Browse the repository at this point in the history
Summary:
Trivial.
`nativeId` is meant to be used by subclasses of external inspector-like tools, so it does not have any real functionality.

Reviewed By: fkgozali

Differential Revision: D8344064

fbshipit-source-id: d86ef378cda1f7f0e9a7b4ffc09f51004ae530d2
  • Loading branch information
shergin authored and facebook-github-bot committed Jun 15, 2018
1 parent da55ef1 commit cde30eb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@ NS_ASSUME_NONNULL_BEGIN
*/
@property (nonatomic, strong, nullable) UIView *contentView;

/**
* Provides access to `nativeId` prop of the component.
* It might be used by subclasses (which need to refer to the view from
* other platform-specific external views or systems by some id) or
* by debugging/inspection tools.
* Defaults to `nil`.
*/
@property (nonatomic, strong, nullable) NSString *nativeId;

@end

NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ - (void)updateProps:(SharedProps)props
}

// TODO: Implement all sutable non-layout <View> props.
// `nativeId`
if (oldViewProps.nativeId != newViewProps.nativeId) {
self.nativeId = [NSString stringWithCString:newViewProps.nativeId.c_str()
encoding:NSASCIIStringEncoding];
}
}

- (void)updateEventEmitter:(SharedEventEmitter)eventEmitter
Expand Down

0 comments on commit cde30eb

Please sign in to comment.