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