Apply clang-format update fixes
Reviewed By: igorsugak Differential Revision: D25861683 fbshipit-source-id: 616afca13ae64c76421053ce49286035e0687e36
This commit is contained in:
Родитель
e3a05c9e3e
Коммит
0f4f917663
|
@ -154,13 +154,12 @@ RCT_EXTERN NSString *RCTFormatStackTrace(NSArray<NSDictionary<NSString *, id> *>
|
||||||
*/
|
*/
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
|
|
||||||
#define RCTAssertThread(thread, format...) \
|
#define RCTAssertThread(thread, format...) \
|
||||||
_Pragma("clang diagnostic push") _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") RCTAssert( \
|
_Pragma("clang diagnostic push") _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") RCTAssert( \
|
||||||
[(id)thread isKindOfClass:[NSString class]] \
|
[(id)thread isKindOfClass:[NSString class]] ? [RCTCurrentThreadName() isEqualToString:(NSString *)thread] \
|
||||||
? [RCTCurrentThreadName() isEqualToString:(NSString *)thread] \
|
: [(id)thread isKindOfClass:[NSThread class]] ? [NSThread currentThread] == (NSThread *)thread \
|
||||||
: [(id)thread isKindOfClass:[NSThread class]] ? [NSThread currentThread] == (NSThread *)thread \
|
: dispatch_get_current_queue() == (dispatch_queue_t)thread, \
|
||||||
: dispatch_get_current_queue() == (dispatch_queue_t)thread, \
|
format); \
|
||||||
format); \
|
|
||||||
_Pragma("clang diagnostic pop")
|
_Pragma("clang diagnostic pop")
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -167,8 +167,12 @@ id RCTJSONClean(id object)
|
||||||
static dispatch_once_t onceToken;
|
static dispatch_once_t onceToken;
|
||||||
static NSSet<Class> *validLeafTypes;
|
static NSSet<Class> *validLeafTypes;
|
||||||
dispatch_once(&onceToken, ^{
|
dispatch_once(&onceToken, ^{
|
||||||
validLeafTypes =
|
validLeafTypes = [[NSSet alloc] initWithArray:@[
|
||||||
[[NSSet alloc] initWithArray:@ [[NSString class], [NSMutableString class], [NSNumber class], [NSNull class], ]];
|
[NSString class],
|
||||||
|
[NSMutableString class],
|
||||||
|
[NSNumber class],
|
||||||
|
[NSNull class],
|
||||||
|
]];
|
||||||
});
|
});
|
||||||
|
|
||||||
if ([validLeafTypes containsObject:[object classForCoder]]) {
|
if ([validLeafTypes containsObject:[object classForCoder]]) {
|
||||||
|
|
|
@ -96,16 +96,17 @@ RCT_EXPORT_METHOD(showActionSheetWithOptions
|
||||||
UIColor *tintColor = [RCTConvert UIColor:options.tintColor() ? @(*options.tintColor()) : nil];
|
UIColor *tintColor = [RCTConvert UIColor:options.tintColor() ? @(*options.tintColor()) : nil];
|
||||||
|
|
||||||
if (controller == nil) {
|
if (controller == nil) {
|
||||||
RCTLogError(@"Tried to display action sheet but there is no application window. options: %@", @{
|
RCTLogError(
|
||||||
@"title" : title,
|
@"Tried to display action sheet but there is no application window. options: %@", @{
|
||||||
@"message" : message,
|
@"title" : title,
|
||||||
@"options" : buttons,
|
@"message" : message,
|
||||||
@"cancelButtonIndex" : @(cancelButtonIndex),
|
@"options" : buttons,
|
||||||
@"destructiveButtonIndices" : destructiveButtonIndices,
|
@"cancelButtonIndex" : @(cancelButtonIndex),
|
||||||
@"anchor" : anchor,
|
@"destructiveButtonIndices" : destructiveButtonIndices,
|
||||||
@"tintColor" : tintColor,
|
@"anchor" : anchor,
|
||||||
@"disabledButtonIndices" : disabledButtonIndices,
|
@"tintColor" : tintColor,
|
||||||
});
|
@"disabledButtonIndices" : disabledButtonIndices,
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -318,9 +318,9 @@ RCT_EXPORT_MODULE()
|
||||||
if (devSettings.isLiveReloadAvailable) {
|
if (devSettings.isLiveReloadAvailable) {
|
||||||
[items addObject:[RCTDevMenuItem
|
[items addObject:[RCTDevMenuItem
|
||||||
buttonItemWithTitleBlock:^NSString * {
|
buttonItemWithTitleBlock:^NSString * {
|
||||||
return devSettings.isDebuggingRemotely
|
return devSettings.isDebuggingRemotely ? @"Systrace Unavailable"
|
||||||
? @"Systrace Unavailable"
|
: devSettings.isProfilingEnabled ? @"Stop Systrace"
|
||||||
: devSettings.isProfilingEnabled ? @"Stop Systrace" : @"Start Systrace";
|
: @"Start Systrace";
|
||||||
}
|
}
|
||||||
handler:^{
|
handler:^{
|
||||||
if (devSettings.isDebuggingRemotely) {
|
if (devSettings.isDebuggingRemotely) {
|
||||||
|
|
|
@ -160,11 +160,12 @@ using namespace facebook::react;
|
||||||
reusingView:(UILabel *)label
|
reusingView:(UILabel *)label
|
||||||
{
|
{
|
||||||
if (!label) {
|
if (!label) {
|
||||||
label = [[UILabel alloc] initWithFrame:(CGRect){CGPointZero,
|
label = [[UILabel alloc] initWithFrame:(CGRect){
|
||||||
{
|
CGPointZero,
|
||||||
[pickerView rowSizeForComponent:component].width,
|
{
|
||||||
[pickerView rowSizeForComponent:component].height,
|
[pickerView rowSizeForComponent:component].width,
|
||||||
}}];
|
[pickerView rowSizeForComponent:component].height,
|
||||||
|
}}];
|
||||||
}
|
}
|
||||||
NSMutableDictionary<NSAttributedStringKey, id> *attributes = [_textAttributes mutableCopy];
|
NSMutableDictionary<NSAttributedStringKey, id> *attributes = [_textAttributes mutableCopy];
|
||||||
// Color can be passed in from <Picker style={}/> or from <Picker.Item color={}/>
|
// Color can be passed in from <Picker style={}/> or from <Picker.Item color={}/>
|
||||||
|
|
|
@ -224,9 +224,9 @@
|
||||||
// Pick snap point based on direction and proximity
|
// Pick snap point based on direction and proximity
|
||||||
CGFloat fractionalIndex = (targetContentOffsetAlongAxis + alignmentOffset) / snapToIntervalF;
|
CGFloat fractionalIndex = (targetContentOffsetAlongAxis + alignmentOffset) / snapToIntervalF;
|
||||||
|
|
||||||
NSInteger snapIndex = velocityAlongAxis > 0.0
|
NSInteger snapIndex = velocityAlongAxis > 0.0 ? ceil(fractionalIndex)
|
||||||
? ceil(fractionalIndex)
|
: velocityAlongAxis < 0.0 ? floor(fractionalIndex)
|
||||||
: velocityAlongAxis < 0.0 ? floor(fractionalIndex) : round(fractionalIndex);
|
: round(fractionalIndex);
|
||||||
CGFloat newTargetContentOffset = (snapIndex * snapToIntervalF) - alignmentOffset;
|
CGFloat newTargetContentOffset = (snapIndex * snapToIntervalF) - alignmentOffset;
|
||||||
|
|
||||||
// Set new targetContentOffset
|
// Set new targetContentOffset
|
||||||
|
|
|
@ -74,8 +74,9 @@ using namespace facebook::react;
|
||||||
|
|
||||||
+ (std::vector<facebook::react::ComponentDescriptorProvider>)supplementalComponentDescriptorProviders
|
+ (std::vector<facebook::react::ComponentDescriptorProvider>)supplementalComponentDescriptorProviders
|
||||||
{
|
{
|
||||||
return {concreteComponentDescriptorProvider<RawTextComponentDescriptor>(),
|
return {
|
||||||
concreteComponentDescriptorProvider<TextComponentDescriptor>()};
|
concreteComponentDescriptorProvider<RawTextComponentDescriptor>(),
|
||||||
|
concreteComponentDescriptorProvider<TextComponentDescriptor>()};
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps
|
- (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps
|
||||||
|
|
|
@ -174,10 +174,11 @@ using namespace facebook::react;
|
||||||
|
|
||||||
// `hitSlop`
|
// `hitSlop`
|
||||||
if (oldViewProps.hitSlop != newViewProps.hitSlop) {
|
if (oldViewProps.hitSlop != newViewProps.hitSlop) {
|
||||||
self.hitTestEdgeInsets = {-newViewProps.hitSlop.top,
|
self.hitTestEdgeInsets = {
|
||||||
-newViewProps.hitSlop.left,
|
-newViewProps.hitSlop.top,
|
||||||
-newViewProps.hitSlop.bottom,
|
-newViewProps.hitSlop.left,
|
||||||
-newViewProps.hitSlop.right};
|
-newViewProps.hitSlop.bottom,
|
||||||
|
-newViewProps.hitSlop.right};
|
||||||
}
|
}
|
||||||
|
|
||||||
// `overflow`
|
// `overflow`
|
||||||
|
@ -372,18 +373,20 @@ using namespace facebook::react;
|
||||||
|
|
||||||
static RCTCornerRadii RCTCornerRadiiFromBorderRadii(BorderRadii borderRadii)
|
static RCTCornerRadii RCTCornerRadiiFromBorderRadii(BorderRadii borderRadii)
|
||||||
{
|
{
|
||||||
return RCTCornerRadii{.topLeft = (CGFloat)borderRadii.topLeft,
|
return RCTCornerRadii{
|
||||||
.topRight = (CGFloat)borderRadii.topRight,
|
.topLeft = (CGFloat)borderRadii.topLeft,
|
||||||
.bottomLeft = (CGFloat)borderRadii.bottomLeft,
|
.topRight = (CGFloat)borderRadii.topRight,
|
||||||
.bottomRight = (CGFloat)borderRadii.bottomRight};
|
.bottomLeft = (CGFloat)borderRadii.bottomLeft,
|
||||||
|
.bottomRight = (CGFloat)borderRadii.bottomRight};
|
||||||
}
|
}
|
||||||
|
|
||||||
static RCTBorderColors RCTCreateRCTBorderColorsFromBorderColors(BorderColors borderColors)
|
static RCTBorderColors RCTCreateRCTBorderColorsFromBorderColors(BorderColors borderColors)
|
||||||
{
|
{
|
||||||
return RCTBorderColors{.top = RCTCreateCGColorRefFromSharedColor(borderColors.top),
|
return RCTBorderColors{
|
||||||
.left = RCTCreateCGColorRefFromSharedColor(borderColors.left),
|
.top = RCTCreateCGColorRefFromSharedColor(borderColors.top),
|
||||||
.bottom = RCTCreateCGColorRefFromSharedColor(borderColors.bottom),
|
.left = RCTCreateCGColorRefFromSharedColor(borderColors.left),
|
||||||
.right = RCTCreateCGColorRefFromSharedColor(borderColors.right)};
|
.bottom = RCTCreateCGColorRefFromSharedColor(borderColors.bottom),
|
||||||
|
.right = RCTCreateCGColorRefFromSharedColor(borderColors.right)};
|
||||||
}
|
}
|
||||||
|
|
||||||
static void RCTReleaseRCTBorderColors(RCTBorderColors borderColors)
|
static void RCTReleaseRCTBorderColors(RCTBorderColors borderColors)
|
||||||
|
@ -491,9 +494,9 @@ static RCTBorderStyle RCTBorderStyleFromBorderStyle(BorderStyle borderStyle)
|
||||||
} else {
|
} else {
|
||||||
CGSize imageSize = image.size;
|
CGSize imageSize = image.size;
|
||||||
UIEdgeInsets imageCapInsets = image.capInsets;
|
UIEdgeInsets imageCapInsets = image.capInsets;
|
||||||
CGRect contentsCenter =
|
CGRect contentsCenter = CGRect{
|
||||||
CGRect{CGPoint{imageCapInsets.left / imageSize.width, imageCapInsets.top / imageSize.height},
|
CGPoint{imageCapInsets.left / imageSize.width, imageCapInsets.top / imageSize.height},
|
||||||
CGSize{(CGFloat)1.0 / imageSize.width, (CGFloat)1.0 / imageSize.height}};
|
CGSize{(CGFloat)1.0 / imageSize.width, (CGFloat)1.0 / imageSize.height}};
|
||||||
|
|
||||||
_borderLayer.contents = (id)image.CGImage;
|
_borderLayer.contents = (id)image.CGImage;
|
||||||
_borderLayer.contentsScale = image.scale;
|
_borderLayer.contentsScale = image.scale;
|
||||||
|
|
|
@ -146,22 +146,23 @@ inline UIAccessibilityTraits RCTUIAccessibilityTraitsFromAccessibilityTraits(
|
||||||
|
|
||||||
inline CATransform3D RCTCATransform3DFromTransformMatrix(const facebook::react::Transform &transformMatrix)
|
inline CATransform3D RCTCATransform3DFromTransformMatrix(const facebook::react::Transform &transformMatrix)
|
||||||
{
|
{
|
||||||
return {(CGFloat)transformMatrix.matrix[0],
|
return {
|
||||||
(CGFloat)transformMatrix.matrix[1],
|
(CGFloat)transformMatrix.matrix[0],
|
||||||
(CGFloat)transformMatrix.matrix[2],
|
(CGFloat)transformMatrix.matrix[1],
|
||||||
(CGFloat)transformMatrix.matrix[3],
|
(CGFloat)transformMatrix.matrix[2],
|
||||||
(CGFloat)transformMatrix.matrix[4],
|
(CGFloat)transformMatrix.matrix[3],
|
||||||
(CGFloat)transformMatrix.matrix[5],
|
(CGFloat)transformMatrix.matrix[4],
|
||||||
(CGFloat)transformMatrix.matrix[6],
|
(CGFloat)transformMatrix.matrix[5],
|
||||||
(CGFloat)transformMatrix.matrix[7],
|
(CGFloat)transformMatrix.matrix[6],
|
||||||
(CGFloat)transformMatrix.matrix[8],
|
(CGFloat)transformMatrix.matrix[7],
|
||||||
(CGFloat)transformMatrix.matrix[9],
|
(CGFloat)transformMatrix.matrix[8],
|
||||||
(CGFloat)transformMatrix.matrix[10],
|
(CGFloat)transformMatrix.matrix[9],
|
||||||
(CGFloat)transformMatrix.matrix[11],
|
(CGFloat)transformMatrix.matrix[10],
|
||||||
(CGFloat)transformMatrix.matrix[12],
|
(CGFloat)transformMatrix.matrix[11],
|
||||||
(CGFloat)transformMatrix.matrix[13],
|
(CGFloat)transformMatrix.matrix[12],
|
||||||
(CGFloat)transformMatrix.matrix[14],
|
(CGFloat)transformMatrix.matrix[13],
|
||||||
(CGFloat)transformMatrix.matrix[15]};
|
(CGFloat)transformMatrix.matrix[14],
|
||||||
|
(CGFloat)transformMatrix.matrix[15]};
|
||||||
}
|
}
|
||||||
|
|
||||||
inline facebook::react::Point RCTPointFromCGPoint(const CGPoint &point)
|
inline facebook::react::Point RCTPointFromCGPoint(const CGPoint &point)
|
||||||
|
|
|
@ -89,8 +89,8 @@ class LayoutAnimationDelegateProxy : public LayoutAnimationStatusDelegate, publi
|
||||||
[scheduler onAllAnimationsComplete];
|
[scheduler onAllAnimationsComplete];
|
||||||
}
|
}
|
||||||
|
|
||||||
void activityDidChange(RunLoopObserver::Delegate const *delegate, RunLoopObserver::Activity activity) const
|
void activityDidChange(RunLoopObserver::Delegate const *delegate, RunLoopObserver::Activity activity)
|
||||||
noexcept override
|
const noexcept override
|
||||||
{
|
{
|
||||||
RCTScheduler *scheduler = (__bridge RCTScheduler *)scheduler_;
|
RCTScheduler *scheduler = (__bridge RCTScheduler *)scheduler_;
|
||||||
[scheduler animationTick];
|
[scheduler animationTick];
|
||||||
|
|
|
@ -51,11 +51,12 @@ static inline LayoutConstraints RCTGetLayoutConstraintsForSize(CGSize minimumSiz
|
||||||
|
|
||||||
static inline LayoutContext RCTGetLayoutContext(CGPoint viewportOffset)
|
static inline LayoutContext RCTGetLayoutContext(CGPoint viewportOffset)
|
||||||
{
|
{
|
||||||
return {.pointScaleFactor = RCTScreenScale(),
|
return {
|
||||||
.swapLeftAndRightInRTL =
|
.pointScaleFactor = RCTScreenScale(),
|
||||||
[[RCTI18nUtil sharedInstance] isRTL] && [[RCTI18nUtil sharedInstance] doLeftAndRightSwapInRTL],
|
.swapLeftAndRightInRTL =
|
||||||
.fontSizeMultiplier = RCTFontSizeMultiplier(),
|
[[RCTI18nUtil sharedInstance] isRTL] && [[RCTI18nUtil sharedInstance] doLeftAndRightSwapInRTL],
|
||||||
.viewportOffset = RCTPointFromCGPoint(viewportOffset)};
|
.fontSizeMultiplier = RCTFontSizeMultiplier(),
|
||||||
|
.viewportOffset = RCTPointFromCGPoint(viewportOffset)};
|
||||||
}
|
}
|
||||||
|
|
||||||
static dispatch_queue_t RCTGetBackgroundQueue()
|
static dispatch_queue_t RCTGetBackgroundQueue()
|
||||||
|
|
|
@ -555,11 +555,12 @@ static NSDictionary *deviceOrientationEventBody(UIDeviceOrientation orientation)
|
||||||
for (RCTShadowView *shadowView in affectedShadowViews) {
|
for (RCTShadowView *shadowView in affectedShadowViews) {
|
||||||
reactTags[index] = shadowView.reactTag;
|
reactTags[index] = shadowView.reactTag;
|
||||||
RCTLayoutMetrics layoutMetrics = shadowView.layoutMetrics;
|
RCTLayoutMetrics layoutMetrics = shadowView.layoutMetrics;
|
||||||
frameDataArray[index++] = (RCTFrameData){layoutMetrics.frame,
|
frameDataArray[index++] = (RCTFrameData){
|
||||||
layoutMetrics.layoutDirection,
|
layoutMetrics.frame,
|
||||||
shadowView.isNewView,
|
layoutMetrics.layoutDirection,
|
||||||
shadowView.superview.isNewView,
|
shadowView.isNewView,
|
||||||
layoutMetrics.displayType};
|
shadowView.superview.isNewView,
|
||||||
|
layoutMetrics.displayType};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -469,14 +469,15 @@ void RCTProfileInit(RCTBridge *bridge)
|
||||||
NSArray *orderedThreads =
|
NSArray *orderedThreads =
|
||||||
@[ @"JS async", @"RCTPerformanceLogger", @"com.facebook.react.JavaScript", @(RCTUIManagerQueueName), @"main" ];
|
@[ @"JS async", @"RCTPerformanceLogger", @"com.facebook.react.JavaScript", @(RCTUIManagerQueueName), @"main" ];
|
||||||
[orderedThreads enumerateObjectsUsingBlock:^(NSString *thread, NSUInteger idx, __unused BOOL *stop) {
|
[orderedThreads enumerateObjectsUsingBlock:^(NSString *thread, NSUInteger idx, __unused BOOL *stop) {
|
||||||
RCTProfileAddEvent(kProfileTraceEvents,
|
RCTProfileAddEvent(
|
||||||
@"ph"
|
kProfileTraceEvents,
|
||||||
: @"M", // metadata event
|
@"ph"
|
||||||
@"name"
|
: @"M", // metadata event
|
||||||
: @"thread_sort_index", @"tid"
|
@"name"
|
||||||
: thread, @"args"
|
: @"thread_sort_index", @"tid"
|
||||||
:
|
: thread, @"args"
|
||||||
@{@"sort_index" : @(-1000 + (NSInteger)idx)});
|
:
|
||||||
|
@{@"sort_index" : @(-1000 + (NSInteger)idx)});
|
||||||
}];
|
}];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -33,22 +33,23 @@ BOOL RCTBorderColorsAreEqual(RCTBorderColors borderColors)
|
||||||
|
|
||||||
RCTCornerInsets RCTGetCornerInsets(RCTCornerRadii cornerRadii, UIEdgeInsets edgeInsets)
|
RCTCornerInsets RCTGetCornerInsets(RCTCornerRadii cornerRadii, UIEdgeInsets edgeInsets)
|
||||||
{
|
{
|
||||||
return (RCTCornerInsets){{
|
return (RCTCornerInsets){
|
||||||
MAX(0, cornerRadii.topLeft - edgeInsets.left),
|
{
|
||||||
MAX(0, cornerRadii.topLeft - edgeInsets.top),
|
MAX(0, cornerRadii.topLeft - edgeInsets.left),
|
||||||
},
|
MAX(0, cornerRadii.topLeft - edgeInsets.top),
|
||||||
{
|
},
|
||||||
MAX(0, cornerRadii.topRight - edgeInsets.right),
|
{
|
||||||
MAX(0, cornerRadii.topRight - edgeInsets.top),
|
MAX(0, cornerRadii.topRight - edgeInsets.right),
|
||||||
},
|
MAX(0, cornerRadii.topRight - edgeInsets.top),
|
||||||
{
|
},
|
||||||
MAX(0, cornerRadii.bottomLeft - edgeInsets.left),
|
{
|
||||||
MAX(0, cornerRadii.bottomLeft - edgeInsets.bottom),
|
MAX(0, cornerRadii.bottomLeft - edgeInsets.left),
|
||||||
},
|
MAX(0, cornerRadii.bottomLeft - edgeInsets.bottom),
|
||||||
{
|
},
|
||||||
MAX(0, cornerRadii.bottomRight - edgeInsets.right),
|
{
|
||||||
MAX(0, cornerRadii.bottomRight - edgeInsets.bottom),
|
MAX(0, cornerRadii.bottomRight - edgeInsets.right),
|
||||||
}};
|
MAX(0, cornerRadii.bottomRight - edgeInsets.bottom),
|
||||||
|
}};
|
||||||
}
|
}
|
||||||
|
|
||||||
static UIEdgeInsets RCTRoundInsetsToPixel(UIEdgeInsets edgeInsets)
|
static UIEdgeInsets RCTRoundInsetsToPixel(UIEdgeInsets edgeInsets)
|
||||||
|
@ -206,11 +207,11 @@ static UIImage *RCTGetSolidBorderImage(
|
||||||
(borderInsets.top + cornerInsets.topRight.height + borderInsets.bottom + cornerInsets.bottomLeft.height <=
|
(borderInsets.top + cornerInsets.topRight.height + borderInsets.bottom + cornerInsets.bottomLeft.height <=
|
||||||
viewSize.height);
|
viewSize.height);
|
||||||
|
|
||||||
UIEdgeInsets edgeInsets =
|
UIEdgeInsets edgeInsets = (UIEdgeInsets){
|
||||||
(UIEdgeInsets){borderInsets.top + MAX(cornerInsets.topLeft.height, cornerInsets.topRight.height),
|
borderInsets.top + MAX(cornerInsets.topLeft.height, cornerInsets.topRight.height),
|
||||||
borderInsets.left + MAX(cornerInsets.topLeft.width, cornerInsets.bottomLeft.width),
|
borderInsets.left + MAX(cornerInsets.topLeft.width, cornerInsets.bottomLeft.width),
|
||||||
borderInsets.bottom + MAX(cornerInsets.bottomLeft.height, cornerInsets.bottomRight.height),
|
borderInsets.bottom + MAX(cornerInsets.bottomLeft.height, cornerInsets.bottomRight.height),
|
||||||
borderInsets.right + MAX(cornerInsets.bottomRight.width, cornerInsets.topRight.width)};
|
borderInsets.right + MAX(cornerInsets.bottomRight.width, cornerInsets.topRight.width)};
|
||||||
|
|
||||||
if (hasCornerRadii) {
|
if (hasCornerRadii) {
|
||||||
// Asymmetrical edgeInsets cause strange artifacting on iOS 10 and earlier.
|
// Asymmetrical edgeInsets cause strange artifacting on iOS 10 and earlier.
|
||||||
|
@ -271,8 +272,9 @@ static UIImage *RCTGetSolidBorderImage(
|
||||||
if (cornerInsets.bottomLeft.width > 0 && cornerInsets.bottomLeft.height > 0) {
|
if (cornerInsets.bottomLeft.width > 0 && cornerInsets.bottomLeft.height > 0) {
|
||||||
CGPoint points[2];
|
CGPoint points[2];
|
||||||
RCTEllipseGetIntersectionsWithLine(
|
RCTEllipseGetIntersectionsWithLine(
|
||||||
(CGRect){{bottomLeft.x, bottomLeft.y - 2 * cornerInsets.bottomLeft.height},
|
(CGRect){
|
||||||
{2 * cornerInsets.bottomLeft.width, 2 * cornerInsets.bottomLeft.height}},
|
{bottomLeft.x, bottomLeft.y - 2 * cornerInsets.bottomLeft.height},
|
||||||
|
{2 * cornerInsets.bottomLeft.width, 2 * cornerInsets.bottomLeft.height}},
|
||||||
(CGPoint){0, size.height},
|
(CGPoint){0, size.height},
|
||||||
bottomLeft,
|
bottomLeft,
|
||||||
points);
|
points);
|
||||||
|
@ -285,8 +287,9 @@ static UIImage *RCTGetSolidBorderImage(
|
||||||
if (cornerInsets.topRight.width > 0 && cornerInsets.topRight.height > 0) {
|
if (cornerInsets.topRight.width > 0 && cornerInsets.topRight.height > 0) {
|
||||||
CGPoint points[2];
|
CGPoint points[2];
|
||||||
RCTEllipseGetIntersectionsWithLine(
|
RCTEllipseGetIntersectionsWithLine(
|
||||||
(CGRect){{topRight.x - 2 * cornerInsets.topRight.width, topRight.y},
|
(CGRect){
|
||||||
{2 * cornerInsets.topRight.width, 2 * cornerInsets.topRight.height}},
|
{topRight.x - 2 * cornerInsets.topRight.width, topRight.y},
|
||||||
|
{2 * cornerInsets.topRight.width, 2 * cornerInsets.topRight.height}},
|
||||||
(CGPoint){size.width, 0},
|
(CGPoint){size.width, 0},
|
||||||
topRight,
|
topRight,
|
||||||
points);
|
points);
|
||||||
|
|
|
@ -15,8 +15,8 @@ RCT_CONVERTER(CLLocationDistance, CLLocationDistance, doubleValue);
|
||||||
+ (CLLocationCoordinate2D)CLLocationCoordinate2D:(id)json
|
+ (CLLocationCoordinate2D)CLLocationCoordinate2D:(id)json
|
||||||
{
|
{
|
||||||
json = [self NSDictionary:json];
|
json = [self NSDictionary:json];
|
||||||
return (CLLocationCoordinate2D){[self CLLocationDegrees:json[@"latitude"]],
|
return (CLLocationCoordinate2D){
|
||||||
[self CLLocationDegrees:json[@"longitude"]]};
|
[self CLLocationDegrees:json[@"latitude"]], [self CLLocationDegrees:json[@"longitude"]]};
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -14,27 +14,31 @@ RCTLayoutMetrics RCTLayoutMetricsFromYogaNode(YGNodeRef yogaNode)
|
||||||
{
|
{
|
||||||
RCTLayoutMetrics layoutMetrics;
|
RCTLayoutMetrics layoutMetrics;
|
||||||
|
|
||||||
CGRect frame = (CGRect){(CGPoint){RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetLeft(yogaNode)),
|
CGRect frame = (CGRect){
|
||||||
RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetTop(yogaNode))},
|
(CGPoint){
|
||||||
(CGSize){RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetWidth(yogaNode)),
|
RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetLeft(yogaNode)),
|
||||||
RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetHeight(yogaNode))}};
|
RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetTop(yogaNode))},
|
||||||
|
(CGSize){
|
||||||
|
RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetWidth(yogaNode)),
|
||||||
|
RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetHeight(yogaNode))}};
|
||||||
|
|
||||||
UIEdgeInsets padding =
|
UIEdgeInsets padding = (UIEdgeInsets){
|
||||||
(UIEdgeInsets){RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetPadding(yogaNode, YGEdgeTop)),
|
RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetPadding(yogaNode, YGEdgeTop)),
|
||||||
RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetPadding(yogaNode, YGEdgeLeft)),
|
RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetPadding(yogaNode, YGEdgeLeft)),
|
||||||
RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetPadding(yogaNode, YGEdgeBottom)),
|
RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetPadding(yogaNode, YGEdgeBottom)),
|
||||||
RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetPadding(yogaNode, YGEdgeRight))};
|
RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetPadding(yogaNode, YGEdgeRight))};
|
||||||
|
|
||||||
UIEdgeInsets borderWidth =
|
UIEdgeInsets borderWidth = (UIEdgeInsets){
|
||||||
(UIEdgeInsets){RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetBorder(yogaNode, YGEdgeTop)),
|
RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetBorder(yogaNode, YGEdgeTop)),
|
||||||
RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetBorder(yogaNode, YGEdgeLeft)),
|
RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetBorder(yogaNode, YGEdgeLeft)),
|
||||||
RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetBorder(yogaNode, YGEdgeBottom)),
|
RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetBorder(yogaNode, YGEdgeBottom)),
|
||||||
RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetBorder(yogaNode, YGEdgeRight))};
|
RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetBorder(yogaNode, YGEdgeRight))};
|
||||||
|
|
||||||
UIEdgeInsets compoundInsets = (UIEdgeInsets){borderWidth.top + padding.top,
|
UIEdgeInsets compoundInsets = (UIEdgeInsets){
|
||||||
borderWidth.left + padding.left,
|
borderWidth.top + padding.top,
|
||||||
borderWidth.bottom + padding.bottom,
|
borderWidth.left + padding.left,
|
||||||
borderWidth.right + padding.right};
|
borderWidth.bottom + padding.bottom,
|
||||||
|
borderWidth.right + padding.right};
|
||||||
|
|
||||||
CGRect bounds = (CGRect){CGPointZero, frame.size};
|
CGRect bounds = (CGRect){CGPointZero, frame.size};
|
||||||
CGRect contentFrame = UIEdgeInsetsInsetRect(bounds, compoundInsets);
|
CGRect contentFrame = UIEdgeInsetsInsetRect(bounds, compoundInsets);
|
||||||
|
|
|
@ -82,11 +82,12 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : (NSCoder *)aDecoder)
|
||||||
reusingView:(UILabel *)label
|
reusingView:(UILabel *)label
|
||||||
{
|
{
|
||||||
if (!label) {
|
if (!label) {
|
||||||
label = [[UILabel alloc] initWithFrame:(CGRect){CGPointZero,
|
label = [[UILabel alloc] initWithFrame:(CGRect){
|
||||||
{
|
CGPointZero,
|
||||||
[pickerView rowSizeForComponent:component].width,
|
{
|
||||||
[pickerView rowSizeForComponent:component].height,
|
[pickerView rowSizeForComponent:component].width,
|
||||||
}}];
|
[pickerView rowSizeForComponent:component].height,
|
||||||
|
}}];
|
||||||
}
|
}
|
||||||
|
|
||||||
label.font = _font;
|
label.font = _font;
|
||||||
|
|
|
@ -18,19 +18,21 @@
|
||||||
- (UIEdgeInsets)paddingAsInsets
|
- (UIEdgeInsets)paddingAsInsets
|
||||||
{
|
{
|
||||||
YGNodeRef yogaNode = self.yogaNode;
|
YGNodeRef yogaNode = self.yogaNode;
|
||||||
return (UIEdgeInsets){RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetPadding(yogaNode, YGEdgeTop)),
|
return (UIEdgeInsets){
|
||||||
RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetPadding(yogaNode, YGEdgeLeft)),
|
RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetPadding(yogaNode, YGEdgeTop)),
|
||||||
RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetPadding(yogaNode, YGEdgeBottom)),
|
RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetPadding(yogaNode, YGEdgeLeft)),
|
||||||
RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetPadding(yogaNode, YGEdgeRight))};
|
RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetPadding(yogaNode, YGEdgeBottom)),
|
||||||
|
RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetPadding(yogaNode, YGEdgeRight))};
|
||||||
}
|
}
|
||||||
|
|
||||||
- (UIEdgeInsets)borderAsInsets
|
- (UIEdgeInsets)borderAsInsets
|
||||||
{
|
{
|
||||||
YGNodeRef yogaNode = self.yogaNode;
|
YGNodeRef yogaNode = self.yogaNode;
|
||||||
return (UIEdgeInsets){RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetBorder(yogaNode, YGEdgeTop)),
|
return (UIEdgeInsets){
|
||||||
RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetBorder(yogaNode, YGEdgeLeft)),
|
RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetBorder(yogaNode, YGEdgeTop)),
|
||||||
RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetBorder(yogaNode, YGEdgeBottom)),
|
RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetBorder(yogaNode, YGEdgeLeft)),
|
||||||
RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetBorder(yogaNode, YGEdgeRight))};
|
RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetBorder(yogaNode, YGEdgeBottom)),
|
||||||
|
RCTCoreGraphicsFloatFromYogaFloat(YGNodeLayoutGetBorder(yogaNode, YGEdgeRight))};
|
||||||
}
|
}
|
||||||
|
|
||||||
- (UIEdgeInsets)compoundInsets
|
- (UIEdgeInsets)compoundInsets
|
||||||
|
@ -38,10 +40,11 @@
|
||||||
UIEdgeInsets borderAsInsets = self.borderAsInsets;
|
UIEdgeInsets borderAsInsets = self.borderAsInsets;
|
||||||
UIEdgeInsets paddingAsInsets = self.paddingAsInsets;
|
UIEdgeInsets paddingAsInsets = self.paddingAsInsets;
|
||||||
|
|
||||||
return (UIEdgeInsets){borderAsInsets.top + paddingAsInsets.top,
|
return (UIEdgeInsets){
|
||||||
borderAsInsets.left + paddingAsInsets.left,
|
borderAsInsets.top + paddingAsInsets.top,
|
||||||
borderAsInsets.bottom + paddingAsInsets.bottom,
|
borderAsInsets.left + paddingAsInsets.left,
|
||||||
borderAsInsets.right + paddingAsInsets.right};
|
borderAsInsets.bottom + paddingAsInsets.bottom,
|
||||||
|
borderAsInsets.right + paddingAsInsets.right};
|
||||||
}
|
}
|
||||||
|
|
||||||
- (CGSize)availableSize
|
- (CGSize)availableSize
|
||||||
|
|
|
@ -267,8 +267,9 @@ static void RCTProcessMetaPropsBorder(const YGValue metaProps[META_PROP_COUNT],
|
||||||
{
|
{
|
||||||
YGNodeRef yogaNode = _yogaNode;
|
YGNodeRef yogaNode = _yogaNode;
|
||||||
|
|
||||||
CGSize oldMinimumSize = (CGSize){RCTCoreGraphicsFloatFromYogaValue(YGNodeStyleGetMinWidth(yogaNode), 0.0),
|
CGSize oldMinimumSize = (CGSize){
|
||||||
RCTCoreGraphicsFloatFromYogaValue(YGNodeStyleGetMinHeight(yogaNode), 0.0)};
|
RCTCoreGraphicsFloatFromYogaValue(YGNodeStyleGetMinWidth(yogaNode), 0.0),
|
||||||
|
RCTCoreGraphicsFloatFromYogaValue(YGNodeStyleGetMinHeight(yogaNode), 0.0)};
|
||||||
|
|
||||||
if (!CGSizeEqualToSize(oldMinimumSize, minimumSize)) {
|
if (!CGSizeEqualToSize(oldMinimumSize, minimumSize)) {
|
||||||
YGNodeStyleSetMinWidth(yogaNode, RCTYogaFloatFromCoreGraphicsFloat(minimumSize.width));
|
YGNodeStyleSetMinWidth(yogaNode, RCTYogaFloatFromCoreGraphicsFloat(minimumSize.width));
|
||||||
|
|
|
@ -714,9 +714,9 @@ RCT_SCROLL_EVENT_HANDLER(scrollViewDidScrollToTop, onScrollToTop)
|
||||||
// Pick snap point based on direction and proximity
|
// Pick snap point based on direction and proximity
|
||||||
CGFloat fractionalIndex = (targetContentOffsetAlongAxis + alignmentOffset) / snapToIntervalF;
|
CGFloat fractionalIndex = (targetContentOffsetAlongAxis + alignmentOffset) / snapToIntervalF;
|
||||||
|
|
||||||
NSInteger snapIndex = velocityAlongAxis > 0.0
|
NSInteger snapIndex = velocityAlongAxis > 0.0 ? ceil(fractionalIndex)
|
||||||
? ceil(fractionalIndex)
|
: velocityAlongAxis < 0.0 ? floor(fractionalIndex)
|
||||||
: velocityAlongAxis < 0.0 ? floor(fractionalIndex) : round(fractionalIndex);
|
: round(fractionalIndex);
|
||||||
CGFloat newTargetContentOffset = (snapIndex * snapToIntervalF) - alignmentOffset;
|
CGFloat newTargetContentOffset = (snapIndex * snapToIntervalF) - alignmentOffset;
|
||||||
|
|
||||||
// Set new targetContentOffset
|
// Set new targetContentOffset
|
||||||
|
|
|
@ -204,7 +204,7 @@ static inline RefPtr<T> adoptRef(T *ptr) {
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, typename... Args>
|
template <typename T, typename... Args>
|
||||||
static inline RefPtr<T> createNew(Args &&... arguments) {
|
static inline RefPtr<T> createNew(Args &&...arguments) {
|
||||||
return RefPtr<T>::adoptRef(new T(std::forward<Args>(arguments)...));
|
return RefPtr<T>::adoptRef(new T(std::forward<Args>(arguments)...));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ class StaticInitialized {
|
||||||
constexpr StaticInitialized() : m_instance(nullptr) {}
|
constexpr StaticInitialized() : m_instance(nullptr) {}
|
||||||
|
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
void initialize(Args &&... arguments) {
|
void initialize(Args &&...arguments) {
|
||||||
FBASSERT(!m_instance);
|
FBASSERT(!m_instance);
|
||||||
m_instance = new T(std::forward<Args>(arguments)...);
|
m_instance = new T(std::forward<Args>(arguments)...);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ namespace xplat {
|
||||||
namespace detail {
|
namespace detail {
|
||||||
|
|
||||||
template <typename R, typename M, typename... T>
|
template <typename R, typename M, typename... T>
|
||||||
R jsArg1(const folly::dynamic &arg, M asFoo, const T &... desc) {
|
R jsArg1(const folly::dynamic &arg, M asFoo, const T &...desc) {
|
||||||
try {
|
try {
|
||||||
return (arg.*asFoo)();
|
return (arg.*asFoo)();
|
||||||
} catch (const folly::TypeError &ex) {
|
} catch (const folly::TypeError &ex) {
|
||||||
|
@ -35,7 +35,7 @@ template <typename R, typename... T>
|
||||||
R jsArg(
|
R jsArg(
|
||||||
const folly::dynamic &arg,
|
const folly::dynamic &arg,
|
||||||
R (folly::dynamic::*asFoo)() const,
|
R (folly::dynamic::*asFoo)() const,
|
||||||
const T &... desc) {
|
const T &...desc) {
|
||||||
return detail::jsArg1<R>(arg, asFoo, desc...);
|
return detail::jsArg1<R>(arg, asFoo, desc...);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ template <typename R, typename... T>
|
||||||
R jsArg(
|
R jsArg(
|
||||||
const folly::dynamic &arg,
|
const folly::dynamic &arg,
|
||||||
R (folly::dynamic::*asFoo)() const &,
|
R (folly::dynamic::*asFoo)() const &,
|
||||||
const T &... desc) {
|
const T &...desc) {
|
||||||
return detail::jsArg1<R>(arg, asFoo, desc...);
|
return detail::jsArg1<R>(arg, asFoo, desc...);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,12 +39,12 @@ template <typename R, typename... T>
|
||||||
R jsArg(
|
R jsArg(
|
||||||
const folly::dynamic &arg,
|
const folly::dynamic &arg,
|
||||||
R (folly::dynamic::*asFoo)() const,
|
R (folly::dynamic::*asFoo)() const,
|
||||||
const T &... desc);
|
const T &...desc);
|
||||||
template <typename R, typename... T>
|
template <typename R, typename... T>
|
||||||
R jsArg(
|
R jsArg(
|
||||||
const folly::dynamic &arg,
|
const folly::dynamic &arg,
|
||||||
R (folly::dynamic::*asFoo)() const &,
|
R (folly::dynamic::*asFoo)() const &,
|
||||||
const T &... desc);
|
const T &...desc);
|
||||||
|
|
||||||
// This is like jsArg, but a operates on a dynamic representing an array of
|
// This is like jsArg, but a operates on a dynamic representing an array of
|
||||||
// arguments. The argument n is used both to index the array and build the
|
// arguments. The argument n is used both to index the array and build the
|
||||||
|
|
|
@ -29,7 +29,7 @@ struct ConcreteSystraceSection {
|
||||||
template <typename... ConvertsToStringPiece>
|
template <typename... ConvertsToStringPiece>
|
||||||
explicit ConcreteSystraceSection(
|
explicit ConcreteSystraceSection(
|
||||||
const char *name,
|
const char *name,
|
||||||
ConvertsToStringPiece &&... args)
|
ConvertsToStringPiece &&...args)
|
||||||
: m_section(TRACE_TAG_REACT_CXX_BRIDGE, name, args...) {}
|
: m_section(TRACE_TAG_REACT_CXX_BRIDGE, name, args...) {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -42,7 +42,7 @@ struct DummySystraceSection {
|
||||||
template <typename... ConvertsToStringPiece>
|
template <typename... ConvertsToStringPiece>
|
||||||
explicit DummySystraceSection(
|
explicit DummySystraceSection(
|
||||||
__unused const char *name,
|
__unused const char *name,
|
||||||
__unused ConvertsToStringPiece &&... args) {}
|
__unused ConvertsToStringPiece &&...args) {}
|
||||||
};
|
};
|
||||||
using SystraceSection = DummySystraceSection;
|
using SystraceSection = DummySystraceSection;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -299,9 +299,10 @@ void InspectorState::Running::pushPendingEval(
|
||||||
std::shared_ptr<folly::Promise<debugger::EvalResult>> promise,
|
std::shared_ptr<folly::Promise<debugger::EvalResult>> promise,
|
||||||
folly::Function<void(const facebook::hermes::debugger::EvalResult &)>
|
folly::Function<void(const facebook::hermes::debugger::EvalResult &)>
|
||||||
resultTransformer) {
|
resultTransformer) {
|
||||||
PendingEval pendingEval{debugger::Command::eval(src, frameIndex),
|
PendingEval pendingEval{
|
||||||
promise,
|
debugger::Command::eval(src, frameIndex),
|
||||||
std::move(resultTransformer)};
|
promise,
|
||||||
|
std::move(resultTransformer)};
|
||||||
|
|
||||||
pendingEvals_.emplace(std::move(pendingEval));
|
pendingEvals_.emplace(std::move(pendingEval));
|
||||||
|
|
||||||
|
@ -476,9 +477,10 @@ void InspectorState::Paused::pushPendingEval(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PendingEval pendingEval{debugger::Command::eval(src, frameIndex),
|
PendingEval pendingEval{
|
||||||
promise,
|
debugger::Command::eval(src, frameIndex),
|
||||||
std::move(resultTransformer)};
|
promise,
|
||||||
|
std::move(resultTransformer)};
|
||||||
pendingEvals_.emplace(std::move(pendingEval));
|
pendingEvals_.emplace(std::move(pendingEval));
|
||||||
hasPendingWork_.notify_one();
|
hasPendingWork_.notify_one();
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,8 +156,8 @@ static void sendResponse(const std::string &str) {
|
||||||
|
|
||||||
static std::string readScriptSource(const char *path) {
|
static std::string readScriptSource(const char *path) {
|
||||||
std::ifstream stream(path);
|
std::ifstream stream(path);
|
||||||
return std::string{std::istreambuf_iterator<char>(stream),
|
return std::string{
|
||||||
std::istreambuf_iterator<char>()};
|
std::istreambuf_iterator<char>(stream), std::istreambuf_iterator<char>()};
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string getUrl(const char *path) {
|
static std::string getUrl(const char *path) {
|
||||||
|
@ -228,9 +228,10 @@ static void runScript(const std::string &scriptSource, const std::string &url) {
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
const char *shortOpts = "l:h";
|
const char *shortOpts = "l:h";
|
||||||
const option longOpts[] = {{"log", 1, nullptr, 'l'},
|
const option longOpts[] = {
|
||||||
{"help", 0, nullptr, 'h'},
|
{"log", 1, nullptr, 'l'},
|
||||||
{nullptr, 0, nullptr, 0}};
|
{"help", 0, nullptr, 'h'},
|
||||||
|
{nullptr, 0, nullptr, 0}};
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
int opt = getopt_long(argc, argv, shortOpts, longOpts, nullptr);
|
int opt = getopt_long(argc, argv, shortOpts, longOpts, nullptr);
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <jsi/test/testlib.h>
|
#include <jsi/test/testlib.h>
|
||||||
|
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
#include <jsi/decorator.h>
|
#include <jsi/decorator.h>
|
||||||
#include <jsi/jsi.h>
|
#include <jsi/jsi.h>
|
||||||
|
|
|
@ -119,12 +119,12 @@ void LayoutAnimationDriver::animationMutationsForFrame(
|
||||||
|
|
||||||
// Copy so that if something else mutates the inflight animations, it
|
// Copy so that if something else mutates the inflight animations, it
|
||||||
// won't change this mutation after this point.
|
// won't change this mutation after this point.
|
||||||
auto mutation =
|
auto mutation = ShadowViewMutation{
|
||||||
ShadowViewMutation{finalMutationForKeyFrame.type,
|
finalMutationForKeyFrame.type,
|
||||||
finalMutationForKeyFrame.parentShadowView,
|
finalMutationForKeyFrame.parentShadowView,
|
||||||
keyframe.viewPrev,
|
keyframe.viewPrev,
|
||||||
finalMutationForKeyFrame.newChildShadowView,
|
finalMutationForKeyFrame.newChildShadowView,
|
||||||
finalMutationForKeyFrame.index};
|
finalMutationForKeyFrame.index};
|
||||||
assert(mutation.oldChildShadowView.tag != 0);
|
assert(mutation.oldChildShadowView.tag != 0);
|
||||||
assert(
|
assert(
|
||||||
mutation.newChildShadowView.tag != 0 ||
|
mutation.newChildShadowView.tag != 0 ||
|
||||||
|
@ -136,11 +136,12 @@ void LayoutAnimationDriver::animationMutationsForFrame(
|
||||||
// mounting layer is the same as the one on the ShadowTree. This is
|
// mounting layer is the same as the one on the ShadowTree. This is
|
||||||
// mostly to make the MountingCoordinator StubViewTree assertions
|
// mostly to make the MountingCoordinator StubViewTree assertions
|
||||||
// pass.
|
// pass.
|
||||||
auto mutation = ShadowViewMutation{ShadowViewMutation::Type::Update,
|
auto mutation = ShadowViewMutation{
|
||||||
keyframe.parentView,
|
ShadowViewMutation::Type::Update,
|
||||||
keyframe.viewPrev,
|
keyframe.parentView,
|
||||||
keyframe.viewEnd,
|
keyframe.viewPrev,
|
||||||
-1};
|
keyframe.viewEnd,
|
||||||
|
-1};
|
||||||
assert(mutation.oldChildShadowView.tag != 0);
|
assert(mutation.oldChildShadowView.tag != 0);
|
||||||
assert(mutation.newChildShadowView.tag != 0);
|
assert(mutation.newChildShadowView.tag != 0);
|
||||||
mutationsList.push_back(mutation);
|
mutationsList.push_back(mutation);
|
||||||
|
|
|
@ -119,12 +119,13 @@ static better::optional<AnimationConfig> parseAnimationConfig(
|
||||||
double defaultDuration,
|
double defaultDuration,
|
||||||
bool parsePropertyType) {
|
bool parsePropertyType) {
|
||||||
if (config.empty() || !config.isObject()) {
|
if (config.empty() || !config.isObject()) {
|
||||||
return AnimationConfig{AnimationType::Linear,
|
return AnimationConfig{
|
||||||
AnimationProperty::NotApplicable,
|
AnimationType::Linear,
|
||||||
defaultDuration,
|
AnimationProperty::NotApplicable,
|
||||||
0,
|
defaultDuration,
|
||||||
0,
|
0,
|
||||||
0};
|
0,
|
||||||
|
0};
|
||||||
}
|
}
|
||||||
|
|
||||||
auto const typeIt = config.find("type");
|
auto const typeIt = config.find("type");
|
||||||
|
@ -219,12 +220,13 @@ static better::optional<AnimationConfig> parseAnimationConfig(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return better::optional<AnimationConfig>(AnimationConfig{*animationType,
|
return better::optional<AnimationConfig>(AnimationConfig{
|
||||||
animationProperty,
|
*animationType,
|
||||||
duration,
|
animationProperty,
|
||||||
delay,
|
duration,
|
||||||
springDamping,
|
delay,
|
||||||
initialVelocity});
|
springDamping,
|
||||||
|
initialVelocity});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse animation config from JS
|
// Parse animation config from JS
|
||||||
|
@ -291,14 +293,14 @@ void LayoutAnimationKeyFrameManager::uiManagerDidConfigureNextLayoutAnimation(
|
||||||
if (layoutAnimationConfig) {
|
if (layoutAnimationConfig) {
|
||||||
std::lock_guard<std::mutex> lock(currentAnimationMutex_);
|
std::lock_guard<std::mutex> lock(currentAnimationMutex_);
|
||||||
|
|
||||||
currentAnimation_ = better::optional<LayoutAnimation>{
|
currentAnimation_ = better::optional<LayoutAnimation>{LayoutAnimation{
|
||||||
LayoutAnimation{-1,
|
-1,
|
||||||
0,
|
0,
|
||||||
false,
|
false,
|
||||||
*layoutAnimationConfig,
|
*layoutAnimationConfig,
|
||||||
successCallback,
|
successCallback,
|
||||||
failureCallback,
|
failureCallback,
|
||||||
{}}};
|
{}}};
|
||||||
} else {
|
} else {
|
||||||
LOG(ERROR) << "Parsing LayoutAnimationConfig failed: "
|
LOG(ERROR) << "Parsing LayoutAnimationConfig failed: "
|
||||||
<< (folly::dynamic)config;
|
<< (folly::dynamic)config;
|
||||||
|
@ -372,8 +374,9 @@ LayoutAnimationKeyFrameManager::calculateAnimationProgress(
|
||||||
} else if (mutationConfig.animationType == AnimationType::EaseInEaseOut) {
|
} else if (mutationConfig.animationType == AnimationType::EaseInEaseOut) {
|
||||||
// This is a combination of accelerate+decelerate.
|
// This is a combination of accelerate+decelerate.
|
||||||
// The animation starts and ends slowly, and speeds up in the middle.
|
// The animation starts and ends slowly, and speeds up in the middle.
|
||||||
return {linearTimeProgression,
|
return {
|
||||||
cos((linearTimeProgression + 1.0) * PI) / 2 + 0.5};
|
linearTimeProgression,
|
||||||
|
cos((linearTimeProgression + 1.0) * PI) / 2 + 0.5};
|
||||||
} else if (mutationConfig.animationType == AnimationType::Spring) {
|
} else if (mutationConfig.animationType == AnimationType::Spring) {
|
||||||
// Using mSpringDamping in this equation is not really the exact
|
// Using mSpringDamping in this equation is not really the exact
|
||||||
// mathematical springDamping, but a good approximation We need to replace
|
// mathematical springDamping, but a good approximation We need to replace
|
||||||
|
@ -926,13 +929,13 @@ LayoutAnimationKeyFrameManager::pullTransaction(
|
||||||
mutationConfig.animationType != AnimationType::None;
|
mutationConfig.animationType != AnimationType::None;
|
||||||
|
|
||||||
if (wasInsertedTagRemoved && haveConfiguration) {
|
if (wasInsertedTagRemoved && haveConfiguration) {
|
||||||
movesToAnimate.push_back(
|
movesToAnimate.push_back(AnimationKeyFrame{
|
||||||
AnimationKeyFrame{{},
|
{},
|
||||||
AnimationConfigurationType::Update,
|
AnimationConfigurationType::Update,
|
||||||
mutation.newChildShadowView.tag,
|
mutation.newChildShadowView.tag,
|
||||||
mutation.parentShadowView,
|
mutation.parentShadowView,
|
||||||
movedIt->second.oldChildShadowView,
|
movedIt->second.oldChildShadowView,
|
||||||
mutation.newChildShadowView});
|
mutation.newChildShadowView});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Creates and inserts should also be executed immediately.
|
// Creates and inserts should also be executed immediately.
|
||||||
|
@ -1019,14 +1022,15 @@ LayoutAnimationKeyFrameManager::pullTransaction(
|
||||||
viewStart.props = props;
|
viewStart.props = props;
|
||||||
}
|
}
|
||||||
|
|
||||||
keyFrame = AnimationKeyFrame{{},
|
keyFrame = AnimationKeyFrame{
|
||||||
AnimationConfigurationType::Create,
|
{},
|
||||||
tag,
|
AnimationConfigurationType::Create,
|
||||||
parent,
|
tag,
|
||||||
viewStart,
|
parent,
|
||||||
viewFinal,
|
viewStart,
|
||||||
baselineShadowView,
|
viewFinal,
|
||||||
0};
|
baselineShadowView,
|
||||||
|
0};
|
||||||
} else if (mutation.type == ShadowViewMutation::Type::Delete) {
|
} else if (mutation.type == ShadowViewMutation::Type::Delete) {
|
||||||
if (mutationConfig.animationProperty ==
|
if (mutationConfig.animationProperty ==
|
||||||
AnimationProperty::Opacity &&
|
AnimationProperty::Opacity &&
|
||||||
|
@ -1221,12 +1225,12 @@ LayoutAnimationKeyFrameManager::pullTransaction(
|
||||||
|
|
||||||
if (keyFrame.finalMutationForKeyFrame.hasValue()) {
|
if (keyFrame.finalMutationForKeyFrame.hasValue()) {
|
||||||
auto &finalMutation = *keyFrame.finalMutationForKeyFrame;
|
auto &finalMutation = *keyFrame.finalMutationForKeyFrame;
|
||||||
auto mutationInstruction =
|
auto mutationInstruction = ShadowViewMutation{
|
||||||
ShadowViewMutation{finalMutation.type,
|
finalMutation.type,
|
||||||
finalMutation.parentShadowView,
|
finalMutation.parentShadowView,
|
||||||
keyFrame.viewPrev,
|
keyFrame.viewPrev,
|
||||||
finalMutation.newChildShadowView,
|
finalMutation.newChildShadowView,
|
||||||
finalMutation.index};
|
finalMutation.index};
|
||||||
PrintMutationInstruction(
|
PrintMutationInstruction(
|
||||||
"Queueing up final mutation instruction - update:",
|
"Queueing up final mutation instruction - update:",
|
||||||
mutationInstruction);
|
mutationInstruction);
|
||||||
|
@ -1409,11 +1413,12 @@ LayoutAnimationKeyFrameManager::pullTransaction(
|
||||||
for (auto const &keyFrame : conflictingAnimations) {
|
for (auto const &keyFrame : conflictingAnimations) {
|
||||||
if (keyFrame.finalMutationForKeyFrame.hasValue()) {
|
if (keyFrame.finalMutationForKeyFrame.hasValue()) {
|
||||||
auto &finalMutation = (*keyFrame.finalMutationForKeyFrame);
|
auto &finalMutation = (*keyFrame.finalMutationForKeyFrame);
|
||||||
auto mutation = ShadowViewMutation{finalMutation.type,
|
auto mutation = ShadowViewMutation{
|
||||||
finalMutation.parentShadowView,
|
finalMutation.type,
|
||||||
keyFrame.viewPrev,
|
finalMutation.parentShadowView,
|
||||||
finalMutation.newChildShadowView,
|
keyFrame.viewPrev,
|
||||||
finalMutation.index};
|
finalMutation.newChildShadowView,
|
||||||
|
finalMutation.index};
|
||||||
PrintMutationInstruction(
|
PrintMutationInstruction(
|
||||||
"No Animation: Queueing up final conflicting mutation instruction",
|
"No Animation: Queueing up final conflicting mutation instruction",
|
||||||
mutation);
|
mutation);
|
||||||
|
|
|
@ -63,10 +63,11 @@ ComponentDescriptorProvider concreteComponentDescriptorProvider() {
|
||||||
std::is_base_of<ComponentDescriptor, ComponentDescriptorT>::value,
|
std::is_base_of<ComponentDescriptor, ComponentDescriptorT>::value,
|
||||||
"ComponentDescriptorT must be a descendant of ComponentDescriptor");
|
"ComponentDescriptorT must be a descendant of ComponentDescriptor");
|
||||||
|
|
||||||
return {ComponentDescriptorT::ConcreteShadowNode::Handle(),
|
return {
|
||||||
ComponentDescriptorT::ConcreteShadowNode::Name(),
|
ComponentDescriptorT::ConcreteShadowNode::Handle(),
|
||||||
nullptr,
|
ComponentDescriptorT::ConcreteShadowNode::Name(),
|
||||||
&concreteComponentDescriptorConstructor<ComponentDescriptorT>};
|
nullptr,
|
||||||
|
&concreteComponentDescriptorConstructor<ComponentDescriptorT>};
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace react
|
} // namespace react
|
||||||
|
|
|
@ -35,10 +35,10 @@ void ImageShadowNode::updateStateIfNeeded() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto state =
|
auto state = ImageState{
|
||||||
ImageState{imageSource,
|
imageSource,
|
||||||
imageManager_->requestImage(imageSource, getSurfaceId()),
|
imageManager_->requestImage(imageSource, getSurfaceId()),
|
||||||
getConcreteProps().blurRadius};
|
getConcreteProps().blurRadius};
|
||||||
setStateData(std::move(state));
|
setStateData(std::move(state));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,8 +32,9 @@ class ModalHostViewState final {
|
||||||
ModalHostViewState(
|
ModalHostViewState(
|
||||||
ModalHostViewState const &previousState,
|
ModalHostViewState const &previousState,
|
||||||
folly::dynamic data)
|
folly::dynamic data)
|
||||||
: screenSize(Size{(Float)data["screenWidth"].getDouble(),
|
: screenSize(Size{
|
||||||
(Float)data["screenHeight"].getDouble()}){};
|
(Float)data["screenWidth"].getDouble(),
|
||||||
|
(Float)data["screenHeight"].getDouble()}){};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const Size screenSize{};
|
const Size screenSize{};
|
||||||
|
|
|
@ -30,8 +30,9 @@ class ScrollViewState final {
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
ScrollViewState() = default;
|
ScrollViewState() = default;
|
||||||
ScrollViewState(ScrollViewState const &previousState, folly::dynamic data)
|
ScrollViewState(ScrollViewState const &previousState, folly::dynamic data)
|
||||||
: contentOffset({(Float)data["contentOffsetLeft"].getDouble(),
|
: contentOffset(
|
||||||
(Float)data["contentOffsetTop"].getDouble()}),
|
{(Float)data["contentOffsetLeft"].getDouble(),
|
||||||
|
(Float)data["contentOffsetTop"].getDouble()}),
|
||||||
contentBoundingRect({}){};
|
contentBoundingRect({}){};
|
||||||
|
|
||||||
folly::dynamic getDynamic() const {
|
folly::dynamic getDynamic() const {
|
||||||
|
|
|
@ -43,14 +43,15 @@ class SliderShadowNode final : public ConcreteViewShadowNode<
|
||||||
ShadowNodeFamilyFragment const &familyFragment,
|
ShadowNodeFamilyFragment const &familyFragment,
|
||||||
ComponentDescriptor const &componentDescriptor) {
|
ComponentDescriptor const &componentDescriptor) {
|
||||||
auto imageSource = ImageSource{ImageSource::Type::Invalid};
|
auto imageSource = ImageSource{ImageSource::Type::Invalid};
|
||||||
return {imageSource,
|
return {
|
||||||
{imageSource, nullptr},
|
imageSource,
|
||||||
imageSource,
|
{imageSource, nullptr},
|
||||||
{imageSource, nullptr},
|
imageSource,
|
||||||
imageSource,
|
{imageSource, nullptr},
|
||||||
{imageSource, nullptr},
|
imageSource,
|
||||||
imageSource,
|
{imageSource, nullptr},
|
||||||
{imageSource, nullptr}};
|
imageSource,
|
||||||
|
{imageSource, nullptr}};
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - LayoutableShadowNode
|
#pragma mark - LayoutableShadowNode
|
||||||
|
|
|
@ -112,9 +112,10 @@ void ParagraphShadowNode::updateStateIfNeeded(Content const &content) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setStateData(ParagraphState{content.attributedString,
|
setStateData(ParagraphState{
|
||||||
content.paragraphAttributes,
|
content.attributedString,
|
||||||
textLayoutManager_});
|
content.paragraphAttributes,
|
||||||
|
textLayoutManager_});
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - LayoutableShadowNode
|
#pragma mark - LayoutableShadowNode
|
||||||
|
|
|
@ -155,17 +155,18 @@ void AndroidTextInputShadowNode::updateStateIfNeeded() {
|
||||||
// current attributedString unchanged, and pass in zero for the "event count"
|
// current attributedString unchanged, and pass in zero for the "event count"
|
||||||
// so no changes are applied There's no way to prevent a state update from
|
// so no changes are applied There's no way to prevent a state update from
|
||||||
// flowing to Java, so we just ensure it's a noop in those cases.
|
// flowing to Java, so we just ensure it's a noop in those cases.
|
||||||
setStateData(AndroidTextInputState{newEventCount,
|
setStateData(AndroidTextInputState{
|
||||||
newAttributedString,
|
newEventCount,
|
||||||
reactTreeAttributedString,
|
newAttributedString,
|
||||||
getConcreteProps().paragraphAttributes,
|
reactTreeAttributedString,
|
||||||
defaultTextAttributes,
|
getConcreteProps().paragraphAttributes,
|
||||||
ShadowView(*this),
|
defaultTextAttributes,
|
||||||
textLayoutManager_,
|
ShadowView(*this),
|
||||||
state.defaultThemePaddingStart,
|
textLayoutManager_,
|
||||||
state.defaultThemePaddingEnd,
|
state.defaultThemePaddingStart,
|
||||||
state.defaultThemePaddingTop,
|
state.defaultThemePaddingEnd,
|
||||||
state.defaultThemePaddingBottom});
|
state.defaultThemePaddingTop,
|
||||||
|
state.defaultThemePaddingBottom});
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - LayoutableShadowNode
|
#pragma mark - LayoutableShadowNode
|
||||||
|
|
|
@ -451,9 +451,10 @@ YGNode *YogaLayoutableShadowNode::yogaNodeCloneCallbackConnector(
|
||||||
auto oldNode =
|
auto oldNode =
|
||||||
static_cast<YogaLayoutableShadowNode *>(oldYogaNode->getContext());
|
static_cast<YogaLayoutableShadowNode *>(oldYogaNode->getContext());
|
||||||
|
|
||||||
auto clonedNode = oldNode->clone({ShadowNodeFragment::propsPlaceholder(),
|
auto clonedNode = oldNode->clone(
|
||||||
ShadowNodeFragment::childrenPlaceholder(),
|
{ShadowNodeFragment::propsPlaceholder(),
|
||||||
oldNode->getState()});
|
ShadowNodeFragment::childrenPlaceholder(),
|
||||||
|
oldNode->getState()});
|
||||||
parentNode->replaceChild(*oldNode, clonedNode, childIndex);
|
parentNode->replaceChild(*oldNode, clonedNode, childIndex);
|
||||||
return &static_cast<YogaLayoutableShadowNode &>(*clonedNode).yogaNode_;
|
return &static_cast<YogaLayoutableShadowNode &>(*clonedNode).yogaNode_;
|
||||||
}
|
}
|
||||||
|
@ -471,8 +472,9 @@ YGSize YogaLayoutableShadowNode::yogaNodeMeasureCallbackConnector(
|
||||||
static_cast<YogaLayoutableShadowNode *>(yogaNode->getContext());
|
static_cast<YogaLayoutableShadowNode *>(yogaNode->getContext());
|
||||||
|
|
||||||
auto minimumSize = Size{0, 0};
|
auto minimumSize = Size{0, 0};
|
||||||
auto maximumSize = Size{std::numeric_limits<Float>::infinity(),
|
auto maximumSize = Size{
|
||||||
std::numeric_limits<Float>::infinity()};
|
std::numeric_limits<Float>::infinity(),
|
||||||
|
std::numeric_limits<Float>::infinity()};
|
||||||
|
|
||||||
switch (widthMode) {
|
switch (widthMode) {
|
||||||
case YGMeasureModeUndefined:
|
case YGMeasureModeUndefined:
|
||||||
|
@ -501,8 +503,8 @@ YGSize YogaLayoutableShadowNode::yogaNodeMeasureCallbackConnector(
|
||||||
auto size = shadowNodeRawPtr->measureContent(
|
auto size = shadowNodeRawPtr->measureContent(
|
||||||
threadLocalLayoutContext, {minimumSize, maximumSize});
|
threadLocalLayoutContext, {minimumSize, maximumSize});
|
||||||
|
|
||||||
return YGSize{yogaFloatFromFloat(size.width),
|
return YGSize{
|
||||||
yogaFloatFromFloat(size.height)};
|
yogaFloatFromFloat(size.width), yogaFloatFromFloat(size.height)};
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef RN_DEBUG_YOGA_LOGGER
|
#ifdef RN_DEBUG_YOGA_LOGGER
|
||||||
|
|
|
@ -117,11 +117,13 @@ inline better::optional<Float> optionalFloatFromYogaValue(
|
||||||
inline LayoutMetrics layoutMetricsFromYogaNode(YGNode &yogaNode) {
|
inline LayoutMetrics layoutMetricsFromYogaNode(YGNode &yogaNode) {
|
||||||
auto layoutMetrics = LayoutMetrics{};
|
auto layoutMetrics = LayoutMetrics{};
|
||||||
|
|
||||||
layoutMetrics.frame =
|
layoutMetrics.frame = Rect{
|
||||||
Rect{Point{floatFromYogaFloat(YGNodeLayoutGetLeft(&yogaNode)),
|
Point{
|
||||||
floatFromYogaFloat(YGNodeLayoutGetTop(&yogaNode))},
|
floatFromYogaFloat(YGNodeLayoutGetLeft(&yogaNode)),
|
||||||
Size{floatFromYogaFloat(YGNodeLayoutGetWidth(&yogaNode)),
|
floatFromYogaFloat(YGNodeLayoutGetTop(&yogaNode))},
|
||||||
floatFromYogaFloat(YGNodeLayoutGetHeight(&yogaNode))}};
|
Size{
|
||||||
|
floatFromYogaFloat(YGNodeLayoutGetWidth(&yogaNode)),
|
||||||
|
floatFromYogaFloat(YGNodeLayoutGetHeight(&yogaNode))}};
|
||||||
|
|
||||||
layoutMetrics.borderWidth = EdgeInsets{
|
layoutMetrics.borderWidth = EdgeInsets{
|
||||||
floatFromYogaFloat(YGNodeLayoutGetBorder(&yogaNode, YGEdgeLeft)),
|
floatFromYogaFloat(YGNodeLayoutGetBorder(&yogaNode, YGEdgeLeft)),
|
||||||
|
|
|
@ -208,9 +208,10 @@ TEST_F(YogaDirtyFlagTest, updatingStateForScrollViewMistNotDirtyYogaNode) {
|
||||||
oldShadowNode.getFamily(),
|
oldShadowNode.getFamily(),
|
||||||
std::make_shared<ScrollViewState>(state));
|
std::make_shared<ScrollViewState>(state));
|
||||||
|
|
||||||
return oldShadowNode.clone({ShadowNodeFragment::propsPlaceholder(),
|
return oldShadowNode.clone(
|
||||||
ShadowNodeFragment::childrenPlaceholder(),
|
{ShadowNodeFragment::propsPlaceholder(),
|
||||||
newState});
|
ShadowNodeFragment::childrenPlaceholder(),
|
||||||
|
newState});
|
||||||
});
|
});
|
||||||
|
|
||||||
EXPECT_FALSE(
|
EXPECT_FALSE(
|
||||||
|
|
|
@ -21,8 +21,9 @@ namespace react {
|
||||||
*/
|
*/
|
||||||
struct LayoutConstraints {
|
struct LayoutConstraints {
|
||||||
Size minimumSize{0, 0};
|
Size minimumSize{0, 0};
|
||||||
Size maximumSize{std::numeric_limits<Float>::infinity(),
|
Size maximumSize{
|
||||||
std::numeric_limits<Float>::infinity()};
|
std::numeric_limits<Float>::infinity(),
|
||||||
|
std::numeric_limits<Float>::infinity()};
|
||||||
LayoutDirection layoutDirection{LayoutDirection::Undefined};
|
LayoutDirection layoutDirection{LayoutDirection::Undefined};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -28,8 +28,9 @@ struct LayoutMetrics {
|
||||||
Rect getContentFrame() const {
|
Rect getContentFrame() const {
|
||||||
return Rect{
|
return Rect{
|
||||||
Point{contentInsets.left, contentInsets.top},
|
Point{contentInsets.left, contentInsets.top},
|
||||||
Size{frame.size.width - contentInsets.left - contentInsets.right,
|
Size{
|
||||||
frame.size.height - contentInsets.top - contentInsets.bottom}};
|
frame.size.width - contentInsets.left - contentInsets.right,
|
||||||
|
frame.size.height - contentInsets.top - contentInsets.bottom}};
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(const LayoutMetrics &rhs) const {
|
bool operator==(const LayoutMetrics &rhs) const {
|
||||||
|
|
|
@ -15,8 +15,8 @@
|
||||||
namespace facebook {
|
namespace facebook {
|
||||||
namespace react {
|
namespace react {
|
||||||
|
|
||||||
void RawPropsKey::render(char *buffer, RawPropsPropNameLength *length) const
|
void RawPropsKey::render(char *buffer, RawPropsPropNameLength *length)
|
||||||
noexcept {
|
const noexcept {
|
||||||
*length = 0;
|
*length = 0;
|
||||||
|
|
||||||
// Prefix
|
// Prefix
|
||||||
|
|
|
@ -64,8 +64,8 @@ class RawPropsParser final {
|
||||||
/*
|
/*
|
||||||
* To be used by `RawProps` only.
|
* To be used by `RawProps` only.
|
||||||
*/
|
*/
|
||||||
RawValue const *at(RawProps const &rawProps, RawPropsKey const &key) const
|
RawValue const *at(RawProps const &rawProps, RawPropsKey const &key)
|
||||||
noexcept;
|
const noexcept;
|
||||||
|
|
||||||
mutable better::small_vector<RawPropsKey, kNumberOfPropsPerComponentSoftCap>
|
mutable better::small_vector<RawPropsKey, kNumberOfPropsPerComponentSoftCap>
|
||||||
keys_{};
|
keys_{};
|
||||||
|
|
|
@ -29,7 +29,7 @@ struct ConcreteSystraceSection {
|
||||||
template <typename... ConvertsToStringPiece>
|
template <typename... ConvertsToStringPiece>
|
||||||
explicit ConcreteSystraceSection(
|
explicit ConcreteSystraceSection(
|
||||||
const char *name,
|
const char *name,
|
||||||
ConvertsToStringPiece &&... args)
|
ConvertsToStringPiece &&...args)
|
||||||
: m_section(TRACE_TAG_REACT_CXX_BRIDGE, name, args...) {}
|
: m_section(TRACE_TAG_REACT_CXX_BRIDGE, name, args...) {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -42,7 +42,7 @@ struct DummySystraceSection {
|
||||||
template <typename... ConvertsToStringPiece>
|
template <typename... ConvertsToStringPiece>
|
||||||
explicit DummySystraceSection(
|
explicit DummySystraceSection(
|
||||||
const char *name,
|
const char *name,
|
||||||
ConvertsToStringPiece &&... args) {}
|
ConvertsToStringPiece &&...args) {}
|
||||||
};
|
};
|
||||||
using SystraceSection = DummySystraceSection;
|
using SystraceSection = DummySystraceSection;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -45,9 +45,10 @@ ShadowNode::Unshared ComponentBuilder::build(
|
||||||
*family, elementFragment.stateCallback());
|
*family, elementFragment.stateCallback());
|
||||||
constShadowNode = componentDescriptor.cloneShadowNode(
|
constShadowNode = componentDescriptor.cloneShadowNode(
|
||||||
*constShadowNode,
|
*constShadowNode,
|
||||||
ShadowNodeFragment{ShadowNodeFragment::propsPlaceholder(),
|
ShadowNodeFragment{
|
||||||
ShadowNodeFragment::childrenPlaceholder(),
|
ShadowNodeFragment::propsPlaceholder(),
|
||||||
newState});
|
ShadowNodeFragment::childrenPlaceholder(),
|
||||||
|
newState});
|
||||||
}
|
}
|
||||||
|
|
||||||
auto shadowNode = std::const_pointer_cast<ShadowNode>(constShadowNode);
|
auto shadowNode = std::const_pointer_cast<ShadowNode>(constShadowNode);
|
||||||
|
|
|
@ -94,9 +94,10 @@ struct Rect {
|
||||||
rightBottomPoint.y = std::max(rightBottomPoint.y, c.y);
|
rightBottomPoint.y = std::max(rightBottomPoint.y, c.y);
|
||||||
rightBottomPoint.y = std::max(rightBottomPoint.y, d.y);
|
rightBottomPoint.y = std::max(rightBottomPoint.y, d.y);
|
||||||
|
|
||||||
return {leftTopPoint,
|
return {
|
||||||
{rightBottomPoint.x - leftTopPoint.x,
|
leftTopPoint,
|
||||||
rightBottomPoint.y - leftTopPoint.y}};
|
{rightBottomPoint.x - leftTopPoint.x,
|
||||||
|
rightBottomPoint.y - leftTopPoint.y}};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -57,8 +57,8 @@ namespace std {
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct hash<facebook::react::RectangleCorners<T>> {
|
struct hash<facebook::react::RectangleCorners<T>> {
|
||||||
size_t operator()(facebook::react::RectangleCorners<T> const &corners) const
|
size_t operator()(
|
||||||
noexcept {
|
facebook::react::RectangleCorners<T> const &corners) const noexcept {
|
||||||
return folly::hash::hash_combine(
|
return folly::hash::hash_combine(
|
||||||
0,
|
0,
|
||||||
corners.topLeft,
|
corners.topLeft,
|
||||||
|
|
|
@ -45,20 +45,22 @@ template <typename T>
|
||||||
RectangleEdges<T> operator+(
|
RectangleEdges<T> operator+(
|
||||||
RectangleEdges<T> const &lhs,
|
RectangleEdges<T> const &lhs,
|
||||||
RectangleEdges<T> const &rhs) noexcept {
|
RectangleEdges<T> const &rhs) noexcept {
|
||||||
return RectangleEdges<T>{lhs.left + rhs.left,
|
return RectangleEdges<T>{
|
||||||
lhs.top + rhs.top,
|
lhs.left + rhs.left,
|
||||||
lhs.right + rhs.right,
|
lhs.top + rhs.top,
|
||||||
lhs.bottom + rhs.bottom};
|
lhs.right + rhs.right,
|
||||||
|
lhs.bottom + rhs.bottom};
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
RectangleEdges<T> operator-(
|
RectangleEdges<T> operator-(
|
||||||
RectangleEdges<T> const &lhs,
|
RectangleEdges<T> const &lhs,
|
||||||
RectangleEdges<T> const &rhs) noexcept {
|
RectangleEdges<T> const &rhs) noexcept {
|
||||||
return RectangleEdges<T>{lhs.left - rhs.left,
|
return RectangleEdges<T>{
|
||||||
lhs.top - rhs.top,
|
lhs.left - rhs.left,
|
||||||
lhs.right - rhs.right,
|
lhs.top - rhs.top,
|
||||||
lhs.bottom - rhs.bottom};
|
lhs.right - rhs.right,
|
||||||
|
lhs.bottom - rhs.bottom};
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -70,9 +72,10 @@ using EdgeInsets = RectangleEdges<Float>;
|
||||||
* Adjusts a rectangle by the given edge insets.
|
* Adjusts a rectangle by the given edge insets.
|
||||||
*/
|
*/
|
||||||
inline Rect insetBy(Rect const &rect, EdgeInsets const &insets) noexcept {
|
inline Rect insetBy(Rect const &rect, EdgeInsets const &insets) noexcept {
|
||||||
return Rect{{rect.origin.x + insets.left, rect.origin.y + insets.top},
|
return Rect{
|
||||||
{rect.size.width - insets.left - insets.right,
|
{rect.origin.x + insets.left, rect.origin.y + insets.top},
|
||||||
rect.size.height - insets.top - insets.bottom}};
|
{rect.size.width - insets.left - insets.right,
|
||||||
|
rect.size.height - insets.top - insets.bottom}};
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace react
|
} // namespace react
|
||||||
|
@ -82,8 +85,8 @@ namespace std {
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct hash<facebook::react::RectangleEdges<T>> {
|
struct hash<facebook::react::RectangleEdges<T>> {
|
||||||
size_t operator()(facebook::react::RectangleEdges<T> const &edges) const
|
size_t operator()(
|
||||||
noexcept {
|
facebook::react::RectangleEdges<T> const &edges) const noexcept {
|
||||||
return folly::hash::hash_combine(
|
return folly::hash::hash_combine(
|
||||||
0, edges.left, edges.right, edges.top, edges.bottom);
|
0, edges.left, edges.right, edges.top, edges.bottom);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,10 +22,11 @@ SharedColor colorFromComponents(ColorComponents components) {
|
||||||
ColorComponents colorComponentsFromColor(SharedColor sharedColor) {
|
ColorComponents colorComponentsFromColor(SharedColor sharedColor) {
|
||||||
float ratio = 256;
|
float ratio = 256;
|
||||||
Color color = *sharedColor;
|
Color color = *sharedColor;
|
||||||
return ColorComponents{(float)((color >> 16) & 0xff) / ratio,
|
return ColorComponents{
|
||||||
(float)((color >> 8) & 0xff) / ratio,
|
(float)((color >> 16) & 0xff) / ratio,
|
||||||
(float)((color >> 0) & 0xff) / ratio,
|
(float)((color >> 8) & 0xff) / ratio,
|
||||||
(float)((color >> 24) & 0xff) / ratio};
|
(float)((color >> 0) & 0xff) / ratio,
|
||||||
|
(float)((color >> 24) & 0xff) / ratio};
|
||||||
}
|
}
|
||||||
|
|
||||||
SharedColor clearColor() {
|
SharedColor clearColor() {
|
||||||
|
|
|
@ -29,10 +29,11 @@ ColorComponents colorComponentsFromColor(SharedColor sharedColor) {
|
||||||
|
|
||||||
float ratio = 256;
|
float ratio = 256;
|
||||||
Color color = *sharedColor;
|
Color color = *sharedColor;
|
||||||
return ColorComponents{(float)((color >> 16) & 0xff) / ratio,
|
return ColorComponents{
|
||||||
(float)((color >> 8) & 0xff) / ratio,
|
(float)((color >> 16) & 0xff) / ratio,
|
||||||
(float)((color >> 0) & 0xff) / ratio,
|
(float)((color >> 8) & 0xff) / ratio,
|
||||||
(float)((color >> 24) & 0xff) / ratio};
|
(float)((color >> 0) & 0xff) / ratio,
|
||||||
|
(float)((color >> 24) & 0xff) / ratio};
|
||||||
}
|
}
|
||||||
|
|
||||||
SharedColor clearColor() {
|
SharedColor clearColor() {
|
||||||
|
|
|
@ -30,20 +30,23 @@ Float roundToPixel(Float value, Float scaleFactor) {
|
||||||
|
|
||||||
template <Float (*RoundingFunction)(Float)>
|
template <Float (*RoundingFunction)(Float)>
|
||||||
Point roundToPixel(Point value, Float scaleFactor) {
|
Point roundToPixel(Point value, Float scaleFactor) {
|
||||||
return Point{roundToPixel<RoundingFunction>(value.x, scaleFactor),
|
return Point{
|
||||||
roundToPixel<RoundingFunction>(value.y, scaleFactor)};
|
roundToPixel<RoundingFunction>(value.x, scaleFactor),
|
||||||
|
roundToPixel<RoundingFunction>(value.y, scaleFactor)};
|
||||||
}
|
}
|
||||||
|
|
||||||
template <Float (*RoundingFunction)(Float)>
|
template <Float (*RoundingFunction)(Float)>
|
||||||
Size roundToPixel(Size value, Float scaleFactor) {
|
Size roundToPixel(Size value, Float scaleFactor) {
|
||||||
return Size{roundToPixel<RoundingFunction>(value.width, scaleFactor),
|
return Size{
|
||||||
roundToPixel<RoundingFunction>(value.height, scaleFactor)};
|
roundToPixel<RoundingFunction>(value.width, scaleFactor),
|
||||||
|
roundToPixel<RoundingFunction>(value.height, scaleFactor)};
|
||||||
}
|
}
|
||||||
|
|
||||||
template <Float (*RoundingFunction)(Float)>
|
template <Float (*RoundingFunction)(Float)>
|
||||||
Rect roundToPixel(Rect value, Float scaleFactor) {
|
Rect roundToPixel(Rect value, Float scaleFactor) {
|
||||||
return Rect{roundToPixel<RoundingFunction>(value.origin),
|
return Rect{
|
||||||
roundToPixel<RoundingFunction>(value.size)};
|
roundToPixel<RoundingFunction>(value.origin),
|
||||||
|
roundToPixel<RoundingFunction>(value.size)};
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <react/renderer/graphics/Transform.h>
|
#include <react/renderer/graphics/Transform.h>
|
||||||
|
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
|
|
|
@ -774,14 +774,14 @@ static void calculateShadowViewMutationsV2(
|
||||||
auto updateMutations = ShadowViewMutation::List{};
|
auto updateMutations = ShadowViewMutation::List{};
|
||||||
auto downwardMutations = ShadowViewMutation::List{};
|
auto downwardMutations = ShadowViewMutation::List{};
|
||||||
auto destructiveDownwardMutations = ShadowViewMutation::List{};
|
auto destructiveDownwardMutations = ShadowViewMutation::List{};
|
||||||
auto mutationInstructionContainer =
|
auto mutationInstructionContainer = OrderedMutationInstructionContainer{
|
||||||
OrderedMutationInstructionContainer{createMutations,
|
createMutations,
|
||||||
deleteMutations,
|
deleteMutations,
|
||||||
insertMutations,
|
insertMutations,
|
||||||
removeMutations,
|
removeMutations,
|
||||||
updateMutations,
|
updateMutations,
|
||||||
downwardMutations,
|
downwardMutations,
|
||||||
destructiveDownwardMutations};
|
destructiveDownwardMutations};
|
||||||
|
|
||||||
DEBUG_LOGS({
|
DEBUG_LOGS({
|
||||||
LOG(ERROR) << "Differ Entry: Child Pairs of node: [" << parentShadowView.tag
|
LOG(ERROR) << "Differ Entry: Child Pairs of node: [" << parentShadowView.tag
|
||||||
|
|
|
@ -45,8 +45,8 @@ bool operator!=(StubView const &lhs, StubView const &rhs) {
|
||||||
|
|
||||||
std::string getDebugName(StubView const &stubView) {
|
std::string getDebugName(StubView const &stubView) {
|
||||||
return std::string{"Stub"} +
|
return std::string{"Stub"} +
|
||||||
std::string{stubView.componentHandle ? stubView.componentName
|
std::string{
|
||||||
: "[invalid]"};
|
stubView.componentHandle ? stubView.componentName : "[invalid]"};
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<DebugStringConvertibleObject> getDebugProps(
|
std::vector<DebugStringConvertibleObject> getDebugProps(
|
||||||
|
|
|
@ -72,9 +72,9 @@ StubViewTree buildStubViewTreeWithoutUsingDifferentiator(
|
||||||
ShadowView(rootShadowNode),
|
ShadowView(rootShadowNode),
|
||||||
sliceChildShadowNodeViewPairsLegacy(rootShadowNode));
|
sliceChildShadowNodeViewPairsLegacy(rootShadowNode));
|
||||||
|
|
||||||
auto emptyRootShadowNode = rootShadowNode.clone(
|
auto emptyRootShadowNode = rootShadowNode.clone(ShadowNodeFragment{
|
||||||
ShadowNodeFragment{ShadowNodeFragment::propsPlaceholder(),
|
ShadowNodeFragment::propsPlaceholder(),
|
||||||
ShadowNode::emptySharedShadowNodeSharedList()});
|
ShadowNode::emptySharedShadowNodeSharedList()});
|
||||||
|
|
||||||
auto stubViewTree = StubViewTree(ShadowView(*emptyRootShadowNode));
|
auto stubViewTree = StubViewTree(ShadowView(*emptyRootShadowNode));
|
||||||
stubViewTree.mutate(mutations);
|
stubViewTree.mutate(mutations);
|
||||||
|
@ -83,9 +83,9 @@ StubViewTree buildStubViewTreeWithoutUsingDifferentiator(
|
||||||
|
|
||||||
StubViewTree buildStubViewTreeUsingDifferentiator(
|
StubViewTree buildStubViewTreeUsingDifferentiator(
|
||||||
ShadowNode const &rootShadowNode) {
|
ShadowNode const &rootShadowNode) {
|
||||||
auto emptyRootShadowNode = rootShadowNode.clone(
|
auto emptyRootShadowNode = rootShadowNode.clone(ShadowNodeFragment{
|
||||||
ShadowNodeFragment{ShadowNodeFragment::propsPlaceholder(),
|
ShadowNodeFragment::propsPlaceholder(),
|
||||||
ShadowNode::emptySharedShadowNodeSharedList()});
|
ShadowNode::emptySharedShadowNodeSharedList()});
|
||||||
|
|
||||||
auto mutations =
|
auto mutations =
|
||||||
calculateShadowViewMutations(*emptyRootShadowNode, rootShadowNode);
|
calculateShadowViewMutations(*emptyRootShadowNode, rootShadowNode);
|
||||||
|
|
|
@ -44,8 +44,8 @@ static ShadowNode::Shared makeNode(
|
||||||
: nonFlattenedDefaultProps(componentDescriptor);
|
: nonFlattenedDefaultProps(componentDescriptor);
|
||||||
|
|
||||||
return componentDescriptor.createShadowNode(
|
return componentDescriptor.createShadowNode(
|
||||||
ShadowNodeFragment{props,
|
ShadowNodeFragment{
|
||||||
std::make_shared<SharedShadowNodeList>(children)},
|
props, std::make_shared<SharedShadowNodeList>(children)},
|
||||||
componentDescriptor.createFamily({tag, SurfaceId(1), nullptr}, nullptr));
|
componentDescriptor.createFamily({tag, SurfaceId(1), nullptr}, nullptr));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,8 +80,8 @@ TEST(MountingTest, testReorderingInstructionGeneration) {
|
||||||
|
|
||||||
// Applying size constraints.
|
// Applying size constraints.
|
||||||
emptyRootNode = emptyRootNode->clone(
|
emptyRootNode = emptyRootNode->clone(
|
||||||
LayoutConstraints{Size{512, 0},
|
LayoutConstraints{
|
||||||
Size{512, std::numeric_limits<Float>::infinity()}},
|
Size{512, 0}, Size{512, std::numeric_limits<Float>::infinity()}},
|
||||||
LayoutContext{});
|
LayoutContext{});
|
||||||
|
|
||||||
auto childA = makeNode(viewComponentDescriptor, 100, {});
|
auto childA = makeNode(viewComponentDescriptor, 100, {});
|
||||||
|
@ -101,22 +101,23 @@ TEST(MountingTest, testReorderingInstructionGeneration) {
|
||||||
|
|
||||||
// Construct "identical" shadow nodes: they differ only in children.
|
// Construct "identical" shadow nodes: they differ only in children.
|
||||||
auto shadowNodeV1 = viewComponentDescriptor.createShadowNode(
|
auto shadowNodeV1 = viewComponentDescriptor.createShadowNode(
|
||||||
ShadowNodeFragment{generateDefaultProps(viewComponentDescriptor),
|
ShadowNodeFragment{
|
||||||
std::make_shared<SharedShadowNodeList>(
|
generateDefaultProps(viewComponentDescriptor),
|
||||||
SharedShadowNodeList{childB, childC, childD})},
|
std::make_shared<SharedShadowNodeList>(
|
||||||
|
SharedShadowNodeList{childB, childC, childD})},
|
||||||
family);
|
family);
|
||||||
auto shadowNodeV2 = shadowNodeV1->clone(ShadowNodeFragment{
|
auto shadowNodeV2 = shadowNodeV1->clone(ShadowNodeFragment{
|
||||||
generateDefaultProps(viewComponentDescriptor),
|
generateDefaultProps(viewComponentDescriptor),
|
||||||
std::make_shared<SharedShadowNodeList>(
|
std::make_shared<SharedShadowNodeList>(
|
||||||
SharedShadowNodeList{childA, childB, childC, childD})});
|
SharedShadowNodeList{childA, childB, childC, childD})});
|
||||||
auto shadowNodeV3 = shadowNodeV2->clone(
|
auto shadowNodeV3 = shadowNodeV2->clone(ShadowNodeFragment{
|
||||||
ShadowNodeFragment{generateDefaultProps(viewComponentDescriptor),
|
generateDefaultProps(viewComponentDescriptor),
|
||||||
std::make_shared<SharedShadowNodeList>(
|
std::make_shared<SharedShadowNodeList>(
|
||||||
SharedShadowNodeList{childB, childC, childD})});
|
SharedShadowNodeList{childB, childC, childD})});
|
||||||
auto shadowNodeV4 = shadowNodeV3->clone(
|
auto shadowNodeV4 = shadowNodeV3->clone(ShadowNodeFragment{
|
||||||
ShadowNodeFragment{generateDefaultProps(viewComponentDescriptor),
|
generateDefaultProps(viewComponentDescriptor),
|
||||||
std::make_shared<SharedShadowNodeList>(
|
std::make_shared<SharedShadowNodeList>(
|
||||||
SharedShadowNodeList{childB, childD, childE})});
|
SharedShadowNodeList{childB, childD, childE})});
|
||||||
auto shadowNodeV5 = shadowNodeV4->clone(ShadowNodeFragment{
|
auto shadowNodeV5 = shadowNodeV4->clone(ShadowNodeFragment{
|
||||||
generateDefaultProps(viewComponentDescriptor),
|
generateDefaultProps(viewComponentDescriptor),
|
||||||
std::make_shared<SharedShadowNodeList>(
|
std::make_shared<SharedShadowNodeList>(
|
||||||
|
@ -127,52 +128,53 @@ TEST(MountingTest, testReorderingInstructionGeneration) {
|
||||||
childB, childA, childD, childF, childE, childC})});
|
childB, childA, childD, childF, childE, childC})});
|
||||||
auto shadowNodeV7 = shadowNodeV6->clone(ShadowNodeFragment{
|
auto shadowNodeV7 = shadowNodeV6->clone(ShadowNodeFragment{
|
||||||
generateDefaultProps(viewComponentDescriptor),
|
generateDefaultProps(viewComponentDescriptor),
|
||||||
std::make_shared<SharedShadowNodeList>(SharedShadowNodeList{childF,
|
std::make_shared<SharedShadowNodeList>(SharedShadowNodeList{
|
||||||
childE,
|
childF,
|
||||||
childC,
|
childE,
|
||||||
childD,
|
childC,
|
||||||
childG,
|
childD,
|
||||||
childH,
|
childG,
|
||||||
childI,
|
childH,
|
||||||
childJ,
|
childI,
|
||||||
childK})});
|
childJ,
|
||||||
|
childK})});
|
||||||
|
|
||||||
// Injecting a tree into the root node.
|
// Injecting a tree into the root node.
|
||||||
auto rootNodeV1 = std::static_pointer_cast<RootShadowNode const>(
|
auto rootNodeV1 = std::static_pointer_cast<RootShadowNode const>(
|
||||||
emptyRootNode->ShadowNode::clone(
|
emptyRootNode->ShadowNode::clone(ShadowNodeFragment{
|
||||||
ShadowNodeFragment{ShadowNodeFragment::propsPlaceholder(),
|
ShadowNodeFragment::propsPlaceholder(),
|
||||||
std::make_shared<SharedShadowNodeList>(
|
std::make_shared<SharedShadowNodeList>(
|
||||||
SharedShadowNodeList{shadowNodeV1})}));
|
SharedShadowNodeList{shadowNodeV1})}));
|
||||||
auto rootNodeV2 = std::static_pointer_cast<RootShadowNode const>(
|
auto rootNodeV2 = std::static_pointer_cast<RootShadowNode const>(
|
||||||
rootNodeV1->ShadowNode::clone(
|
rootNodeV1->ShadowNode::clone(ShadowNodeFragment{
|
||||||
ShadowNodeFragment{ShadowNodeFragment::propsPlaceholder(),
|
ShadowNodeFragment::propsPlaceholder(),
|
||||||
std::make_shared<SharedShadowNodeList>(
|
std::make_shared<SharedShadowNodeList>(
|
||||||
SharedShadowNodeList{shadowNodeV2})}));
|
SharedShadowNodeList{shadowNodeV2})}));
|
||||||
auto rootNodeV3 = std::static_pointer_cast<RootShadowNode const>(
|
auto rootNodeV3 = std::static_pointer_cast<RootShadowNode const>(
|
||||||
rootNodeV2->ShadowNode::clone(
|
rootNodeV2->ShadowNode::clone(ShadowNodeFragment{
|
||||||
ShadowNodeFragment{ShadowNodeFragment::propsPlaceholder(),
|
ShadowNodeFragment::propsPlaceholder(),
|
||||||
std::make_shared<SharedShadowNodeList>(
|
std::make_shared<SharedShadowNodeList>(
|
||||||
SharedShadowNodeList{shadowNodeV3})}));
|
SharedShadowNodeList{shadowNodeV3})}));
|
||||||
auto rootNodeV4 = std::static_pointer_cast<RootShadowNode const>(
|
auto rootNodeV4 = std::static_pointer_cast<RootShadowNode const>(
|
||||||
rootNodeV3->ShadowNode::clone(
|
rootNodeV3->ShadowNode::clone(ShadowNodeFragment{
|
||||||
ShadowNodeFragment{ShadowNodeFragment::propsPlaceholder(),
|
ShadowNodeFragment::propsPlaceholder(),
|
||||||
std::make_shared<SharedShadowNodeList>(
|
std::make_shared<SharedShadowNodeList>(
|
||||||
SharedShadowNodeList{shadowNodeV4})}));
|
SharedShadowNodeList{shadowNodeV4})}));
|
||||||
auto rootNodeV5 = std::static_pointer_cast<RootShadowNode const>(
|
auto rootNodeV5 = std::static_pointer_cast<RootShadowNode const>(
|
||||||
rootNodeV4->ShadowNode::clone(
|
rootNodeV4->ShadowNode::clone(ShadowNodeFragment{
|
||||||
ShadowNodeFragment{ShadowNodeFragment::propsPlaceholder(),
|
ShadowNodeFragment::propsPlaceholder(),
|
||||||
std::make_shared<SharedShadowNodeList>(
|
std::make_shared<SharedShadowNodeList>(
|
||||||
SharedShadowNodeList{shadowNodeV5})}));
|
SharedShadowNodeList{shadowNodeV5})}));
|
||||||
auto rootNodeV6 = std::static_pointer_cast<RootShadowNode const>(
|
auto rootNodeV6 = std::static_pointer_cast<RootShadowNode const>(
|
||||||
rootNodeV5->ShadowNode::clone(
|
rootNodeV5->ShadowNode::clone(ShadowNodeFragment{
|
||||||
ShadowNodeFragment{ShadowNodeFragment::propsPlaceholder(),
|
ShadowNodeFragment::propsPlaceholder(),
|
||||||
std::make_shared<SharedShadowNodeList>(
|
std::make_shared<SharedShadowNodeList>(
|
||||||
SharedShadowNodeList{shadowNodeV6})}));
|
SharedShadowNodeList{shadowNodeV6})}));
|
||||||
auto rootNodeV7 = std::static_pointer_cast<RootShadowNode const>(
|
auto rootNodeV7 = std::static_pointer_cast<RootShadowNode const>(
|
||||||
rootNodeV6->ShadowNode::clone(
|
rootNodeV6->ShadowNode::clone(ShadowNodeFragment{
|
||||||
ShadowNodeFragment{ShadowNodeFragment::propsPlaceholder(),
|
ShadowNodeFragment::propsPlaceholder(),
|
||||||
std::make_shared<SharedShadowNodeList>(
|
std::make_shared<SharedShadowNodeList>(
|
||||||
SharedShadowNodeList{shadowNodeV7})}));
|
SharedShadowNodeList{shadowNodeV7})}));
|
||||||
|
|
||||||
// Layout
|
// Layout
|
||||||
std::vector<LayoutableShadowNode const *> affectedLayoutableNodesV1{};
|
std::vector<LayoutableShadowNode const *> affectedLayoutableNodesV1{};
|
||||||
|
@ -383,8 +385,8 @@ TEST(MountingTest, testViewReparentingInstructionGeneration) {
|
||||||
|
|
||||||
// Applying size constraints.
|
// Applying size constraints.
|
||||||
emptyRootNode = emptyRootNode->clone(
|
emptyRootNode = emptyRootNode->clone(
|
||||||
LayoutConstraints{Size{512, 0},
|
LayoutConstraints{
|
||||||
Size{512, std::numeric_limits<Float>::infinity()}},
|
Size{512, 0}, Size{512, std::numeric_limits<Float>::infinity()}},
|
||||||
LayoutContext{});
|
LayoutContext{});
|
||||||
|
|
||||||
auto childA = makeNode(viewComponentDescriptor, 100, {});
|
auto childA = makeNode(viewComponentDescriptor, 100, {});
|
||||||
|
@ -535,30 +537,30 @@ TEST(MountingTest, testViewReparentingInstructionGeneration) {
|
||||||
|
|
||||||
// Injecting a tree into the root node.
|
// Injecting a tree into the root node.
|
||||||
auto rootNodeV1 = std::static_pointer_cast<RootShadowNode const>(
|
auto rootNodeV1 = std::static_pointer_cast<RootShadowNode const>(
|
||||||
emptyRootNode->ShadowNode::clone(
|
emptyRootNode->ShadowNode::clone(ShadowNodeFragment{
|
||||||
ShadowNodeFragment{ShadowNodeFragment::propsPlaceholder(),
|
ShadowNodeFragment::propsPlaceholder(),
|
||||||
std::make_shared<SharedShadowNodeList>(
|
std::make_shared<SharedShadowNodeList>(
|
||||||
SharedShadowNodeList{shadowNodeV1})}));
|
SharedShadowNodeList{shadowNodeV1})}));
|
||||||
auto rootNodeV2 = std::static_pointer_cast<RootShadowNode const>(
|
auto rootNodeV2 = std::static_pointer_cast<RootShadowNode const>(
|
||||||
rootNodeV1->ShadowNode::clone(
|
rootNodeV1->ShadowNode::clone(ShadowNodeFragment{
|
||||||
ShadowNodeFragment{ShadowNodeFragment::propsPlaceholder(),
|
ShadowNodeFragment::propsPlaceholder(),
|
||||||
std::make_shared<SharedShadowNodeList>(
|
std::make_shared<SharedShadowNodeList>(
|
||||||
SharedShadowNodeList{shadowNodeV2})}));
|
SharedShadowNodeList{shadowNodeV2})}));
|
||||||
auto rootNodeV3 = std::static_pointer_cast<RootShadowNode const>(
|
auto rootNodeV3 = std::static_pointer_cast<RootShadowNode const>(
|
||||||
rootNodeV2->ShadowNode::clone(
|
rootNodeV2->ShadowNode::clone(ShadowNodeFragment{
|
||||||
ShadowNodeFragment{ShadowNodeFragment::propsPlaceholder(),
|
ShadowNodeFragment::propsPlaceholder(),
|
||||||
std::make_shared<SharedShadowNodeList>(
|
std::make_shared<SharedShadowNodeList>(
|
||||||
SharedShadowNodeList{shadowNodeV3})}));
|
SharedShadowNodeList{shadowNodeV3})}));
|
||||||
auto rootNodeV4 = std::static_pointer_cast<RootShadowNode const>(
|
auto rootNodeV4 = std::static_pointer_cast<RootShadowNode const>(
|
||||||
rootNodeV3->ShadowNode::clone(
|
rootNodeV3->ShadowNode::clone(ShadowNodeFragment{
|
||||||
ShadowNodeFragment{ShadowNodeFragment::propsPlaceholder(),
|
ShadowNodeFragment::propsPlaceholder(),
|
||||||
std::make_shared<SharedShadowNodeList>(
|
std::make_shared<SharedShadowNodeList>(
|
||||||
SharedShadowNodeList{shadowNodeV4})}));
|
SharedShadowNodeList{shadowNodeV4})}));
|
||||||
auto rootNodeV5 = std::static_pointer_cast<RootShadowNode const>(
|
auto rootNodeV5 = std::static_pointer_cast<RootShadowNode const>(
|
||||||
rootNodeV4->ShadowNode::clone(
|
rootNodeV4->ShadowNode::clone(ShadowNodeFragment{
|
||||||
ShadowNodeFragment{ShadowNodeFragment::propsPlaceholder(),
|
ShadowNodeFragment::propsPlaceholder(),
|
||||||
std::make_shared<SharedShadowNodeList>(
|
std::make_shared<SharedShadowNodeList>(
|
||||||
SharedShadowNodeList{shadowNodeV5})}));
|
SharedShadowNodeList{shadowNodeV5})}));
|
||||||
|
|
||||||
// Layout
|
// Layout
|
||||||
std::vector<LayoutableShadowNode const *> affectedLayoutableNodesV1{};
|
std::vector<LayoutableShadowNode const *> affectedLayoutableNodesV1{};
|
||||||
|
|
|
@ -57,8 +57,8 @@ static void testShadowNodeTreeLifeCycle(
|
||||||
|
|
||||||
// Applying size constraints.
|
// Applying size constraints.
|
||||||
emptyRootNode = emptyRootNode->clone(
|
emptyRootNode = emptyRootNode->clone(
|
||||||
LayoutConstraints{Size{512, 0},
|
LayoutConstraints{
|
||||||
Size{512, std::numeric_limits<Float>::infinity()}},
|
Size{512, 0}, Size{512, std::numeric_limits<Float>::infinity()}},
|
||||||
LayoutContext{});
|
LayoutContext{});
|
||||||
|
|
||||||
// Generation of a random tree.
|
// Generation of a random tree.
|
||||||
|
|
|
@ -98,12 +98,13 @@ TEST(StateReconciliationTest, testStateReconciliation) {
|
||||||
auto eventDispatcher = EventDispatcher::Shared{};
|
auto eventDispatcher = EventDispatcher::Shared{};
|
||||||
auto rootComponentDescriptor =
|
auto rootComponentDescriptor =
|
||||||
ComponentDescriptorParameters{eventDispatcher, nullptr, nullptr};
|
ComponentDescriptorParameters{eventDispatcher, nullptr, nullptr};
|
||||||
ShadowTree shadowTree{SurfaceId{11},
|
ShadowTree shadowTree{
|
||||||
LayoutConstraints{},
|
SurfaceId{11},
|
||||||
LayoutContext{},
|
LayoutConstraints{},
|
||||||
rootComponentDescriptor,
|
LayoutContext{},
|
||||||
shadowTreeDelegate,
|
rootComponentDescriptor,
|
||||||
{}};
|
shadowTreeDelegate,
|
||||||
|
{}};
|
||||||
|
|
||||||
shadowTree.commit(
|
shadowTree.commit(
|
||||||
[&](RootShadowNode const &oldRootShadowNode) {
|
[&](RootShadowNode const &oldRootShadowNode) {
|
||||||
|
@ -121,9 +122,10 @@ TEST(StateReconciliationTest, testStateReconciliation) {
|
||||||
|
|
||||||
auto rootShadowNodeState2 =
|
auto rootShadowNodeState2 =
|
||||||
shadowNode->cloneTree(family, [&](ShadowNode const &oldShadowNode) {
|
shadowNode->cloneTree(family, [&](ShadowNode const &oldShadowNode) {
|
||||||
return oldShadowNode.clone({ShadowNodeFragment::propsPlaceholder(),
|
return oldShadowNode.clone(
|
||||||
ShadowNodeFragment::childrenPlaceholder(),
|
{ShadowNodeFragment::propsPlaceholder(),
|
||||||
state2});
|
ShadowNodeFragment::childrenPlaceholder(),
|
||||||
|
state2});
|
||||||
});
|
});
|
||||||
|
|
||||||
EXPECT_EQ(
|
EXPECT_EQ(
|
||||||
|
@ -143,9 +145,10 @@ TEST(StateReconciliationTest, testStateReconciliation) {
|
||||||
|
|
||||||
auto rootShadowNodeState3 = rootShadowNodeState2->cloneTree(
|
auto rootShadowNodeState3 = rootShadowNodeState2->cloneTree(
|
||||||
family, [&](ShadowNode const &oldShadowNode) {
|
family, [&](ShadowNode const &oldShadowNode) {
|
||||||
return oldShadowNode.clone({ShadowNodeFragment::propsPlaceholder(),
|
return oldShadowNode.clone(
|
||||||
ShadowNodeFragment::childrenPlaceholder(),
|
{ShadowNodeFragment::propsPlaceholder(),
|
||||||
state3});
|
ShadowNodeFragment::childrenPlaceholder(),
|
||||||
|
state3});
|
||||||
});
|
});
|
||||||
|
|
||||||
EXPECT_EQ(
|
EXPECT_EQ(
|
||||||
|
|
|
@ -250,8 +250,9 @@ static inline ShadowNode::Shared generateShadowNodeTree(
|
||||||
auto family = componentDescriptor.createFamily(
|
auto family = componentDescriptor.createFamily(
|
||||||
{generateReactTag(), SurfaceId(1), nullptr}, nullptr);
|
{generateReactTag(), SurfaceId(1), nullptr}, nullptr);
|
||||||
return componentDescriptor.createShadowNode(
|
return componentDescriptor.createShadowNode(
|
||||||
ShadowNodeFragment{generateDefaultProps(componentDescriptor),
|
ShadowNodeFragment{
|
||||||
std::make_shared<SharedShadowNodeList>(children)},
|
generateDefaultProps(componentDescriptor),
|
||||||
|
std::make_shared<SharedShadowNodeList>(children)},
|
||||||
family);
|
family);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -166,8 +166,8 @@ TextMeasurement TextLayoutManager::doMeasure(
|
||||||
float width = (float)fragment["width"].getDouble();
|
float width = (float)fragment["width"].getDouble();
|
||||||
float height = (float)fragment["height"].getDouble();
|
float height = (float)fragment["height"].getDouble();
|
||||||
|
|
||||||
auto rect = facebook::react::Rect{{left, top},
|
auto rect = facebook::react::Rect{
|
||||||
facebook::react::Size{width, height}};
|
{left, top}, facebook::react::Size{width, height}};
|
||||||
attachments.push_back(TextMeasurement::Attachment{rect, false});
|
attachments.push_back(TextMeasurement::Attachment{rect, false});
|
||||||
attachmentIndex++;
|
attachmentIndex++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,15 +41,16 @@ inline static UIFontWeight RCTUIFontWeightFromInteger(NSInteger fontWeight)
|
||||||
assert(fontWeight > 50);
|
assert(fontWeight > 50);
|
||||||
assert(fontWeight < 950);
|
assert(fontWeight < 950);
|
||||||
|
|
||||||
static UIFontWeight weights[] = {/* ~100 */ UIFontWeightUltraLight,
|
static UIFontWeight weights[] = {
|
||||||
/* ~200 */ UIFontWeightThin,
|
/* ~100 */ UIFontWeightUltraLight,
|
||||||
/* ~300 */ UIFontWeightLight,
|
/* ~200 */ UIFontWeightThin,
|
||||||
/* ~400 */ UIFontWeightRegular,
|
/* ~300 */ UIFontWeightLight,
|
||||||
/* ~500 */ UIFontWeightMedium,
|
/* ~400 */ UIFontWeightRegular,
|
||||||
/* ~600 */ UIFontWeightSemibold,
|
/* ~500 */ UIFontWeightMedium,
|
||||||
/* ~700 */ UIFontWeightBold,
|
/* ~600 */ UIFontWeightSemibold,
|
||||||
/* ~800 */ UIFontWeightHeavy,
|
/* ~700 */ UIFontWeightBold,
|
||||||
/* ~900 */ UIFontWeightBlack};
|
/* ~800 */ UIFontWeightHeavy,
|
||||||
|
/* ~900 */ UIFontWeightBlack};
|
||||||
// The expression is designed to convert something like 760 or 830 to 7.
|
// The expression is designed to convert something like 760 or 830 to 7.
|
||||||
return weights[(fontWeight + 50) / 100 - 1];
|
return weights[(fontWeight + 50) / 100 - 1];
|
||||||
}
|
}
|
||||||
|
@ -319,8 +320,9 @@ NSAttributedString *RCTNSAttributedStringFromAttributedString(const AttributedSt
|
||||||
|
|
||||||
if (fragment.isAttachment()) {
|
if (fragment.isAttachment()) {
|
||||||
auto layoutMetrics = fragment.parentShadowView.layoutMetrics;
|
auto layoutMetrics = fragment.parentShadowView.layoutMetrics;
|
||||||
CGRect bounds = {.origin = {.x = layoutMetrics.frame.origin.x, .y = layoutMetrics.frame.origin.y},
|
CGRect bounds = {
|
||||||
.size = {.width = layoutMetrics.frame.size.width, .height = layoutMetrics.frame.size.height}};
|
.origin = {.x = layoutMetrics.frame.origin.x, .y = layoutMetrics.frame.origin.y},
|
||||||
|
.size = {.width = layoutMetrics.frame.size.width, .height = layoutMetrics.frame.size.height}};
|
||||||
|
|
||||||
NSTextAttachment *attachment = [NSTextAttachment new];
|
NSTextAttachment *attachment = [NSTextAttachment new];
|
||||||
attachment.image = placeholderImage;
|
attachment.image = placeholderImage;
|
||||||
|
|
|
@ -75,12 +75,14 @@ static NSLineBreakMode RCTNSLineBreakModeFromEllipsizeMode(EllipsizeMode ellipsi
|
||||||
|
|
||||||
UIFont *font = [textStorage attribute:NSFontAttributeName atIndex:range.location effectiveRange:nil];
|
UIFont *font = [textStorage attribute:NSFontAttributeName atIndex:range.location effectiveRange:nil];
|
||||||
|
|
||||||
CGRect frame = {{glyphRect.origin.x,
|
CGRect frame = {
|
||||||
glyphRect.origin.y + glyphRect.size.height - attachmentSize.height + font.descender},
|
{glyphRect.origin.x,
|
||||||
attachmentSize};
|
glyphRect.origin.y + glyphRect.size.height - attachmentSize.height + font.descender},
|
||||||
|
attachmentSize};
|
||||||
|
|
||||||
auto rect = facebook::react::Rect{facebook::react::Point{frame.origin.x, frame.origin.y},
|
auto rect = facebook::react::Rect{
|
||||||
facebook::react::Size{frame.size.width, frame.size.height}};
|
facebook::react::Point{frame.origin.x, frame.origin.y},
|
||||||
|
facebook::react::Size{frame.size.width, frame.size.height}};
|
||||||
|
|
||||||
attachments.push_back(TextMeasurement::Attachment{rect, false});
|
attachments.push_back(TextMeasurement::Attachment{rect, false});
|
||||||
}];
|
}];
|
||||||
|
@ -156,12 +158,13 @@ static NSLineBreakMode RCTNSLineBreakModeFromEllipsizeMode(EllipsizeMode ellipsi
|
||||||
auto rect = facebook::react::Rect{
|
auto rect = facebook::react::Rect{
|
||||||
facebook::react::Point{usedRect.origin.x, usedRect.origin.y},
|
facebook::react::Point{usedRect.origin.x, usedRect.origin.y},
|
||||||
facebook::react::Size{usedRect.size.width, usedRect.size.height}};
|
facebook::react::Size{usedRect.size.width, usedRect.size.height}};
|
||||||
auto line = LineMeasurement{std::string([renderedString UTF8String]),
|
auto line = LineMeasurement{
|
||||||
rect,
|
std::string([renderedString UTF8String]),
|
||||||
-font.descender,
|
rect,
|
||||||
font.capHeight,
|
-font.descender,
|
||||||
font.ascender,
|
font.capHeight,
|
||||||
font.xHeight};
|
font.ascender,
|
||||||
|
font.xHeight};
|
||||||
blockParagraphLines->push_back(line);
|
blockParagraphLines->push_back(line);
|
||||||
}];
|
}];
|
||||||
return paragraphLines;
|
return paragraphLines;
|
||||||
|
|
|
@ -217,10 +217,10 @@ jsi::Value UIManagerBinding::get(
|
||||||
name,
|
name,
|
||||||
5,
|
5,
|
||||||
[uiManager](
|
[uiManager](
|
||||||
jsi::Runtime & runtime,
|
jsi::Runtime &runtime,
|
||||||
jsi::Value const &thisValue,
|
jsi::Value const &thisValue,
|
||||||
jsi::Value const *arguments,
|
jsi::Value const *arguments,
|
||||||
size_t count) noexcept->jsi::Value {
|
size_t count) noexcept -> jsi::Value {
|
||||||
return valueFromShadowNode(
|
return valueFromShadowNode(
|
||||||
runtime,
|
runtime,
|
||||||
uiManager->createNode(
|
uiManager->createNode(
|
||||||
|
@ -239,10 +239,10 @@ jsi::Value UIManagerBinding::get(
|
||||||
name,
|
name,
|
||||||
1,
|
1,
|
||||||
[uiManager](
|
[uiManager](
|
||||||
jsi::Runtime & runtime,
|
jsi::Runtime &runtime,
|
||||||
jsi::Value const &thisValue,
|
jsi::Value const &thisValue,
|
||||||
jsi::Value const *arguments,
|
jsi::Value const *arguments,
|
||||||
size_t count) noexcept->jsi::Value {
|
size_t count) noexcept -> jsi::Value {
|
||||||
return valueFromShadowNode(
|
return valueFromShadowNode(
|
||||||
runtime,
|
runtime,
|
||||||
uiManager->cloneNode(shadowNodeFromValue(runtime, arguments[0])));
|
uiManager->cloneNode(shadowNodeFromValue(runtime, arguments[0])));
|
||||||
|
@ -255,10 +255,10 @@ jsi::Value UIManagerBinding::get(
|
||||||
name,
|
name,
|
||||||
2,
|
2,
|
||||||
[uiManager](
|
[uiManager](
|
||||||
jsi::Runtime & runtime,
|
jsi::Runtime &runtime,
|
||||||
jsi::Value const &thisValue,
|
jsi::Value const &thisValue,
|
||||||
jsi::Value const *arguments,
|
jsi::Value const *arguments,
|
||||||
size_t count) noexcept->jsi::Value {
|
size_t count) noexcept -> jsi::Value {
|
||||||
uiManager->setJSResponder(
|
uiManager->setJSResponder(
|
||||||
shadowNodeFromValue(runtime, arguments[0]),
|
shadowNodeFromValue(runtime, arguments[0]),
|
||||||
arguments[1].getBool());
|
arguments[1].getBool());
|
||||||
|
@ -273,10 +273,10 @@ jsi::Value UIManagerBinding::get(
|
||||||
name,
|
name,
|
||||||
2,
|
2,
|
||||||
[uiManager](
|
[uiManager](
|
||||||
jsi::Runtime & runtime,
|
jsi::Runtime &runtime,
|
||||||
jsi::Value const &thisValue,
|
jsi::Value const &thisValue,
|
||||||
jsi::Value const *arguments,
|
jsi::Value const *arguments,
|
||||||
size_t count) noexcept->jsi::Value {
|
size_t count) noexcept -> jsi::Value {
|
||||||
auto node = shadowNodeFromValue(runtime, arguments[0]);
|
auto node = shadowNodeFromValue(runtime, arguments[0]);
|
||||||
auto locationX = (Float)arguments[1].getNumber();
|
auto locationX = (Float)arguments[1].getNumber();
|
||||||
auto locationY = (Float)arguments[2].getNumber();
|
auto locationY = (Float)arguments[2].getNumber();
|
||||||
|
@ -303,10 +303,10 @@ jsi::Value UIManagerBinding::get(
|
||||||
name,
|
name,
|
||||||
0,
|
0,
|
||||||
[uiManager](
|
[uiManager](
|
||||||
jsi::Runtime & runtime,
|
jsi::Runtime &runtime,
|
||||||
jsi::Value const &thisValue,
|
jsi::Value const &thisValue,
|
||||||
jsi::Value const *arguments,
|
jsi::Value const *arguments,
|
||||||
size_t count) noexcept->jsi::Value {
|
size_t count) noexcept -> jsi::Value {
|
||||||
uiManager->clearJSResponder();
|
uiManager->clearJSResponder();
|
||||||
|
|
||||||
return jsi::Value::undefined();
|
return jsi::Value::undefined();
|
||||||
|
@ -320,10 +320,10 @@ jsi::Value UIManagerBinding::get(
|
||||||
name,
|
name,
|
||||||
1,
|
1,
|
||||||
[uiManager](
|
[uiManager](
|
||||||
jsi::Runtime & runtime,
|
jsi::Runtime &runtime,
|
||||||
jsi::Value const &thisValue,
|
jsi::Value const &thisValue,
|
||||||
jsi::Value const *arguments,
|
jsi::Value const *arguments,
|
||||||
size_t count) noexcept->jsi::Value {
|
size_t count) noexcept -> jsi::Value {
|
||||||
return valueFromShadowNode(
|
return valueFromShadowNode(
|
||||||
runtime,
|
runtime,
|
||||||
uiManager->cloneNode(
|
uiManager->cloneNode(
|
||||||
|
@ -339,10 +339,10 @@ jsi::Value UIManagerBinding::get(
|
||||||
name,
|
name,
|
||||||
2,
|
2,
|
||||||
[uiManager](
|
[uiManager](
|
||||||
jsi::Runtime & runtime,
|
jsi::Runtime &runtime,
|
||||||
jsi::Value const &thisValue,
|
jsi::Value const &thisValue,
|
||||||
jsi::Value const *arguments,
|
jsi::Value const *arguments,
|
||||||
size_t count) noexcept->jsi::Value {
|
size_t count) noexcept -> jsi::Value {
|
||||||
auto const &rawProps = RawProps(runtime, arguments[1]);
|
auto const &rawProps = RawProps(runtime, arguments[1]);
|
||||||
return valueFromShadowNode(
|
return valueFromShadowNode(
|
||||||
runtime,
|
runtime,
|
||||||
|
@ -360,10 +360,10 @@ jsi::Value UIManagerBinding::get(
|
||||||
name,
|
name,
|
||||||
2,
|
2,
|
||||||
[uiManager](
|
[uiManager](
|
||||||
jsi::Runtime & runtime,
|
jsi::Runtime &runtime,
|
||||||
jsi::Value const &thisValue,
|
jsi::Value const &thisValue,
|
||||||
jsi::Value const *arguments,
|
jsi::Value const *arguments,
|
||||||
size_t count) noexcept->jsi::Value {
|
size_t count) noexcept -> jsi::Value {
|
||||||
auto const &rawProps = RawProps(runtime, arguments[1]);
|
auto const &rawProps = RawProps(runtime, arguments[1]);
|
||||||
return valueFromShadowNode(
|
return valueFromShadowNode(
|
||||||
runtime,
|
runtime,
|
||||||
|
@ -380,10 +380,10 @@ jsi::Value UIManagerBinding::get(
|
||||||
name,
|
name,
|
||||||
2,
|
2,
|
||||||
[uiManager](
|
[uiManager](
|
||||||
jsi::Runtime & runtime,
|
jsi::Runtime &runtime,
|
||||||
jsi::Value const &thisValue,
|
jsi::Value const &thisValue,
|
||||||
jsi::Value const *arguments,
|
jsi::Value const *arguments,
|
||||||
size_t count) noexcept->jsi::Value {
|
size_t count) noexcept -> jsi::Value {
|
||||||
uiManager->appendChild(
|
uiManager->appendChild(
|
||||||
shadowNodeFromValue(runtime, arguments[0]),
|
shadowNodeFromValue(runtime, arguments[0]),
|
||||||
shadowNodeFromValue(runtime, arguments[1]));
|
shadowNodeFromValue(runtime, arguments[1]));
|
||||||
|
@ -396,10 +396,10 @@ jsi::Value UIManagerBinding::get(
|
||||||
runtime,
|
runtime,
|
||||||
name,
|
name,
|
||||||
1,
|
1,
|
||||||
[](jsi::Runtime & runtime,
|
[](jsi::Runtime &runtime,
|
||||||
jsi::Value const &thisValue,
|
jsi::Value const &thisValue,
|
||||||
jsi::Value const *arguments,
|
jsi::Value const *arguments,
|
||||||
size_t count) noexcept->jsi::Value {
|
size_t count) noexcept -> jsi::Value {
|
||||||
auto shadowNodeList =
|
auto shadowNodeList =
|
||||||
std::make_shared<SharedShadowNodeList>(SharedShadowNodeList({}));
|
std::make_shared<SharedShadowNodeList>(SharedShadowNodeList({}));
|
||||||
return valueFromShadowNodeList(runtime, shadowNodeList);
|
return valueFromShadowNodeList(runtime, shadowNodeList);
|
||||||
|
@ -411,10 +411,10 @@ jsi::Value UIManagerBinding::get(
|
||||||
runtime,
|
runtime,
|
||||||
name,
|
name,
|
||||||
2,
|
2,
|
||||||
[](jsi::Runtime & runtime,
|
[](jsi::Runtime &runtime,
|
||||||
jsi::Value const &thisValue,
|
jsi::Value const &thisValue,
|
||||||
jsi::Value const *arguments,
|
jsi::Value const *arguments,
|
||||||
size_t count) noexcept->jsi::Value {
|
size_t count) noexcept -> jsi::Value {
|
||||||
auto shadowNodeList = shadowNodeListFromValue(runtime, arguments[0]);
|
auto shadowNodeList = shadowNodeListFromValue(runtime, arguments[0]);
|
||||||
auto shadowNode = shadowNodeFromValue(runtime, arguments[1]);
|
auto shadowNode = shadowNodeFromValue(runtime, arguments[1]);
|
||||||
shadowNodeList->push_back(shadowNode);
|
shadowNodeList->push_back(shadowNode);
|
||||||
|
@ -430,11 +430,11 @@ jsi::Value UIManagerBinding::get(
|
||||||
runtime,
|
runtime,
|
||||||
name,
|
name,
|
||||||
2,
|
2,
|
||||||
[ uiManager, sharedUIManager = uiManager_ ](
|
[uiManager, sharedUIManager = uiManager_](
|
||||||
jsi::Runtime & runtime,
|
jsi::Runtime &runtime,
|
||||||
jsi::Value const &thisValue,
|
jsi::Value const &thisValue,
|
||||||
jsi::Value const *arguments,
|
jsi::Value const *arguments,
|
||||||
size_t count) noexcept->jsi::Value {
|
size_t count) noexcept -> jsi::Value {
|
||||||
auto surfaceId = surfaceIdFromValue(runtime, arguments[0]);
|
auto surfaceId = surfaceIdFromValue(runtime, arguments[0]);
|
||||||
auto shadowNodeList =
|
auto shadowNodeList =
|
||||||
shadowNodeListFromValue(runtime, arguments[1]);
|
shadowNodeListFromValue(runtime, arguments[1]);
|
||||||
|
@ -472,10 +472,10 @@ jsi::Value UIManagerBinding::get(
|
||||||
name,
|
name,
|
||||||
2,
|
2,
|
||||||
[uiManager](
|
[uiManager](
|
||||||
jsi::Runtime & runtime,
|
jsi::Runtime &runtime,
|
||||||
jsi::Value const &thisValue,
|
jsi::Value const &thisValue,
|
||||||
jsi::Value const *arguments,
|
jsi::Value const *arguments,
|
||||||
size_t count) noexcept->jsi::Value {
|
size_t count) noexcept -> jsi::Value {
|
||||||
uiManager->completeSurface(
|
uiManager->completeSurface(
|
||||||
surfaceIdFromValue(runtime, arguments[0]),
|
surfaceIdFromValue(runtime, arguments[0]),
|
||||||
shadowNodeListFromValue(runtime, arguments[1]),
|
shadowNodeListFromValue(runtime, arguments[1]),
|
||||||
|
@ -492,10 +492,10 @@ jsi::Value UIManagerBinding::get(
|
||||||
name,
|
name,
|
||||||
1,
|
1,
|
||||||
[this](
|
[this](
|
||||||
jsi::Runtime & runtime,
|
jsi::Runtime &runtime,
|
||||||
jsi::Value const &thisValue,
|
jsi::Value const &thisValue,
|
||||||
jsi::Value const *arguments,
|
jsi::Value const *arguments,
|
||||||
size_t count) noexcept->jsi::Value {
|
size_t count) noexcept -> jsi::Value {
|
||||||
auto eventHandler =
|
auto eventHandler =
|
||||||
arguments[0].getObject(runtime).getFunction(runtime);
|
arguments[0].getObject(runtime).getFunction(runtime);
|
||||||
eventHandler_ =
|
eventHandler_ =
|
||||||
|
@ -510,10 +510,10 @@ jsi::Value UIManagerBinding::get(
|
||||||
name,
|
name,
|
||||||
2,
|
2,
|
||||||
[uiManager](
|
[uiManager](
|
||||||
jsi::Runtime & runtime,
|
jsi::Runtime &runtime,
|
||||||
jsi::Value const &thisValue,
|
jsi::Value const &thisValue,
|
||||||
jsi::Value const *arguments,
|
jsi::Value const *arguments,
|
||||||
size_t count) noexcept->jsi::Value {
|
size_t count) noexcept -> jsi::Value {
|
||||||
auto layoutMetrics = uiManager->getRelativeLayoutMetrics(
|
auto layoutMetrics = uiManager->getRelativeLayoutMetrics(
|
||||||
*shadowNodeFromValue(runtime, arguments[0]),
|
*shadowNodeFromValue(runtime, arguments[0]),
|
||||||
shadowNodeFromValue(runtime, arguments[1]).get(),
|
shadowNodeFromValue(runtime, arguments[1]).get(),
|
||||||
|
@ -534,10 +534,10 @@ jsi::Value UIManagerBinding::get(
|
||||||
name,
|
name,
|
||||||
3,
|
3,
|
||||||
[uiManager](
|
[uiManager](
|
||||||
jsi::Runtime & runtime,
|
jsi::Runtime &runtime,
|
||||||
jsi::Value const &thisValue,
|
jsi::Value const &thisValue,
|
||||||
jsi::Value const *arguments,
|
jsi::Value const *arguments,
|
||||||
size_t count) noexcept->jsi::Value {
|
size_t count) noexcept -> jsi::Value {
|
||||||
uiManager->dispatchCommand(
|
uiManager->dispatchCommand(
|
||||||
shadowNodeFromValue(runtime, arguments[0]),
|
shadowNodeFromValue(runtime, arguments[0]),
|
||||||
stringFromValue(runtime, arguments[1]),
|
stringFromValue(runtime, arguments[1]),
|
||||||
|
@ -554,10 +554,10 @@ jsi::Value UIManagerBinding::get(
|
||||||
name,
|
name,
|
||||||
4,
|
4,
|
||||||
[uiManager](
|
[uiManager](
|
||||||
jsi::Runtime & runtime,
|
jsi::Runtime &runtime,
|
||||||
jsi::Value const &thisValue,
|
jsi::Value const &thisValue,
|
||||||
jsi::Value const *arguments,
|
jsi::Value const *arguments,
|
||||||
size_t count) noexcept->jsi::Value {
|
size_t count) noexcept -> jsi::Value {
|
||||||
auto layoutMetrics = uiManager->getRelativeLayoutMetrics(
|
auto layoutMetrics = uiManager->getRelativeLayoutMetrics(
|
||||||
*shadowNodeFromValue(runtime, arguments[0]),
|
*shadowNodeFromValue(runtime, arguments[0]),
|
||||||
shadowNodeFromValue(runtime, arguments[1]).get(),
|
shadowNodeFromValue(runtime, arguments[1]).get(),
|
||||||
|
@ -590,10 +590,10 @@ jsi::Value UIManagerBinding::get(
|
||||||
name,
|
name,
|
||||||
2,
|
2,
|
||||||
[uiManager](
|
[uiManager](
|
||||||
jsi::Runtime & runtime,
|
jsi::Runtime &runtime,
|
||||||
jsi::Value const &thisValue,
|
jsi::Value const &thisValue,
|
||||||
jsi::Value const *arguments,
|
jsi::Value const *arguments,
|
||||||
size_t count) noexcept->jsi::Value {
|
size_t count) noexcept -> jsi::Value {
|
||||||
auto shadowNode = shadowNodeFromValue(runtime, arguments[0]);
|
auto shadowNode = shadowNodeFromValue(runtime, arguments[0]);
|
||||||
auto layoutMetrics = uiManager->getRelativeLayoutMetrics(
|
auto layoutMetrics = uiManager->getRelativeLayoutMetrics(
|
||||||
*shadowNode, nullptr, {/* .includeTransform = */ true});
|
*shadowNode, nullptr, {/* .includeTransform = */ true});
|
||||||
|
@ -632,10 +632,10 @@ jsi::Value UIManagerBinding::get(
|
||||||
name,
|
name,
|
||||||
2,
|
2,
|
||||||
[uiManager](
|
[uiManager](
|
||||||
jsi::Runtime & runtime,
|
jsi::Runtime &runtime,
|
||||||
jsi::Value const &thisValue,
|
jsi::Value const &thisValue,
|
||||||
jsi::Value const *arguments,
|
jsi::Value const *arguments,
|
||||||
size_t count) noexcept->jsi::Value {
|
size_t count) noexcept -> jsi::Value {
|
||||||
auto layoutMetrics = uiManager->getRelativeLayoutMetrics(
|
auto layoutMetrics = uiManager->getRelativeLayoutMetrics(
|
||||||
*shadowNodeFromValue(runtime, arguments[0]),
|
*shadowNodeFromValue(runtime, arguments[0]),
|
||||||
nullptr,
|
nullptr,
|
||||||
|
@ -667,10 +667,10 @@ jsi::Value UIManagerBinding::get(
|
||||||
name,
|
name,
|
||||||
2,
|
2,
|
||||||
[uiManager](
|
[uiManager](
|
||||||
jsi::Runtime & runtime,
|
jsi::Runtime &runtime,
|
||||||
jsi::Value const &thisValue,
|
jsi::Value const &thisValue,
|
||||||
jsi::Value const *arguments,
|
jsi::Value const *arguments,
|
||||||
size_t count) noexcept->jsi::Value {
|
size_t count) noexcept -> jsi::Value {
|
||||||
uiManager->sendAccessibilityEvent(
|
uiManager->sendAccessibilityEvent(
|
||||||
shadowNodeFromValue(runtime, arguments[0]),
|
shadowNodeFromValue(runtime, arguments[0]),
|
||||||
stringFromValue(runtime, arguments[1]));
|
stringFromValue(runtime, arguments[1]));
|
||||||
|
@ -685,10 +685,10 @@ jsi::Value UIManagerBinding::get(
|
||||||
name,
|
name,
|
||||||
3,
|
3,
|
||||||
[uiManager](
|
[uiManager](
|
||||||
jsi::Runtime & runtime,
|
jsi::Runtime &runtime,
|
||||||
jsi::Value const &thisValue,
|
jsi::Value const &thisValue,
|
||||||
jsi::Value const *arguments,
|
jsi::Value const *arguments,
|
||||||
size_t count) noexcept->jsi::Value {
|
size_t count) noexcept -> jsi::Value {
|
||||||
uiManager->configureNextLayoutAnimation(
|
uiManager->configureNextLayoutAnimation(
|
||||||
runtime,
|
runtime,
|
||||||
// TODO: pass in JSI value instead of folly::dynamic to RawValue
|
// TODO: pass in JSI value instead of folly::dynamic to RawValue
|
||||||
|
|
|
@ -23,10 +23,10 @@ class UIManagerCommitHook {
|
||||||
/*
|
/*
|
||||||
* Called right after the commit hook is registered or unregistered.
|
* Called right after the commit hook is registered or unregistered.
|
||||||
*/
|
*/
|
||||||
virtual void commitHookWasRegistered(UIManager const &uiManager) const
|
virtual void commitHookWasRegistered(
|
||||||
noexcept = 0;
|
UIManager const &uiManager) const noexcept = 0;
|
||||||
virtual void commitHookWasUnregistered(UIManager const &uiManager) const
|
virtual void commitHookWasUnregistered(
|
||||||
noexcept = 0;
|
UIManager const &uiManager) const noexcept = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Called right before a `ShadowTree` commits a new tree.
|
* Called right before a `ShadowTree` commits a new tree.
|
||||||
|
|
Загрузка…
Ссылка в новой задаче