Fabric: Basic implementation of <View nativeId={...}>

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
This commit is contained in:
Valentin Shergin 2018-06-15 11:25:22 -07:00 committed by Facebook Github Bot
parent da55ef1367
commit cde30eb6b7
2 changed files with 14 additions and 0 deletions

View File

@ -36,6 +36,15 @@ NS_ASSUME_NONNULL_BEGIN
*/ */
@property (nonatomic, strong, nullable) UIView *contentView; @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 @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END

View File

@ -53,6 +53,11 @@ using namespace facebook::react;
} }
// TODO: Implement all sutable non-layout <View> 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 - (void)updateEventEmitter:(SharedEventEmitter)eventEmitter