diff --git a/.circleci/config.yml b/.circleci/config.yml index b62ec8a85a6321..e963bd1a592400 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -497,8 +497,8 @@ jobs: # Keep configuring Android dependencies while AVD boots up - run: - name: Install rsync - command: apt-get update -y && apt-get install rsync -y + name: Install rsync, zip + command: apt-get update -y && apt-get install rsync zip -y # Install Buck - install_buck_tooling diff --git a/.flowconfig b/.flowconfig index 16f997971fe0db..081e6ba894124f 100644 --- a/.flowconfig +++ b/.flowconfig @@ -86,4 +86,4 @@ untyped-import untyped-type-import [version] -^0.129.0 +^0.130.0 diff --git a/.flowconfig.android b/.flowconfig.android index 5fcc18922577d3..806ab8d0f6a043 100644 --- a/.flowconfig.android +++ b/.flowconfig.android @@ -89,4 +89,4 @@ untyped-import untyped-type-import [version] -^0.129.0 +^0.130.0 diff --git a/.flowconfig.macos b/.flowconfig.macos index 020edb4e834b4c..962e542dc83692 100644 --- a/.flowconfig.macos +++ b/.flowconfig.macos @@ -85,4 +85,4 @@ untyped-import untyped-type-import [version] -^0.129.0 +^0.130.0 diff --git a/ECOSYSTEM.md b/ECOSYSTEM.md index 2095cbad199a46..75dc1ec14d3d25 100644 --- a/ECOSYSTEM.md +++ b/ECOSYSTEM.md @@ -10,14 +10,15 @@ There are three types of stakeholders: ## Partners -Partners are companies that are significantly invested in React Native and have been for years. Informed by their use of React Native, they push for improvements of the core and/or the ecosystem around it. Facebook's partners think of React Native as a product: they understand the trade offs that the project makes as well as future plans and goals. Together we shape the vision for React Native to make it the best way to build applications. +Partners are companies that are significantly invested in React Native and have been for years. Informed by their use of React Native, they push for improvements of the core and/or the ecosystem around it. Partners think of React Native as a product: they understand the trade offs that the project makes as well as future plans and goals. Together we shape the vision for React Native to make it the best way to build applications. -Our current set of partners include Callstack, Expo, Infinite Red, Microsoft and Software Mansion. Many engineers from these companies are core contributors, and their partner responsibilities also include: +React Native's current set of partners include Callstack, Expo, Facebook, Infinite Red, Microsoft and Software Mansion. Many engineers from these companies are core contributors, and their partner responsibilities also include: * **[Callstack](https://callstack.com/):** Manages releases, maintains the [React Native CLI](https://github.com/react-native-community/react-native-cli) and organizes [React Native EU](https://react-native.eu/) * **[Expo](https://expo.io/):** Builds [expo](https://github.com/expo/expo) on top of React Native to simplify app development +* **[Facebook](https://opensource.facebook.com):** Oversees the React Native product and maintains the [React Native core repo](https://reactnative.dev/) * **[Infinite Red](https://infinite.red/):** Maintains the [ignite cli/boilerplate](https://github.com/infinitered/ignite), organizes [Chain React Conf](https://infinite.red/ChainReactConf) -* **[Microsoft](https://www.microsoft.com/en-gb/):** Develops [React Native Windows](https://github.com/Microsoft/react-native-windows) for the Universal Windows Platform (UWP) +* **[Microsoft](http://aka.ms/reactnative):** Develops [React Native Windows](https://github.com/Microsoft/react-native-windows) and [React Native macOS](https://github.com/microsoft/react-native-macos) for building apps that target Windows and macOS * **[Software Mansion](https://swmansion.com/):** Maintain core infrastructure including JSC, Animated, and other popular third-party plugins. In terms of open source work, pull requests from partners are commonly prioritized. When you are contributing to React Native, you'll most likely meet somebody who works at one of the partner companies and who is a core contributor: diff --git a/IntegrationTests/GlobalEvalWithSourceUrlTest.js b/IntegrationTests/GlobalEvalWithSourceUrlTest.js index 52fbe0e2fa8aa7..a30bfeec12df1a 100644 --- a/IntegrationTests/GlobalEvalWithSourceUrlTest.js +++ b/IntegrationTests/GlobalEvalWithSourceUrlTest.js @@ -59,7 +59,7 @@ class GlobalEvalWithSourceUrlTest extends React.Component<{...}> { 'Expected globalEvalWithSourceUrl to throw an Error object', ); } - const parsedStack = parseErrorStack(error); + const parsedStack = parseErrorStack(error?.stack); if (parsedStack[0].file !== url) { throw new Error( `Expected first eval stack frame to be in ${url} but found ${String( diff --git a/Libraries/ART/ARTCGFloatArray.h b/Libraries/ART/ARTCGFloatArray.h deleted file mode 100644 index c71adf73371b6c..00000000000000 --- a/Libraries/ART/ARTCGFloatArray.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -// A little helper to make sure we have the right memory allocation ready for use. -// We assume that we will only this in one place so no reference counting is necessary. -// Needs to be freed when deallocated. - -// This is fragile since this relies on these values not getting reused. Consider -// wrapping these in an Obj-C class or some ARC hackery to get refcounting. - -typedef struct { - size_t count; - CGFloat *array; -} ARTCGFloatArray; diff --git a/Libraries/ART/ARTContainer.h b/Libraries/ART/ARTContainer.h deleted file mode 100644 index 96c393fed9e930..00000000000000 --- a/Libraries/ART/ARTContainer.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@protocol ARTContainer - -// This is used as a hook for child to mark it's parent as dirty. -// This bubbles up to the root which gets marked as dirty. -- (void)invalidate; - -@end diff --git a/Libraries/ART/ARTGroup.h b/Libraries/ART/ARTGroup.h deleted file mode 100644 index 16749792176065..00000000000000 --- a/Libraries/ART/ARTGroup.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import "ARTContainer.h" -#import "ARTNode.h" - -@interface ARTGroup : ARTNode - -@property (nonatomic, assign) CGRect clipping; - -@end diff --git a/Libraries/ART/ARTGroup.m b/Libraries/ART/ARTGroup.m deleted file mode 100644 index 8a863f74c2a6c0..00000000000000 --- a/Libraries/ART/ARTGroup.m +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@implementation ARTGroup - -- (void)renderLayerTo:(CGContextRef)context -{ - if (!CGRectIsEmpty(self.clipping)) { - CGContextClipToRect(context, self.clipping); - } - - for (RCTPlatformView *subview in self.subviews) { // TODO(macOS GH#774) - if ([subview respondsToSelector:@selector(renderTo:)]) { - [(ARTNode *)subview renderTo:context]; - } else { - // This is needed for legacy interop layer. Legacy interop layer - // is superview of the view that it is bridging, that's why we need - // to grab its first subview. - [(ARTNode *)subview.subviews.firstObject renderTo:context]; - } - } -} - -@end diff --git a/Libraries/ART/ARTNode.h b/Libraries/ART/ARTNode.h deleted file mode 100644 index c4a13c0e701628..00000000000000 --- a/Libraries/ART/ARTNode.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -/** - * ART nodes are implemented as empty UIViews but this is just an implementation detail to fit - * into the existing view management. They should also be shadow views and painted on a background - * thread. - */ - -@interface ARTNode : RCTUIView // TODO(macOS ISS#3536887) - -@property (nonatomic, assign) CGFloat opacity; - -- (void)invalidate; -- (void)renderTo:(CGContextRef)context; - -/** - * renderTo will take opacity into account and draw renderLayerTo off-screen if there is opacity - * specified, then composite that onto the context. renderLayerTo always draws at opacity=1. - * @abstract - */ -- (void)renderLayerTo:(CGContextRef)context; - -@end diff --git a/Libraries/ART/ARTNode.m b/Libraries/ART/ARTNode.m deleted file mode 100644 index 9b96d16bcc1938..00000000000000 --- a/Libraries/ART/ARTNode.m +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -@implementation ARTNode - -- (void)insertReactSubview:(RCTUIView *)subview atIndex:(NSInteger)atIndex // TODO(macOS ISS#3536887) -{ - [super insertReactSubview:subview atIndex:atIndex]; - [self insertSubview:subview atIndex:atIndex]; - [self invalidate]; -} - -- (void)removeReactSubview:(RCTUIView *)subview // TODO(macOS ISS#3536887) -{ - [super removeReactSubview:subview]; - [self invalidate]; -} - -- (void)didUpdateReactSubviews -{ - // Do nothing, as subviews are inserted by insertReactSubview: -} - -- (void)setOpacity:(CGFloat)opacity -{ - [self invalidate]; - _opacity = opacity; -} - -- (void)setTransform:(CGAffineTransform)transform -{ - [self invalidate]; - super.transform = transform; -} - -- (void)invalidate -{ - if ([self.superview respondsToSelector:@selector(invalidate)]) { - id container = (id)self.superview; - [container invalidate]; - } -} - -- (void)renderTo:(CGContextRef)context -{ - if (self.opacity <= 0) { - // Nothing to paint - return; - } - if (self.opacity >= 1) { - // Just paint at full opacity - CGContextSaveGState(context); - CGContextConcatCTM(context, self.transform); - CGContextSetAlpha(context, 1); - [self renderLayerTo:context]; - CGContextRestoreGState(context); - return; - } - // This needs to be painted on a layer before being composited. - CGContextSaveGState(context); - CGContextConcatCTM(context, self.transform); - CGContextSetAlpha(context, self.opacity); - CGContextBeginTransparencyLayer(context, NULL); - [self renderLayerTo:context]; - CGContextEndTransparencyLayer(context); - CGContextRestoreGState(context); -} - -- (void)renderLayerTo:(CGContextRef)context -{ - // abstract -} - -@end diff --git a/Libraries/ART/ARTRenderable.h b/Libraries/ART/ARTRenderable.h deleted file mode 100644 index 0fb86bd9b8511a..00000000000000 --- a/Libraries/ART/ARTRenderable.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import "ARTBrush.h" -#import "ARTCGFloatArray.h" -#import "ARTNode.h" - -@interface ARTRenderable : ARTNode - -@property (nonatomic, strong) ARTBrush *fill; -@property (nonatomic, assign) CGColorRef stroke; -@property (nonatomic, assign) CGFloat strokeWidth; -@property (nonatomic, assign) CGLineCap strokeCap; -@property (nonatomic, assign) CGLineJoin strokeJoin; -@property (nonatomic, assign) ARTCGFloatArray strokeDash; - -@end diff --git a/Libraries/ART/ARTRenderable.m b/Libraries/ART/ARTRenderable.m deleted file mode 100644 index e99bda698c7241..00000000000000 --- a/Libraries/ART/ARTRenderable.m +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@implementation ARTRenderable - -- (void)setFill:(ARTBrush *)fill -{ - [self invalidate]; - _fill = fill; -} - -- (void)setStroke:(CGColorRef)stroke -{ - if (stroke == _stroke) { - return; - } - [self invalidate]; - CGColorRelease(_stroke); - _stroke = CGColorRetain(stroke); -} - -- (void)setStrokeWidth:(CGFloat)strokeWidth -{ - [self invalidate]; - _strokeWidth = strokeWidth; -} - -- (void)setStrokeCap:(CGLineCap)strokeCap -{ - [self invalidate]; - _strokeCap = strokeCap; -} - -- (void)setStrokeJoin:(CGLineJoin)strokeJoin -{ - [self invalidate]; - _strokeJoin = strokeJoin; -} - -- (void)setStrokeDash:(ARTCGFloatArray)strokeDash -{ - if (strokeDash.array == _strokeDash.array) { - return; - } - if (_strokeDash.array) { - free(_strokeDash.array); - } - [self invalidate]; - _strokeDash = strokeDash; -} - -- (void)dealloc -{ - CGColorRelease(_stroke); - if (_strokeDash.array) { - free(_strokeDash.array); - } -} - -- (void)renderTo:(CGContextRef)context -{ - if (self.opacity <= 0 || self.opacity >= 1 || (self.fill && self.stroke)) { - // If we have both fill and stroke, we will need to paint this using normal compositing - [super renderTo: context]; - return; - } - // This is a terminal with only one painting. Therefore we don't need to paint this - // off-screen. We can just composite it straight onto the buffer. - CGContextSaveGState(context); - CGContextConcatCTM(context, self.transform); - CGContextSetAlpha(context, self.opacity); - [self renderLayerTo:context]; - CGContextRestoreGState(context); -} - -- (void)renderLayerTo:(CGContextRef)context -{ - // abstract -} - -@end diff --git a/Libraries/ART/ARTShape.h b/Libraries/ART/ARTShape.h deleted file mode 100644 index 356c2d240c6eba..00000000000000 --- a/Libraries/ART/ARTShape.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import "ARTRenderable.h" - -@interface ARTShape : ARTRenderable - -@property (nonatomic, assign) CGPathRef d; - -@end diff --git a/Libraries/ART/ARTShape.m b/Libraries/ART/ARTShape.m deleted file mode 100644 index 0a70e3bbf17786..00000000000000 --- a/Libraries/ART/ARTShape.m +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@implementation ARTShape - -- (void)setD:(CGPathRef)d -{ - if (d == _d) { - return; - } - [self invalidate]; - CGPathRelease(_d); - _d = CGPathRetain(d); -} - -- (void)dealloc -{ - CGPathRelease(_d); -} - -- (void)renderLayerTo:(CGContextRef)context -{ - if ((!self.fill && !self.stroke) || !self.d) { - return; - } - - CGPathDrawingMode mode = kCGPathStroke; - if (self.fill) { - if ([self.fill applyFillColor:context]) { - mode = kCGPathFill; - } else { - CGContextSaveGState(context); - CGContextAddPath(context, self.d); - CGContextClip(context); - [self.fill paint:context]; - CGContextRestoreGState(context); - if (!self.stroke) { - return; - } - } - } - if (self.stroke) { - CGContextSetStrokeColorWithColor(context, self.stroke); - CGContextSetLineWidth(context, self.strokeWidth); - CGContextSetLineCap(context, self.strokeCap); - CGContextSetLineJoin(context, self.strokeJoin); - ARTCGFloatArray dash = self.strokeDash; - if (dash.count) { - CGContextSetLineDash(context, 0, dash.array, dash.count); - } - if (mode == kCGPathFill) { - mode = kCGPathFillStroke; - } - } - - CGContextAddPath(context, self.d); - CGContextDrawPath(context, mode); -} - -@end diff --git a/Libraries/ART/ARTSurfaceView.m b/Libraries/ART/ARTSurfaceView.m deleted file mode 100644 index 92c8836b57ceb0..00000000000000 --- a/Libraries/ART/ARTSurfaceView.m +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -#import - -@implementation ARTSurfaceView - -- (instancetype)initWithFrame:(CGRect)frame -{ - if (self = [super initWithFrame:frame]) { - self.opaque = NO; - } - - return self; -} - -- (void)insertReactSubview:(RCTUIView *)subview atIndex:(NSInteger)atIndex // TODO(macOS ISS#3536887) -{ - [super insertReactSubview:subview atIndex:atIndex]; - [self insertSubview:subview atIndex:atIndex]; - [self invalidate]; -} - -- (void)removeReactSubview:(RCTUIView *)subview // TODO(macOS ISS#3536887) -{ - [super removeReactSubview:subview]; - [self invalidate]; -} - -- (void)didUpdateReactSubviews -{ - // Do nothing, as subviews are inserted by insertReactSubview: -} - -- (void)invalidate -{ - [self setNeedsDisplay]; -} - -- (void)drawRect:(CGRect)rect -{ - [super drawRect:rect]; - CGContextRef context = UIGraphicsGetCurrentContext(); - for (RCTPlatformView *subview in self.subviews) { - if ([subview respondsToSelector:@selector(renderTo:)]) { - [(ARTNode *)subview renderTo:context]; - } else { - // This is needed for legacy interop layer. Legacy interop layer - // is superview of the view that it is bridging, that's why we need - // to grab its first subview. - [(ARTNode *)subview.subviews.firstObject renderTo:context]; - } - } -} - -@end diff --git a/Libraries/ART/ARTText.h b/Libraries/ART/ARTText.h deleted file mode 100644 index 539cbd7feb8e81..00000000000000 --- a/Libraries/ART/ARTText.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import "ARTRenderable.h" -#import "ARTTextFrame.h" - -@interface ARTText : ARTRenderable - -@property (nonatomic, assign) CTTextAlignment alignment; -@property (nonatomic, assign) ARTTextFrame textFrame; - -@end diff --git a/Libraries/ART/ARTText.m b/Libraries/ART/ARTText.m deleted file mode 100644 index 0a7709d169cac0..00000000000000 --- a/Libraries/ART/ARTText.m +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -@implementation ARTText - -- (void)setAlignment:(CTTextAlignment)alignment -{ - [self invalidate]; - _alignment = alignment; -} - -static void ARTFreeTextFrame(ARTTextFrame frame) -{ - if (frame.count) { - // We must release each line before freeing up this struct - for (int i = 0; i < frame.count; i++) { - CFRelease(frame.lines[i]); - } - free(frame.lines); - free(frame.widths); - } -} - -- (void)setTextFrame:(ARTTextFrame)frame -{ - if (frame.lines != _textFrame.lines) { - ARTFreeTextFrame(_textFrame); - } - [self invalidate]; - _textFrame = frame; -} - -- (void)dealloc -{ - ARTFreeTextFrame(_textFrame); -} - -- (void)renderLayerTo:(CGContextRef)context -{ - ARTTextFrame frame = self.textFrame; - - if ((!self.fill && !self.stroke) || !frame.count) { - return; - } - - // to-do: draw along a path - - CGTextDrawingMode mode = kCGTextStroke; - if (self.fill) { - if ([self.fill applyFillColor:context]) { - mode = kCGTextFill; - } else { - - for (int i = 0; i < frame.count; i++) { - CGContextSaveGState(context); - // Inverse the coordinate space since CoreText assumes a bottom-up coordinate space - CGContextScaleCTM(context, 1.0, -1.0); - CGContextSetTextDrawingMode(context, kCGTextClip); - [self renderLineTo:context atIndex:i]; - // Inverse the coordinate space back to the original before filling - CGContextScaleCTM(context, 1.0, -1.0); - [self.fill paint:context]; - // Restore the state so that the next line can be clipped separately - CGContextRestoreGState(context); - } - - if (!self.stroke) { - return; - } - } - } - if (self.stroke) { - CGContextSetStrokeColorWithColor(context, self.stroke); - CGContextSetLineWidth(context, self.strokeWidth); - CGContextSetLineCap(context, self.strokeCap); - CGContextSetLineJoin(context, self.strokeJoin); - ARTCGFloatArray dash = self.strokeDash; - if (dash.count) { - CGContextSetLineDash(context, 0, dash.array, dash.count); - } - if (mode == kCGTextFill) { - mode = kCGTextFillStroke; - } - } - - CGContextSetTextDrawingMode(context, mode); - - // Inverse the coordinate space since CoreText assumes a bottom-up coordinate space - CGContextScaleCTM(context, 1.0, -1.0); - for (int i = 0; i < frame.count; i++) { - [self renderLineTo:context atIndex:i]; - } -} - -- (void)renderLineTo:(CGContextRef)context atIndex:(int)index -{ - ARTTextFrame frame = self.textFrame; - CGFloat shift; - switch (self.alignment) { - case kCTTextAlignmentRight: - shift = frame.widths[index]; - break; - case kCTTextAlignmentCenter: - shift = (frame.widths[index] / 2); - break; - default: - shift = 0; - break; - } - // We should consider snapping this shift to device pixels to improve rendering quality - // when a line has subpixel width. - CGContextSetTextPosition(context, -shift, -frame.baseLine - frame.lineHeight * index); - CTLineRef line = frame.lines[index]; - CTLineDraw(line, context); -} - -@end diff --git a/Libraries/ART/ARTTextFrame.h b/Libraries/ART/ARTTextFrame.h deleted file mode 100644 index 4b77fcf33c9bcb..00000000000000 --- a/Libraries/ART/ARTTextFrame.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -// A little helper to make sure we have a set of lines including width ready for use. -// We assume that we will only this in one place so no reference counting is necessary. -// Needs to be freed when deallocated. - -// This is fragile since this relies on these values not getting reused. Consider -// wrapping these in an Obj-C class or some ARC hackery to get refcounting. - -typedef struct { - size_t count; - CGFloat baseLine; // Distance from the origin to the base line of the first line - CGFloat lineHeight; // Distance between lines - CTLineRef *lines; - CGFloat *widths; // Width of each line -} ARTTextFrame; diff --git a/Libraries/ART/Brushes/ARTBrush.h b/Libraries/ART/Brushes/ARTBrush.h deleted file mode 100644 index 018246a267da48..00000000000000 --- a/Libraries/ART/Brushes/ARTBrush.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#import - -@interface ARTBrush : NSObject - -/* @abstract */ -- (instancetype)initWithArray:(NSArray *)data NS_DESIGNATED_INITIALIZER; - -/** - * For certain brushes we can fast path a combined fill and stroke. - * For those brushes we override applyFillColor which sets the fill - * color to be used by those batch paints. Those return YES. - * We can't batch gradient painting in CoreGraphics, so those will - * return NO and paint gets called instead. - * @abstract - */ -- (BOOL)applyFillColor:(CGContextRef)context; - -/** - * paint fills the context with a brush. The context is assumed to - * be clipped. - * @abstract - */ -- (void)paint:(CGContextRef)context; - -@end diff --git a/Libraries/ART/Brushes/ARTBrush.m b/Libraries/ART/Brushes/ARTBrush.m deleted file mode 100644 index 478e8a9526b0fd..00000000000000 --- a/Libraries/ART/Brushes/ARTBrush.m +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -@implementation ARTBrush - -- (instancetype)initWithArray:(NSArray *)data -{ - return [super init]; -} - -RCT_NOT_IMPLEMENTED(- (instancetype)init) - -- (BOOL)applyFillColor:(CGContextRef)context -{ - return NO; -} - -- (void)paint:(CGContextRef)context -{ - // abstract -} - -@end diff --git a/Libraries/ART/Brushes/ARTLinearGradient.h b/Libraries/ART/Brushes/ARTLinearGradient.h deleted file mode 100644 index d177081c714fe1..00000000000000 --- a/Libraries/ART/Brushes/ARTLinearGradient.h +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ARTBrush.h" - -@interface ARTLinearGradient : ARTBrush - -@end diff --git a/Libraries/ART/Brushes/ARTLinearGradient.m b/Libraries/ART/Brushes/ARTLinearGradient.m deleted file mode 100644 index 365821fb9a9de9..00000000000000 --- a/Libraries/ART/Brushes/ARTLinearGradient.m +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -#import "RCTConvert+ART.h" - -@implementation ARTLinearGradient -{ - CGGradientRef _gradient; - CGPoint _startPoint; - CGPoint _endPoint; -} - -- (instancetype)initWithArray:(NSArray *)array -{ - if ((self = [super initWithArray:array])) { - if (array.count < 5) { - RCTLogError(@"-[%@ %@] expects 5 elements, received %@", - self.class, NSStringFromSelector(_cmd), array); - return nil; - } - _startPoint = [RCTConvert CGPoint:array offset:1]; - _endPoint = [RCTConvert CGPoint:array offset:3]; - _gradient = CGGradientRetain([RCTConvert CGGradient:array offset:5]); - } - return self; -} - -- (void)dealloc -{ - CGGradientRelease(_gradient); -} - -- (void)paint:(CGContextRef)context -{ - CGGradientDrawingOptions extendOptions = - kCGGradientDrawsBeforeStartLocation | kCGGradientDrawsAfterEndLocation; - CGContextDrawLinearGradient(context, _gradient, _startPoint, _endPoint, extendOptions); -} - -@end diff --git a/Libraries/ART/Brushes/ARTPattern.h b/Libraries/ART/Brushes/ARTPattern.h deleted file mode 100644 index 72270ab8aa2020..00000000000000 --- a/Libraries/ART/Brushes/ARTPattern.h +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ARTBrush.h" - -@interface ARTPattern : ARTBrush - -@end diff --git a/Libraries/ART/Brushes/ARTPattern.m b/Libraries/ART/Brushes/ARTPattern.m deleted file mode 100644 index 3f369b32d4f695..00000000000000 --- a/Libraries/ART/Brushes/ARTPattern.m +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -#import "RCTConvert+ART.h" - -@implementation ARTPattern -{ - CGImageRef _image; - CGRect _rect; -} - -- (instancetype)initWithArray:(NSArray *)array -{ - if ((self = [super initWithArray:array])) { - if (array.count < 6) { - RCTLogError(@"-[%@ %@] expects 6 elements, received %@", - self.class, NSStringFromSelector(_cmd), array); - return nil; - } - _image = CGImageRetain([RCTConvert CGImage:array[1]]); - _rect = [RCTConvert CGRect:array offset:2]; - } - return self; -} - -- (void)dealloc -{ - CGImageRelease(_image); -} - -// Note: This could use applyFillColor with a pattern. This could be more efficient but -// to do that, we need to calculate our own user space CTM. - -- (void)paint:(CGContextRef)context -{ - CGContextDrawTiledImage(context, _rect, _image); -} - - - -@end diff --git a/Libraries/ART/Brushes/ARTRadialGradient.h b/Libraries/ART/Brushes/ARTRadialGradient.h deleted file mode 100644 index 8759649bd43a88..00000000000000 --- a/Libraries/ART/Brushes/ARTRadialGradient.h +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ARTBrush.h" - -@interface ARTRadialGradient : ARTBrush - -@end diff --git a/Libraries/ART/Brushes/ARTRadialGradient.m b/Libraries/ART/Brushes/ARTRadialGradient.m deleted file mode 100644 index 6a93994a7b3237..00000000000000 --- a/Libraries/ART/Brushes/ARTRadialGradient.m +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -#import "RCTConvert+ART.h" - -@implementation ARTRadialGradient -{ - CGGradientRef _gradient; - CGPoint _focusPoint; - CGPoint _centerPoint; - CGFloat _radius; - CGFloat _radiusRatio; -} - -- (instancetype)initWithArray:(NSArray *)array -{ - if ((self = [super initWithArray:array])) { - if (array.count < 7) { - RCTLogError(@"-[%@ %@] expects 7 elements, received %@", - self.class, NSStringFromSelector(_cmd), array); - return nil; - } - _radius = [RCTConvert CGFloat:array[3]]; - _radiusRatio = [RCTConvert CGFloat:array[4]] / _radius; - _focusPoint.x = [RCTConvert CGFloat:array[1]]; - _focusPoint.y = [RCTConvert CGFloat:array[2]] / _radiusRatio; - _centerPoint.x = [RCTConvert CGFloat:array[5]]; - _centerPoint.y = [RCTConvert CGFloat:array[6]] / _radiusRatio; - _gradient = CGGradientRetain([RCTConvert CGGradient:array offset:7]); - } - return self; -} - -- (void)dealloc -{ - CGGradientRelease(_gradient); -} - -- (void)paint:(CGContextRef)context -{ - CGAffineTransform transform = CGAffineTransformMakeScale(1, _radiusRatio); - CGContextConcatCTM(context, transform); - CGGradientDrawingOptions extendOptions = kCGGradientDrawsBeforeStartLocation | kCGGradientDrawsAfterEndLocation; - CGContextDrawRadialGradient(context, _gradient, _focusPoint, 0, _centerPoint, _radius, extendOptions); -} - -@end diff --git a/Libraries/ART/Brushes/ARTSolidColor.h b/Libraries/ART/Brushes/ARTSolidColor.h deleted file mode 100644 index 27765c6843ef6c..00000000000000 --- a/Libraries/ART/Brushes/ARTSolidColor.h +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ARTBrush.h" - -@interface ARTSolidColor : ARTBrush - -@end diff --git a/Libraries/ART/Brushes/ARTSolidColor.m b/Libraries/ART/Brushes/ARTSolidColor.m deleted file mode 100644 index c7e3991cf88c00..00000000000000 --- a/Libraries/ART/Brushes/ARTSolidColor.m +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -#import "RCTConvert+ART.h" - -@implementation ARTSolidColor -{ - CGColorRef _color; -} - -- (instancetype)initWithArray:(NSArray *)array -{ - if ((self = [super initWithArray:array])) { - _color = CGColorRetain([RCTConvert CGColor:array offset:1]); - } - return self; -} - -- (void)dealloc -{ - CGColorRelease(_color); -} - -- (BOOL)applyFillColor:(CGContextRef)context -{ - CGContextSetFillColorWithColor(context, _color); - return YES; -} - -@end diff --git a/Libraries/ART/RCTConvert+ART.h b/Libraries/ART/RCTConvert+ART.h deleted file mode 100644 index 2225e186c50d56..00000000000000 --- a/Libraries/ART/RCTConvert+ART.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -#import "ARTBrush.h" -#import "ARTCGFloatArray.h" -#import "ARTTextFrame.h" - -@interface RCTConvert (ART) - -+ (CGPathRef)CGPath:(id)json CF_RETURNS_NOT_RETAINED; -+ (CTTextAlignment)CTTextAlignment:(id)json; -+ (ARTTextFrame)ARTTextFrame:(id)json; -+ (ARTCGFloatArray)ARTCGFloatArray:(id)json; -+ (ARTBrush *)ARTBrush:(id)json; - -+ (CGPoint)CGPoint:(id)json offset:(NSUInteger)offset; -+ (CGRect)CGRect:(id)json offset:(NSUInteger)offset; -+ (CGColorRef)CGColor:(id)json offset:(NSUInteger)offset CF_RETURNS_NOT_RETAINED; -+ (CGGradientRef)CGGradient:(id)json offset:(NSUInteger)offset CF_RETURNS_NOT_RETAINED; - -@end diff --git a/Libraries/ART/RCTConvert+ART.m b/Libraries/ART/RCTConvert+ART.m deleted file mode 100644 index a8299d947cc7e6..00000000000000 --- a/Libraries/ART/RCTConvert+ART.m +++ /dev/null @@ -1,222 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTConvert+ART.h" - -#import -#import - -#import -#import -#import -#import - -@implementation RCTConvert (ART) - -+ (CGPathRef)CGPath:(id)json -{ - NSArray *arr = [self NSNumberArray:json]; - - NSUInteger count = [arr count]; - -#define NEXT_VALUE [self double:arr[i++]] - - CGMutablePathRef path = CGPathCreateMutable(); - CGPathMoveToPoint(path, NULL, 0, 0); - - @try { - NSUInteger i = 0; - while (i < count) { - NSUInteger type = [arr[i++] unsignedIntegerValue]; - switch (type) { - case 0: - CGPathMoveToPoint(path, NULL, NEXT_VALUE, NEXT_VALUE); - break; - case 1: - CGPathCloseSubpath(path); - break; - case 2: - CGPathAddLineToPoint(path, NULL, NEXT_VALUE, NEXT_VALUE); - break; - case 3: - CGPathAddCurveToPoint(path, NULL, NEXT_VALUE, NEXT_VALUE, NEXT_VALUE, NEXT_VALUE, NEXT_VALUE, NEXT_VALUE); - break; - case 4: - CGPathAddArc(path, NULL, NEXT_VALUE, NEXT_VALUE, NEXT_VALUE, NEXT_VALUE, NEXT_VALUE, NEXT_VALUE == 0); - break; - default: - RCTLogError(@"Invalid CGPath type %llu at element %llu of %@", (unsigned long long)type, (unsigned long long)i, arr); - CGPathRelease(path); - return NULL; - } - } - } - @catch (NSException *exception) { - RCTLogError(@"Invalid CGPath format: %@", arr); - CGPathRelease(path); - return NULL; - } - - return (CGPathRef)CFAutorelease(path); -} - -RCT_ENUM_CONVERTER(CTTextAlignment, (@{ - @"auto": @(kCTTextAlignmentNatural), - @"left": @(kCTTextAlignmentLeft), - @"center": @(kCTTextAlignmentCenter), - @"right": @(kCTTextAlignmentRight), - @"justify": @(kCTTextAlignmentJustified), -}), kCTTextAlignmentNatural, integerValue) - -// This takes a tuple of text lines and a font to generate a CTLine for each text line. -// This prepares everything for rendering a frame of text in ARTText. -+ (ARTTextFrame)ARTTextFrame:(id)json -{ - NSDictionary *dict = [self NSDictionary:json]; - ARTTextFrame frame; - frame.count = 0; - - NSArray *lines = [self NSArray:dict[@"lines"]]; - NSUInteger lineCount = [lines count]; - if (lineCount == 0) { - return frame; - } - - CTFontRef font = (__bridge CTFontRef)[self UIFont:dict[@"font"]]; - if (!font) { - return frame; - } - - // Create a dictionary for this font - CFDictionaryRef attributes = (__bridge CFDictionaryRef)@{ - (NSString *)kCTFontAttributeName:(__bridge id)font, - (NSString *)kCTForegroundColorFromContextAttributeName: @YES - }; - - // Set up text frame with font metrics - CGFloat size = CTFontGetSize(font); - frame.count = lineCount; - frame.baseLine = size; // estimate base line - frame.lineHeight = size * 1.1; // Base on ART canvas line height estimate - frame.lines = malloc(sizeof(CTLineRef) * lineCount); - frame.widths = malloc(sizeof(CGFloat) * lineCount); - - [lines enumerateObjectsUsingBlock:^(NSString *text, NSUInteger i, BOOL *stop) { - - CFStringRef string = (__bridge CFStringRef)text; - CFAttributedStringRef attrString = CFAttributedStringCreate(kCFAllocatorDefault, string, attributes); - CTLineRef line = CTLineCreateWithAttributedString(attrString); - CFRelease(attrString); - - frame.lines[i] = line; - frame.widths[i] = CTLineGetTypographicBounds(line, NULL, NULL, NULL); - }]; - - return frame; -} - -+ (ARTCGFloatArray)ARTCGFloatArray:(id)json -{ - NSArray *arr = [self NSNumberArray:json]; - NSUInteger count = arr.count; - - ARTCGFloatArray array; - array.count = count; - array.array = NULL; - - if (count) { - // Ideally, these arrays should already use the same memory layout. - // In that case we shouldn't need this new malloc. - array.array = malloc(sizeof(CGFloat) * count); - for (NSUInteger i = 0; i < count; i++) { - array.array[i] = [arr[i] doubleValue]; - } - } - - return array; -} - -+ (ARTBrush *)ARTBrush:(id)json -{ - NSArray *arr = [self NSArray:json]; - NSUInteger type = [self NSUInteger:arr.firstObject]; - switch (type) { - case 0: // solid color - // These are probably expensive allocations since it's often the same value. - // We should memoize colors but look ups may be just as expensive. - return [[ARTSolidColor alloc] initWithArray:arr]; - case 1: // linear gradient - return [[ARTLinearGradient alloc] initWithArray:arr]; - case 2: // radial gradient - return [[ARTRadialGradient alloc] initWithArray:arr]; - case 3: // pattern - return [[ARTPattern alloc] initWithArray:arr]; - default: - RCTLogError(@"Unknown brush type: %llu", (unsigned long long)type); - return nil; - } -} - -+ (CGPoint)CGPoint:(id)json offset:(NSUInteger)offset -{ - NSArray *arr = [self NSArray:json]; - if (arr.count < offset + 2) { - RCTLogError(@"Too few elements in array (expected at least %llu): %@", (unsigned long long)(2 + offset), arr); - return CGPointZero; - } - return (CGPoint){ - [self CGFloat:arr[offset]], - [self CGFloat:arr[offset + 1]], - }; -} - -+ (CGRect)CGRect:(id)json offset:(NSUInteger)offset -{ - NSArray *arr = [self NSArray:json]; - if (arr.count < offset + 4) { - RCTLogError(@"Too few elements in array (expected at least %llu): %@", (unsigned long long)(4 + offset), arr); - return CGRectZero; - } - return (CGRect){ - {[self CGFloat:arr[offset]], [self CGFloat:arr[offset + 1]]}, - {[self CGFloat:arr[offset + 2]], [self CGFloat:arr[offset + 3]]}, - }; -} - -+ (CGColorRef)CGColor:(id)json offset:(NSUInteger)offset -{ - NSArray *arr = [self NSArray:json]; - if (arr.count < offset + 4) { - RCTLogError(@"Too few elements in array (expected at least %llu): %@", (unsigned long long)(4 + offset), arr); - return NULL; - } - return [self CGColor:[arr subarrayWithRange:(NSRange){offset, 4}]]; -} - -+ (CGGradientRef)CGGradient:(id)json offset:(NSUInteger)offset -{ - NSArray *arr = [self NSArray:json]; - if (arr.count < offset) { - RCTLogError(@"Too few elements in array (expected at least %llu): %@", (unsigned long long)offset, arr); - return NULL; - } - arr = [arr subarrayWithRange:(NSRange){offset, arr.count - offset}]; - ARTCGFloatArray colorsAndOffsets = [self ARTCGFloatArray:arr]; - size_t stops = colorsAndOffsets.count / 5; - CGColorSpaceRef rgb = CGColorSpaceCreateDeviceRGB(); - CGGradientRef gradient = CGGradientCreateWithColorComponents( - rgb, - colorsAndOffsets.array, - colorsAndOffsets.array + stops * 4, - stops - ); - CGColorSpaceRelease(rgb); - free(colorsAndOffsets.array); - return (CGGradientRef)CFAutorelease(gradient); -} - -@end diff --git a/Libraries/ART/React-ART.podspec b/Libraries/ART/React-ART.podspec deleted file mode 100644 index 7f33d56724fba9..00000000000000 --- a/Libraries/ART/React-ART.podspec +++ /dev/null @@ -1,33 +0,0 @@ -# Copyright (c) Facebook, Inc. and its affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -require "json" - -package = JSON.parse(File.read(File.join(__dir__, "..", "..", "package.json"))) -version = package['version'] - -source = { :git => 'https://github.com/facebook/react-native.git' } -if version == '1000.0.0' - # This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in. - source[:commit] = `git rev-parse HEAD`.strip -else - source[:tag] = "v#{version}" -end - -Pod::Spec.new do |s| - s.name = "React-ART" - s.version = version - s.summary = "A library for drawing vector graphics." - s.homepage = "https://reactnative.dev/" - s.license = package["license"] - s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "10.0", :tvos => "10.0", :osx => "10.14" } # TODO(macOS GH#214) - s.source = source - s.source_files = "**/*.{m}" - s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs" - s.header_dir = "ART" - - s.dependency "React-Core/ARTHeaders", version -end diff --git a/Libraries/ART/ViewManagers/ARTGroupManager.h b/Libraries/ART/ViewManagers/ARTGroupManager.h deleted file mode 100644 index 1663c7a7fda82e..00000000000000 --- a/Libraries/ART/ViewManagers/ARTGroupManager.h +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ARTNodeManager.h" - -@interface ARTGroupManager : ARTNodeManager - -@end diff --git a/Libraries/ART/ViewManagers/ARTGroupManager.m b/Libraries/ART/ViewManagers/ARTGroupManager.m deleted file mode 100644 index 5a1a1c0392eeb1..00000000000000 --- a/Libraries/ART/ViewManagers/ARTGroupManager.m +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import -#import "RCTConvert+ART.h" - -@implementation ARTGroupManager - -RCT_EXPORT_MODULE() - -- (ARTNode *)node -{ - return [ARTGroup new]; -} - -RCT_EXPORT_VIEW_PROPERTY(clipping, CGRect) - -@end diff --git a/Libraries/ART/ViewManagers/ARTNodeManager.h b/Libraries/ART/ViewManagers/ARTNodeManager.h deleted file mode 100644 index fd00745e6a8fcd..00000000000000 --- a/Libraries/ART/ViewManagers/ARTNodeManager.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@class ARTNode; - -@interface ARTNodeManager : RCTViewManager - -- (ARTNode *)node; - -@end diff --git a/Libraries/ART/ViewManagers/ARTNodeManager.m b/Libraries/ART/ViewManagers/ARTNodeManager.m deleted file mode 100644 index 0b62e44a29e167..00000000000000 --- a/Libraries/ART/ViewManagers/ARTNodeManager.m +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -@implementation ARTNodeManager - -RCT_EXPORT_MODULE() - -- (ARTNode *)node -{ - return [ARTNode new]; -} - -- (RCTUIView *)view // TODO(macOS ISS#3536887) -{ - return [self node]; -} - -- (RCTShadowView *)shadowView -{ - return nil; -} - -RCT_EXPORT_VIEW_PROPERTY(opacity, CGFloat) -RCT_EXPORT_VIEW_PROPERTY(transform, CGAffineTransform) - -@end diff --git a/Libraries/ART/ViewManagers/ARTRenderableManager.h b/Libraries/ART/ViewManagers/ARTRenderableManager.h deleted file mode 100644 index 72b550ebbfae05..00000000000000 --- a/Libraries/ART/ViewManagers/ARTRenderableManager.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ARTNodeManager.h" -#import "ARTRenderable.h" - -@interface ARTRenderableManager : ARTNodeManager - -- (ARTRenderable *)node; - -@end diff --git a/Libraries/ART/ViewManagers/ARTRenderableManager.m b/Libraries/ART/ViewManagers/ARTRenderableManager.m deleted file mode 100644 index 1f8d4a7814e9d2..00000000000000 --- a/Libraries/ART/ViewManagers/ARTRenderableManager.m +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import "RCTConvert+ART.h" - -@implementation ARTRenderableManager - -RCT_EXPORT_MODULE() - -- (ARTRenderable *)node -{ - return [ARTRenderable new]; -} - -RCT_EXPORT_VIEW_PROPERTY(strokeWidth, CGFloat) -RCT_EXPORT_VIEW_PROPERTY(strokeCap, CGLineCap) -RCT_EXPORT_VIEW_PROPERTY(strokeJoin, CGLineJoin) -RCT_EXPORT_VIEW_PROPERTY(fill, ARTBrush) -RCT_EXPORT_VIEW_PROPERTY(stroke, CGColor) -RCT_EXPORT_VIEW_PROPERTY(strokeDash, ARTCGFloatArray) - -@end diff --git a/Libraries/ART/ViewManagers/ARTShapeManager.h b/Libraries/ART/ViewManagers/ARTShapeManager.h deleted file mode 100644 index 1672c257cc642a..00000000000000 --- a/Libraries/ART/ViewManagers/ARTShapeManager.h +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ARTRenderableManager.h" - -@interface ARTShapeManager : ARTRenderableManager - -@end diff --git a/Libraries/ART/ViewManagers/ARTShapeManager.m b/Libraries/ART/ViewManagers/ARTShapeManager.m deleted file mode 100644 index 05fba6fac17f06..00000000000000 --- a/Libraries/ART/ViewManagers/ARTShapeManager.m +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import -#import "RCTConvert+ART.h" - -@implementation ARTShapeManager - -RCT_EXPORT_MODULE() - -- (ARTRenderable *)node -{ - return [ARTShape new]; -} - -RCT_EXPORT_VIEW_PROPERTY(d, CGPath) - -@end diff --git a/Libraries/ART/ViewManagers/ARTSurfaceViewManager.h b/Libraries/ART/ViewManagers/ARTSurfaceViewManager.h deleted file mode 100644 index b021c8dd4fcbeb..00000000000000 --- a/Libraries/ART/ViewManagers/ARTSurfaceViewManager.h +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@interface ARTSurfaceViewManager : RCTViewManager - -@end diff --git a/Libraries/ART/ViewManagers/ARTSurfaceViewManager.m b/Libraries/ART/ViewManagers/ARTSurfaceViewManager.m deleted file mode 100644 index 86f5185899b8a3..00000000000000 --- a/Libraries/ART/ViewManagers/ARTSurfaceViewManager.m +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -@implementation ARTSurfaceViewManager - -RCT_EXPORT_MODULE() - -- (RCTUIView *)view // TODO(macOS ISS#3536887) -{ - return [ARTSurfaceView new]; -} - -@end diff --git a/Libraries/ART/ViewManagers/ARTTextManager.h b/Libraries/ART/ViewManagers/ARTTextManager.h deleted file mode 100644 index cc0622eb13184e..00000000000000 --- a/Libraries/ART/ViewManagers/ARTTextManager.h +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ARTRenderableManager.h" - -@interface ARTTextManager : ARTRenderableManager - -@end diff --git a/Libraries/ART/ViewManagers/ARTTextManager.m b/Libraries/ART/ViewManagers/ARTTextManager.m deleted file mode 100644 index 7bea655c4d0e3e..00000000000000 --- a/Libraries/ART/ViewManagers/ARTTextManager.m +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import -#import "RCTConvert+ART.h" - -@implementation ARTTextManager - -RCT_EXPORT_MODULE() - -- (ARTRenderable *)node -{ - return [ARTText new]; -} - -RCT_EXPORT_VIEW_PROPERTY(alignment, CTTextAlignment) -RCT_REMAP_VIEW_PROPERTY(frame, textFrame, ARTTextFrame) - -@end diff --git a/Libraries/Animated/src/NativeAnimatedHelper.js b/Libraries/Animated/src/NativeAnimatedHelper.js index 632b543c50ea6f..5b4ac69eab5b8f 100644 --- a/Libraries/Animated/src/NativeAnimatedHelper.js +++ b/Libraries/Animated/src/NativeAnimatedHelper.js @@ -10,9 +10,11 @@ 'use strict'; +import NativeAnimatedNonTurboModule from './NativeAnimatedModule'; +import NativeAnimatedTurboModule from './NativeAnimatedTurboModule'; import NativeEventEmitter from '../../EventEmitter/NativeEventEmitter'; +import Platform from '../../Utilities/Platform'; import type {EventConfig} from './AnimatedEvent'; -import NativeAnimatedModule from './NativeAnimatedModule'; import type { EventMapping, AnimatedNodeConfig, @@ -22,13 +24,21 @@ import type {AnimationConfig, EndCallback} from './animations/Animation'; import type {InterpolationConfigType} from './nodes/AnimatedInterpolation'; import invariant from 'invariant'; +// TODO T69437152 @petetheheat - Delete this fork when Fabric ships to 100%. +const NativeAnimatedModule = + Platform.OS === 'ios' && global.RN$Bridgeless + ? NativeAnimatedTurboModule + : NativeAnimatedNonTurboModule; + let __nativeAnimatedNodeTagCount = 1; /* used for animated nodes */ let __nativeAnimationIdCount = 1; /* used for started animations */ let nativeEventEmitter; +let waitingForQueuedOperations = new Set(); +let queueOperations = false; let queueConnections = false; -let queue = []; +let queue: Array<() => void> = []; /** * Simple wrappers around NativeAnimatedModule to provide flow and autocomplete support for @@ -47,38 +57,74 @@ const API = { NativeAnimatedModule.getValue(tag, saveValueCallback); } }, + setWaitingForIdentifier: function(id: number): void { + invariant(NativeAnimatedModule, 'Native animated module is not available'); + waitingForQueuedOperations.add(id); + queueOperations = true; + queueConnections = true; + }, + unsetWaitingForIdentifier: function(id: number): void { + invariant(NativeAnimatedModule, 'Native animated module is not available'); + waitingForQueuedOperations.delete(id); + + if (waitingForQueuedOperations.size === 0) { + queueOperations = false; + API.disableQueue(); + } + }, disableQueue: function(): void { invariant(NativeAnimatedModule, 'Native animated module is not available'); queueConnections = false; - for (let q = 0, l = queue.length; q < l; q++) { - const args = queue[q]; - NativeAnimatedModule.connectAnimatedNodes(args[0], args[1]); + if (!queueOperations) { + for (let q = 0, l = queue.length; q < l; q++) { + queue[q](); + } + queue.length = 0; + } + }, + queueConnection: (fn: () => void): void => { + if (queueConnections) { + queue.push(fn); + } else { + fn(); + } + }, + queueOperation: (fn: () => void): void => { + if (queueOperations) { + queue.push(fn); + } else { + fn(); } - queue.length = 0; }, createAnimatedNode: function(tag: number, config: AnimatedNodeConfig): void { invariant(NativeAnimatedModule, 'Native animated module is not available'); - NativeAnimatedModule.createAnimatedNode(tag, config); + API.queueOperation(() => + NativeAnimatedModule.createAnimatedNode(tag, config), + ); }, startListeningToAnimatedNodeValue: function(tag: number) { invariant(NativeAnimatedModule, 'Native animated module is not available'); - NativeAnimatedModule.startListeningToAnimatedNodeValue(tag); + API.queueOperation(() => + NativeAnimatedModule.startListeningToAnimatedNodeValue(tag), + ); }, stopListeningToAnimatedNodeValue: function(tag: number) { invariant(NativeAnimatedModule, 'Native animated module is not available'); - NativeAnimatedModule.stopListeningToAnimatedNodeValue(tag); + API.queueOperation(() => + NativeAnimatedModule.stopListeningToAnimatedNodeValue(tag), + ); }, connectAnimatedNodes: function(parentTag: number, childTag: number): void { invariant(NativeAnimatedModule, 'Native animated module is not available'); - if (queueConnections) { - queue.push([parentTag, childTag]); - return; - } - NativeAnimatedModule.connectAnimatedNodes(parentTag, childTag); + API.queueConnection(() => + NativeAnimatedModule.connectAnimatedNodes(parentTag, childTag), + ); }, disconnectAnimatedNodes: function(parentTag: number, childTag: number): void { invariant(NativeAnimatedModule, 'Native animated module is not available'); - NativeAnimatedModule.disconnectAnimatedNodes(parentTag, childTag); + API.queueOperation(() => + NativeAnimatedModule.disconnectAnimatedNodes(parentTag, childTag), + ); }, startAnimatingNode: function( animationId: number, @@ -87,54 +133,70 @@ const API = { endCallback: EndCallback, ): void { invariant(NativeAnimatedModule, 'Native animated module is not available'); - NativeAnimatedModule.startAnimatingNode( - animationId, - nodeTag, - config, - endCallback, + API.queueOperation(() => + NativeAnimatedModule.startAnimatingNode( + animationId, + nodeTag, + config, + endCallback, + ), ); }, stopAnimation: function(animationId: number) { invariant(NativeAnimatedModule, 'Native animated module is not available'); - NativeAnimatedModule.stopAnimation(animationId); + API.queueOperation(() => NativeAnimatedModule.stopAnimation(animationId)); }, setAnimatedNodeValue: function(nodeTag: number, value: number): void { invariant(NativeAnimatedModule, 'Native animated module is not available'); - NativeAnimatedModule.setAnimatedNodeValue(nodeTag, value); + API.queueOperation(() => + NativeAnimatedModule.setAnimatedNodeValue(nodeTag, value), + ); }, setAnimatedNodeOffset: function(nodeTag: number, offset: number): void { invariant(NativeAnimatedModule, 'Native animated module is not available'); - NativeAnimatedModule.setAnimatedNodeOffset(nodeTag, offset); + API.queueOperation(() => + NativeAnimatedModule.setAnimatedNodeOffset(nodeTag, offset), + ); }, flattenAnimatedNodeOffset: function(nodeTag: number): void { invariant(NativeAnimatedModule, 'Native animated module is not available'); - NativeAnimatedModule.flattenAnimatedNodeOffset(nodeTag); + API.queueOperation(() => + NativeAnimatedModule.flattenAnimatedNodeOffset(nodeTag), + ); }, extractAnimatedNodeOffset: function(nodeTag: number): void { invariant(NativeAnimatedModule, 'Native animated module is not available'); - NativeAnimatedModule.extractAnimatedNodeOffset(nodeTag); + API.queueOperation(() => + NativeAnimatedModule.extractAnimatedNodeOffset(nodeTag), + ); }, connectAnimatedNodeToView: function(nodeTag: number, viewTag: number): void { invariant(NativeAnimatedModule, 'Native animated module is not available'); - NativeAnimatedModule.connectAnimatedNodeToView(nodeTag, viewTag); + API.queueOperation(() => + NativeAnimatedModule.connectAnimatedNodeToView(nodeTag, viewTag), + ); }, disconnectAnimatedNodeFromView: function( nodeTag: number, viewTag: number, ): void { invariant(NativeAnimatedModule, 'Native animated module is not available'); - NativeAnimatedModule.disconnectAnimatedNodeFromView(nodeTag, viewTag); + API.queueOperation(() => + NativeAnimatedModule.disconnectAnimatedNodeFromView(nodeTag, viewTag), + ); }, restoreDefaultValues: function(nodeTag: number): void { invariant(NativeAnimatedModule, 'Native animated module is not available'); // Backwards compat with older native runtimes, can be removed later. if (NativeAnimatedModule.restoreDefaultValues != null) { - NativeAnimatedModule.restoreDefaultValues(nodeTag); + API.queueOperation(() => + NativeAnimatedModule.restoreDefaultValues(nodeTag), + ); } }, dropAnimatedNode: function(tag: number): void { invariant(NativeAnimatedModule, 'Native animated module is not available'); - NativeAnimatedModule.dropAnimatedNode(tag); + API.queueOperation(() => NativeAnimatedModule.dropAnimatedNode(tag)); }, addAnimatedEventToView: function( viewTag: number, @@ -142,10 +204,12 @@ const API = { eventMapping: EventMapping, ) { invariant(NativeAnimatedModule, 'Native animated module is not available'); - NativeAnimatedModule.addAnimatedEventToView( - viewTag, - eventName, - eventMapping, + API.queueOperation(() => + NativeAnimatedModule.addAnimatedEventToView( + viewTag, + eventName, + eventMapping, + ), ); }, removeAnimatedEventFromView( @@ -154,10 +218,12 @@ const API = { animatedNodeTag: number, ) { invariant(NativeAnimatedModule, 'Native animated module is not available'); - NativeAnimatedModule.removeAnimatedEventFromView( - viewTag, - eventName, - animatedNodeTag, + API.queueOperation(() => + NativeAnimatedModule.removeAnimatedEventFromView( + viewTag, + eventName, + animatedNodeTag, + ), ); }, }; diff --git a/Libraries/Animated/src/NativeAnimatedTurboModule.js b/Libraries/Animated/src/NativeAnimatedTurboModule.js new file mode 100644 index 00000000000000..d31a36fdebc735 --- /dev/null +++ b/Libraries/Animated/src/NativeAnimatedTurboModule.js @@ -0,0 +1,70 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow + * @format + */ + +'use strict'; + +import type {TurboModule} from '../../TurboModule/RCTExport'; +import * as TurboModuleRegistry from '../../TurboModule/TurboModuleRegistry'; + +type EndResult = {finished: boolean, ...}; +type EndCallback = (result: EndResult) => void; +type SaveValueCallback = (value: number) => void; + +export type EventMapping = {| + nativeEventPath: Array, + animatedValueTag: ?number, +|}; + +// The config has different keys depending on the type of the Node +// TODO(T54896888): Make these types strict +export type AnimatedNodeConfig = Object; +export type AnimatingNodeConfig = Object; + +export interface Spec extends TurboModule { + +createAnimatedNode: (tag: number, config: AnimatedNodeConfig) => void; + +getValue: (tag: number, saveValueCallback: SaveValueCallback) => void; + +startListeningToAnimatedNodeValue: (tag: number) => void; + +stopListeningToAnimatedNodeValue: (tag: number) => void; + +connectAnimatedNodes: (parentTag: number, childTag: number) => void; + +disconnectAnimatedNodes: (parentTag: number, childTag: number) => void; + +startAnimatingNode: ( + animationId: number, + nodeTag: number, + config: AnimatingNodeConfig, + endCallback: EndCallback, + ) => void; + +stopAnimation: (animationId: number) => void; + +setAnimatedNodeValue: (nodeTag: number, value: number) => void; + +setAnimatedNodeOffset: (nodeTag: number, offset: number) => void; + +flattenAnimatedNodeOffset: (nodeTag: number) => void; + +extractAnimatedNodeOffset: (nodeTag: number) => void; + +connectAnimatedNodeToView: (nodeTag: number, viewTag: number) => void; + +disconnectAnimatedNodeFromView: (nodeTag: number, viewTag: number) => void; + +restoreDefaultValues: (nodeTag: number) => void; + +dropAnimatedNode: (tag: number) => void; + +addAnimatedEventToView: ( + viewTag: number, + eventName: string, + eventMapping: EventMapping, + ) => void; + +removeAnimatedEventFromView: ( + viewTag: number, + eventName: string, + animatedNodeTag: number, + ) => void; + + // Events + +addListener: (eventName: string) => void; + +removeListeners: (count: number) => void; +} + +export default (TurboModuleRegistry.get( + 'NativeAnimatedTurboModule', +): ?Spec); diff --git a/Libraries/Animated/src/createAnimatedComponent.js b/Libraries/Animated/src/createAnimatedComponent.js index 4851399fd1bb9f..22d0a2f62b5126 100644 --- a/Libraries/Animated/src/createAnimatedComponent.js +++ b/Libraries/Animated/src/createAnimatedComponent.js @@ -11,13 +11,17 @@ 'use strict'; const View = require('../../Components/View/View'); +const Platform = require('../../Utilities/Platform'); const {AnimatedEvent} = require('./AnimatedEvent'); const AnimatedProps = require('./nodes/AnimatedProps'); const React = require('react'); +const NativeAnimatedHelper = require('./NativeAnimatedHelper'); const invariant = require('invariant'); const setAndForwardRef = require('../../Utilities/setAndForwardRef'); +let animatedComponentNextId = 1; + export type AnimatedComponentType< Props: {+[string]: mixed, ...}, Instance, @@ -51,6 +55,9 @@ function createAnimatedComponent( _propsAnimated: AnimatedProps; _eventDetachers: Array = []; + // Only to be used in this file, and only in Fabric. + _animatedComponentId: number = -1; + _attachNativeEvents() { // Make sure to get the scrollable node for components that implement // `ScrollResponder.Mixin`. @@ -72,25 +79,11 @@ function createAnimatedComponent( this._eventDetachers = []; } - // The system is best designed when setNativeProps is implemented. It is - // able to avoid re-rendering and directly set the attributes that changed. - // However, setNativeProps can only be implemented on leaf native - // components. If you want to animate a composite component, you need to - // re-render it. In this case, we have a fallback that uses forceUpdate. - // This fallback is also called in Fabric. - _animatedPropsCallback = () => { + _isFabric = (): boolean => { if (this._component == null) { - // AnimatedProps is created in will-mount because it's used in render. - // But this callback may be invoked before mount in async mode, - // In which case we should defer the setNativeProps() call. - // React may throw away uncommitted work in async mode, - // So a deferred call won't always be invoked. - this._invokeAnimatedPropsCallbackOnMount = true; - } else if ( - process.env.NODE_ENV === 'test' || - // For animating properties of non-leaf/non-native components - typeof this._component.setNativeProps !== 'function' || - // In Fabric, force animations to go through forceUpdate and skip setNativeProps + return false; + } + return ( // eslint-disable-next-line dot-notation this._component['_internalInstanceHandle']?.stateNode?.canonical != null || @@ -114,6 +107,54 @@ function createAnimatedComponent( // eslint-disable-next-line dot-notation '_internalInstanceHandle' ]?.stateNode?.canonical != null) + ); + }; + + _waitForUpdate = (): void => { + // If this works well on iOS, we should remove this check + if (Platform.OS === 'android') { + if (this._isFabric()) { + if (this._animatedComponentId === -1) { + this._animatedComponentId = animatedComponentNextId++; + } + NativeAnimatedHelper.API.setWaitingForIdentifier( + this._animatedComponentId, + ); + } + } + }; + + _markUpdateComplete = (): void => { + // If this works well on iOS, we should remove this check + if (Platform.OS === 'android') { + if (this._isFabric()) { + NativeAnimatedHelper.API.unsetWaitingForIdentifier( + this._animatedComponentId, + ); + } + } + }; + + // The system is best designed when setNativeProps is implemented. It is + // able to avoid re-rendering and directly set the attributes that changed. + // However, setNativeProps can only be implemented on leaf native + // components. If you want to animate a composite component, you need to + // re-render it. In this case, we have a fallback that uses forceUpdate. + // This fallback is also called in Fabric. + _animatedPropsCallback = () => { + if (this._component == null) { + // AnimatedProps is created in will-mount because it's used in render. + // But this callback may be invoked before mount in async mode, + // In which case we should defer the setNativeProps() call. + // React may throw away uncommitted work in async mode, + // So a deferred call won't always be invoked. + this._invokeAnimatedPropsCallbackOnMount = true; + } else if ( + process.env.NODE_ENV === 'test' || + // For animating properties of non-leaf/non-native components + typeof this._component.setNativeProps !== 'function' || + // In Fabric, force animations to go through forceUpdate and skip setNativeProps + this._isFabric() ) { this.forceUpdate(); } else if (!this._propsAnimated.__isNative) { @@ -199,6 +240,7 @@ function createAnimatedComponent( } UNSAFE_componentWillMount() { + this._waitForUpdate(); this._attachProps(this.props); } @@ -210,9 +252,11 @@ function createAnimatedComponent( this._propsAnimated.setNativeView(this._component); this._attachNativeEvents(); + this._markUpdateComplete(); } UNSAFE_componentWillReceiveProps(newProps) { + this._waitForUpdate(); this._attachProps(newProps); } @@ -224,11 +268,13 @@ function createAnimatedComponent( this._detachNativeEvents(); this._attachNativeEvents(); } + this._markUpdateComplete(); } componentWillUnmount() { this._propsAnimated && this._propsAnimated.__detach(); this._detachNativeEvents(); + this._markUpdateComplete(); } } diff --git a/Libraries/BatchedBridge/BatchedBridge.js b/Libraries/BatchedBridge/BatchedBridge.js index b68e9873e393ba..5b928edcc6b3f2 100644 --- a/Libraries/BatchedBridge/BatchedBridge.js +++ b/Libraries/BatchedBridge/BatchedBridge.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format - * @flow strict-local + * @flow strict */ 'use strict'; diff --git a/Libraries/BatchedBridge/MessageQueue.js b/Libraries/BatchedBridge/MessageQueue.js index d68f2fd2ceff53..c1314d9ea794d0 100644 --- a/Libraries/BatchedBridge/MessageQueue.js +++ b/Libraries/BatchedBridge/MessageQueue.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow + * @flow strict * @format */ @@ -22,7 +22,7 @@ export type SpyData = { type: number, module: ?string, method: string | number, - args: any[], + args: mixed[], ... }; @@ -40,10 +40,10 @@ const TRACE_TAG_REACT_APPS = 1 << 17; const DEBUG_INFO_LIMIT = 32; class MessageQueue { - _lazyCallableModules: {[key: string]: (void) => Object, ...}; - _queue: [number[], number[], any[], number]; - _successCallbacks: Map; - _failureCallbacks: Map; + _lazyCallableModules: {[key: string]: (void) => {...}, ...}; + _queue: [number[], number[], mixed[], number]; + _successCallbacks: Map void>; + _failureCallbacks: Map void>; _callID: number; _lastFlush: number; _eventLoopStartTime: number; @@ -71,11 +71,15 @@ class MessageQueue { this._remoteMethodTable = {}; } - (this: any).callFunctionReturnFlushedQueue = this.callFunctionReturnFlushedQueue.bind( + // $FlowFixMe[cannot-write] + this.callFunctionReturnFlushedQueue = this.callFunctionReturnFlushedQueue.bind( this, ); - (this: any).flushedQueue = this.flushedQueue.bind(this); - (this: any).invokeCallbackAndReturnFlushedQueue = this.invokeCallbackAndReturnFlushedQueue.bind( + // $FlowFixMe[cannot-write] + this.flushedQueue = this.flushedQueue.bind(this); + + // $FlowFixMe[cannot-write] + this.invokeCallbackAndReturnFlushedQueue = this.invokeCallbackAndReturnFlushedQueue.bind( this, ); } @@ -89,7 +93,7 @@ class MessageQueue { MessageQueue.prototype.__spy = info => { console.log( `${info.type === TO_JS ? 'N->JS' : 'JS->N'} : ` + - `${info.module ? info.module + '.' : ''}${info.method}` + + `${info.module != null ? info.module + '.' : ''}${info.method}` + `(${JSON.stringify(info.args)})`, ); }; @@ -103,8 +107,8 @@ class MessageQueue { callFunctionReturnFlushedQueue( module: string, method: string, - args: any[], - ): null | [Array, Array, Array, number] { + args: mixed[], + ): null | [Array, Array, Array, number] { this.__guard(() => { this.__callFunction(module, method, args); }); @@ -114,8 +118,8 @@ class MessageQueue { invokeCallbackAndReturnFlushedQueue( cbID: number, - args: any[], - ): null | [Array, Array, Array, number] { + args: mixed[], + ): null | [Array, Array, Array, number] { this.__guard(() => { this.__invokeCallback(cbID, args); }); @@ -123,7 +127,7 @@ class MessageQueue { return this.flushedQueue(); } - flushedQueue(): null | [Array, Array, Array, number] { + flushedQueue(): null | [Array, Array, Array, number] { this.__guard(() => { this.__callImmediates(); }); @@ -137,13 +141,13 @@ class MessageQueue { return Date.now() - this._eventLoopStartTime; } - registerCallableModule(name: string, module: Object) { + registerCallableModule(name: string, module: {...}) { this._lazyCallableModules[name] = () => module; } - registerLazyCallableModule(name: string, factory: void => Object) { - let module: Object; - let getValue: ?(void) => Object = factory; + registerLazyCallableModule(name: string, factory: void => {...}) { + let module: {...}; + let getValue: ?(void) => {...} = factory; this._lazyCallableModules[name] = () => { if (getValue) { module = getValue(); @@ -153,7 +157,7 @@ class MessageQueue { }; } - getCallableModule(name: string): any | null { + getCallableModule(name: string): {...} | null { const getValue = this._lazyCallableModules[name]; return getValue ? getValue() : null; } @@ -161,10 +165,10 @@ class MessageQueue { callNativeSyncHook( moduleID: number, methodID: number, - params: any[], - onFail: ?Function, - onSucc: ?Function, - ): any { + params: mixed[], + onFail: ?(...mixed[]) => void, + onSucc: ?(...mixed[]) => void, + ): mixed { if (__DEV__) { invariant( global.nativeCallSyncHook, @@ -181,10 +185,10 @@ class MessageQueue { processCallbacks( moduleID: number, methodID: number, - params: any[], - onFail: ?Function, - onSucc: ?Function, - ) { + params: mixed[], + onFail: ?(...mixed[]) => void, + onSucc: ?(...mixed[]) => void, + ): void { if (onFail || onSucc) { if (__DEV__) { this._debugInfo[this._callID] = [moduleID, methodID]; @@ -232,9 +236,9 @@ class MessageQueue { enqueueNativeCall( moduleID: number, methodID: number, - params: any[], - onFail: ?Function, - onSucc: ?Function, + params: mixed[], + onFail: ?(...mixed[]) => void, + onSucc: ?(...mixed[]) => void, ) { this.processCallbacks(moduleID, methodID, params, onFail, onSucc); @@ -247,30 +251,34 @@ class MessageQueue { // function it is permitted here, and special-cased in the // conversion. const isValidArgument = val => { - const t = typeof val; - if ( - t === 'undefined' || - t === 'null' || - t === 'boolean' || - t === 'string' - ) { - return true; - } - if (t === 'number') { - return isFinite(val); - } - if (t === 'function' || t !== 'object') { - return false; - } - if (Array.isArray(val)) { - return val.every(isValidArgument); - } - for (const k in val) { - if (typeof val[k] !== 'function' && !isValidArgument(val[k])) { + switch (typeof val) { + case 'undefined': + case 'boolean': + case 'string': + return true; + case 'number': + return isFinite(val); + case 'object': + if (val == null) { + return true; + } + + if (Array.isArray(val)) { + return val.every(isValidArgument); + } + + for (const k in val) { + if (typeof val[k] !== 'function' && !isValidArgument(val[k])) { + return false; + } + } + + return true; + case 'function': + return false; + default: return false; - } } - return true; }; // Replacement allows normally non-JSON-convertible values to be @@ -295,7 +303,7 @@ class MessageQueue { ); // The params object should not be mutated after being queued - deepFreezeAndThrowOnMutationInDev((params: any)); + deepFreezeAndThrowOnMutationInDev(params); } this._queue[PARAMS].push(params); @@ -382,7 +390,7 @@ class MessageQueue { Systrace.endEvent(); } - __callFunction(module: string, method: string, args: any[]): void { + __callFunction(module: string, method: string, args: mixed[]): void { this._lastFlush = Date.now(); this._eventLoopStartTime = this._lastFlush; if (__DEV__ || this.__spy) { @@ -410,7 +418,7 @@ class MessageQueue { Systrace.endEvent(); } - __invokeCallback(cbID: number, args: any[]) { + __invokeCallback(cbID: number, args: mixed[]) { this._lastFlush = Date.now(); this._eventLoopStartTime = this._lastFlush; diff --git a/Libraries/BatchedBridge/NativeModules.js b/Libraries/BatchedBridge/NativeModules.js index 541012582c091c..4f764463738d9f 100644 --- a/Libraries/BatchedBridge/NativeModules.js +++ b/Libraries/BatchedBridge/NativeModules.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format - * @flow + * @flow strict */ 'use strict'; @@ -18,7 +18,7 @@ import type {ExtendedError} from '../Core/Devtools/parseErrorStack'; export type ModuleConfig = [ string /* name */, - ?Object /* constants */, + ?{...} /* constants */, ?$ReadOnlyArray /* functions */, ?$ReadOnlyArray /* promise method IDs */, ?$ReadOnlyArray /* sync method IDs */, @@ -31,7 +31,7 @@ function genModule( moduleID: number, ): ?{ name: string, - module?: Object, + module?: {...}, ... } { if (!config) { @@ -55,8 +55,9 @@ function genModule( methods && methods.forEach((methodName, methodID) => { const isPromise = - promiseMethods && arrayContains(promiseMethods, methodID); - const isSync = syncMethods && arrayContains(syncMethods, methodID); + (promiseMethods && arrayContains(promiseMethods, methodID)) || false; + const isSync = + (syncMethods && arrayContains(syncMethods, methodID)) || false; invariant( !isPromise || !isSync, 'Cannot have a method that is both async and a sync hook', @@ -85,7 +86,7 @@ function genModule( // export this method as a global so we can call it from native global.__fbGenNativeModule = genModule; -function loadModule(name: string, moduleID: number): ?Object { +function loadModule(name: string, moduleID: number): ?{...} { invariant( global.nativeRequireModuleConfig, "Can't lazily create module without nativeRequireModuleConfig", @@ -98,7 +99,7 @@ function loadModule(name: string, moduleID: number): ?Object { function genMethod(moduleID: number, methodID: number, type: MethodType) { let fn = null; if (type === 'promise') { - fn = function promiseMethodWrapper(...args: Array) { + fn = function promiseMethodWrapper(...args: Array) { // In case we reject, capture a useful stack trace here. const enqueueingFrameError: ExtendedError = new Error(); return new Promise((resolve, reject) => { @@ -108,12 +109,17 @@ function genMethod(moduleID: number, methodID: number, type: MethodType) { args, data => resolve(data), errorData => - reject(updateErrorWithErrorData(errorData, enqueueingFrameError)), + reject( + updateErrorWithErrorData( + (errorData: $FlowFixMe), + enqueueingFrameError, + ), + ), ); }); }; } else { - fn = function nonPromiseMethodWrapper(...args: Array) { + fn = function nonPromiseMethodWrapper(...args: Array) { const lastArg = args.length > 0 ? args[args.length - 1] : null; const secondLastArg = args.length > 1 ? args[args.length - 2] : null; const hasSuccessCallback = typeof lastArg === 'function'; @@ -123,15 +129,17 @@ function genMethod(moduleID: number, methodID: number, type: MethodType) { hasSuccessCallback, 'Cannot have a non-function arg after a function arg.', ); - const onSuccess = hasSuccessCallback ? lastArg : null; - const onFail = hasErrorCallback ? secondLastArg : null; + // $FlowFixMe[incompatible-type] + const onSuccess: ?(mixed) => void = hasSuccessCallback ? lastArg : null; + // $FlowFixMe[incompatible-type] + const onFail: ?(mixed) => void = hasErrorCallback ? secondLastArg : null; const callbackCount = hasSuccessCallback + hasErrorCallback; - args = args.slice(0, args.length - callbackCount); + const newArgs = args.slice(0, args.length - callbackCount); if (type === 'sync') { return BatchedBridge.callNativeSyncHook( moduleID, methodID, - args, + newArgs, onFail, onSuccess, ); @@ -139,7 +147,7 @@ function genMethod(moduleID: number, methodID: number, type: MethodType) { BatchedBridge.enqueueNativeCall( moduleID, methodID, - args, + newArgs, onFail, onSuccess, ); @@ -161,7 +169,7 @@ function updateErrorWithErrorData( return Object.assign(error, errorData || {}); } -let NativeModules: {[moduleName: string]: Object, ...} = {}; +let NativeModules: {[moduleName: string]: $FlowFixMe, ...} = {}; if (global.nativeModuleProxy) { NativeModules = global.nativeModuleProxy; } else if (!global.nativeExtensions) { diff --git a/Libraries/Blob/Blob.js b/Libraries/Blob/Blob.js index 2af35f2bcb0ac2..99d5e59b8e58ab 100644 --- a/Libraries/Blob/Blob.js +++ b/Libraries/Blob/Blob.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow + * @flow strict-local * @format */ @@ -67,10 +67,12 @@ class Blob { * the data in the specified range of bytes of the source Blob. * Reference: https://developer.mozilla.org/en-US/docs/Web/API/Blob/slice */ + // $FlowFixMe[unsafe-getters-setters] set data(data: ?BlobData) { this._data = data; } + // $FlowFixMe[unsafe-getters-setters] get data(): BlobData { if (!this._data) { throw new Error('Blob has been closed and is no longer available'); @@ -85,6 +87,7 @@ class Blob { if (typeof start === 'number') { if (start > size) { + // $FlowFixMe[reassign-const] start = size; } offset += start; @@ -92,6 +95,7 @@ class Blob { if (typeof end === 'number') { if (end < 0) { + // $FlowFixMe[reassign-const] end = this.size + end; } size = end - start; @@ -125,6 +129,7 @@ class Blob { /** * Size of the data contained in the Blob object, in bytes. */ + // $FlowFixMe[unsafe-getters-setters] get size(): number { return this.data.size; } @@ -133,6 +138,7 @@ class Blob { * String indicating the MIME type of the data contained in the Blob. * If the type is unknown, this string is empty. */ + // $FlowFixMe[unsafe-getters-setters] get type(): string { return this.data.type || ''; } diff --git a/Libraries/Components/AccessibilityInfo/AccessibilityInfo.android.js b/Libraries/Components/AccessibilityInfo/AccessibilityInfo.android.js index e2b19d2bd1146b..26e68371dd558f 100644 --- a/Libraries/Components/AccessibilityInfo/AccessibilityInfo.android.js +++ b/Libraries/Components/AccessibilityInfo/AccessibilityInfo.android.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format - * @flow + * @flow strict-local */ 'use strict'; @@ -97,6 +97,7 @@ const AccessibilityInfo = { * * Same as `isScreenReaderEnabled` */ + // $FlowFixMe[unsafe-getters-setters] get fetch(): () => Promise { console.warn( 'AccessibilityInfo.fetch is deprecated, call AccessibilityInfo.isScreenReaderEnabled instead', @@ -104,34 +105,27 @@ const AccessibilityInfo = { return this.isScreenReaderEnabled; }, - addEventListener: function( - eventName: ChangeEventName, - handler: Function, - ): void { + addEventListener: function(eventName: ChangeEventName, handler: T): void { let listener; if (eventName === 'change' || eventName === 'screenReaderChanged') { listener = RCTDeviceEventEmitter.addListener( TOUCH_EXPLORATION_EVENT, - enabled => { - handler(enabled); - }, + handler, ); } else if (eventName === 'reduceMotionChanged') { listener = RCTDeviceEventEmitter.addListener( REDUCE_MOTION_EVENT, - enabled => { - handler(enabled); - }, + handler, ); } _subscriptions.set(handler, listener); }, - removeEventListener: function( + removeEventListener: function( eventName: ChangeEventName, - handler: Function, + handler: T, ): void { const listener = _subscriptions.get(handler); if (!listener) { diff --git a/Libraries/Components/AccessibilityInfo/AccessibilityInfo.ios.js b/Libraries/Components/AccessibilityInfo/AccessibilityInfo.ios.js index 157f5bc6388a59..5d01323453f4f3 100644 --- a/Libraries/Components/AccessibilityInfo/AccessibilityInfo.ios.js +++ b/Libraries/Components/AccessibilityInfo/AccessibilityInfo.ios.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format - * @flow + * @flow strict-local */ 'use strict'; @@ -170,6 +170,7 @@ const AccessibilityInfo = { * * Same as `isScreenReaderEnabled` */ + // $FlowFixMe[unsafe-getters-setters] get fetch(): $FlowFixMe { console.warn( 'AccessibilityInfo.fetch is deprecated, call AccessibilityInfo.isScreenReaderEnabled instead', @@ -208,10 +209,10 @@ const AccessibilityInfo = { * * See https://reactnative.dev/docs/accessibilityinfo.html#addeventlistener */ - addEventListener: function( + addEventListener: function( eventName: ChangeEventName, - handler: Function, - ): Object { + handler: T, + ): {remove: () => void} { let listener; if (eventName === 'change') { @@ -260,9 +261,9 @@ const AccessibilityInfo = { * * See https://reactnative.dev/docs/accessibilityinfo.html#removeeventlistener */ - removeEventListener: function( + removeEventListener: function( eventName: ChangeEventName, - handler: Function, + handler: T, ): void { const listener = _subscriptions.get(handler); if (!listener) { diff --git a/Libraries/Components/AccessibilityInfo/NativeAccessibilityInfo.js b/Libraries/Components/AccessibilityInfo/NativeAccessibilityInfo.js index 10aa0f110cdb20..03484f2158c10d 100644 --- a/Libraries/Components/AccessibilityInfo/NativeAccessibilityInfo.js +++ b/Libraries/Components/AccessibilityInfo/NativeAccessibilityInfo.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow strict-local + * @flow strict * @format */ diff --git a/Libraries/Components/AppleTV/NativeTVNavigationEventEmitter.js b/Libraries/Components/AppleTV/NativeTVNavigationEventEmitter.js index 3cecc6e84e7198..26f9f801679683 100644 --- a/Libraries/Components/AppleTV/NativeTVNavigationEventEmitter.js +++ b/Libraries/Components/AppleTV/NativeTVNavigationEventEmitter.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow strict-local + * @flow strict * @format */ diff --git a/Libraries/Components/Clipboard/Clipboard.js b/Libraries/Components/Clipboard/Clipboard.js index d58b2285473a78..fa0b9a050d4e64 100644 --- a/Libraries/Components/Clipboard/Clipboard.js +++ b/Libraries/Components/Clipboard/Clipboard.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format - * @flow strict-local + * @flow strict */ 'use strict'; diff --git a/Libraries/Components/Clipboard/NativeClipboard.js b/Libraries/Components/Clipboard/NativeClipboard.js index 35bfa11851cf6e..b585a108e04371 100644 --- a/Libraries/Components/Clipboard/NativeClipboard.js +++ b/Libraries/Components/Clipboard/NativeClipboard.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow strict-local + * @flow strict * @format */ diff --git a/Libraries/Components/Keyboard/KeyboardAvoidingView.js b/Libraries/Components/Keyboard/KeyboardAvoidingView.js index b8a150efbaa34d..4e87a3f16c8d76 100644 --- a/Libraries/Components/Keyboard/KeyboardAvoidingView.js +++ b/Libraries/Components/Keyboard/KeyboardAvoidingView.js @@ -67,6 +67,7 @@ class KeyboardAvoidingView extends React.Component { }; _frame: ?ViewLayout = null; + _keyboardEvent: ?KeyboardEvent = null; _subscriptions: Array = []; viewRef: {current: React.ElementRef | null, ...}; _initialFrameHeight: number = 0; @@ -91,12 +92,27 @@ class KeyboardAvoidingView extends React.Component { } _onKeyboardChange = (event: ?KeyboardEvent) => { - if (event == null) { + this._keyboardEvent = event; + this._updateBottomIfNecesarry(); + }; + + _onLayout = (event: ViewLayoutEvent) => { + this._frame = event.nativeEvent.layout; + if (!this._initialFrameHeight) { + // save the initial frame height, before the keyboard is visible + this._initialFrameHeight = this._frame.height; + } + + this._updateBottomIfNecesarry(); + }; + + _updateBottomIfNecesarry = () => { + if (this._keyboardEvent == null) { this.setState({bottom: 0}); return; } - const {duration, easing, endCoordinates} = event; + const {duration, easing, endCoordinates} = this._keyboardEvent; const height = this._relativeKeyboardHeight(endCoordinates); if (this.state.bottom === height) { @@ -116,14 +132,6 @@ class KeyboardAvoidingView extends React.Component { this.setState({bottom: height}); }; - _onLayout = (event: ViewLayoutEvent) => { - this._frame = event.nativeEvent.layout; - if (!this._initialFrameHeight) { - // save the initial frame height, before the keyboard is visible - this._initialFrameHeight = this._frame.height; - } - }; - componentDidMount(): void { if (Platform.OS === 'ios') { this._subscriptions = [ diff --git a/Libraries/Components/Keyboard/NativeKeyboardObserver.js b/Libraries/Components/Keyboard/NativeKeyboardObserver.js index b6ef87b4d3a7ab..7f077c3c88baa8 100644 --- a/Libraries/Components/Keyboard/NativeKeyboardObserver.js +++ b/Libraries/Components/Keyboard/NativeKeyboardObserver.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow strict-local + * @flow strict * @format */ diff --git a/Libraries/Components/ScrollView/ScrollViewStickyHeader.js b/Libraries/Components/ScrollView/ScrollViewStickyHeader.js index 172be92dfcab14..351dfc16afc24c 100644 --- a/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +++ b/Libraries/Components/ScrollView/ScrollViewStickyHeader.js @@ -304,6 +304,7 @@ class ScrollViewStickyHeader extends React.Component { const styles = StyleSheet.create({ header: { zIndex: 10, + position: 'relative', }, fill: { flex: 1, diff --git a/Libraries/Components/Sound/NativeSoundManager.js b/Libraries/Components/Sound/NativeSoundManager.js index b5b72ac49599d4..d278168552fcae 100644 --- a/Libraries/Components/Sound/NativeSoundManager.js +++ b/Libraries/Components/Sound/NativeSoundManager.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow strict-local + * @flow strict * @format */ diff --git a/Libraries/Components/Sound/SoundManager.js b/Libraries/Components/Sound/SoundManager.js index 943b4c5c535186..0e63332728f5cb 100644 --- a/Libraries/Components/Sound/SoundManager.js +++ b/Libraries/Components/Sound/SoundManager.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format - * @flow strict-local + * @flow strict */ 'use strict'; diff --git a/Libraries/Components/StatusBar/NativeStatusBarManagerAndroid.js b/Libraries/Components/StatusBar/NativeStatusBarManagerAndroid.js index 7dc9f9b75175c1..e9168b5dc52b06 100644 --- a/Libraries/Components/StatusBar/NativeStatusBarManagerAndroid.js +++ b/Libraries/Components/StatusBar/NativeStatusBarManagerAndroid.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow strict-local + * @flow strict * @format */ @@ -12,14 +12,13 @@ import type {TurboModule} from '../../TurboModule/RCTExport'; import * as TurboModuleRegistry from '../../TurboModule/TurboModuleRegistry'; -import type {ProcessedColorValue} from '../../StyleSheet/processColor'; // TODO(macOS GH#774) export interface Spec extends TurboModule { +getConstants: () => {| +HEIGHT: number, +DEFAULT_BACKGROUND_COLOR: number, |}; - +setColor: (color: ProcessedColorValue, animated: boolean) => void; // TODO(macOS GH#774) + +setColor: (color: number, animated: boolean) => void; // TODO(macOS GH#774) +setTranslucent: (translucent: boolean) => void; /** diff --git a/Libraries/Components/StatusBar/NativeStatusBarManagerIOS.js b/Libraries/Components/StatusBar/NativeStatusBarManagerIOS.js index 9840e3da2d43ee..b5da2851bf2436 100644 --- a/Libraries/Components/StatusBar/NativeStatusBarManagerIOS.js +++ b/Libraries/Components/StatusBar/NativeStatusBarManagerIOS.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow strict-local + * @flow strict * @format */ diff --git a/Libraries/Components/ToastAndroid/NativeToastAndroid.js b/Libraries/Components/ToastAndroid/NativeToastAndroid.js index d4039be72f3926..97f70204e9bfae 100644 --- a/Libraries/Components/ToastAndroid/NativeToastAndroid.js +++ b/Libraries/Components/ToastAndroid/NativeToastAndroid.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow strict-local + * @flow strict * @format */ diff --git a/Libraries/Core/Devtools/__tests__/parseErrorStack-test.js b/Libraries/Core/Devtools/__tests__/parseErrorStack-test.js index c361f7a9edcaf3..a92172c9876157 100644 --- a/Libraries/Core/Devtools/__tests__/parseErrorStack-test.js +++ b/Libraries/Core/Devtools/__tests__/parseErrorStack-test.js @@ -18,7 +18,7 @@ function getFakeError() { describe('parseErrorStack', function() { it('parses error stack', function() { - const stack = parseErrorStack(getFakeError()); + const stack = parseErrorStack(getFakeError().stack); expect(stack.length).toBeGreaterThan(0); const firstFrame = stack[0]; @@ -33,12 +33,12 @@ describe('parseErrorStack', function() { return error; } - const stack = parseErrorStack(getWrappedError()); + const stack = parseErrorStack(getWrappedError().stack); expect(stack[0].methodName).toEqual('getFakeError'); }); it('ignores bad inputs', function() { - expect(parseErrorStack({})).toEqual([]); + expect(parseErrorStack(undefined)).toEqual([]); expect(parseErrorStack(null)).toEqual([]); }); }); diff --git a/Libraries/Core/Devtools/getDevServer.js b/Libraries/Core/Devtools/getDevServer.js index c60d0e51606035..97c7c72468c188 100644 --- a/Libraries/Core/Devtools/getDevServer.js +++ b/Libraries/Core/Devtools/getDevServer.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format - * @flow + * @flow strict */ 'use strict'; @@ -36,7 +36,7 @@ function getDevServer(): DevServerInfo { } return { - url: _cachedDevServerURL || FALLBACK, + url: _cachedDevServerURL ?? FALLBACK, fullBundleUrl: _cachedFullBundleURL, bundleLoadedFromServer: _cachedDevServerURL !== null, }; diff --git a/Libraries/Core/Devtools/openFileInEditor.js b/Libraries/Core/Devtools/openFileInEditor.js index 4d52b3f4ff708e..66dca4721b9c52 100644 --- a/Libraries/Core/Devtools/openFileInEditor.js +++ b/Libraries/Core/Devtools/openFileInEditor.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format - * @flow strict-local + * @flow strict */ 'use strict'; diff --git a/Libraries/Core/Devtools/openURLInBrowser.js b/Libraries/Core/Devtools/openURLInBrowser.js index e69dc57183fcaa..d4b00663aaf051 100644 --- a/Libraries/Core/Devtools/openURLInBrowser.js +++ b/Libraries/Core/Devtools/openURLInBrowser.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format - * @flow strict-local + * @flow strict */ 'use strict'; diff --git a/Libraries/Core/Devtools/parseErrorStack.js b/Libraries/Core/Devtools/parseErrorStack.js index ec69f3f69cfd86..fe2cc205375b45 100644 --- a/Libraries/Core/Devtools/parseErrorStack.js +++ b/Libraries/Core/Devtools/parseErrorStack.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format - * @flow + * @flow strict */ 'use strict'; @@ -47,22 +47,22 @@ function convertHermesStack(stack: HermesParsedStack): Array { return frames; } -function parseErrorStack(e: ExtendedError): Array { - if (!e || !e.stack) { +function parseErrorStack(errorStack?: string): Array { + if (errorStack == null) { return []; } const stacktraceParser = require('stacktrace-parser'); - const stack = Array.isArray(e.stack) - ? e.stack + const parsedStack = Array.isArray(errorStack) + ? errorStack : global.HermesInternal - ? convertHermesStack(parseHermesStack(e.stack)) - : stacktraceParser.parse(e.stack).map(frame => ({ + ? convertHermesStack(parseHermesStack(errorStack)) + : stacktraceParser.parse(errorStack).map(frame => ({ ...frame, column: frame.column != null ? frame.column - 1 : null, })); - return stack; + return parsedStack; } module.exports = parseErrorStack; diff --git a/Libraries/Core/Devtools/parseHermesStack.js b/Libraries/Core/Devtools/parseHermesStack.js index 7aa91caf5d3df1..9d3ba2f9284f2f 100644 --- a/Libraries/Core/Devtools/parseHermesStack.js +++ b/Libraries/Core/Devtools/parseHermesStack.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format - * @flow strict-local + * @flow strict */ 'use strict'; diff --git a/Libraries/Core/Devtools/symbolicateStackTrace.js b/Libraries/Core/Devtools/symbolicateStackTrace.js index ef1289908678bb..7a6b8cd80ceca7 100644 --- a/Libraries/Core/Devtools/symbolicateStackTrace.js +++ b/Libraries/Core/Devtools/symbolicateStackTrace.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format - * @flow + * @flow strict */ 'use strict'; @@ -53,6 +53,7 @@ async function symbolicateStackTrace( // The fix below postpones trying to load fetch until the first call to symbolicateStackTrace. // At that time, we will have either global.fetch (whatwg-fetch) or RN's fetch. if (!fetch) { + // flowlint-next-line untyped-import:off fetch = global.fetch || require('../../Network/fetch').fetch; } diff --git a/Libraries/Core/ExceptionsManager.js b/Libraries/Core/ExceptionsManager.js index ba35831eeb8596..6da6d8a4a302cb 100644 --- a/Libraries/Core/ExceptionsManager.js +++ b/Libraries/Core/ExceptionsManager.js @@ -59,7 +59,7 @@ function reportException( const NativeExceptionsManager = require('./NativeExceptionsManager').default; if (NativeExceptionsManager) { const parseErrorStack = require('./Devtools/parseErrorStack'); - const stack = parseErrorStack(e); + const stack = parseErrorStack(e?.stack); const currentExceptionID = ++exceptionID; const originalMessage = e.message || ''; let message = originalMessage; diff --git a/Libraries/Core/NativeExceptionsManager.js b/Libraries/Core/NativeExceptionsManager.js index b36eb0cd74370b..798bb45686ebcd 100644 --- a/Libraries/Core/NativeExceptionsManager.js +++ b/Libraries/Core/NativeExceptionsManager.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow strict-local + * @flow strict * @format */ diff --git a/Libraries/Core/ReactNativeVersion.js b/Libraries/Core/ReactNativeVersion.js index 590676d886ae12..0a6de3d068056a 100644 --- a/Libraries/Core/ReactNativeVersion.js +++ b/Libraries/Core/ReactNativeVersion.js @@ -6,7 +6,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow + * @flow strict */ exports.version = { diff --git a/Libraries/Core/ReactNativeVersionCheck.js b/Libraries/Core/ReactNativeVersionCheck.js index 263d8794f0fbaa..5958842b30f020 100644 --- a/Libraries/Core/ReactNativeVersionCheck.js +++ b/Libraries/Core/ReactNativeVersionCheck.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow strict-local + * @flow strict * @format */ diff --git a/Libraries/Core/SegmentFetcher/NativeSegmentFetcher.js b/Libraries/Core/SegmentFetcher/NativeSegmentFetcher.js index 63df69cfbb30d8..8baeee3d4c1716 100644 --- a/Libraries/Core/SegmentFetcher/NativeSegmentFetcher.js +++ b/Libraries/Core/SegmentFetcher/NativeSegmentFetcher.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow strict-local + * @flow strict * @format */ diff --git a/Libraries/Core/Timers/NativeTiming.js b/Libraries/Core/Timers/NativeTiming.js index 14d03d52cfddf2..53477dd6584fa8 100644 --- a/Libraries/Core/Timers/NativeTiming.js +++ b/Libraries/Core/Timers/NativeTiming.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow strict-local + * @flow strict * @format */ diff --git a/Libraries/Core/polyfillPromise.js b/Libraries/Core/polyfillPromise.js index f7375ab1ee8acf..b15ccc2b301d25 100644 --- a/Libraries/Core/polyfillPromise.js +++ b/Libraries/Core/polyfillPromise.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow strict-local + * @flow strict * @format */ diff --git a/Libraries/Core/setUpGlobals.js b/Libraries/Core/setUpGlobals.js index 5acc42ae794536..ea6da8fbbbe3f1 100644 --- a/Libraries/Core/setUpGlobals.js +++ b/Libraries/Core/setUpGlobals.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow strict-local + * @flow strict * @format */ diff --git a/Libraries/Core/setUpNavigator.js b/Libraries/Core/setUpNavigator.js index 74f58695ad6eeb..48cdd45cb1d9e1 100644 --- a/Libraries/Core/setUpNavigator.js +++ b/Libraries/Core/setUpNavigator.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow strict-local + * @flow strict * @format */ diff --git a/Libraries/Core/setUpPerformance.js b/Libraries/Core/setUpPerformance.js index 6fd0a1e42b8213..12cace05f81247 100644 --- a/Libraries/Core/setUpPerformance.js +++ b/Libraries/Core/setUpPerformance.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow strict-local + * @flow strict * @format */ diff --git a/Libraries/Core/setUpSystrace.js b/Libraries/Core/setUpSystrace.js index dc50797f310fcf..610324b440ea6f 100644 --- a/Libraries/Core/setUpSystrace.js +++ b/Libraries/Core/setUpSystrace.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow strict-local + * @flow strict * @format */ diff --git a/Libraries/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec-generated.mm b/Libraries/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec-generated.mm index 5fb45d2153da68..a3a1068464eb97 100644 --- a/Libraries/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec-generated.mm +++ b/Libraries/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec-generated.mm @@ -375,6 +375,172 @@ + (RCTManagedPointer *)JS_NativeAnimatedModule_EventMapping:(id)json + } + + } // namespace react +} // namespace facebook +@implementation RCTCxxConvert (NativeAnimatedTurboModule_EndResult) ++ (RCTManagedPointer *)JS_NativeAnimatedTurboModule_EndResult:(id)json +{ + return facebook::react::managedPointer(json); +} +@end +@implementation RCTCxxConvert (NativeAnimatedTurboModule_EventMapping) ++ (RCTManagedPointer *)JS_NativeAnimatedTurboModule_EventMapping:(id)json +{ + return facebook::react::managedPointer(json); +} +@end +namespace facebook { + namespace react { + + + static facebook::jsi::Value __hostFunction_NativeAnimatedTurboModuleSpecJSI_createAnimatedNode(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "createAnimatedNode", @selector(createAnimatedNode:config:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAnimatedTurboModuleSpecJSI_getValue(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "getValue", @selector(getValue:saveValueCallback:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAnimatedTurboModuleSpecJSI_startListeningToAnimatedNodeValue(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "startListeningToAnimatedNodeValue", @selector(startListeningToAnimatedNodeValue:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAnimatedTurboModuleSpecJSI_stopListeningToAnimatedNodeValue(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "stopListeningToAnimatedNodeValue", @selector(stopListeningToAnimatedNodeValue:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAnimatedTurboModuleSpecJSI_connectAnimatedNodes(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "connectAnimatedNodes", @selector(connectAnimatedNodes:childTag:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAnimatedTurboModuleSpecJSI_disconnectAnimatedNodes(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "disconnectAnimatedNodes", @selector(disconnectAnimatedNodes:childTag:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAnimatedTurboModuleSpecJSI_startAnimatingNode(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "startAnimatingNode", @selector(startAnimatingNode:nodeTag:config:endCallback:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAnimatedTurboModuleSpecJSI_stopAnimation(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "stopAnimation", @selector(stopAnimation:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAnimatedTurboModuleSpecJSI_setAnimatedNodeValue(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "setAnimatedNodeValue", @selector(setAnimatedNodeValue:value:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAnimatedTurboModuleSpecJSI_setAnimatedNodeOffset(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "setAnimatedNodeOffset", @selector(setAnimatedNodeOffset:offset:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAnimatedTurboModuleSpecJSI_flattenAnimatedNodeOffset(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "flattenAnimatedNodeOffset", @selector(flattenAnimatedNodeOffset:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAnimatedTurboModuleSpecJSI_extractAnimatedNodeOffset(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "extractAnimatedNodeOffset", @selector(extractAnimatedNodeOffset:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAnimatedTurboModuleSpecJSI_connectAnimatedNodeToView(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "connectAnimatedNodeToView", @selector(connectAnimatedNodeToView:viewTag:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAnimatedTurboModuleSpecJSI_disconnectAnimatedNodeFromView(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "disconnectAnimatedNodeFromView", @selector(disconnectAnimatedNodeFromView:viewTag:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAnimatedTurboModuleSpecJSI_restoreDefaultValues(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "restoreDefaultValues", @selector(restoreDefaultValues:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAnimatedTurboModuleSpecJSI_dropAnimatedNode(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "dropAnimatedNode", @selector(dropAnimatedNode:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAnimatedTurboModuleSpecJSI_addAnimatedEventToView(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "addAnimatedEventToView", @selector(addAnimatedEventToView:eventName:eventMapping:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAnimatedTurboModuleSpecJSI_removeAnimatedEventFromView(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "removeAnimatedEventFromView", @selector(removeAnimatedEventFromView:eventName:animatedNodeTag:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAnimatedTurboModuleSpecJSI_addListener(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "addListener", @selector(addListener:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAnimatedTurboModuleSpecJSI_removeListeners(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, "removeListeners", @selector(removeListeners:), args, count); + } + + + NativeAnimatedTurboModuleSpecJSI::NativeAnimatedTurboModuleSpecJSI(const ObjCTurboModule::InitParams ¶ms) + : ObjCTurboModule(params) { + + methodMap_["createAnimatedNode"] = MethodMetadata {2, __hostFunction_NativeAnimatedTurboModuleSpecJSI_createAnimatedNode}; + + + methodMap_["getValue"] = MethodMetadata {2, __hostFunction_NativeAnimatedTurboModuleSpecJSI_getValue}; + + + methodMap_["startListeningToAnimatedNodeValue"] = MethodMetadata {1, __hostFunction_NativeAnimatedTurboModuleSpecJSI_startListeningToAnimatedNodeValue}; + + + methodMap_["stopListeningToAnimatedNodeValue"] = MethodMetadata {1, __hostFunction_NativeAnimatedTurboModuleSpecJSI_stopListeningToAnimatedNodeValue}; + + + methodMap_["connectAnimatedNodes"] = MethodMetadata {2, __hostFunction_NativeAnimatedTurboModuleSpecJSI_connectAnimatedNodes}; + + + methodMap_["disconnectAnimatedNodes"] = MethodMetadata {2, __hostFunction_NativeAnimatedTurboModuleSpecJSI_disconnectAnimatedNodes}; + + + methodMap_["startAnimatingNode"] = MethodMetadata {4, __hostFunction_NativeAnimatedTurboModuleSpecJSI_startAnimatingNode}; + + + methodMap_["stopAnimation"] = MethodMetadata {1, __hostFunction_NativeAnimatedTurboModuleSpecJSI_stopAnimation}; + + + methodMap_["setAnimatedNodeValue"] = MethodMetadata {2, __hostFunction_NativeAnimatedTurboModuleSpecJSI_setAnimatedNodeValue}; + + + methodMap_["setAnimatedNodeOffset"] = MethodMetadata {2, __hostFunction_NativeAnimatedTurboModuleSpecJSI_setAnimatedNodeOffset}; + + + methodMap_["flattenAnimatedNodeOffset"] = MethodMetadata {1, __hostFunction_NativeAnimatedTurboModuleSpecJSI_flattenAnimatedNodeOffset}; + + + methodMap_["extractAnimatedNodeOffset"] = MethodMetadata {1, __hostFunction_NativeAnimatedTurboModuleSpecJSI_extractAnimatedNodeOffset}; + + + methodMap_["connectAnimatedNodeToView"] = MethodMetadata {2, __hostFunction_NativeAnimatedTurboModuleSpecJSI_connectAnimatedNodeToView}; + + + methodMap_["disconnectAnimatedNodeFromView"] = MethodMetadata {2, __hostFunction_NativeAnimatedTurboModuleSpecJSI_disconnectAnimatedNodeFromView}; + + + methodMap_["restoreDefaultValues"] = MethodMetadata {1, __hostFunction_NativeAnimatedTurboModuleSpecJSI_restoreDefaultValues}; + + + methodMap_["dropAnimatedNode"] = MethodMetadata {1, __hostFunction_NativeAnimatedTurboModuleSpecJSI_dropAnimatedNode}; + + + methodMap_["addAnimatedEventToView"] = MethodMetadata {3, __hostFunction_NativeAnimatedTurboModuleSpecJSI_addAnimatedEventToView}; + + setMethodArgConversionSelector(@"addAnimatedEventToView", 2, @"JS_NativeAnimatedTurboModule_EventMapping:"); + + methodMap_["removeAnimatedEventFromView"] = MethodMetadata {3, __hostFunction_NativeAnimatedTurboModuleSpecJSI_removeAnimatedEventFromView}; + + + methodMap_["addListener"] = MethodMetadata {1, __hostFunction_NativeAnimatedTurboModuleSpecJSI_addListener}; + + + methodMap_["removeListeners"] = MethodMetadata {1, __hostFunction_NativeAnimatedTurboModuleSpecJSI_removeListeners}; + + + } } // namespace react diff --git a/Libraries/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec.h b/Libraries/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec.h index 2dde2e571ba2d9..ac8bb7b040ed54 100644 --- a/Libraries/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec.h +++ b/Libraries/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec.h @@ -324,6 +324,91 @@ namespace facebook { }; } // namespace react } // namespace facebook + +namespace JS { + namespace NativeAnimatedTurboModule { + struct EndResult { + bool finished() const; + + EndResult(NSDictionary *const v) : _v(v) {} + private: + NSDictionary *_v; + }; + } +} + +@interface RCTCxxConvert (NativeAnimatedTurboModule_EndResult) ++ (RCTManagedPointer *)JS_NativeAnimatedTurboModule_EndResult:(id)json; +@end + +namespace JS { + namespace NativeAnimatedTurboModule { + struct EventMapping { + facebook::react::LazyVector nativeEventPath() const; + folly::Optional animatedValueTag() const; + + EventMapping(NSDictionary *const v) : _v(v) {} + private: + NSDictionary *_v; + }; + } +} + +@interface RCTCxxConvert (NativeAnimatedTurboModule_EventMapping) ++ (RCTManagedPointer *)JS_NativeAnimatedTurboModule_EventMapping:(id)json; +@end +@protocol NativeAnimatedTurboModuleSpec + +- (void)createAnimatedNode:(double)tag + config:(NSDictionary *)config; +- (void)getValue:(double)tag +saveValueCallback:(RCTResponseSenderBlock)saveValueCallback; +- (void)startListeningToAnimatedNodeValue:(double)tag; +- (void)stopListeningToAnimatedNodeValue:(double)tag; +- (void)connectAnimatedNodes:(double)parentTag + childTag:(double)childTag; +- (void)disconnectAnimatedNodes:(double)parentTag + childTag:(double)childTag; +- (void)startAnimatingNode:(double)animationId + nodeTag:(double)nodeTag + config:(NSDictionary *)config + endCallback:(RCTResponseSenderBlock)endCallback; +- (void)stopAnimation:(double)animationId; +- (void)setAnimatedNodeValue:(double)nodeTag + value:(double)value; +- (void)setAnimatedNodeOffset:(double)nodeTag + offset:(double)offset; +- (void)flattenAnimatedNodeOffset:(double)nodeTag; +- (void)extractAnimatedNodeOffset:(double)nodeTag; +- (void)connectAnimatedNodeToView:(double)nodeTag + viewTag:(double)viewTag; +- (void)disconnectAnimatedNodeFromView:(double)nodeTag + viewTag:(double)viewTag; +- (void)restoreDefaultValues:(double)nodeTag; +- (void)dropAnimatedNode:(double)tag; +- (void)addAnimatedEventToView:(double)viewTag + eventName:(NSString *)eventName + eventMapping:(JS::NativeAnimatedTurboModule::EventMapping &)eventMapping; +- (void)removeAnimatedEventFromView:(double)viewTag + eventName:(NSString *)eventName + animatedNodeTag:(double)animatedNodeTag; +- (void)addListener:(NSString *)eventName; +- (void)removeListeners:(double)count; + +@end +namespace facebook { + namespace react { + /** + * ObjC++ class for module 'AnimatedTurboModule' + */ + + class JSI_EXPORT NativeAnimatedTurboModuleSpecJSI : public ObjCTurboModule { + public: + NativeAnimatedTurboModuleSpecJSI(const ObjCTurboModule::InitParams ¶ms); + + }; + } // namespace react +} // namespace facebook @protocol NativeAnimationsDebugModuleSpec - (void)startRecordingFps; @@ -2878,6 +2963,21 @@ inline folly::Optional JS::NativeAnimatedModule::EventMapping::animatedV id const p = _v[@"animatedValueTag"]; return RCTBridgingToOptionalDouble(p); } +inline bool JS::NativeAnimatedTurboModule::EndResult::finished() const +{ + id const p = _v[@"finished"]; + return RCTBridgingToBool(p); +} +inline facebook::react::LazyVector JS::NativeAnimatedTurboModule::EventMapping::nativeEventPath() const +{ + id const p = _v[@"nativeEventPath"]; + return RCTBridgingToVec(p, ^NSString *(id itemValue_0) { return RCTBridgingToString(itemValue_0); }); +} +inline folly::Optional JS::NativeAnimatedTurboModule::EventMapping::animatedValueTag() const +{ + id const p = _v[@"animatedValueTag"]; + return RCTBridgingToOptionalDouble(p); +} inline NSString *JS::NativeAppState::SpecGetCurrentAppStateSuccessAppState::app_state() const { id const p = _v[@"app_state"]; diff --git a/Libraries/HeapCapture/HeapCapture.js b/Libraries/HeapCapture/HeapCapture.js index 903343a05b0601..d48368d8aa1608 100644 --- a/Libraries/HeapCapture/HeapCapture.js +++ b/Libraries/HeapCapture/HeapCapture.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format - * @flow strict-local + * @flow strict */ 'use strict'; diff --git a/Libraries/HeapCapture/NativeJSCHeapCapture.js b/Libraries/HeapCapture/NativeJSCHeapCapture.js index 05e941f17e7b83..0605cd119e099b 100644 --- a/Libraries/HeapCapture/NativeJSCHeapCapture.js +++ b/Libraries/HeapCapture/NativeJSCHeapCapture.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow strict-local + * @flow strict * @format */ diff --git a/Libraries/Image/AssetRegistry.js b/Libraries/Image/AssetRegistry.js index 088187ff3e70ab..436195f76f77a6 100644 --- a/Libraries/Image/AssetRegistry.js +++ b/Libraries/Image/AssetRegistry.js @@ -10,29 +10,4 @@ 'use strict'; -export type PackagerAsset = { - +__packager_asset: boolean, - +fileSystemLocation: string, - +httpServerLocation: string, - +width: ?number, - +height: ?number, - +scales: Array, - +hash: string, - +name: string, - +type: string, - ... -}; - -const assets: Array = []; - -function registerAsset(asset: PackagerAsset): number { - // `push` returns new array length, so the first asset will - // get id 1 (not 0) to make the value truthy - return assets.push(asset); -} - -function getAssetByID(assetId: number): PackagerAsset { - return assets[assetId - 1]; -} - -module.exports = {registerAsset, getAssetByID}; +module.exports = require('@react-native/assets/registry'); diff --git a/Libraries/Image/AssetSourceResolver.js b/Libraries/Image/AssetSourceResolver.js index bc671090b25b5f..5ebd97a3d0298f 100644 --- a/Libraries/Image/AssetSourceResolver.js +++ b/Libraries/Image/AssetSourceResolver.js @@ -18,21 +18,26 @@ export type ResolvedAssetSource = {| +scale: number, |}; -import type {PackagerAsset} from './AssetRegistry'; +import type {PackagerAsset} from '@react-native/assets/registry'; const PixelRatio = require('../Utilities/PixelRatio'); const Platform = require('../Utilities/Platform'); -const assetPathUtils = require('./assetPathUtils'); const invariant = require('invariant'); +const { + getAndroidResourceFolderName, + getAndroidResourceIdentifier, + getBasePath, +} = require('@react-native/assets/path-support'); + /** * Returns a path like 'assets/AwesomeModule/icon@2x.png' */ function getScaledAssetPath(asset): string { const scale = AssetSourceResolver.pickScale(asset.scales, PixelRatio.get()); const scaleSuffix = scale === 1 ? '' : '@' + scale + 'x'; - const assetDir = assetPathUtils.getBasePath(asset); + const assetDir = getBasePath(asset); return assetDir + '/' + asset.name + scaleSuffix + '.' + asset.type; } @@ -41,11 +46,8 @@ function getScaledAssetPath(asset): string { */ function getAssetPathInDrawableFolder(asset): string { const scale = AssetSourceResolver.pickScale(asset.scales, PixelRatio.get()); - const drawbleFolder = assetPathUtils.getAndroidResourceFolderName( - asset, - scale, - ); - const fileName = assetPathUtils.getAndroidResourceIdentifier(asset); + const drawbleFolder = getAndroidResourceFolderName(asset, scale); + const fileName = getAndroidResourceIdentifier(asset); return drawbleFolder + '/' + fileName + '.' + asset.type; } @@ -133,9 +135,7 @@ class AssetSourceResolver { Platform.OS === 'android', 'resource identifiers work on Android', ); - return this.fromSource( - assetPathUtils.getAndroidResourceIdentifier(this.asset), - ); + return this.fromSource(getAndroidResourceIdentifier(this.asset)); } /** diff --git a/Libraries/Image/NativeImageEditor.js b/Libraries/Image/NativeImageEditor.js index 19dbf3cb6e52a2..c6fdc63f7d4812 100644 --- a/Libraries/Image/NativeImageEditor.js +++ b/Libraries/Image/NativeImageEditor.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow strict-local + * @flow strict * @format */ diff --git a/Libraries/Image/NativeImagePickerIOS.js b/Libraries/Image/NativeImagePickerIOS.js index 4db17f4059a8f9..fa64998c57b945 100644 --- a/Libraries/Image/NativeImagePickerIOS.js +++ b/Libraries/Image/NativeImagePickerIOS.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow strict-local + * @flow strict * @format */ diff --git a/Libraries/Image/NativeImageStore.js b/Libraries/Image/NativeImageStore.js index cbd7b22fd02613..38603b6aaab2cf 100644 --- a/Libraries/Image/NativeImageStore.js +++ b/Libraries/Image/NativeImageStore.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow strict-local + * @flow strict * @format */ diff --git a/Libraries/Image/RCTUIImageViewAnimated.m b/Libraries/Image/RCTUIImageViewAnimated.m index 40661daf6531b7..e3f0605495bd55 100644 --- a/Libraries/Image/RCTUIImageViewAnimated.m +++ b/Libraries/Image/RCTUIImageViewAnimated.m @@ -191,14 +191,8 @@ - (void)displayDidRefresh:(CADisplayLink *)displayLink #else // displaylink.duration -- time interval between frames, assuming maximumFramesPerSecond // displayLink.preferredFramesPerSecond (>= iOS 10) -- Set to 30 for displayDidRefresh to be called at 30 fps - // displayLink.frameInterval (< iOS 10) -- # of frames that must pass before each displayDidRefresh. After iOS 10, when this is set to 2, preferredFramesPerSecond becomes 30 fps. // durationToNextRefresh -- Time interval to the next time displayDidRefresh is called - NSTimeInterval durationToNextRefresh; - if (@available(iOS 10.0, *)) { - durationToNextRefresh = displayLink.targetTimestamp - displayLink.timestamp; - } else { - durationToNextRefresh = displayLink.duration * displayLink.frameInterval; - } + NSTimeInterval durationToNextRefresh = displayLink.targetTimestamp - displayLink.timestamp; #endif NSUInteger totalFrameCount = self.totalFrameCount; NSUInteger currentFrameIndex = self.currentFrameIndex; diff --git a/Libraries/Image/RelativeImageStub.js b/Libraries/Image/RelativeImageStub.js index 040392a75e2e07..3303143d933780 100644 --- a/Libraries/Image/RelativeImageStub.js +++ b/Libraries/Image/RelativeImageStub.js @@ -13,7 +13,7 @@ // This is a stub for flow to make it understand require('./icon.png') // See metro/src/Bundler/index.js -const AssetRegistry = require('./AssetRegistry'); +const AssetRegistry = require('@react-native/assets/registry'); module.exports = (AssetRegistry.registerAsset({ __packager_asset: true, diff --git a/Libraries/Image/__tests__/resolveAssetSource-test.js b/Libraries/Image/__tests__/resolveAssetSource-test.js index ee752bd7322c4a..c9fa18374bbf56 100644 --- a/Libraries/Image/__tests__/resolveAssetSource-test.js +++ b/Libraries/Image/__tests__/resolveAssetSource-test.js @@ -19,7 +19,7 @@ describe('resolveAssetSource', () => { beforeEach(() => { jest.resetModules(); - AssetRegistry = require('../AssetRegistry'); + AssetRegistry = require('@react-native/assets/registry'); resolveAssetSource = require('../resolveAssetSource'); NativeSourceCode = require('../../NativeModules/specs/NativeSourceCode') .default; diff --git a/Libraries/Image/resolveAssetSource.js b/Libraries/Image/resolveAssetSource.js index 2b97b8d6b59367..71df2005163baa 100644 --- a/Libraries/Image/resolveAssetSource.js +++ b/Libraries/Image/resolveAssetSource.js @@ -12,7 +12,7 @@ 'use strict'; -const AssetRegistry = require('./AssetRegistry'); +const AssetRegistry = require('@react-native/assets/registry'); const AssetSourceResolver = require('./AssetSourceResolver'); import type {ResolvedAssetSource} from './AssetSourceResolver'; diff --git a/Libraries/Interaction/InteractionManager.js b/Libraries/Interaction/InteractionManager.js index c438a67e7a9f1c..8aec6727e33c8d 100644 --- a/Libraries/Interaction/InteractionManager.js +++ b/Libraries/Interaction/InteractionManager.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format - * @flow + * @flow strict-local */ 'use strict'; @@ -88,13 +88,16 @@ const InteractionManager = { runAfterInteractions( task: ?Task, ): { - then: Function, - done: Function, - cancel: Function, + then: ( + onFulfill?: ?(void) => ?(Promise | U), + onReject?: ?(error: mixed) => ?(Promise | U), + ) => Promise, + done: () => void, + cancel: () => void, ... } { - const tasks = []; - const promise = new Promise(resolve => { + const tasks: Array = []; + const promise = new Promise((resolve: () => void) => { _scheduleUpdate(); if (task) { tasks.push(task); @@ -164,8 +167,6 @@ let _nextUpdateHandle = 0; let _inc = 0; let _deadline = -1; -declare function setImmediate(callback: any, ...args: Array): number; - /** * Schedule an asynchronous update to the interaction state. */ diff --git a/Libraries/Interaction/NativeFrameRateLogger.js b/Libraries/Interaction/NativeFrameRateLogger.js index d248a7cf3cb9e0..363294aed75e87 100644 --- a/Libraries/Interaction/NativeFrameRateLogger.js +++ b/Libraries/Interaction/NativeFrameRateLogger.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format - * @flow strict-local + * @flow strict */ import type {TurboModule} from '../TurboModule/RCTExport'; diff --git a/Libraries/Interaction/TaskQueue.js b/Libraries/Interaction/TaskQueue.js index 15eb69388dc30a..965953f64fb8d0 100644 --- a/Libraries/Interaction/TaskQueue.js +++ b/Libraries/Interaction/TaskQueue.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format - * @flow + * @flow strict */ 'use strict'; @@ -16,14 +16,12 @@ const invariant = require('invariant'); type SimpleTask = { name: string, run: () => void, - ... }; type PromiseTask = { name: string, - gen: () => Promise, - ... + gen: () => Promise, }; -export type Task = Function | SimpleTask | PromiseTask; +export type Task = SimpleTask | PromiseTask | (() => void); const DEBUG: false = false; @@ -101,10 +99,10 @@ class TaskQueue { if (queue.length) { const task = queue.shift(); try { - if (task.gen) { + if (typeof task === 'object' && task.gen) { DEBUG && infoLog('TaskQueue: genPromise for task ' + task.name); - this._genPromise((task: any)); // Rather than annoying tagged union - } else if (task.run) { + this._genPromise(task); + } else if (typeof task === 'object' && task.run) { DEBUG && infoLog('TaskQueue: run task ' + task.name); task.run(); } else { diff --git a/Libraries/JSInspector/InspectorAgent.js b/Libraries/JSInspector/InspectorAgent.js index b3bd461314336b..8c12d695293c31 100644 --- a/Libraries/JSInspector/InspectorAgent.js +++ b/Libraries/JSInspector/InspectorAgent.js @@ -5,12 +5,12 @@ * LICENSE file in the root directory of this source tree. * * @format - * @flow + * @flow strict */ 'use strict'; -export type EventSender = (name: string, params: Object) => void; +export type EventSender = (name: string, params: mixed) => void; class InspectorAgent { _eventSender: EventSender; @@ -19,7 +19,7 @@ class InspectorAgent { this._eventSender = eventSender; } - sendEvent(name: string, params: Object) { + sendEvent(name: string, params: mixed) { this._eventSender(name, params); } } diff --git a/Libraries/JSInspector/JSInspector.js b/Libraries/JSInspector/JSInspector.js index 44917ac36b16f8..d4c8815ebe1c37 100644 --- a/Libraries/JSInspector/JSInspector.js +++ b/Libraries/JSInspector/JSInspector.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format - * @flow strict-local + * @flow strict */ 'use strict'; diff --git a/Libraries/JSInspector/NetworkAgent.js b/Libraries/JSInspector/NetworkAgent.js index 9f48f7cb1f22c2..f1811978709eac 100644 --- a/Libraries/JSInspector/NetworkAgent.js +++ b/Libraries/JSInspector/NetworkAgent.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format - * @flow + * @flow strict-local */ 'use strict'; @@ -22,7 +22,7 @@ type LoaderId = string; type FrameId = string; type Timestamp = number; -type Headers = Object; +type Headers = {[string]: string}; // We don't currently care about this type ResourceTiming = null; @@ -160,7 +160,7 @@ class Interceptor { return this._requests.get(requestId); } - requestSent(id: number, url: string, method: string, headers: Object) { + requestSent(id: number, url: string, method: string, headers: Headers) { const requestId = String(id); this._requests.set(requestId, ''); @@ -188,7 +188,7 @@ class Interceptor { this._agent.sendEvent('requestWillBeSent', event); } - responseReceived(id: number, url: string, status: number, headers: Object) { + responseReceived(id: number, url: string, status: number, headers: Headers) { const requestId = String(id); const response: Response = { url, @@ -247,7 +247,7 @@ class Interceptor { this._agent.sendEvent('loadingFailed', event); } - _getMimeType(headers: Object): string { + _getMimeType(headers: Headers): string { const contentType = headers['Content-Type'] || ''; return contentType.split(';')[0]; } diff --git a/Libraries/LayoutAnimation/LayoutAnimation.js b/Libraries/LayoutAnimation/LayoutAnimation.js index 159b2b96c785ad..d68c0b14a04583 100644 --- a/Libraries/LayoutAnimation/LayoutAnimation.js +++ b/Libraries/LayoutAnimation/LayoutAnimation.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow + * @flow strict-local * @format */ @@ -23,9 +23,11 @@ import Platform from '../Utilities/Platform'; // Reexport type export type LayoutAnimationConfig = LayoutAnimationConfig_; +type OnAnimationDidEndCallback = () => void; + function configureNext( config: LayoutAnimationConfig, - onAnimationDidEnd?: Function, + onAnimationDidEnd?: OnAnimationDidEndCallback, ) { if (!Platform.isTesting) { if (UIManager?.configureNextLayoutAnimation) { @@ -131,13 +133,13 @@ const LayoutAnimation = { }, Presets, easeInEaseOut: (configureNext.bind(null, Presets.easeInEaseOut): ( - onAnimationDidEnd?: any, + onAnimationDidEnd?: OnAnimationDidEndCallback, ) => void), linear: (configureNext.bind(null, Presets.linear): ( - onAnimationDidEnd?: any, + onAnimationDidEnd?: OnAnimationDidEndCallback, ) => void), spring: (configureNext.bind(null, Presets.spring): ( - onAnimationDidEnd?: any, + onAnimationDidEnd?: OnAnimationDidEndCallback, ) => void), }; diff --git a/Libraries/Linking/Linking.js b/Libraries/Linking/Linking.js index 7a0ab925a6d8c8..1ce5a8ae0795d0 100644 --- a/Libraries/Linking/Linking.js +++ b/Libraries/Linking/Linking.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format - * @flow + * @flow strict-local */ 'use strict'; @@ -33,7 +33,7 @@ class Linking extends NativeEventEmitter { * * See https://reactnative.dev/docs/linking.html#addeventlistener */ - addEventListener(type: string, handler: Function) { + addEventListener(type: string, handler: T) { this.addListener(type, handler); } @@ -42,7 +42,7 @@ class Linking extends NativeEventEmitter { * * See https://reactnative.dev/docs/linking.html#removeeventlistener */ - removeEventListener(type: string, handler: Function) { + removeEventListener(type: string, handler: T) { this.removeListener(type, handler); } @@ -51,7 +51,7 @@ class Linking extends NativeEventEmitter { * * See https://reactnative.dev/docs/linking.html#openurl */ - openURL(url: string): Promise { + openURL(url: string): Promise { this._validateURL(url); return NativeLinking.openURL(url); } @@ -71,7 +71,7 @@ class Linking extends NativeEventEmitter { * * See https://reactnative.dev/docs/linking.html#opensettings */ - openSettings(): Promise { + openSettings(): Promise { return NativeLinking.openSettings(); } diff --git a/Libraries/Linking/NativeLinking.js b/Libraries/Linking/NativeLinking.js index 18b3e7128cd570..942aa4f01b8b9b 100644 --- a/Libraries/Linking/NativeLinking.js +++ b/Libraries/Linking/NativeLinking.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow strict-local + * @flow strict * @format */ diff --git a/Libraries/LogBox/Data/LogBoxData.js b/Libraries/LogBox/Data/LogBoxData.js index 9d35132a490f3a..b9890449b4c0c7 100644 --- a/Libraries/LogBox/Data/LogBoxData.js +++ b/Libraries/LogBox/Data/LogBoxData.js @@ -198,8 +198,7 @@ export function addLog(log: LogData): void { // otherwise spammy logs would pause rendering. setImmediate(() => { try { - // TODO: Use Error.captureStackTrace on Hermes - const stack = parseErrorStack(errorForStackTrace); + const stack = parseErrorStack(errorForStackTrace?.stack); appendNewLog( new LogBoxLog({ diff --git a/Libraries/LogBox/Data/__tests__/parseLogBoxLog-test.js b/Libraries/LogBox/Data/__tests__/parseLogBoxLog-test.js index 30c489a3445a49..ad1bf18210035c 100644 --- a/Libraries/LogBox/Data/__tests__/parseLogBoxLog-test.js +++ b/Libraries/LogBox/Data/__tests__/parseLogBoxLog-test.js @@ -11,10 +11,6 @@ 'use strict'; -jest.mock('../../../Core/Devtools/parseErrorStack', () => { - return {__esModule: true, default: jest.fn(() => [])}; -}); - const {parseLogBoxLog, parseLogBoxException} = require('../parseLogBoxLog'); describe('parseLogBoxLog', () => { @@ -738,4 +734,499 @@ Please follow the instructions at: fburl.com/rn-remote-assets`, ], }); }); + + describe('Handles component stack frames formatted as call stacks', () => { + // In new versions of React, the component stack frame format changed to match call stacks. + it('detects a component stack in an interpolated warning', () => { + expect( + parseLogBoxLog([ + 'Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?%s%s', + '\n\nCheck the render method of `MyComponent`.', + '\n at MyComponent (/path/to/filename.js:1:2)\n at MyOtherComponent\n at MyAppComponent (/path/to/app.js:100:20)', + ]), + ).toEqual({ + componentStack: [ + { + collapse: false, + content: 'MyComponent', + fileName: '/path/to/filename.js', + location: {column: 1, row: 1}, + }, + // TODO: we're missing the second component, + // because React isn't sending back a properly formatted stackframe. + { + collapse: false, + content: 'MyAppComponent', + fileName: '/path/to/app.js', + location: {column: 19, row: 100}, + }, + ], + category: + 'Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?%s', + message: { + content: + 'Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?\n\nCheck the render method of `MyComponent`.', + substitutions: [ + { + length: 43, + offset: 129, + }, + ], + }, + }); + }); + + it('detects a component stack in the first argument', () => { + expect( + parseLogBoxLog([ + 'Some kind of message\n at MyComponent (/path/to/filename.js:1:2)\n at MyOtherComponent\n at MyAppComponent (/path/to/app.js:100:20)', + ]), + ).toEqual({ + componentStack: [ + { + collapse: false, + content: 'MyComponent', + fileName: '/path/to/filename.js', + location: {column: 1, row: 1}, + }, + // TODO: we're missing the second component, + // because React isn't sending back a properly formatted stackframe. + { + collapse: false, + content: 'MyAppComponent', + fileName: '/path/to/app.js', + location: {column: 19, row: 100}, + }, + ], + category: 'Some kind of message', + message: { + content: 'Some kind of message', + substitutions: [], + }, + }); + }); + + it('detects a component stack in the second argument', () => { + expect( + parseLogBoxLog([ + 'Some kind of message', + '\n at MyComponent (/path/to/filename.js:1:2)\n at MyOtherComponent\n at MyAppComponent (/path/to/app.js:100:20)', + ]), + ).toEqual({ + componentStack: [ + { + collapse: false, + content: 'MyComponent', + fileName: '/path/to/filename.js', + location: {column: 1, row: 1}, + }, + // TODO: we're missing the second component, + // because React isn't sending back a properly formatted stackframe. + { + collapse: false, + content: 'MyAppComponent', + fileName: '/path/to/app.js', + location: {column: 19, row: 100}, + }, + ], + category: 'Some kind of message', + message: { + content: 'Some kind of message', + substitutions: [], + }, + }); + }); + + it('detects a component stack in the nth argument', () => { + expect( + parseLogBoxLog([ + 'Warning: Each child in a list should have a unique "key" prop.%s%s See https://fb.me/react-warning-keys for more information.%s', + '\n\nCheck the render method of `MyOtherComponent`.', + '', + '\n at MyComponent (/path/to/filename.js:1:2)\n at MyOtherComponent\n at MyAppComponent (/path/to/app.js:100:20)', + ]), + ).toEqual({ + componentStack: [ + { + collapse: false, + content: 'MyComponent', + fileName: '/path/to/filename.js', + location: {column: 1, row: 1}, + }, + // TODO: we're missing the second component, + // because React isn't sending back a properly formatted stackframe. + { + collapse: false, + content: 'MyAppComponent', + fileName: '/path/to/app.js', + location: {column: 19, row: 100}, + }, + ], + category: + 'Warning: Each child in a list should have a unique "key" prop.%s%s See https://fb.me/react-warning-keys for more information.', + message: { + content: + 'Warning: Each child in a list should have a unique "key" prop.\n\nCheck the render method of `MyOtherComponent`. See https://fb.me/react-warning-keys for more information.', + substitutions: [ + { + length: 48, + offset: 62, + }, + { + length: 0, + offset: 110, + }, + ], + }, + }); + }); + + it('parses an error log with `error.componentStack`', () => { + const error = { + id: 0, + isFatal: false, + isComponentError: false, + message: '### Error', + originalMessage: '### Error', + name: '', + componentStack: + '\n at MyComponent (/path/to/filename.js:1:2)\n at MyOtherComponent\n at MyAppComponent (/path/to/app.js:100:20)', + stack: [ + { + column: 1, + file: 'foo.js', + lineNumber: 1, + methodName: 'bar', + collapse: false, + }, + ], + }; + + expect(parseLogBoxException(error)).toEqual({ + level: 'error', + category: '### Error', + isComponentError: false, + message: { + content: '### Error', + substitutions: [], + }, + componentStack: [ + { + collapse: false, + content: 'MyComponent', + fileName: '/path/to/filename.js', + location: {column: 1, row: 1}, + }, + // TODO: we're missing the second component, + // because React isn't sending back a properly formatted stackframe. + { + collapse: false, + content: 'MyAppComponent', + fileName: '/path/to/app.js', + location: {column: 19, row: 100}, + }, + ], + stack: [ + { + column: 1, + file: 'foo.js', + lineNumber: 1, + methodName: 'bar', + collapse: false, + }, + ], + }); + }); + }); + + describe('Handles component stack frames formatted as call stacks in JSC', () => { + // In new versions of React, the component stack frame format changed to match call stacks. + it('detects a component stack in an interpolated warning', () => { + expect( + parseLogBoxLog([ + 'Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?%s%s', + '\n\nCheck the render method of `MyComponent`.', + '\nMyComponent@/path/to/filename.js:1:2\nforEach@[native code]\nMyAppComponent@/path/to/app.js:100:20', + ]), + ).toEqual({ + componentStack: [ + { + collapse: false, + content: 'MyComponent', + fileName: '/path/to/filename.js', + location: {column: 1, row: 1}, + }, + // TODO: we're missing the second component, + // because stackframe-parser does not recognize it. + { + collapse: false, + content: 'MyAppComponent', + fileName: '/path/to/app.js', + location: {column: 19, row: 100}, + }, + ], + category: + 'Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?%s', + message: { + content: + 'Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?\n\nCheck the render method of `MyComponent`.', + substitutions: [ + { + length: 43, + offset: 129, + }, + ], + }, + }); + }); + + it('detects a component stack in the first argument', () => { + expect( + parseLogBoxLog([ + 'Some kind of message\nMyComponent@/path/to/filename.js:1:2\nforEach@[native code]\nMyAppComponent@/path/to/app.js:100:20', + ]), + ).toEqual({ + componentStack: [ + { + collapse: false, + content: 'MyComponent', + fileName: '/path/to/filename.js', + location: {column: 1, row: 1}, + }, + // TODO: we're missing the second component, + // because stackframe-parser does not recognize it. + { + collapse: false, + content: 'MyAppComponent', + fileName: '/path/to/app.js', + location: {column: 19, row: 100}, + }, + ], + category: 'Some kind of message', + message: { + content: 'Some kind of message', + substitutions: [], + }, + }); + }); + + it('detects a component stack in the first argument (JSC)', () => { + expect( + parseLogBoxLog([ + 'Some kind of message\nMyComponent@/path/to/filename.js:1:2\nforEach@[native code]\nMyAppComponent@/path/to/app.js:100:20', + ]), + ).toEqual({ + componentStack: [ + { + collapse: false, + content: 'MyComponent', + fileName: '/path/to/filename.js', + location: {column: 1, row: 1}, + }, + // TODO: we're missing the second component, + // because stackframe-parser does not recognize it. + { + collapse: false, + content: 'MyAppComponent', + fileName: '/path/to/app.js', + location: {column: 19, row: 100}, + }, + ], + category: 'Some kind of message', + message: { + content: 'Some kind of message', + substitutions: [], + }, + }); + }); + + it('detects a component stack in the second argument', () => { + expect( + parseLogBoxLog([ + 'Some kind of message', + '\nMyComponent@/path/to/filename.js:1:2\nforEach@[native code]\nMyAppComponent@/path/to/app.js:100:20', + ]), + ).toEqual({ + componentStack: [ + { + collapse: false, + content: 'MyComponent', + fileName: '/path/to/filename.js', + location: {column: 1, row: 1}, + }, + // TODO: we're missing the second component, + // because stackframe-parser does not recognize it. + { + collapse: false, + content: 'MyAppComponent', + fileName: '/path/to/app.js', + location: {column: 19, row: 100}, + }, + ], + category: 'Some kind of message', + message: { + content: 'Some kind of message', + substitutions: [], + }, + }); + }); + + it('detects a component stack in the nth argument', () => { + expect( + parseLogBoxLog([ + 'Warning: Each child in a list should have a unique "key" prop.%s%s See https://fb.me/react-warning-keys for more information.%s', + '\n\nCheck the render method of `MyOtherComponent`.', + '', + '\nMyComponent@/path/to/filename.js:1:2\nforEach@[native code]\nMyAppComponent@/path/to/app.js:100:20', + ]), + ).toEqual({ + componentStack: [ + { + collapse: false, + content: 'MyComponent', + fileName: '/path/to/filename.js', + location: {column: 1, row: 1}, + }, + // TODO: we're missing the second component, + // because stackframe-parser does not recognize it. + { + collapse: false, + content: 'MyAppComponent', + fileName: '/path/to/app.js', + location: {column: 19, row: 100}, + }, + ], + category: + 'Warning: Each child in a list should have a unique "key" prop.%s%s See https://fb.me/react-warning-keys for more information.', + message: { + content: + 'Warning: Each child in a list should have a unique "key" prop.\n\nCheck the render method of `MyOtherComponent`. See https://fb.me/react-warning-keys for more information.', + substitutions: [ + { + length: 48, + offset: 62, + }, + { + length: 0, + offset: 110, + }, + ], + }, + }); + }); + + it('parses an error log with `error.componentStack`', () => { + const error = { + id: 0, + isFatal: false, + isComponentError: false, + message: '### Error', + originalMessage: '### Error', + name: '', + componentStack: + '\nMyComponent@/path/to/filename.js:1:2\nforEach@[native code]\nMyAppComponent@/path/to/app.js:100:20', + stack: [ + { + column: 1, + file: 'foo.js', + lineNumber: 1, + methodName: 'bar', + collapse: false, + }, + ], + }; + + expect(parseLogBoxException(error)).toEqual({ + level: 'error', + category: '### Error', + isComponentError: false, + message: { + content: '### Error', + substitutions: [], + }, + componentStack: [ + { + collapse: false, + content: 'MyComponent', + fileName: '/path/to/filename.js', + location: {column: 1, row: 1}, + }, + // TODO: we're missing the second component, + // because stackframe-parser does not recognize it. + { + collapse: false, + content: 'MyAppComponent', + fileName: '/path/to/app.js', + location: {column: 19, row: 100}, + }, + ], + stack: [ + { + column: 1, + file: 'foo.js', + lineNumber: 1, + methodName: 'bar', + collapse: false, + }, + ], + }); + }); + + it('parses an error log with a component stack in the message', () => { + const error = { + id: 0, + isFatal: false, + isComponentError: false, + message: + 'Some kind of message\nMyComponent@/path/to/filename.js:1:2\nforEach@[native code]\nMyAppComponent@/path/to/app.js:100:20', + originalMessage: + 'Some kind of message\nMyComponent@/path/to/filename.js:1:2\nforEach@[native code]\nMyAppComponent@/path/to/app.js:100:20', + name: '', + componentStack: null, + stack: [ + { + column: 1, + file: 'foo.js', + lineNumber: 1, + methodName: 'bar', + collapse: false, + }, + ], + }; + expect(parseLogBoxException(error)).toEqual({ + level: 'error', + isComponentError: false, + stack: [ + { + collapse: false, + column: 1, + file: 'foo.js', + lineNumber: 1, + methodName: 'bar', + }, + ], + componentStack: [ + { + collapse: false, + content: 'MyComponent', + fileName: '/path/to/filename.js', + location: {column: 1, row: 1}, + }, + // TODO: we're missing the second component, + // because stackframe-parser does not recognize it. + { + collapse: false, + content: 'MyAppComponent', + fileName: '/path/to/app.js', + location: {column: 19, row: 100}, + }, + ], + category: 'Some kind of message', + message: { + content: 'Some kind of message', + substitutions: [], + }, + }); + }); + }); }); diff --git a/Libraries/LogBox/Data/parseLogBoxLog.js b/Libraries/LogBox/Data/parseLogBoxLog.js index 0d7c83d3755270..c382ca301b37de 100644 --- a/Libraries/LogBox/Data/parseLogBoxLog.js +++ b/Libraries/LogBox/Data/parseLogBoxLog.js @@ -14,6 +14,7 @@ import UTFSequence from '../../UTFSequence'; import stringifySafe from '../../Utilities/stringifySafe'; import type {ExceptionData} from '../../Core/NativeExceptionsManager'; import type {LogBoxLogData} from './LogBoxLog'; +import parseErrorStack from '../../Core/Devtools/parseErrorStack'; const BABEL_TRANSFORM_ERROR_FORMAT = /^(?:TransformError )?(?:SyntaxError: |ReferenceError: )(.*): (.*) \((\d+):(\d+)\)\n\n([\s\S]+)/; const BABEL_CODE_FRAME_ERROR_FORMAT = /^(?:TransformError )?(?:.*):? (?:.*?)(\/.*): ([\s\S]+?)\n([ >]{2}[\d\s]+ \|[\s\S]+|\u{001b}[\s\S]+)/u; @@ -32,6 +33,11 @@ export type CodeFrame = $ReadOnly<{| ... }, fileName: string, + + // TODO: When React switched to using call stack frames, + // we gained the ability to use the collapse flag, but + // it is not integrated into the LogBox UI. + collapse?: boolean, |}>; export type Message = $ReadOnly<{| content: string, @@ -124,7 +130,35 @@ export function parseInterpolation( }; } +function isComponentStack(consoleArgument: string) { + const isOldComponentStackFormat = /\s{4}in/.test(consoleArgument); + const isNewComponentStackFormat = /\s{4}at/.test(consoleArgument); + const isNewJSCComponentStackFormat = /@.*\n/.test(consoleArgument); + + return ( + isOldComponentStackFormat || + isNewComponentStackFormat || + isNewJSCComponentStackFormat + ); +} + export function parseComponentStack(message: string): ComponentStack { + // In newer versions of React, the component stack is formatted as a call stack frame. + // First try to parse the component stack as a call stack frame, and if that doesn't + // work then we'll fallback to the old custom component stack format parsing. + const stack = parseErrorStack(message); + if (stack && stack.length > 0) { + return stack.map(frame => ({ + content: frame.methodName, + collapse: frame.collapse || false, + fileName: frame.file == null ? 'unknown' : frame.file, + location: { + column: frame.column == null ? -1 : frame.column, + row: frame.lineNumber == null ? -1 : frame.lineNumber, + }, + })); + } + return message .split(/\n {4}in /g) .map(s => { @@ -304,8 +338,7 @@ export function parseLogBoxLog( args.length > 0 ) { const lastArg = args[args.length - 1]; - // Does it look like React component stack? " in ..." - if (typeof lastArg === 'string' && /\s{4}in/.test(lastArg)) { + if (typeof lastArg === 'string' && isComponentStack(lastArg)) { argsWithoutComponentStack = args.slice(0, -1); argsWithoutComponentStack[0] = message.slice(0, -2); componentStack = parseComponentStack(lastArg); @@ -315,9 +348,13 @@ export function parseLogBoxLog( if (componentStack.length === 0) { // Try finding the component stack elsewhere. for (const arg of args) { - if (typeof arg === 'string' && /\n {4}in /.exec(arg)) { + if (typeof arg === 'string' && isComponentStack(arg)) { // Strip out any messages before the component stack. - const messageEndIndex = arg.indexOf('\n in '); + let messageEndIndex = arg.search(/\n {4}(in|at) /); + if (messageEndIndex < 0) { + // Handle JSC component stacks. + messageEndIndex = arg.search(/\n/); + } if (messageEndIndex > 0) { argsWithoutComponentStack.push(arg.slice(0, messageEndIndex)); } diff --git a/Libraries/LogBox/__tests__/LogBox-integration-test.js b/Libraries/LogBox/__tests__/LogBox-integration-test.js new file mode 100644 index 00000000000000..f8187a4e5cb020 --- /dev/null +++ b/Libraries/LogBox/__tests__/LogBox-integration-test.js @@ -0,0 +1,128 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + * @emails oncall+react_native + */ + +'use strict'; + +const LogBoxData = require('../Data/LogBoxData'); +const TestRenderer = require('react-test-renderer'); + +import * as React from 'react'; + +import { + DoesNotUseKey, + FragmentWithProp, +} from './__fixtures__/ReactWarningFixtures'; + +const installLogBox = () => { + const LogBox = require('../LogBox'); + + LogBox.install(); +}; + +const uninstallLogBox = () => { + const LogBox = require('../LogBox'); + LogBox.uninstall(); +}; + +const BEFORE_SLASH_RE = /(?:\/[a-zA-Z]+\/)(.+?)(?:\/.+)\//; + +const cleanPath = message => { + return message.replace(BEFORE_SLASH_RE, '/path/to/'); +}; + +const cleanLog = logs => { + return logs.map(log => { + return { + ...log, + componentStack: log.componentStack.map(stack => ({ + ...stack, + fileName: cleanPath(stack.fileName), + })), + }; + }); +}; + +describe('LogBox', () => { + const {error, warn} = console; + const mockError = jest.fn(); + const mockWarn = jest.fn(); + + beforeEach(() => { + jest.resetModules(); + jest.restoreAllMocks(); + + mockError.mockClear(); + mockWarn.mockClear(); + + (console: any).error = mockError; + (console: any).warn = mockWarn; + }); + + afterEach(() => { + uninstallLogBox(); + (console: any).error = error; + (console: any).warn = warn; + }); + + it('integrates with React and handles a key error in LogBox', () => { + const spy = jest.spyOn(LogBoxData, 'addLog'); + installLogBox(); + + // Spy console.error after LogBox is installed + // so we can assert on what React logs. + jest.spyOn(console, 'error'); + + const output = TestRenderer.create(); + + // The key error should always be the highest severity. + // In LogBox, we expect these errors to: + // - Be added to LogBox, because all errors and warnings are. + // - Not call through to console.warn, because they are errors. + // - Pass to console.error, with a "Warning" prefix so it does not pop a RedBox. + expect(output).toBeDefined(); + expect(mockWarn).not.toBeCalled(); + expect(console.error.mock.calls[0].map(cleanPath)).toMatchSnapshot( + 'Log sent from React', + ); + expect(cleanLog(spy.mock.calls[0])).toMatchSnapshot('Log added to LogBox'); + expect(mockError.mock.calls[0].map(cleanPath)).toMatchSnapshot( + 'Log passed to console error', + ); + expect(mockError.mock.calls[0][0].startsWith('Warning: ')).toBe(true); + }); + + it('integrates with React and handles a fragment warning in LogBox', () => { + const spy = jest.spyOn(LogBoxData, 'addLog'); + installLogBox(); + + // Spy console.error after LogBox is installed + // so we can assert on what React logs. + jest.spyOn(console, 'error'); + + const output = TestRenderer.create(); + + // The fragment warning is not as severe. For this warning we don't want to + // pop open a dialog, so we show a collapsed error UI. + // That means we expect these warnings to: + // - Be added to LogBox and displayed collapsed as an error. + // - Not call console.warn, because they are errors in the console. + // - Pass to console.error, with a "Warning" prefix so it does not pop a RedBox. + expect(output).toBeDefined(); + expect(mockWarn).not.toBeCalled(); + expect(console.error.mock.calls[0].map(cleanPath)).toMatchSnapshot( + 'Log sent from React', + ); + expect(cleanLog(spy.mock.calls[0])).toMatchSnapshot('Log added to LogBox'); + expect(mockError.mock.calls[0].map(cleanPath)).toMatchSnapshot( + 'Log passed to console error', + ); + expect(mockError.mock.calls[0][0].startsWith('Warning: ')).toBe(true); + }); +}); diff --git a/Libraries/LogBox/__tests__/__fixtures__/ReactWarningFixtures.js b/Libraries/LogBox/__tests__/__fixtures__/ReactWarningFixtures.js new file mode 100644 index 00000000000000..f8962098c649c5 --- /dev/null +++ b/Libraries/LogBox/__tests__/__fixtures__/ReactWarningFixtures.js @@ -0,0 +1,34 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + * @emails oncall+react_native + */ + +'use strict'; + +import {Text} from 'react-native'; +import * as React from 'react'; + +export const DoesNotUseKey = () => { + return ( + <> + {['foo', 'bar'].map(item => ( + {item} + ))} + + ); +}; + +export const FragmentWithProp = () => { + return ( + + {['foo', 'bar'].map(item => ( + {item} + ))} + + ); +}; diff --git a/Libraries/LogBox/__tests__/__snapshots__/LogBox-integration-test.js.snap b/Libraries/LogBox/__tests__/__snapshots__/LogBox-integration-test.js.snap new file mode 100644 index 00000000000000..9209ee6be5f0b4 --- /dev/null +++ b/Libraries/LogBox/__tests__/__snapshots__/LogBox-integration-test.js.snap @@ -0,0 +1,94 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`LogBox integrates with React and handles a fragment warning in LogBox: Log added to LogBox 1`] = ` +Array [ + Object { + "category": "Warning: Invalid prop \`%s\` supplied to \`React.Fragment\`. React.Fragment can only have \`key\` and \`children\` props.", + "componentStack": Array [ + Object { + "content": "Fragment", + "fileName": "ReactWarningFixtures.js", + "location": Object { + "column": -1, + "row": 28, + }, + }, + ], + "level": "warn", + "message": Object { + "content": "Warning: Invalid prop \`invalid\` supplied to \`React.Fragment\`. React.Fragment can only have \`key\` and \`children\` props.", + "substitutions": Array [ + Object { + "length": 7, + "offset": 23, + }, + ], + }, + }, +] +`; + +exports[`LogBox integrates with React and handles a fragment warning in LogBox: Log passed to console error 1`] = ` +Array [ + "Warning: Invalid prop \`invalid\` supplied to \`React.Fragment\`. React.Fragment can only have \`key\` and \`children\` props. + in Fragment (at ReactWarningFixtures.js:28)", +] +`; + +exports[`LogBox integrates with React and handles a fragment warning in LogBox: Log sent from React 1`] = ` +Array [ + "Warning: Invalid prop \`%s\` supplied to \`React.Fragment\`. React.Fragment can only have \`key\` and \`children\` props.%s", + "invalid", + " + in Fragment (at ReactWarningFixtures.js:28)", +] +`; + +exports[`LogBox integrates with React and handles a key error in LogBox: Log added to LogBox 1`] = ` +Array [ + Object { + "category": "Warning: Each child in a list should have a unique \\"key\\" prop.%s%s See https://fb.me/react-warning-keys for more information.", + "componentStack": Array [ + Object { + "content": "Text", + "fileName": "ReactWarningFixtures.js", + "location": Object { + "column": -1, + "row": 20, + }, + }, + ], + "level": "warn", + "message": Object { + "content": "Warning: Each child in a list should have a unique \\"key\\" prop. See https://fb.me/react-warning-keys for more information.", + "substitutions": Array [ + Object { + "length": 0, + "offset": 62, + }, + Object { + "length": 0, + "offset": 62, + }, + ], + }, + }, +] +`; + +exports[`LogBox integrates with React and handles a key error in LogBox: Log passed to console error 1`] = ` +Array [ + "Warning: Each child in a list should have a unique \\"key\\" prop. See https://fb.me/react-warning-keys for more information. + in Text (at ReactWarningFixtures.js:20)", +] +`; + +exports[`LogBox integrates with React and handles a key error in LogBox: Log sent from React 1`] = ` +Array [ + "Warning: Each child in a list should have a unique \\"key\\" prop.%s%s See https://fb.me/react-warning-keys for more information.%s", + "", + "", + " + in Text (at ReactWarningFixtures.js:20)", +] +`; diff --git a/Libraries/Modal/Modal.js b/Libraries/Modal/Modal.js index ef1d75c3639eb5..8d7785cab6bc22 100644 --- a/Libraries/Modal/Modal.js +++ b/Libraries/Modal/Modal.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format - * @flow + * @flow strict-local */ 'use strict'; @@ -197,7 +197,7 @@ class Modal extends React.Component { if ( props.presentationStyle && props.presentationStyle !== 'overFullScreen' && - props.transparent + props.transparent === true ) { console.warn( `Modal with '${props.presentationStyle}' presentation style and 'transparent' value is not supported.`, @@ -211,7 +211,8 @@ class Modal extends React.Component { } const containerStyles = { - backgroundColor: this.props.transparent ? 'transparent' : 'white', + backgroundColor: + this.props.transparent === true ? 'transparent' : 'white', }; let animationType = this.props.animationType || 'none'; @@ -219,7 +220,7 @@ class Modal extends React.Component { let presentationStyle = this.props.presentationStyle; if (!presentationStyle) { presentationStyle = 'fullScreen'; - if (this.props.transparent) { + if (this.props.transparent === true) { presentationStyle = 'overFullScreen'; } } diff --git a/Libraries/Modal/NativeModalManager.js b/Libraries/Modal/NativeModalManager.js index 159e095b9a4e2c..05fc5b2c73cc8d 100644 --- a/Libraries/Modal/NativeModalManager.js +++ b/Libraries/Modal/NativeModalManager.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow strict-local + * @flow strict * @format */ diff --git a/Libraries/Modal/__tests__/Modal-test.js b/Libraries/Modal/__tests__/Modal-test.js index db45cd2fe6ade9..33cbb19dd50af8 100644 --- a/Libraries/Modal/__tests__/Modal-test.js +++ b/Libraries/Modal/__tests__/Modal-test.js @@ -27,7 +27,7 @@ describe('', () => { expect(instance).toMatchSnapshot(); }); - it('should shallow render as when mocked', () => { + it('should shallow render as when mocked', () => { const output = render.shallow( diff --git a/Libraries/Modal/__tests__/__snapshots__/Modal-test.js.snap b/Libraries/Modal/__tests__/__snapshots__/Modal-test.js.snap index 807bc29ca552b9..d6272a92fb5fbe 100644 --- a/Libraries/Modal/__tests__/__snapshots__/Modal-test.js.snap +++ b/Libraries/Modal/__tests__/__snapshots__/Modal-test.js.snap @@ -61,13 +61,13 @@ exports[` should render as when not mocked 1`] = ` `; -exports[` should shallow render as when mocked 1`] = ` - should shallow render as when mocked 1`] = ` + - + `; exports[` should shallow render as when not mocked 1`] = ` diff --git a/Libraries/NativeAnimation/RCTAnimationPlugins.h b/Libraries/NativeAnimation/RCTAnimationPlugins.h index 46e9de8c76f5df..406eb68b38dcdd 100644 --- a/Libraries/NativeAnimation/RCTAnimationPlugins.h +++ b/Libraries/NativeAnimation/RCTAnimationPlugins.h @@ -30,6 +30,7 @@ Class RCTAnimationClassProvider(const char *name); // Lookup functions Class RCTNativeAnimatedModuleCls(void) __attribute__((used)); +Class RCTNativeAnimatedTurboModuleCls(void) __attribute__((used)); #ifdef __cplusplus } diff --git a/Libraries/NativeAnimation/RCTAnimationPlugins.mm b/Libraries/NativeAnimation/RCTAnimationPlugins.mm index 3b1e7c61145fbc..6b9768b5257e10 100644 --- a/Libraries/NativeAnimation/RCTAnimationPlugins.mm +++ b/Libraries/NativeAnimation/RCTAnimationPlugins.mm @@ -19,6 +19,7 @@ Class RCTAnimationClassProvider(const char *name) { static std::unordered_map sCoreModuleClassMap = { {"NativeAnimatedModule", RCTNativeAnimatedModuleCls}, + {"NativeAnimatedTurboModule", RCTNativeAnimatedTurboModuleCls}, }; auto p = sCoreModuleClassMap.find(name); diff --git a/Libraries/NativeAnimation/RCTNativeAnimatedModule.h b/Libraries/NativeAnimation/RCTNativeAnimatedModule.h index e6c07f77c0b0a0..fde319b0eaef98 100644 --- a/Libraries/NativeAnimation/RCTNativeAnimatedModule.h +++ b/Libraries/NativeAnimation/RCTNativeAnimatedModule.h @@ -15,6 +15,9 @@ #import "RCTValueAnimatedNode.h" +// TODO T69437152 @petetheheat - Delete this fork when Fabric ships to 100%. +// NOTE: This module is temporarily forked (see RCTNativeAnimatedTurboModule). +// When making any changes, be sure to apply them to the fork as well. @interface RCTNativeAnimatedModule : RCTEventEmitter @end diff --git a/Libraries/NativeAnimation/RCTNativeAnimatedModule.mm b/Libraries/NativeAnimation/RCTNativeAnimatedModule.mm index 60897f2f48c713..7b64ac3aa5d852 100644 --- a/Libraries/NativeAnimation/RCTNativeAnimatedModule.mm +++ b/Libraries/NativeAnimation/RCTNativeAnimatedModule.mm @@ -216,9 +216,9 @@ - (void)setBridge:(RCTBridge *)bridge }]; } -RCT_EXPORT_METHOD(getValue:(double)nodeTag saveCallback:(RCTResponseSenderBlock)saveCallback) { +RCT_EXPORT_METHOD(getValue:(double)nodeTag saveValueCallback:(RCTResponseSenderBlock)saveValueCallback) { [self addOperationBlock:^(RCTNativeAnimatedNodesManager *nodesManager) { - [nodesManager getValue:[NSNumber numberWithDouble:nodeTag] saveCallback:saveCallback]; + [nodesManager getValue:[NSNumber numberWithDouble:nodeTag] saveCallback:saveValueCallback]; }]; } diff --git a/Libraries/NativeAnimation/RCTNativeAnimatedTurboModule.h b/Libraries/NativeAnimation/RCTNativeAnimatedTurboModule.h new file mode 100644 index 00000000000000..71f40200c2328f --- /dev/null +++ b/Libraries/NativeAnimation/RCTNativeAnimatedTurboModule.h @@ -0,0 +1,23 @@ +/* + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#import +#import +#import +#import +#import +#import +#import + +#import "RCTValueAnimatedNode.h" + +// TODO T69437152 @petetheheat - Delete this fork when Fabric ships to 100%. +// NOTE: This module is temporarily forked (see RCTNativeAnimatedModule). +// When making any changes, be sure to apply them to the fork as well. +@interface RCTNativeAnimatedTurboModule: RCTEventEmitter + +@end diff --git a/Libraries/NativeAnimation/RCTNativeAnimatedTurboModule.mm b/Libraries/NativeAnimation/RCTNativeAnimatedTurboModule.mm new file mode 100644 index 00000000000000..08bb7666fd0cb9 --- /dev/null +++ b/Libraries/NativeAnimation/RCTNativeAnimatedTurboModule.mm @@ -0,0 +1,352 @@ +/* + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#import +#import +#import + +#import + +#import "RCTAnimationPlugins.h" + +typedef void (^AnimatedOperation)(RCTNativeAnimatedNodesManager *nodesManager); + +@interface RCTNativeAnimatedTurboModule() +@end + +@implementation RCTNativeAnimatedTurboModule +{ + RCTNativeAnimatedNodesManager *_nodesManager; + + // Operations called after views have been updated. + NSMutableArray *_operations; + // Operations called before views have been updated. + NSMutableArray *_preOperations; + NSMutableDictionary *_animIdIsManagedByFabric; +} + +RCT_EXPORT_MODULE(); + +- (void)invalidate +{ + [_nodesManager stopAnimationLoop]; + [self.bridge.eventDispatcher removeDispatchObserver:self]; + [self.bridge.uiManager.observerCoordinator removeObserver:self]; + [self.bridge.surfacePresenter removeObserver:self]; +} + +- (dispatch_queue_t)methodQueue +{ + // This module needs to be on the same queue as the UIManager to avoid + // having to lock `_operations` and `_preOperations` since `uiManagerWillPerformMounting` + // will be called from that queue. + return RCTGetUIManagerQueue(); +} + +- (void)setBridge:(RCTBridge *)bridge +{ + [super setBridge:bridge]; + + _nodesManager = [[RCTNativeAnimatedNodesManager alloc] initWithBridge:self.bridge]; + _operations = [NSMutableArray new]; + _preOperations = [NSMutableArray new]; + _animIdIsManagedByFabric = [NSMutableDictionary new]; + + [bridge.eventDispatcher addDispatchObserver:self]; + [bridge.uiManager.observerCoordinator addObserver:self]; + [bridge.surfacePresenter addObserver:self]; +} + +#pragma mark -- API + +RCT_EXPORT_METHOD(createAnimatedNode:(double)tag + config:(NSDictionary *)config) +{ + [self addOperationBlock:^(RCTNativeAnimatedNodesManager *nodesManager) { + [nodesManager createAnimatedNode:[NSNumber numberWithDouble:tag] config:config]; + }]; +} + +RCT_EXPORT_METHOD(connectAnimatedNodes:(double)parentTag + childTag:(double)childTag) +{ + [self addOperationBlock:^(RCTNativeAnimatedNodesManager *nodesManager) { + [nodesManager connectAnimatedNodes:[NSNumber numberWithDouble:parentTag] childTag:[NSNumber numberWithDouble:childTag]]; + }]; +} + +RCT_EXPORT_METHOD(disconnectAnimatedNodes:(double)parentTag + childTag:(double)childTag) +{ + [self addOperationBlock:^(RCTNativeAnimatedNodesManager *nodesManager) { + [nodesManager disconnectAnimatedNodes:[NSNumber numberWithDouble:parentTag] childTag:[NSNumber numberWithDouble:childTag]]; + }]; +} + +RCT_EXPORT_METHOD(startAnimatingNode:(double)animationId + nodeTag:(double)nodeTag + config:(NSDictionary *)config + endCallback:(RCTResponseSenderBlock)callBack) +{ + [self addOperationBlock:^(RCTNativeAnimatedNodesManager *nodesManager) { + [nodesManager startAnimatingNode:[NSNumber numberWithDouble:animationId] nodeTag:[NSNumber numberWithDouble:nodeTag] config:config endCallback:callBack]; + }]; + + RCTExecuteOnMainQueue(^{ + if (![self->_nodesManager isNodeManagedByFabric:[NSNumber numberWithDouble:nodeTag]]) { + return; + } + + RCTExecuteOnUIManagerQueue(^{ + self->_animIdIsManagedByFabric[[NSNumber numberWithDouble:animationId]] = @YES; + [self flushOperationQueues]; + }); + }); +} + +RCT_EXPORT_METHOD(stopAnimation:(double)animationId) +{ + [self addOperationBlock:^(RCTNativeAnimatedNodesManager *nodesManager) { + [nodesManager stopAnimation:[NSNumber numberWithDouble:animationId]]; + }]; + if ([_animIdIsManagedByFabric[[NSNumber numberWithDouble:animationId]] boolValue]) { + [self flushOperationQueues]; + } +} + +RCT_EXPORT_METHOD(setAnimatedNodeValue:(double)nodeTag + value:(double)value) +{ + [self addOperationBlock:^(RCTNativeAnimatedNodesManager *nodesManager) { + [nodesManager setAnimatedNodeValue:[NSNumber numberWithDouble:nodeTag] value:[NSNumber numberWithDouble:value]]; + }]; +} + +RCT_EXPORT_METHOD(setAnimatedNodeOffset:(double)nodeTag + offset:(double)offset) +{ + [self addOperationBlock:^(RCTNativeAnimatedNodesManager *nodesManager) { + [nodesManager setAnimatedNodeOffset:[NSNumber numberWithDouble:nodeTag] offset:[NSNumber numberWithDouble:offset]]; + }]; +} + +RCT_EXPORT_METHOD(flattenAnimatedNodeOffset:(double)nodeTag) +{ + [self addOperationBlock:^(RCTNativeAnimatedNodesManager *nodesManager) { + [nodesManager flattenAnimatedNodeOffset:[NSNumber numberWithDouble:nodeTag]]; + }]; +} + +RCT_EXPORT_METHOD(extractAnimatedNodeOffset:(double)nodeTag) +{ + [self addOperationBlock:^(RCTNativeAnimatedNodesManager *nodesManager) { + [nodesManager extractAnimatedNodeOffset:[NSNumber numberWithDouble:nodeTag]]; + }]; +} + +RCT_EXPORT_METHOD(connectAnimatedNodeToView:(double)nodeTag + viewTag:(double)viewTag) +{ + NSString *viewName = [self.bridge.uiManager viewNameForReactTag:[NSNumber numberWithDouble:viewTag]]; + [self addOperationBlock:^(RCTNativeAnimatedNodesManager *nodesManager) { + [nodesManager connectAnimatedNodeToView:[NSNumber numberWithDouble:nodeTag] viewTag:[NSNumber numberWithDouble:viewTag] viewName:viewName]; + }]; +} + +RCT_EXPORT_METHOD(disconnectAnimatedNodeFromView:(double)nodeTag + viewTag:(double)viewTag) +{ + [self addOperationBlock:^(RCTNativeAnimatedNodesManager *nodesManager) { + [nodesManager disconnectAnimatedNodeFromView:[NSNumber numberWithDouble:nodeTag] viewTag:[NSNumber numberWithDouble:viewTag]]; + }]; +} + +RCT_EXPORT_METHOD(restoreDefaultValues:(double)nodeTag) +{ + [self addPreOperationBlock:^(RCTNativeAnimatedNodesManager *nodesManager) { + [nodesManager restoreDefaultValues:[NSNumber numberWithDouble:nodeTag]]; + }]; +} + +RCT_EXPORT_METHOD(dropAnimatedNode:(double)tag) +{ + [self addOperationBlock:^(RCTNativeAnimatedNodesManager *nodesManager) { + [nodesManager dropAnimatedNode:[NSNumber numberWithDouble:tag]]; + }]; +} + +RCT_EXPORT_METHOD(startListeningToAnimatedNodeValue:(double)tag) +{ + __weak id valueObserver = self; + [self addOperationBlock:^(RCTNativeAnimatedNodesManager *nodesManager) { + [nodesManager startListeningToAnimatedNodeValue:[NSNumber numberWithDouble:tag] valueObserver:valueObserver]; + }]; +} + +RCT_EXPORT_METHOD(stopListeningToAnimatedNodeValue:(double)tag) +{ + [self addOperationBlock:^(RCTNativeAnimatedNodesManager *nodesManager) { + [nodesManager stopListeningToAnimatedNodeValue:[NSNumber numberWithDouble:tag]]; + }]; +} + +RCT_EXPORT_METHOD(addAnimatedEventToView:(double)viewTag + eventName:(nonnull NSString *)eventName + eventMapping:(JS::NativeAnimatedModule::EventMapping &)eventMapping) +{ + NSMutableDictionary *eventMappingDict = [NSMutableDictionary new]; + eventMappingDict[@"nativeEventPath"] = RCTConvertVecToArray(eventMapping.nativeEventPath()); + + if (eventMapping.animatedValueTag()) { + eventMappingDict[@"animatedValueTag"] = @(*eventMapping.animatedValueTag()); + } + + [self addOperationBlock:^(RCTNativeAnimatedNodesManager *nodesManager) { + [nodesManager addAnimatedEventToView:[NSNumber numberWithDouble:viewTag] eventName:eventName eventMapping:eventMappingDict]; + }]; +} + +RCT_EXPORT_METHOD(removeAnimatedEventFromView:(double)viewTag + eventName:(nonnull NSString *)eventName + animatedNodeTag:(double)animatedNodeTag) +{ + [self addOperationBlock:^(RCTNativeAnimatedNodesManager *nodesManager) { + [nodesManager removeAnimatedEventFromView:[NSNumber numberWithDouble:viewTag] eventName:eventName animatedNodeTag:[NSNumber numberWithDouble:animatedNodeTag]]; + }]; +} + +RCT_EXPORT_METHOD(getValue:(double)nodeTag saveValueCallback:(RCTResponseSenderBlock)saveValueCallback) { + [self addOperationBlock:^(RCTNativeAnimatedNodesManager *nodesManager) { + [nodesManager getValue:[NSNumber numberWithDouble:nodeTag] saveCallback:saveValueCallback]; + }]; +} + +#pragma mark -- Batch handling + +- (void)addOperationBlock:(AnimatedOperation)operation +{ + [_operations addObject:operation]; +} + +- (void)addPreOperationBlock:(AnimatedOperation)operation +{ + [_preOperations addObject:operation]; +} + +- (void)flushOperationQueues +{ + if (_preOperations.count == 0 && _operations.count == 0) { + return; + } + NSArray *preOperations = _preOperations; + NSArray *operations = _operations; + _preOperations = [NSMutableArray new]; + _operations = [NSMutableArray new]; + + + RCTExecuteOnMainQueue(^{ + for (AnimatedOperation operation in preOperations) { + operation(self->_nodesManager); + } + for (AnimatedOperation operation in operations) { + operation(self->_nodesManager); + } + [self->_nodesManager updateAnimations]; + }); +} + +#pragma mark - RCTSurfacePresenterObserver + +- (void)willMountComponentsWithRootTag:(NSInteger)rootTag +{ + RCTAssertMainQueue(); + RCTExecuteOnUIManagerQueue(^{ + NSArray *preOperations = self->_preOperations; + self->_preOperations = [NSMutableArray new]; + + RCTExecuteOnMainQueue(^{ + for (AnimatedOperation preOperation in preOperations) { + preOperation(self->_nodesManager); + } + }); + }); +} + +- (void)didMountComponentsWithRootTag:(NSInteger)rootTag +{ + RCTAssertMainQueue(); + RCTExecuteOnUIManagerQueue(^{ + NSArray *operations = self->_operations; + self->_operations = [NSMutableArray new]; + + RCTExecuteOnMainQueue(^{ + for (AnimatedOperation operation in operations) { + operation(self->_nodesManager); + } + }); + }); +} + +#pragma mark - RCTUIManagerObserver + +- (void)uiManagerWillPerformMounting:(RCTUIManager *)uiManager +{ + if (_preOperations.count == 0 && _operations.count == 0) { + return; + } + + NSArray *preOperations = _preOperations; + NSArray *operations = _operations; + _preOperations = [NSMutableArray new]; + _operations = [NSMutableArray new]; + + [uiManager prependUIBlock:^(__unused RCTUIManager *manager, __unused NSDictionary *viewRegistry) { // TODO(macOS GH#774) + for (AnimatedOperation operation in preOperations) { + operation(self->_nodesManager); + } + }]; + [uiManager addUIBlock:^(__unused RCTUIManager *manager, __unused NSDictionary *viewRegistry) { // TODO(macOS GH#774) + for (AnimatedOperation operation in operations) { + operation(self->_nodesManager); + } + + [self->_nodesManager updateAnimations]; + }]; +} + +#pragma mark -- Events + +- (NSArray *)supportedEvents +{ + return @[@"onAnimatedValueUpdate"]; +} + +- (void)animatedNode:(RCTValueAnimatedNode *)node didUpdateValue:(CGFloat)value +{ + [self sendEventWithName:@"onAnimatedValueUpdate" + body:@{@"tag": node.nodeTag, @"value": @(value)}]; +} + +- (void)eventDispatcherWillDispatchEvent:(id)event +{ + // Events can be dispatched from any queue so we have to make sure handleAnimatedEvent + // is run from the main queue. + RCTExecuteOnMainQueue(^{ + [self->_nodesManager handleAnimatedEvent:event]; + }); +} + +- (std::shared_ptr)getTurboModule:(const facebook::react::ObjCTurboModule::InitParams &)params +{ + return std::make_shared(params); +} + +@end + +Class RCTNativeAnimatedTurboModuleCls(void) { + return RCTNativeAnimatedTurboModule.class; +} diff --git a/Libraries/NativeModules/specs/NativeAnimationsDebugModule.js b/Libraries/NativeModules/specs/NativeAnimationsDebugModule.js index bb784a616cdebc..55c24c1f9d1dd3 100644 --- a/Libraries/NativeModules/specs/NativeAnimationsDebugModule.js +++ b/Libraries/NativeModules/specs/NativeAnimationsDebugModule.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow strict-local + * @flow strict * @format */ diff --git a/Libraries/NativeModules/specs/NativeDevMenu.js b/Libraries/NativeModules/specs/NativeDevMenu.js index 8d3880c739b835..20b858a1c7d4c4 100644 --- a/Libraries/NativeModules/specs/NativeDevMenu.js +++ b/Libraries/NativeModules/specs/NativeDevMenu.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow strict-local + * @flow strict * @format */ diff --git a/Libraries/NativeModules/specs/NativeDevSettings.js b/Libraries/NativeModules/specs/NativeDevSettings.js index 3930da4f90d19d..5cfc21a320b21b 100644 --- a/Libraries/NativeModules/specs/NativeDevSettings.js +++ b/Libraries/NativeModules/specs/NativeDevSettings.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow strict-local + * @flow strict * @format */ diff --git a/Libraries/NativeModules/specs/NativeDeviceEventManager.js b/Libraries/NativeModules/specs/NativeDeviceEventManager.js index 342115dd0e478e..775767e7275e3b 100644 --- a/Libraries/NativeModules/specs/NativeDeviceEventManager.js +++ b/Libraries/NativeModules/specs/NativeDeviceEventManager.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow strict-local + * @flow strict * @format */ diff --git a/Libraries/NativeModules/specs/NativeDialogManagerAndroid.js b/Libraries/NativeModules/specs/NativeDialogManagerAndroid.js index 4ca12692fa1773..fcc476b3419c33 100644 --- a/Libraries/NativeModules/specs/NativeDialogManagerAndroid.js +++ b/Libraries/NativeModules/specs/NativeDialogManagerAndroid.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow strict-local + * @flow strict * @format */ diff --git a/Libraries/NativeModules/specs/NativeLogBox.js b/Libraries/NativeModules/specs/NativeLogBox.js index 6d89481c390a03..782d1b078d40a7 100644 --- a/Libraries/NativeModules/specs/NativeLogBox.js +++ b/Libraries/NativeModules/specs/NativeLogBox.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow + * @flow strict * @format */ diff --git a/Libraries/NativeModules/specs/NativeSourceCode.js b/Libraries/NativeModules/specs/NativeSourceCode.js index 903123c94dacfb..b1fb30fc292247 100644 --- a/Libraries/NativeModules/specs/NativeSourceCode.js +++ b/Libraries/NativeModules/specs/NativeSourceCode.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow strict-local + * @flow strict * @format */ diff --git a/Libraries/Network/FormData.js b/Libraries/Network/FormData.js index bdb1da311da55a..8ff360688693a2 100644 --- a/Libraries/Network/FormData.js +++ b/Libraries/Network/FormData.js @@ -5,12 +5,12 @@ * LICENSE file in the root directory of this source tree. * * @format - * @flow + * @flow strict */ 'use strict'; -type FormDataValue = any; +type FormDataValue = string | {name?: string, type?: string, uri: string}; type FormDataNameValuePair = [string, FormDataValue]; type Headers = {[name: string]: string, ...}; diff --git a/Libraries/Network/RCTNetworking.ios.js b/Libraries/Network/RCTNetworking.ios.js index ec3706bf0ec253..92ef33394316a3 100644 --- a/Libraries/Network/RCTNetworking.ios.js +++ b/Libraries/Network/RCTNetworking.ios.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format - * @flow + * @flow strict-local */ 'use strict'; @@ -25,7 +25,7 @@ class RCTNetworking extends NativeEventEmitter { method: string, trackingName: string, url: string, - headers: Object, + headers: {...}, data: RequestBody, responseType: NativeResponseType, incrementalUpdates: boolean, diff --git a/Libraries/Performance/NativeJSCSamplingProfiler.js b/Libraries/Performance/NativeJSCSamplingProfiler.js index 519656d9d08db3..9ef08c961599a7 100644 --- a/Libraries/Performance/NativeJSCSamplingProfiler.js +++ b/Libraries/Performance/NativeJSCSamplingProfiler.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow strict-local + * @flow strict * @format */ diff --git a/Libraries/Performance/PureComponentDebug.js b/Libraries/Performance/PureComponentDebug.js index 982ed49353c878..767a0d48727b6b 100644 --- a/Libraries/Performance/PureComponentDebug.js +++ b/Libraries/Performance/PureComponentDebug.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow + * @flow strict * @format */ @@ -27,7 +27,7 @@ opaque type DoNotCommitUsageOfPureComponentDebug = {...}; */ class PureComponentDebug< P: DoNotCommitUsageOfPureComponentDebug, - S: ?Object = void, + S: ?{...} = void, > extends React.Component { shouldComponentUpdate(nextProps: P, nextState: S): boolean { const tag = this.constructor.name; diff --git a/Libraries/Performance/SamplingProfiler.js b/Libraries/Performance/SamplingProfiler.js index 2808f83ebddaec..a1c0ece4d16604 100644 --- a/Libraries/Performance/SamplingProfiler.js +++ b/Libraries/Performance/SamplingProfiler.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format - * @flow strict-local + * @flow strict */ 'use strict'; diff --git a/Libraries/Performance/Systrace.js b/Libraries/Performance/Systrace.js index e1db39bbfc5bbc..048c3d404271ad 100644 --- a/Libraries/Performance/Systrace.js +++ b/Libraries/Performance/Systrace.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow + * @flow strict * @format */ @@ -138,11 +138,18 @@ const Systrace = { /** * beginEvent/endEvent for starting and then ending a profile within the same call stack frame **/ - beginEvent(profileName?: any, args?: any) { + beginEvent( + profileName?: string | (() => string), + args?: {[string]: string, ...}, + ) { if (_enabled) { - profileName = + const profileNameString = typeof profileName === 'function' ? profileName() : profileName; - global.nativeTraceBeginSection(TRACE_TAG_REACT_APPS, profileName, args); + global.nativeTraceBeginSection( + TRACE_TAG_REACT_APPS, + profileNameString, + args, + ); } }, @@ -157,28 +164,28 @@ const Systrace = { * occur on another thread or out of the current stack frame, eg await * the returned cookie variable should be used as input into the endAsyncEvent call to end the profile **/ - beginAsyncEvent(profileName?: any): any { + beginAsyncEvent(profileName?: string | (() => string)): number { const cookie = _asyncCookie; if (_enabled) { _asyncCookie++; - profileName = + const profileNameString = typeof profileName === 'function' ? profileName() : profileName; global.nativeTraceBeginAsyncSection( TRACE_TAG_REACT_APPS, - profileName, + profileNameString, cookie, ); } return cookie; }, - endAsyncEvent(profileName?: any, cookie?: any) { + endAsyncEvent(profileName?: string | (() => string), cookie?: number) { if (_enabled) { - profileName = + const profileNameString = typeof profileName === 'function' ? profileName() : profileName; global.nativeTraceEndAsyncSection( TRACE_TAG_REACT_APPS, - profileName, + profileNameString, cookie, ); } @@ -187,12 +194,16 @@ const Systrace = { /** * counterEvent registers the value to the profileName on the systrace timeline **/ - counterEvent(profileName?: any, value?: any) { + counterEvent(profileName?: string | (() => string), value?: number) { if (_enabled) { - profileName = + const profileNameString = typeof profileName === 'function' ? profileName() : profileName; global.nativeTraceCounter && - global.nativeTraceCounter(TRACE_TAG_REACT_APPS, profileName, value); + global.nativeTraceCounter( + TRACE_TAG_REACT_APPS, + profileNameString, + value, + ); } }, }; @@ -202,7 +213,7 @@ if (__DEV__) { // other files. Therefore, calls to `require('moduleId')` are not replaced // with numeric IDs // TODO(davidaurelio) Scan polyfills for dependencies, too (t9759686) - (require: any).Systrace = Systrace; + (require: $FlowFixMe).Systrace = Systrace; } module.exports = Systrace; diff --git a/Libraries/PermissionsAndroid/NativePermissionsAndroid.js b/Libraries/PermissionsAndroid/NativePermissionsAndroid.js index 14aba8f11167e7..2e834fc725cb42 100644 --- a/Libraries/PermissionsAndroid/NativePermissionsAndroid.js +++ b/Libraries/PermissionsAndroid/NativePermissionsAndroid.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format - * @flow strict-local + * @flow strict */ 'use strict'; diff --git a/Libraries/PermissionsAndroid/PermissionsAndroid.js b/Libraries/PermissionsAndroid/PermissionsAndroid.js index 83124ccc24bd05..d99ccd5ec836ee 100644 --- a/Libraries/PermissionsAndroid/PermissionsAndroid.js +++ b/Libraries/PermissionsAndroid/PermissionsAndroid.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format - * @flow strict-local + * @flow strict */ 'use strict'; diff --git a/Libraries/Pressability/HoverState.js b/Libraries/Pressability/HoverState.js index 150ac050e6fa49..5a2ac60732b72e 100644 --- a/Libraries/Pressability/HoverState.js +++ b/Libraries/Pressability/HoverState.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow strict-local + * @flow strict * @format */ diff --git a/Libraries/Promise.js b/Libraries/Promise.js index 292bc2707445c0..836c2978a73065 100644 --- a/Libraries/Promise.js +++ b/Libraries/Promise.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format - * @flow + * @flow strict */ 'use strict'; @@ -18,25 +18,29 @@ require('promise/setimmediate/finally'); if (__DEV__) { require('promise/setimmediate/rejection-tracking').enable({ allRejections: true, - onUnhandled: (id, error = {}) => { + onUnhandled: (id, rejection = {}) => { let message: string; let stack: ?string; - const stringValue = Object.prototype.toString.call(error); + const stringValue = Object.prototype.toString.call(rejection); if (stringValue === '[object Error]') { - message = Error.prototype.toString.call(error); + message = Error.prototype.toString.call(rejection); + const error: Error = (rejection: $FlowFixMe); stack = error.stack; } else { try { - message = require('pretty-format')(error); + message = require('pretty-format')(rejection); } catch { - message = typeof error === 'string' ? error : JSON.stringify(error); + message = + typeof rejection === 'string' + ? rejection + : JSON.stringify((rejection: $FlowFixMe)); } } const warning = `Possible Unhandled Promise Rejection (id: ${id}):\n` + - `${message}\n` + + `${message ?? ''}\n` + (stack == null ? '' : stack); console.warn(warning); }, diff --git a/Libraries/ReactNative/NativeHeadlessJsTaskSupport.js b/Libraries/ReactNative/NativeHeadlessJsTaskSupport.js index 8cd05cf3afb503..45f25deb2114f0 100644 --- a/Libraries/ReactNative/NativeHeadlessJsTaskSupport.js +++ b/Libraries/ReactNative/NativeHeadlessJsTaskSupport.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow strict-local + * @flow strict * @format */ diff --git a/Libraries/ReactNative/NativeI18nManager.js b/Libraries/ReactNative/NativeI18nManager.js index e16db811e62c02..28933d510b30e7 100644 --- a/Libraries/ReactNative/NativeI18nManager.js +++ b/Libraries/ReactNative/NativeI18nManager.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow strict-local + * @flow strict * @format */ diff --git a/Libraries/ReactNative/UIManagerProperties.js b/Libraries/ReactNative/UIManagerProperties.js index 938e42eef9d4ad..77e67267e57b19 100644 --- a/Libraries/ReactNative/UIManagerProperties.js +++ b/Libraries/ReactNative/UIManagerProperties.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow strict-local + * @flow strict * @format */ diff --git a/Libraries/Share/NativeShareModule.js b/Libraries/Share/NativeShareModule.js index 88293b8ce87bac..08d313d76d7d6c 100644 --- a/Libraries/Share/NativeShareModule.js +++ b/Libraries/Share/NativeShareModule.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow strict-local + * @flow strict * @format */ diff --git a/Libraries/Share/Share.js b/Libraries/Share/Share.js index aed341e56d04b5..5dad4772b7e8e1 100644 --- a/Libraries/Share/Share.js +++ b/Libraries/Share/Share.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format - * @flow + * @flow strict-local */ 'use strict'; @@ -74,7 +74,10 @@ class Share { * - `dialogTitle` * */ - static share(content: Content, options: Options = {}): Promise { + static share( + content: Content, + options: Options = {}, + ): Promise<{action: string, activityType: ?string}> { invariant( typeof content === 'object' && content !== null, 'Content to share must be a valid object', @@ -94,7 +97,7 @@ class Share { 'ShareModule should be registered on Android.', ); invariant( - !content.title || typeof content.title === 'string', + content.title == null || typeof content.title === 'string', 'Invalid title: title should be a string.', ); @@ -104,7 +107,12 @@ class Share { typeof content.message === 'string' ? content.message : undefined, }; - return NativeShareModule.share(newContent, options.dialogTitle); + return NativeShareModule.share(newContent, options.dialogTitle).then( + result => ({ + activityType: null, + ...result, + }), + ); } else if (Platform.OS === 'ios') { return new Promise((resolve, reject) => { const tintColor = processColor(options.tintColor); @@ -138,6 +146,7 @@ class Share { } else { resolve({ action: 'dismissedAction', + activityType: null, }); } }, diff --git a/Libraries/Storage/NativeAsyncStorage.js b/Libraries/Storage/NativeAsyncStorage.js index c67d291d034b6f..539adfd80dc4ee 100644 --- a/Libraries/Storage/NativeAsyncStorage.js +++ b/Libraries/Storage/NativeAsyncStorage.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow strict-local + * @flow strict * @format */ diff --git a/Libraries/StyleSheet/__tests__/normalizeColor-test.js b/Libraries/StyleSheet/__tests__/normalizeColor-test.js index 12eac4cfbf8d6d..80979e0ec2c75c 100644 --- a/Libraries/StyleSheet/__tests__/normalizeColor-test.js +++ b/Libraries/StyleSheet/__tests__/normalizeColor-test.js @@ -13,172 +13,63 @@ const {OS} = require('../../Utilities/Platform'); const normalizeColor = require('../normalizeColor'); -describe('normalizeColor', function() { - it('should accept only spec compliant colors', function() { - expect(normalizeColor('#abc')).not.toBe(null); - expect(normalizeColor('#abcd')).not.toBe(null); - expect(normalizeColor('#abcdef')).not.toBe(null); - expect(normalizeColor('#abcdef01')).not.toBe(null); - expect(normalizeColor('rgb(1,2,3)')).not.toBe(null); - expect(normalizeColor('rgb(1, 2, 3)')).not.toBe(null); - expect(normalizeColor('rgb( 1 , 2 , 3 )')).not.toBe(null); - expect(normalizeColor('rgb(-1, -2, -3)')).not.toBe(null); - expect(normalizeColor('rgba(0, 0, 0, 1)')).not.toBe(null); - expect(normalizeColor(0x01234567 + 0.5)).toBe(null); - expect(normalizeColor(-1)).toBe(null); - expect(normalizeColor(0xffffffff + 1)).toBe(null); - }); +it('forwards calls to @react-native/normalize-color/base', () => { + jest + .resetModules() + .mock('@react-native/normalize-color/base', () => jest.fn()); - it('should temporarily accept floating point values for rgb', function() { - expect(normalizeColor('rgb(1.1, 2.1, 3.1)')).toBe(0x010203ff); - expect(normalizeColor('rgba(1.1, 2.1, 3.1, 1.0)')).toBe(0x010203ff); - }); - - it('should refuse non spec compliant colors', function() { - expect(normalizeColor('#00gg00')).toBe(null); - expect(normalizeColor('rgb(1, 2, 3,)')).toBe(null); - expect(normalizeColor('rgb(1, 2, 3')).toBe(null); - - // Used to be accepted by normalizeColor - expect(normalizeColor('abc')).toBe(null); - expect(normalizeColor(' #abc ')).toBe(null); - expect(normalizeColor('##abc')).toBe(null); - expect(normalizeColor('rgb 255 0 0')).toBe(null); - expect(normalizeColor('RGBA(0, 1, 2)')).toBe(null); - expect(normalizeColor('rgb (0, 1, 2)')).toBe(null); - expect(normalizeColor('hsv(0, 1, 2)')).toBe(null); - expect(normalizeColor({r: 10, g: 10, b: 10})).toBe(null); - expect(normalizeColor('hsl(1%, 2, 3)')).toBe(null); - expect(normalizeColor('rgb(1%, 2%, 3%)')).toBe(null); - }); - - it('should handle hex6 properly', function() { - expect(normalizeColor('#000000')).toBe(0x000000ff); - expect(normalizeColor('#ffffff')).toBe(0xffffffff); - expect(normalizeColor('#ff00ff')).toBe(0xff00ffff); - expect(normalizeColor('#abcdef')).toBe(0xabcdefff); - expect(normalizeColor('#012345')).toBe(0x012345ff); - }); - - it('should handle hex3 properly', function() { - expect(normalizeColor('#000')).toBe(0x000000ff); - expect(normalizeColor('#fff')).toBe(0xffffffff); - expect(normalizeColor('#f0f')).toBe(0xff00ffff); - }); - - it('should handle hex8 properly', function() { - expect(normalizeColor('#00000000')).toBe(0x00000000); - expect(normalizeColor('#ffffffff')).toBe(0xffffffff); - expect(normalizeColor('#ffff00ff')).toBe(0xffff00ff); - expect(normalizeColor('#abcdef01')).toBe(0xabcdef01); - expect(normalizeColor('#01234567')).toBe(0x01234567); - }); - - it('should handle rgb properly', function() { - expect(normalizeColor('rgb(0, 0, 0)')).toBe(0x000000ff); - expect(normalizeColor('rgb(-1, -2, -3)')).toBe(0x000000ff); - expect(normalizeColor('rgb(0, 0, 255)')).toBe(0x0000ffff); - expect(normalizeColor('rgb(100, 15, 69)')).toBe(0x640f45ff); - expect(normalizeColor('rgb(255, 255, 255)')).toBe(0xffffffff); - expect(normalizeColor('rgb(256, 256, 256)')).toBe(0xffffffff); - }); - - it('should handle rgba properly', function() { - expect(normalizeColor('rgba(0, 0, 0, 0.0)')).toBe(0x00000000); - expect(normalizeColor('rgba(0, 0, 0, 0)')).toBe(0x00000000); - expect(normalizeColor('rgba(0, 0, 0, -0.5)')).toBe(0x00000000); - expect(normalizeColor('rgba(0, 0, 0, 1.0)')).toBe(0x000000ff); - expect(normalizeColor('rgba(0, 0, 0, 1)')).toBe(0x000000ff); - expect(normalizeColor('rgba(0, 0, 0, 1.5)')).toBe(0x000000ff); - expect(normalizeColor('rgba(100, 15, 69, 0.5)')).toBe(0x640f4580); - }); - - it('should handle hsl properly', function() { - expect(normalizeColor('hsl(0, 0%, 0%)')).toBe(0x000000ff); - expect(normalizeColor('hsl(360, 100%, 100%)')).toBe(0xffffffff); - expect(normalizeColor('hsl(180, 50%, 50%)')).toBe(0x40bfbfff); - expect(normalizeColor('hsl(540, 50%, 50%)')).toBe(0x40bfbfff); - expect(normalizeColor('hsl(70, 25%, 75%)')).toBe(0xcacfafff); - expect(normalizeColor('hsl(70, 100%, 75%)')).toBe(0xeaff80ff); - expect(normalizeColor('hsl(70, 110%, 75%)')).toBe(0xeaff80ff); - expect(normalizeColor('hsl(70, 0%, 75%)')).toBe(0xbfbfbfff); - expect(normalizeColor('hsl(70, -10%, 75%)')).toBe(0xbfbfbfff); - }); - - it('should handle hsla properly', function() { - expect(normalizeColor('hsla(0, 0%, 0%, 0)')).toBe(0x00000000); - expect(normalizeColor('hsla(360, 100%, 100%, 1)')).toBe(0xffffffff); - expect(normalizeColor('hsla(360, 100%, 100%, 0)')).toBe(0xffffff00); - expect(normalizeColor('hsla(180, 50%, 50%, 0.2)')).toBe(0x40bfbf33); - }); - - it('should handle named colors properly', function() { - expect(normalizeColor('red')).toBe(0xff0000ff); - expect(normalizeColor('transparent')).toBe(0x00000000); - expect(normalizeColor('peachpuff')).toBe(0xffdab9ff); - }); - - it('should handle number colors properly', function() { - expect(normalizeColor(0x00000000)).toBe(0x00000000); - expect(normalizeColor(0xff0000ff)).toBe(0xff0000ff); - expect(normalizeColor(0xffffffff)).toBe(0xffffffff); - expect(normalizeColor(0x01234567)).toBe(0x01234567); - }); - - it("should return the same color when it's already normalized", function() { - const normalizedColor = normalizeColor('red') || 0; - expect(normalizeColor(normalizedColor)).toBe(normalizedColor); - }); - - describe('iOS', () => { - if (OS === 'ios') { - const PlatformColor = require('../PlatformColorValueTypes.ios') - .PlatformColor; - const DynamicColorIOS = require('../PlatformColorValueTypesIOS.ios') - .DynamicColorIOS; - - it('should normalize iOS PlatformColor colors', () => { - const color = PlatformColor('systemRedColor'); - const normalizedColor = normalizeColor(color); - const expectedColor = {semantic: ['systemRedColor']}; - expect(normalizedColor).toEqual(expectedColor); - }); - - it('should normalize iOS Dynamic colors with named colors', () => { - const color = DynamicColorIOS({light: 'black', dark: 'white'}); - const normalizedColor = normalizeColor(color); - const expectedColor = {dynamic: {light: 'black', dark: 'white'}}; - expect(normalizedColor).toEqual(expectedColor); - }); + expect(require('../normalizeColor')('#abc')).not.toBe(null); + expect(require('@react-native/normalize-color/base')).toBeCalled(); +}); - it('should normalize iOS Dynamic colors with PlatformColor colors', () => { - const color = DynamicColorIOS({ - light: PlatformColor('systemBlackColor'), - dark: PlatformColor('systemWhiteColor'), - }); - const normalizedColor = normalizeColor(color); - const expectedColor = { - dynamic: { - light: {semantic: ['systemBlackColor']}, - dark: {semantic: ['systemWhiteColor']}, - }, - }; - expect(normalizedColor).toEqual(expectedColor); +describe('iOS', () => { + if (OS === 'ios') { + const PlatformColor = require('../PlatformColorValueTypes.ios') + .PlatformColor; + const DynamicColorIOS = require('../PlatformColorValueTypesIOS.ios') + .DynamicColorIOS; + + it('should normalize iOS PlatformColor colors', () => { + const color = PlatformColor('systemRedColor'); + const normalizedColor = normalizeColor(color); + const expectedColor = {semantic: ['systemRedColor']}; + expect(normalizedColor).toEqual(expectedColor); + }); + + it('should normalize iOS Dynamic colors with named colors', () => { + const color = DynamicColorIOS({light: 'black', dark: 'white'}); + const normalizedColor = normalizeColor(color); + const expectedColor = {dynamic: {light: 'black', dark: 'white'}}; + expect(normalizedColor).toEqual(expectedColor); + }); + + it('should normalize iOS Dynamic colors with PlatformColor colors', () => { + const color = DynamicColorIOS({ + light: PlatformColor('systemBlackColor'), + dark: PlatformColor('systemWhiteColor'), }); - } - }); - - describe('Android', () => { - if (OS === 'android') { - const PlatformColor = require('../PlatformColorValueTypes.android') - .PlatformColor; + const normalizedColor = normalizeColor(color); + const expectedColor = { + dynamic: { + light: {semantic: ['systemBlackColor']}, + dark: {semantic: ['systemWhiteColor']}, + }, + }; + expect(normalizedColor).toEqual(expectedColor); + }); + } +}); - it('should normalize Android PlatformColor colors', () => { - const color = PlatformColor('?attr/colorPrimary'); - const normalizedColor = normalizeColor(color); - const expectedColor = {resource_paths: ['?attr/colorPrimary']}; - expect(normalizedColor).toEqual(expectedColor); - }); - } - }); +describe('Android', () => { + if (OS === 'android') { + const PlatformColor = require('../PlatformColorValueTypes.android') + .PlatformColor; + + it('should normalize Android PlatformColor colors', () => { + const color = PlatformColor('?attr/colorPrimary'); + const normalizedColor = normalizeColor(color); + const expectedColor = {resource_paths: ['?attr/colorPrimary']}; + expect(normalizedColor).toEqual(expectedColor); + }); + } }); diff --git a/Libraries/StyleSheet/normalizeColor.js b/Libraries/StyleSheet/normalizeColor.js index bd7737c5d568b7..94187dfa9fcff3 100755 --- a/Libraries/StyleSheet/normalizeColor.js +++ b/Libraries/StyleSheet/normalizeColor.js @@ -12,382 +12,25 @@ 'use strict'; +import normalizeColorBase from '@react-native/normalize-color/base'; + import type {ColorValue} from './StyleSheet'; import type {ProcessedColorValue} from './processColor'; function normalizeColor( color: ?(ColorValue | ProcessedColorValue), ): ?ProcessedColorValue { - const matchers = getMatchers(); - let match; - - if (typeof color === 'number') { - if (color >>> 0 === color && color >= 0 && color <= 0xffffffff) { - return color; - } - return null; - } - if (typeof color === 'object' && color != null) { - const normalizeColorObject = require('./PlatformColorValueTypes') - .normalizeColorObject; - - const normalizedColorObj = normalizeColorObject(color); - - if (normalizedColorObj != null) { + const {normalizeColorObject} = require('./PlatformColorValueTypes'); + const normalizedColor = normalizeColorObject(color); + if (normalizedColor != null) { return color; } } - if (typeof color !== 'string') { - return null; - } - - // Ordered based on occurrences on Facebook codebase - if ((match = matchers.hex6.exec(color))) { - return parseInt(match[1] + 'ff', 16) >>> 0; - } - - if (names.hasOwnProperty(color)) { - return names[color]; - } - - if ((match = matchers.rgb.exec(color))) { - return ( - // b - ((parse255(match[1]) << 24) | // r - (parse255(match[2]) << 16) | // g - (parse255(match[3]) << 8) | - 0x000000ff) >>> // a - 0 - ); - } - - if ((match = matchers.rgba.exec(color))) { - return ( - // b - ((parse255(match[1]) << 24) | // r - (parse255(match[2]) << 16) | // g - (parse255(match[3]) << 8) | - parse1(match[4])) >>> // a - 0 - ); - } - - if ((match = matchers.hex3.exec(color))) { - return ( - parseInt( - match[1] + - match[1] + // r - match[2] + - match[2] + // g - match[3] + - match[3] + // b - 'ff', // a - 16, - ) >>> 0 - ); - } - - // https://drafts.csswg.org/css-color-4/#hex-notation - if ((match = matchers.hex8.exec(color))) { - return parseInt(match[1], 16) >>> 0; - } - - if ((match = matchers.hex4.exec(color))) { - return ( - parseInt( - match[1] + - match[1] + // r - match[2] + - match[2] + // g - match[3] + - match[3] + // b - match[4] + - match[4], // a - 16, - ) >>> 0 - ); - } - - if ((match = matchers.hsl.exec(color))) { - return ( - (hslToRgb( - parse360(match[1]), // h - parsePercentage(match[2]), // s - parsePercentage(match[3]), // l - ) | - 0x000000ff) >>> // a - 0 - ); - } - - if ((match = matchers.hsla.exec(color))) { - return ( - (hslToRgb( - parse360(match[1]), // h - parsePercentage(match[2]), // s - parsePercentage(match[3]), // l - ) | - parse1(match[4])) >>> // a - 0 - ); - } - - return null; -} - -function hue2rgb(p: number, q: number, t: number): number { - if (t < 0) { - t += 1; - } - if (t > 1) { - t -= 1; - } - if (t < 1 / 6) { - return p + (q - p) * 6 * t; - } - if (t < 1 / 2) { - return q; - } - if (t < 2 / 3) { - return p + (q - p) * (2 / 3 - t) * 6; - } - return p; -} - -function hslToRgb(h: number, s: number, l: number): number { - const q = l < 0.5 ? l * (1 + s) : l + s - l * s; - const p = 2 * l - q; - const r = hue2rgb(p, q, h + 1 / 3); - const g = hue2rgb(p, q, h); - const b = hue2rgb(p, q, h - 1 / 3); - - return ( - (Math.round(r * 255) << 24) | - (Math.round(g * 255) << 16) | - (Math.round(b * 255) << 8) - ); -} - -// var INTEGER = '[-+]?\\d+'; -const NUMBER = '[-+]?\\d*\\.?\\d+'; -const PERCENTAGE = NUMBER + '%'; - -function call(...args) { - return '\\(\\s*(' + args.join(')\\s*,\\s*(') + ')\\s*\\)'; -} - -let cachedMatchers; - -function getMatchers() { - if (cachedMatchers === undefined) { - cachedMatchers = { - rgb: new RegExp('rgb' + call(NUMBER, NUMBER, NUMBER)), - rgba: new RegExp('rgba' + call(NUMBER, NUMBER, NUMBER, NUMBER)), - hsl: new RegExp('hsl' + call(NUMBER, PERCENTAGE, PERCENTAGE)), - hsla: new RegExp('hsla' + call(NUMBER, PERCENTAGE, PERCENTAGE, NUMBER)), - hex3: /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, - hex4: /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, - hex6: /^#([0-9a-fA-F]{6})$/, - hex8: /^#([0-9a-fA-F]{8})$/, - }; - } - return cachedMatchers; -} - -function parse255(str: string): number { - const int = parseInt(str, 10); - if (int < 0) { - return 0; + if (typeof color === 'string' || typeof color === 'number') { + return normalizeColorBase(color); } - if (int > 255) { - return 255; - } - return int; -} - -function parse360(str: string): number { - const int = parseFloat(str); - return (((int % 360) + 360) % 360) / 360; } -function parse1(str: string): number { - const num = parseFloat(str); - if (num < 0) { - return 0; - } - if (num > 1) { - return 255; - } - return Math.round(num * 255); -} - -function parsePercentage(str: string): number { - // parseFloat conveniently ignores the final % - const int = parseFloat(str); - if (int < 0) { - return 0; - } - if (int > 100) { - return 1; - } - return int / 100; -} - -const names = { - transparent: 0x00000000, - - // http://www.w3.org/TR/css3-color/#svg-color - aliceblue: 0xf0f8ffff, - antiquewhite: 0xfaebd7ff, - aqua: 0x00ffffff, - aquamarine: 0x7fffd4ff, - azure: 0xf0ffffff, - beige: 0xf5f5dcff, - bisque: 0xffe4c4ff, - black: 0x000000ff, - blanchedalmond: 0xffebcdff, - blue: 0x0000ffff, - blueviolet: 0x8a2be2ff, - brown: 0xa52a2aff, - burlywood: 0xdeb887ff, - burntsienna: 0xea7e5dff, - cadetblue: 0x5f9ea0ff, - chartreuse: 0x7fff00ff, - chocolate: 0xd2691eff, - coral: 0xff7f50ff, - cornflowerblue: 0x6495edff, - cornsilk: 0xfff8dcff, - crimson: 0xdc143cff, - cyan: 0x00ffffff, - darkblue: 0x00008bff, - darkcyan: 0x008b8bff, - darkgoldenrod: 0xb8860bff, - darkgray: 0xa9a9a9ff, - darkgreen: 0x006400ff, - darkgrey: 0xa9a9a9ff, - darkkhaki: 0xbdb76bff, - darkmagenta: 0x8b008bff, - darkolivegreen: 0x556b2fff, - darkorange: 0xff8c00ff, - darkorchid: 0x9932ccff, - darkred: 0x8b0000ff, - darksalmon: 0xe9967aff, - darkseagreen: 0x8fbc8fff, - darkslateblue: 0x483d8bff, - darkslategray: 0x2f4f4fff, - darkslategrey: 0x2f4f4fff, - darkturquoise: 0x00ced1ff, - darkviolet: 0x9400d3ff, - deeppink: 0xff1493ff, - deepskyblue: 0x00bfffff, - dimgray: 0x696969ff, - dimgrey: 0x696969ff, - dodgerblue: 0x1e90ffff, - firebrick: 0xb22222ff, - floralwhite: 0xfffaf0ff, - forestgreen: 0x228b22ff, - fuchsia: 0xff00ffff, - gainsboro: 0xdcdcdcff, - ghostwhite: 0xf8f8ffff, - gold: 0xffd700ff, - goldenrod: 0xdaa520ff, - gray: 0x808080ff, - green: 0x008000ff, - greenyellow: 0xadff2fff, - grey: 0x808080ff, - honeydew: 0xf0fff0ff, - hotpink: 0xff69b4ff, - indianred: 0xcd5c5cff, - indigo: 0x4b0082ff, - ivory: 0xfffff0ff, - khaki: 0xf0e68cff, - lavender: 0xe6e6faff, - lavenderblush: 0xfff0f5ff, - lawngreen: 0x7cfc00ff, - lemonchiffon: 0xfffacdff, - lightblue: 0xadd8e6ff, - lightcoral: 0xf08080ff, - lightcyan: 0xe0ffffff, - lightgoldenrodyellow: 0xfafad2ff, - lightgray: 0xd3d3d3ff, - lightgreen: 0x90ee90ff, - lightgrey: 0xd3d3d3ff, - lightpink: 0xffb6c1ff, - lightsalmon: 0xffa07aff, - lightseagreen: 0x20b2aaff, - lightskyblue: 0x87cefaff, - lightslategray: 0x778899ff, - lightslategrey: 0x778899ff, - lightsteelblue: 0xb0c4deff, - lightyellow: 0xffffe0ff, - lime: 0x00ff00ff, - limegreen: 0x32cd32ff, - linen: 0xfaf0e6ff, - magenta: 0xff00ffff, - maroon: 0x800000ff, - mediumaquamarine: 0x66cdaaff, - mediumblue: 0x0000cdff, - mediumorchid: 0xba55d3ff, - mediumpurple: 0x9370dbff, - mediumseagreen: 0x3cb371ff, - mediumslateblue: 0x7b68eeff, - mediumspringgreen: 0x00fa9aff, - mediumturquoise: 0x48d1ccff, - mediumvioletred: 0xc71585ff, - midnightblue: 0x191970ff, - mintcream: 0xf5fffaff, - mistyrose: 0xffe4e1ff, - moccasin: 0xffe4b5ff, - navajowhite: 0xffdeadff, - navy: 0x000080ff, - oldlace: 0xfdf5e6ff, - olive: 0x808000ff, - olivedrab: 0x6b8e23ff, - orange: 0xffa500ff, - orangered: 0xff4500ff, - orchid: 0xda70d6ff, - palegoldenrod: 0xeee8aaff, - palegreen: 0x98fb98ff, - paleturquoise: 0xafeeeeff, - palevioletred: 0xdb7093ff, - papayawhip: 0xffefd5ff, - peachpuff: 0xffdab9ff, - peru: 0xcd853fff, - pink: 0xffc0cbff, - plum: 0xdda0ddff, - powderblue: 0xb0e0e6ff, - purple: 0x800080ff, - rebeccapurple: 0x663399ff, - red: 0xff0000ff, - rosybrown: 0xbc8f8fff, - royalblue: 0x4169e1ff, - saddlebrown: 0x8b4513ff, - salmon: 0xfa8072ff, - sandybrown: 0xf4a460ff, - seagreen: 0x2e8b57ff, - seashell: 0xfff5eeff, - sienna: 0xa0522dff, - silver: 0xc0c0c0ff, - skyblue: 0x87ceebff, - slateblue: 0x6a5acdff, - slategray: 0x708090ff, - slategrey: 0x708090ff, - snow: 0xfffafaff, - springgreen: 0x00ff7fff, - steelblue: 0x4682b4ff, - tan: 0xd2b48cff, - teal: 0x008080ff, - thistle: 0xd8bfd8ff, - tomato: 0xff6347ff, - turquoise: 0x40e0d0ff, - violet: 0xee82eeff, - wheat: 0xf5deb3ff, - white: 0xffffffff, - whitesmoke: 0xf5f5f5ff, - yellow: 0xffff00ff, - yellowgreen: 0x9acd32ff, -}; - module.exports = normalizeColor; diff --git a/Libraries/Text/TextInput/RCTBaseTextInputView.m b/Libraries/Text/TextInput/RCTBaseTextInputView.m index e8e10d329ca4e6..1722a2175c73f8 100644 --- a/Libraries/Text/TextInput/RCTBaseTextInputView.m +++ b/Libraries/Text/TextInput/RCTBaseTextInputView.m @@ -668,9 +668,7 @@ - (void)setDefaultInputAccessoryView // These keyboard types (all are number pads) don't have a "Done" button by default, // so we create an `inputAccessoryView` with this button for them. - BOOL shouldHaveInputAccesoryView; - if (@available(iOS 10.0, *)) { - shouldHaveInputAccesoryView = + BOOL shouldHaveInputAccesoryView = ( keyboardType == UIKeyboardTypeNumberPad || keyboardType == UIKeyboardTypePhonePad || @@ -678,15 +676,6 @@ - (void)setDefaultInputAccessoryView keyboardType == UIKeyboardTypeASCIICapableNumberPad ) && textInputView.returnKeyType == UIReturnKeyDone; - } else { - shouldHaveInputAccesoryView = - ( - keyboardType == UIKeyboardTypeNumberPad || - keyboardType == UIKeyboardTypePhonePad || - keyboardType == UIKeyboardTypeDecimalPad - ) && - textInputView.returnKeyType == UIReturnKeyDone; - } if (_hasInputAccesoryView == shouldHaveInputAccesoryView) { return; diff --git a/Libraries/TurboModule/TurboModuleRegistry.js b/Libraries/TurboModule/TurboModuleRegistry.js index b3b1135f98bf9e..9719d833497776 100644 --- a/Libraries/TurboModule/TurboModuleRegistry.js +++ b/Libraries/TurboModule/TurboModuleRegistry.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow + * @flow strict * @format */ @@ -16,26 +16,46 @@ import invariant from 'invariant'; const turboModuleProxy = global.__turboModuleProxy; -export function get(name: string): ?T { +function requireModule(name: string, schema?: ?$FlowFixMe): ?T { // Bridgeless mode requires TurboModules if (!global.RN$Bridgeless) { // Backward compatibility layer during migration. const legacyModule = NativeModules[name]; if (legacyModule != null) { - return ((legacyModule: any): T); + return ((legacyModule: $FlowFixMe): T); } } if (turboModuleProxy != null) { - const module: ?T = turboModuleProxy(name); + const module: ?T = turboModuleProxy(name, schema); return module; } return null; } +export function get(name: string): ?T { + /** + * What is Schema? + * + * @react-native/babel-plugin-codegen will parse the NativeModule + * spec, and pass in the generated schema as the second argument + * to this function + */ + const schema = arguments.length === 2 ? arguments[1] : undefined; + return requireModule(name, schema); +} + export function getEnforcing(name: string): T { - const module = get(name); + /** + * What is Schema? + * + * @react-native/babel-plugin-codegen will parse the NativeModule + * spec, and pass in the generated schema as the second argument + * to this function + */ + const schema = arguments.length === 2 ? arguments[1] : undefined; + const module = requireModule(name, schema); invariant( module != null, `TurboModuleRegistry.getEnforcing(...): '${name}' could not be found. ` + diff --git a/Libraries/UTFSequence.js b/Libraries/UTFSequence.js index 70d17a3ba40a97..65a548df756787 100644 --- a/Libraries/UTFSequence.js +++ b/Libraries/UTFSequence.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow strict-local + * @flow strict * @format */ diff --git a/Libraries/Utilities/Appearance.js b/Libraries/Utilities/Appearance.js index b63ff33c700c39..314b3eaaad649c 100644 --- a/Libraries/Utilities/Appearance.js +++ b/Libraries/Utilities/Appearance.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format - * @flow + * @flow strict-local */ 'use strict'; diff --git a/Libraries/Utilities/BackHandler.android.js b/Libraries/Utilities/BackHandler.android.js index ffa6bbfcf95fce..61ba573ff5aada 100644 --- a/Libraries/Utilities/BackHandler.android.js +++ b/Libraries/Utilities/BackHandler.android.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow + * @flow strict-local * @format */ diff --git a/Libraries/Utilities/BackHandler.ios.js b/Libraries/Utilities/BackHandler.ios.js index 83441bf5a52b32..752cefa8dd0df7 100644 --- a/Libraries/Utilities/BackHandler.ios.js +++ b/Libraries/Utilities/BackHandler.ios.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow + * @flow strict-local * @format */ @@ -113,12 +113,15 @@ if (Platform.isTV) { } else { BackHandler = { exitApp: emptyFunction, - addEventListener(_eventName: BackPressEventName, _handler: Function) { + addEventListener(_eventName: BackPressEventName, _handler: () => ?boolean) { return { remove: emptyFunction, }; }, - removeEventListener(_eventName: BackPressEventName, _handler: Function) {}, + removeEventListener( + _eventName: BackPressEventName, + _handler: () => ?boolean, + ) {}, }; } diff --git a/Libraries/Utilities/DevSettings.js b/Libraries/Utilities/DevSettings.js index 42ffec85148f0f..58494938ec6536 100644 --- a/Libraries/Utilities/DevSettings.js +++ b/Libraries/Utilities/DevSettings.js @@ -5,12 +5,19 @@ * LICENSE file in the root directory of this source tree. * * @format + * @flow strict-local */ import NativeDevSettings from '../NativeModules/specs/NativeDevSettings'; import NativeEventEmitter from '../EventEmitter/NativeEventEmitter'; -class DevSettings extends NativeEventEmitter { +interface IDevSettings { + addMenuItem(title: string, handler: () => mixed): void; + reload(reason?: string): void; + onFastRefresh(): void; +} + +class DevSettings extends NativeEventEmitter implements IDevSettings { _menuItems: Map mixed>; constructor() { @@ -39,9 +46,9 @@ class DevSettings extends NativeEventEmitter { }); } - reload(reason: string) { + reload(reason?: string) { if (typeof NativeDevSettings.reloadWithReason === 'function') { - NativeDevSettings.reloadWithReason(reason || 'Uncategorized from JS'); + NativeDevSettings.reloadWithReason(reason ?? 'Uncategorized from JS'); } else { NativeDevSettings.reload(); } @@ -57,9 +64,12 @@ class DevSettings extends NativeEventEmitter { } // Avoid including the full `NativeDevSettings` class in prod. -class NoopDevSettings { +class NoopDevSettings implements IDevSettings { addMenuItem(title: string, handler: () => mixed) {} - reload() {} + reload(reason?: string) {} + onFastRefresh() {} } -module.exports = __DEV__ ? new DevSettings() : new NoopDevSettings(); +module.exports = ((__DEV__ + ? new DevSettings() + : new NoopDevSettings()): IDevSettings); diff --git a/Libraries/Utilities/GlobalPerformanceLogger.js b/Libraries/Utilities/GlobalPerformanceLogger.js index 5c1f589d134ce9..44b5a8ee7def55 100644 --- a/Libraries/Utilities/GlobalPerformanceLogger.js +++ b/Libraries/Utilities/GlobalPerformanceLogger.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow strict-local + * @flow strict * @format */ 'use strict'; diff --git a/Libraries/Utilities/HMRClient.js b/Libraries/Utilities/HMRClient.js index d890f389bac73d..2b3e5cd0c7d58a 100644 --- a/Libraries/Utilities/HMRClient.js +++ b/Libraries/Utilities/HMRClient.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format - * @flow + * @flow strict-local */ 'use strict'; @@ -274,7 +274,7 @@ function setHMRUnavailableReason(reason) { } function registerBundleEntryPoints(client) { - if (hmrUnavailableReason) { + if (hmrUnavailableReason != null) { DevSettings.reload('Bundle Splitting – Metro disconnected'); return; } diff --git a/Libraries/Utilities/NativeAppearance.js b/Libraries/Utilities/NativeAppearance.js index 5d37b8aded32a9..1f85cc30284988 100644 --- a/Libraries/Utilities/NativeAppearance.js +++ b/Libraries/Utilities/NativeAppearance.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow strict-local + * @flow strict * @format */ diff --git a/Libraries/Utilities/NativeDevLoadingView.js b/Libraries/Utilities/NativeDevLoadingView.js index 8938fb6df5ccbf..a122e2c487df3b 100644 --- a/Libraries/Utilities/NativeDevLoadingView.js +++ b/Libraries/Utilities/NativeDevLoadingView.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow + * @flow strict * @format */ diff --git a/Libraries/Utilities/NativeDevSplitBundleLoader.js b/Libraries/Utilities/NativeDevSplitBundleLoader.js index 505ae1c21081e5..987d47a5330b9a 100644 --- a/Libraries/Utilities/NativeDevSplitBundleLoader.js +++ b/Libraries/Utilities/NativeDevSplitBundleLoader.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow + * @flow strict * @format */ diff --git a/Libraries/Utilities/NativeDeviceInfo.js b/Libraries/Utilities/NativeDeviceInfo.js index e1f2a6625de495..840b754414c5e9 100644 --- a/Libraries/Utilities/NativeDeviceInfo.js +++ b/Libraries/Utilities/NativeDeviceInfo.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow strict-local + * @flow strict * @format */ diff --git a/Libraries/Utilities/NativeJSDevSupport.js b/Libraries/Utilities/NativeJSDevSupport.js index 0c140f0f9621f3..e609e1358ae7d7 100644 --- a/Libraries/Utilities/NativeJSDevSupport.js +++ b/Libraries/Utilities/NativeJSDevSupport.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow + * @flow strict * @format */ diff --git a/Libraries/Utilities/NativePlatformConstantsAndroid.js b/Libraries/Utilities/NativePlatformConstantsAndroid.js index 39aa25d8c49055..c12339267e5081 100644 --- a/Libraries/Utilities/NativePlatformConstantsAndroid.js +++ b/Libraries/Utilities/NativePlatformConstantsAndroid.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow strict-local + * @flow strict * @format */ diff --git a/Libraries/Utilities/NativePlatformConstantsIOS.js b/Libraries/Utilities/NativePlatformConstantsIOS.js index fd73bcffadb93b..5b9d68bbc75565 100644 --- a/Libraries/Utilities/NativePlatformConstantsIOS.js +++ b/Libraries/Utilities/NativePlatformConstantsIOS.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow strict-local + * @flow strict * @format */ diff --git a/Libraries/Utilities/NativePlatformConstantsMacOS.js b/Libraries/Utilities/NativePlatformConstantsMacOS.js index bea9264b17dcba..bc6db3d901f1b1 100644 --- a/Libraries/Utilities/NativePlatformConstantsMacOS.js +++ b/Libraries/Utilities/NativePlatformConstantsMacOS.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow strict-local + * @flow strict * @format */ diff --git a/Libraries/Utilities/Platform.android.js b/Libraries/Utilities/Platform.android.js index 3785bc8790a5b0..ece5fe511ad288 100644 --- a/Libraries/Utilities/Platform.android.js +++ b/Libraries/Utilities/Platform.android.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format - * @flow + * @flow strict */ 'use strict'; @@ -22,9 +22,11 @@ export type PlatformSelectSpec = { const Platform = { __constants: null, OS: 'android', + // $FlowFixMe[unsafe-getters-setters] get Version(): number { return this.constants.Version; }, + // $FlowFixMe[unsafe-getters-setters] get constants(): {| isTesting: boolean, reactNativeVersion: {| @@ -46,12 +48,14 @@ const Platform = { } return this.__constants; }, + // $FlowFixMe[unsafe-getters-setters] get isTesting(): boolean { if (__DEV__) { return this.constants.isTesting; } return false; }, + // $FlowFixMe[unsafe-getters-setters] get isTV(): boolean { return this.constants.uiMode === 'tv'; }, diff --git a/Libraries/Utilities/Platform.ios.js b/Libraries/Utilities/Platform.ios.js index 2b8afec73e4d54..afb39c5aad8b06 100644 --- a/Libraries/Utilities/Platform.ios.js +++ b/Libraries/Utilities/Platform.ios.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format - * @flow + * @flow strict */ 'use strict'; @@ -22,9 +22,11 @@ export type PlatformSelectSpec = { const Platform = { __constants: null, OS: 'ios', + // $FlowFixMe[unsafe-getters-setters] get Version(): string { return this.constants.osVersion; }, + // $FlowFixMe[unsafe-getters-setters] get constants(): {| forceTouchAvailable: boolean, interfaceIdiom: string, @@ -43,18 +45,22 @@ const Platform = { } return this.__constants; }, + // $FlowFixMe[unsafe-getters-setters] get isPad(): boolean { return this.constants.interfaceIdiom === 'pad'; }, /** * Deprecated, use `isTV` instead. */ + // $FlowFixMe[unsafe-getters-setters] get isTVOS(): boolean { return Platform.isTV; }, + // $FlowFixMe[unsafe-getters-setters] get isTV(): boolean { return this.constants.interfaceIdiom === 'tv'; }, + // $FlowFixMe[unsafe-getters-setters] get isTesting(): boolean { if (__DEV__) { return this.constants.isTesting; diff --git a/Libraries/Utilities/Platform.macos.js b/Libraries/Utilities/Platform.macos.js index 60a8af0aaf573b..330b19085ef854 100644 --- a/Libraries/Utilities/Platform.macos.js +++ b/Libraries/Utilities/Platform.macos.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format - * @flow + * @flow strict */ // TODO(macOS GH#774) Copied from Platform.ios.js @@ -24,9 +24,11 @@ export type PlatformSelectSpec = { const Platform = { __constants: null, OS: 'macos', + // $FlowFixMe[unsafe-getters-setters] get Version(): string { return this.constants.osVersion; }, + // $FlowFixMe[unsafe-getters-setters] get constants(): {| isTesting: boolean, osVersion: string, @@ -43,9 +45,11 @@ const Platform = { } return this.__constants; }, + // $FlowFixMe[unsafe-getters-setters] get isTV(): boolean { return false; }, + // $FlowFixMe[unsafe-getters-setters] get isTesting(): boolean { if (__DEV__) { return this.constants.isTesting; diff --git a/Libraries/Utilities/PolyfillFunctions.js b/Libraries/Utilities/PolyfillFunctions.js index dc6d5a0fbcc864..9dd136f593f55b 100644 --- a/Libraries/Utilities/PolyfillFunctions.js +++ b/Libraries/Utilities/PolyfillFunctions.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow + * @flow strict * @format */ @@ -26,7 +26,7 @@ const defineLazyObjectProperty = require('./defineLazyObjectProperty'); * @see https://github.com/facebook/react-native/issues/934 */ function polyfillObjectProperty( - object: Object, + object: {...}, name: string, getValue: () => T, ): void { @@ -36,7 +36,7 @@ function polyfillObjectProperty( Object.defineProperty(object, backupName, descriptor); } - const {enumerable, writable, configurable} = descriptor || {}; + const {enumerable, writable, configurable = false} = descriptor || {}; if (descriptor && !configurable) { console.error('Failed to set polyfill. ' + name + ' is not configurable.'); return; diff --git a/Libraries/Utilities/RCTLog.js b/Libraries/Utilities/RCTLog.js index def04d6c3b2d73..78679c1f4791be 100644 --- a/Libraries/Utilities/RCTLog.js +++ b/Libraries/Utilities/RCTLog.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format - * @flow + * @flow strict */ 'use strict'; @@ -20,11 +20,11 @@ const levelsMap = { fatal: 'error', }; -let warningHandler: ?(Array) => void = null; +let warningHandler: ?(...Array) => void = null; const RCTLog = { // level one of log, info, warn, error, mustfix - logIfNoNativeHook(level: string, ...args: Array): void { + logIfNoNativeHook(level: string, ...args: Array): void { // We already printed in the native console, so only log here if using a js debugger if (typeof global.nativeLoggingHook === 'undefined') { RCTLog.logToConsole(level, ...args); @@ -37,7 +37,7 @@ const RCTLog = { }, // Log to console regardless of nativeLoggingHook - logToConsole(level: string, ...args: Array): void { + logToConsole(level: string, ...args: Array): void { const logFn = levelsMap[level]; invariant( logFn, diff --git a/Libraries/Utilities/__tests__/PerformanceLogger-test.js b/Libraries/Utilities/__tests__/PerformanceLogger-test.js index 4d83a9b7941547..9af931852397ab 100644 --- a/Libraries/Utilities/__tests__/PerformanceLogger-test.js +++ b/Libraries/Utilities/__tests__/PerformanceLogger-test.js @@ -32,7 +32,7 @@ describe('PerformanceLogger', () => { let perfLogger = createPerformanceLogger(); perfLogger.startTimespan(TIMESPAN_1); perfLogger.stopTimespan(TIMESPAN_1); - perfLogger.addTimespan(TIMESPAN_2, TIMESPAN_2_DURATION); + perfLogger.addTimeAnnotation(TIMESPAN_2, TIMESPAN_2_DURATION); expect(perfLogger.hasTimespan(TIMESPAN_1)).toBe(true); expect(perfLogger.hasTimespan(TIMESPAN_2)).toBe(true); expect(perfLogger.getTimespans()[TIMESPAN_2].totalTime).toBe( @@ -46,10 +46,33 @@ describe('PerformanceLogger', () => { let old = perfLogger.getTimespans()[TIMESPAN_1]; perfLogger.startTimespan(TIMESPAN_1); expect(perfLogger.getTimespans()[TIMESPAN_1]).toBe(old); - perfLogger.addTimespan(TIMESPAN_1, 1); + perfLogger.addTimeAnnotation(TIMESPAN_1, 1); expect(perfLogger.getTimespans()[TIMESPAN_1]).toBe(old); }); + it('adds a timespan with start and end timestamps', () => { + let perfLogger = createPerformanceLogger(); + const startTime = 0; + const endTime = 100; + const description = 'description'; + perfLogger.addTimespan(TIMESPAN_1, startTime, endTime, description); + expect(perfLogger.getTimespans()[TIMESPAN_1]).toEqual({ + description, + startTime, + endTime, + totalTime: endTime - startTime, + }); + }); + + it('adds a timespan with same key will not override existing', () => { + let perfLogger = createPerformanceLogger(); + perfLogger.startTimespan(TIMESPAN_1); + perfLogger.stopTimespan(TIMESPAN_1); + const existing = perfLogger.getTimespans()[TIMESPAN_1]; + perfLogger.addTimespan(TIMESPAN_1, 0, 100, 'overriding'); + expect(perfLogger.getTimespans()[TIMESPAN_1]).toEqual(existing); + }); + it('logs an extra', () => { let perfLogger = createPerformanceLogger(); perfLogger.setExtra(EXTRA_KEY, EXTRA_VALUE); diff --git a/Libraries/Utilities/binaryToBase64.js b/Libraries/Utilities/binaryToBase64.js index 19d23d125d2249..8ae743553b75e4 100644 --- a/Libraries/Utilities/binaryToBase64.js +++ b/Libraries/Utilities/binaryToBase64.js @@ -5,15 +5,16 @@ * LICENSE file in the root directory of this source tree. * * @format - * @flow + * @flow strict */ 'use strict'; const base64 = require('base64-js'); -function binaryToBase64(data: ArrayBuffer | $ArrayBufferView): any { +function binaryToBase64(data: ArrayBuffer | $ArrayBufferView): string { if (data instanceof ArrayBuffer) { + // $FlowFixMe[reassign-const] data = new Uint8Array(data); } if (data instanceof Uint8Array) { @@ -22,7 +23,8 @@ function binaryToBase64(data: ArrayBuffer | $ArrayBufferView): any { if (!ArrayBuffer.isView(data)) { throw new Error('data must be ArrayBuffer or typed array'); } - const {buffer, byteOffset, byteLength} = data; + // Already checked that `data` is `DataView` in `ArrayBuffer.isView(data)` + const {buffer, byteOffset, byteLength} = ((data: $FlowFixMe): DataView); return base64.fromByteArray(new Uint8Array(buffer, byteOffset, byteLength)); } diff --git a/Libraries/Utilities/codegenNativeComponent.js b/Libraries/Utilities/codegenNativeComponent.js index c790495c5e41c6..f358450cece322 100644 --- a/Libraries/Utilities/codegenNativeComponent.js +++ b/Libraries/Utilities/codegenNativeComponent.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format - * @flow + * @flow strict-local */ // TODO: move this file to shims/ReactNative (requires React update and sync) @@ -30,7 +30,7 @@ function codegenNativeComponent( options?: Options, ): NativeComponentType { let componentNameInUse = - options && options.paperComponentName + options && options.paperComponentName != null ? options.paperComponentName : componentName; @@ -44,7 +44,7 @@ function codegenNativeComponent( componentNameInUse = options.paperComponentNameDeprecated; } else { throw new Error( - `Failed to find native component for either ${componentName} or ${options.paperComponentNameDeprecated || + `Failed to find native component for either ${componentName} or ${options.paperComponentNameDeprecated ?? '(unknown)'}`, ); } diff --git a/Libraries/Utilities/createPerformanceLogger.js b/Libraries/Utilities/createPerformanceLogger.js index 556363a5fa4081..d53c107b3e4f0e 100644 --- a/Libraries/Utilities/createPerformanceLogger.js +++ b/Libraries/Utilities/createPerformanceLogger.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow + * @flow strict * @format */ @@ -13,7 +13,8 @@ const Systrace = require('../Performance/Systrace'); const infoLog = require('./infoLog'); -const performanceNow = global.nativeQPLTimestamp ?? global.performance.now; +const performanceNow = + global.nativeQPLTimestamp ?? global.performance.now.bind(global.performance); type Timespan = { description?: string, @@ -24,7 +25,8 @@ type Timespan = { }; export type IPerformanceLogger = { - addTimespan(string, number, string | void): void, + addTimeAnnotation(string, number, string | void): void, + addTimespan(string, number, number, string | void): void, startTimespan(string, string | void): void, stopTimespan(string, options?: {update?: boolean}): void, clear(): void, @@ -34,10 +36,10 @@ export type IPerformanceLogger = { getTimespans(): {[key: string]: Timespan, ...}, hasTimespan(string): boolean, logTimespans(): void, - addTimespans(Array, Array): void, - setExtra(string, any): void, - getExtras(): {[key: string]: any, ...}, - removeExtra(string): ?any, + addTimeAnnotations(Array, Array): void, + setExtra(string, mixed): void, + getExtras(): {[key: string]: mixed, ...}, + removeExtra(string): ?mixed, logExtras(): void, markPoint(string, number | void): void, getPoints(): {[key: string]: number, ...}, @@ -58,7 +60,7 @@ const PRINT_TO_CONSOLE: false = false; // Type as false to prevent accidentally function createPerformanceLogger(): IPerformanceLogger { const result: IPerformanceLogger & { _timespans: {[key: string]: Timespan, ...}, - _extras: {[key: string]: any, ...}, + _extras: {[key: string]: mixed, ...}, _points: {[key: string]: number, ...}, ... } = { @@ -66,7 +68,7 @@ function createPerformanceLogger(): IPerformanceLogger { _extras: {}, _points: {}, - addTimespan(key: string, lengthInMs: number, description?: string) { + addTimeAnnotation(key: string, durationInMs: number, description?: string) { if (this._timespans[key]) { if (PRINT_TO_CONSOLE && __DEV__) { infoLog( @@ -79,7 +81,31 @@ function createPerformanceLogger(): IPerformanceLogger { this._timespans[key] = { description: description, - totalTime: lengthInMs, + totalTime: durationInMs, + }; + }, + + addTimespan( + key: string, + startTime: number, + endTime: number, + description?: string, + ) { + if (this._timespans[key]) { + if (PRINT_TO_CONSOLE && __DEV__) { + infoLog( + 'PerformanceLogger: Attempting to add a timespan that already exists ', + key, + ); + } + return; + } + + this._timespans[key] = { + description, + startTime, + endTime, + totalTime: endTime - (startTime || 0), }; }, @@ -199,14 +225,18 @@ function createPerformanceLogger(): IPerformanceLogger { } }, - addTimespans(newTimespans: Array, labels: Array) { - for (let ii = 0, l = newTimespans.length; ii < l; ii += 2) { + addTimeAnnotations(durationsInMs: Array, labels: Array) { + for (let ii = 0, l = durationsInMs.length; ii < l; ii += 2) { const label = labels[ii / 2]; - this.addTimespan(label, newTimespans[ii + 1] - newTimespans[ii], label); + this.addTimespan( + label, + durationsInMs[ii + 1] - durationsInMs[ii], + label, + ); } }, - setExtra(key: string, value: any) { + setExtra(key: string, value: mixed) { if (this._extras[key]) { if (PRINT_TO_CONSOLE && __DEV__) { infoLog( @@ -223,7 +253,7 @@ function createPerformanceLogger(): IPerformanceLogger { return this._extras; }, - removeExtra(key: string): ?any { + removeExtra(key: string): ?mixed { const value = this._extras[key]; delete this._extras[key]; return value; diff --git a/Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js b/Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js index 974314539d2301..72ddbe5cdda858 100644 --- a/Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js +++ b/Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format - * @flow + * @flow strict */ 'use strict'; @@ -27,7 +27,9 @@ * Freezing the object and adding the throw mechanism is expensive and will * only be used in DEV. */ -function deepFreezeAndThrowOnMutationInDev(object: T): T { +function deepFreezeAndThrowOnMutationInDev>( + object: T, +): T { if (__DEV__) { if ( typeof object !== 'object' || @@ -38,7 +40,8 @@ function deepFreezeAndThrowOnMutationInDev(object: T): T { return object; } - const keys = Object.keys(object); + // $FlowFixMe[not-an-object] `object` can be an array, but Object.keys works with arrays too + const keys = Object.keys((object: {...} | Array)); const hasOwnProperty = Object.prototype.hasOwnProperty; for (let i = 0; i < keys.length; i++) { diff --git a/Libraries/Utilities/defineLazyObjectProperty.js b/Libraries/Utilities/defineLazyObjectProperty.js index 9c5698a703699a..c1b486a5fe4902 100644 --- a/Libraries/Utilities/defineLazyObjectProperty.js +++ b/Libraries/Utilities/defineLazyObjectProperty.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format - * @flow + * @flow strict */ 'use strict'; @@ -14,7 +14,7 @@ * Defines a lazily evaluated property on the supplied `object`. */ function defineLazyObjectProperty( - object: Object, + object: {...}, name: string, descriptor: { get: () => T, diff --git a/Libraries/Utilities/stringifySafe.js b/Libraries/Utilities/stringifySafe.js index effeedcd2994dc..e051f59f8f0df0 100644 --- a/Libraries/Utilities/stringifySafe.js +++ b/Libraries/Utilities/stringifySafe.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format - * @flow strict-local + * @flow strict */ 'use strict'; diff --git a/Libraries/Utilities/warnOnce.js b/Libraries/Utilities/warnOnce.js index 70c7460c7855ca..adbc64ebc8598a 100644 --- a/Libraries/Utilities/warnOnce.js +++ b/Libraries/Utilities/warnOnce.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format - * @flow strict-local + * @flow strict */ 'use strict'; diff --git a/Libraries/Vibration/NativeVibration.js b/Libraries/Vibration/NativeVibration.js index 6de5352ec82f8e..d2b2f2424e95df 100644 --- a/Libraries/Vibration/NativeVibration.js +++ b/Libraries/Vibration/NativeVibration.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow strict-local + * @flow strict * @format */ diff --git a/Libraries/Vibration/Vibration.js b/Libraries/Vibration/Vibration.js index 4a2d8444ea702b..ab7f466be626ec 100644 --- a/Libraries/Vibration/Vibration.js +++ b/Libraries/Vibration/Vibration.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format - * @flow + * @flow strict * @jsdoc */ @@ -31,6 +31,7 @@ function vibrateByPattern(pattern: Array, repeat: boolean = false) { _vibrating = true; if (pattern[0] === 0) { NativeVibration.vibrate(_default_vibration_length); + // $FlowFixMe[reassign-const] pattern = pattern.slice(1); } if (pattern.length === 0) { @@ -52,6 +53,7 @@ function vibrateScheduler( NativeVibration.vibrate(_default_vibration_length); if (nextIndex >= pattern.length) { if (repeat) { + // $FlowFixMe[reassign-const] nextIndex = 0; } else { _vibrating = false; diff --git a/Libraries/WebSocket/RCTSRWebSocket.m b/Libraries/WebSocket/RCTSRWebSocket.m index 2f314e73d6d420..301eca95be2157 100644 --- a/Libraries/WebSocket/RCTSRWebSocket.m +++ b/Libraries/WebSocket/RCTSRWebSocket.m @@ -466,7 +466,7 @@ - (void)didConnect CFHTTPMessageSetHeaderFieldValue(request, CFSTR("Origin"), (__bridge CFStringRef)_url.RCTSR_origin); - if (_requestedProtocols) { + if (_requestedProtocols && _requestedProtocols.count > 0) { CFHTTPMessageSetHeaderFieldValue(request, CFSTR("Sec-WebSocket-Protocol"), (__bridge CFStringRef)[_requestedProtocols componentsJoinedByString:@", "]); } diff --git a/Libraries/promiseRejectionIsError.js b/Libraries/promiseRejectionIsError.js index f17583d7b0c14e..2df61813e7be3d 100644 --- a/Libraries/promiseRejectionIsError.js +++ b/Libraries/promiseRejectionIsError.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format - * @flow + * @flow strict */ 'use strict'; diff --git a/Libraries/vendor/core/ErrorUtils.js b/Libraries/vendor/core/ErrorUtils.js index 2d60c4fc378371..8fedfc7376904c 100644 --- a/Libraries/vendor/core/ErrorUtils.js +++ b/Libraries/vendor/core/ErrorUtils.js @@ -8,7 +8,7 @@ * @flow strict */ -import type {ErrorUtilsT} from '../../polyfills/error-guard'; +import type {ErrorUtilsT} from '@react-native/polyfills/error-guard'; /** * The particular require runtime that we are using looks for a global diff --git a/RNTester/Podfile b/RNTester/Podfile index 87c0f00dfc0918..9abeef00858e34 100644 --- a/RNTester/Podfile +++ b/RNTester/Podfile @@ -21,7 +21,6 @@ def pods(options = {}) pod 'ReactCommon/turbomodule/samples', :path => '../ReactCommon' # Additional Pods which aren't included in the default Podfile - pod 'React-ART', :path => '../Libraries/ART' pod 'React-RCTPushNotification', :path => '../Libraries/PushNotificationIOS' pod 'Yoga',:path => '../ReactCommon/yoga', :modular_headers => true pod 'React-TurboModuleCxx-WinRTPort', :path => '../ReactTurboModuleCxx' diff --git a/RNTester/Podfile.lock b/RNTester/Podfile.lock index 372911272cff10..6e47d5f781a8f8 100644 --- a/RNTester/Podfile.lock +++ b/RNTester/Podfile.lock @@ -89,8 +89,6 @@ PODS: - React-RCTSettings (= 1000.0.0) - React-RCTText (= 1000.0.0) - React-RCTVibration (= 1000.0.0) - - React-ART (1000.0.0): - - React-Core/ARTHeaders (= 1000.0.0) - React-callinvoker (1000.0.0) - React-Core (1000.0.0): - glog @@ -101,15 +99,6 @@ PODS: - React-jsiexecutor (= 1000.0.0) - React-perflogger (= 1000.0.0) - Yoga - - React-Core/ARTHeaders (1000.0.0): - - glog - - RCT-Folly (= 2020.01.13.00) - - React-Core/Default - - React-cxxreact (= 1000.0.0) - - React-jsi (= 1000.0.0) - - React-jsiexecutor (= 1000.0.0) - - React-perflogger (= 1000.0.0) - - Yoga - React-Core/CoreModulesHeaders (1000.0.0): - glog - RCT-Folly (= 2020.01.13.00) @@ -406,7 +395,6 @@ DEPENDENCIES: - RCTRequired (from `../Libraries/RCTRequired`) - RCTTypeSafety (from `../Libraries/TypeSafety`) - React (from `../`) - - React-ART (from `../Libraries/ART`) - React-callinvoker (from `../ReactCommon/callinvoker`) - React-Core (from `../`) - React-Core/DevSupport (from `../`) @@ -468,8 +456,6 @@ EXTERNAL SOURCES: :path: "../Libraries/TypeSafety" React: :path: "../" - React-ART: - :path: "../Libraries/ART" React-callinvoker: :path: "../ReactCommon/callinvoker" React-Core: @@ -524,8 +510,8 @@ SPEC CHECKSUMS: CocoaAsyncSocket: 694058e7c0ed05a9e217d1b3c7ded962f4180845 CocoaLibEvent: 2fab71b8bd46dd33ddb959f7928ec5909f838e3f DoubleConversion: 2b45d0f8e156a5b02354c8a4062de64d41ccb4e0 - FBLazyVector: ab4c6d0152ef6fe898f1fe79f43a0eecbc87fbee - FBReactNativeSpec: 1181a07ef463f907e3f65dd10c67832d96a085cc + FBLazyVector: 732869c0b909e8bf216314da06e817522d65cc1b + FBReactNativeSpec: f179c5379aa50218c6d52b5327b3225bc8e86f08 Flipper: be611d4b742d8c87fbae2ca5f44603a02539e365 Flipper-DoubleConversion: 38631e41ef4f9b12861c67d17cb5518d06badc41 Flipper-Folly: c12092ea368353b58e992843a990a3225d4533c3 @@ -536,36 +522,35 @@ SPEC CHECKSUMS: glog: 789873d01e4b200777d0a09bc23d548446758699 OpenSSL-Universal: 8b48cc0d10c1b2923617dfe5c178aa9ed2689355 RCT-Folly: 55d0039b24e192081ec0b2257f7bd9f42e382fb7 - RCTRequired: 29bf5b171dee98522c32df97f5a9e295b7af0760 - RCTTypeSafety: b4dd5a6eff3e4d36017acc259b86e58dc98b0ed3 - React: 51b24afe583c5ad745fdc163985d4862d14ecd9a - React-ART: fe4e5da330d31f1858d4f065600a1b0b50497a69 - React-callinvoker: 9f3a98834312a1ff6835cc3c3d3b8fd51acecb7b - React-Core: 070959b879b02eb6e66cd7d8282b54626b560721 - React-CoreModules: 139e360cf3e6810390138d9beb98afa5572e10d4 - React-cxxreact: c50bb5c2fb8803fa1819ee3f069e953eb61c6f49 - React-jsi: c93a044d107be7665ac3244354be652f655d617f - React-jsiexecutor: ef3091e4690794539c4e1f98750083e6a360ae16 - React-jsinspector: 53d304bbf2e4a6ead8c236c8ddcb25d2cd4b85d0 - React-perflogger: 57587ce78fd0505730f492544ee14570b759b384 - React-RCTActionSheet: 9ace73e604ee2036c83f9c0e4b3077cf0740c686 - React-RCTAnimation: bd9070b019d8be03b1832ec7eee9cc56fff39d3b - React-RCTBlob: 4f142fd7572e53e7412ac361d50e7e6e091b8313 - React-RCTImage: b066681d362900cf6d4851bd40ce41c445067256 - React-RCTLinking: 419474ef4e57746853b1e689ad723c14f1c8b219 - React-RCTNetwork: 1055bf1e0cb1a8c2911367d2cc3d1aa2c88b2d40 - React-RCTPushNotification: acee780df4dcc58a6588c76517678b077984f3de - React-RCTSettings: 5615ad4051740041234b202b6aea820b4452725b - React-RCTTest: 7490fd4d8a7c704080dfdc54df672b6ea13626a4 - React-RCTText: 943d92f61cfe369d599b818c2c4c34f57eb80384 - React-RCTVibration: 05749088a899bba0191a61447cc20e1391df25f0 - React-runtimeexecutor: 52fa0483f4f6ce77e605f364b40c02c27cd60272 + RCTRequired: e57c96e9043b32eb039c3be36b0323c9c0cc78b3 + RCTTypeSafety: d89d63062f5f3880bc142a8115a9d7488f96f6e6 + React: ffa956ca111517bdbac4adbda38f392ff1b24655 + React-callinvoker: f8688c196a51ed024f2f2e5ed964f48fb0ccc104 + React-Core: 23f3d8f877a3d838ba407ff8c4122d5ae5f2675b + React-CoreModules: c584baf382fa2fdd751c272fd8169b478ee9d16a + React-cxxreact: 8182b61c40331f2bab4861a01a148b75ce6d6a25 + React-jsi: b40a0b755266eef1ccd36be376598e6b8deeeb65 + React-jsiexecutor: 9082a6492e0786ee05b7c896b8d013dd14d6a7f5 + React-jsinspector: ace5eb00f739058c1639de2cfa34d4723090c1d6 + React-perflogger: ecc9e8fa74a3fed810ca23be9677dc488a7aa293 + React-RCTActionSheet: f39b0fb0af5750509f1aa86b2ed56955ab9071d7 + React-RCTAnimation: 83c410e9886788e0bad11c15552274bacce10296 + React-RCTBlob: d0391ea7685afe50564c3221445c8b1c911fc1dc + React-RCTImage: 5490eb14709285403f30bb55aa53bb64e1d4183b + React-RCTLinking: 55ec860467d76a01f28284aaaf7bfd406524da93 + React-RCTNetwork: f18683923b0396a68f028cf5a9810777cac4010c + React-RCTPushNotification: 33a883d3e6f10a1842b6b3f7fb592854a6f69676 + React-RCTSettings: 7f8ec2893fa4129a7c7dc3db7fac421fb0a96c5a + React-RCTTest: 18046d93f0b48a7eacf50afb54ff7c7ac75e85e8 + React-RCTText: 1f3470878a4ce51821a83640d6b4e310c8f7e1fc + React-RCTVibration: 0b7cef95d0b04c778c6751ff638c47e190cee7c5 + React-runtimeexecutor: 14a8a45de8e02b8895afae7f38cc5aaf5ea90b5a React-TurboModuleCxx-RNW: 18bb71af41fe34c8b12a56bef60aae7ee32b0817 - React-TurboModuleCxx-WinRTPort: bda120670acda667c1751bba68639377aa9dc24c - ReactCommon: 73845e097427ff0d225887fe9c291ec576e31e94 - Yoga: 3e98dc4f25d60ca42e409b5e53b3be634946d0d9 + React-TurboModuleCxx-WinRTPort: c4538e76df5bdf83edd892a8919c7202ac790ed1 + ReactCommon: 6d574adf7fdd5d0e7e2e892b95c75ea167d3a725 + Yoga: af7ff9d5087d827aa8dd130c1e2b1c3062494887 YogaKit: f782866e155069a2cca2517aafea43200b01fd5a -PODFILE CHECKSUM: 2a5ebd1edccf5913eeb0748b1ce38c8dafa87a21 +PODFILE CHECKSUM: d3ddf54cbfd92c34f45d8fb0c9166fe4730df5c0 COCOAPODS: 1.10.1 diff --git a/RNTester/android/app/build.gradle b/RNTester/android/app/build.gradle index 0a36475ade519b..1f495a29270ac2 100644 --- a/RNTester/android/app/build.gradle +++ b/RNTester/android/app/build.gradle @@ -60,7 +60,17 @@ plugins { * // date; if you have any other folders that you want to ignore for performance reasons (gradle * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/ * // for example, you might want to remove it from here. - * inputExcludes: ["android/**", "ios/**"] + * inputExcludes: ["android/**", "ios/**"], + * + * // Root dir for all JS files for the app. Defaults to `root` above. + * jsRootDir: "../..", + * + * // Enable react-native-codegen during build time. + * enableCodegen: true, + * + * // Java package name to use for any codegen artifacts produced during build time. + * // Defaults to "com.facebook.fbreact.specs". + * codegenJavaPackageName: "com.facebook.fbreact.specs", * ] */ @@ -72,7 +82,9 @@ project.ext.react = [ inputExcludes: ["android/**", "./**", ".gradle/**"], composeSourceMapsPath: "$rootDir/scripts/compose-source-maps.js", hermesCommand: "../../../node_modules/hermes-engine/%OS-BIN%/hermesc", - enableHermesForVariant: { def v -> v.name.contains("hermes") } + enableHermesForVariant: { def v -> v.name.contains("hermes") }, + jsRootDir: "$rootDir/RNTester", + enableCodegen: System.getenv('USE_CODEGEN'), ] apply from: "../../../react.gradle" @@ -121,7 +133,7 @@ android { defaultConfig { applicationId "com.facebook.react.uiapp" - minSdkVersion 18 + minSdkVersion 19 targetSdkVersion 29 versionCode 1 versionName "1.0" diff --git a/React-Core.podspec b/React-Core.podspec index fc0a69f377561b..672f0e7d468a7f 100644 --- a/React-Core.podspec +++ b/React-Core.podspec @@ -21,7 +21,6 @@ folly_version = '2020.01.13.00' boost_compiler_flags = '-Wno-documentation' header_subspecs = { - 'ARTHeaders' => 'Libraries/ART/**/*.h', 'CoreModulesHeaders' => 'React/CoreModules/**/*.h', 'RCTActionSheetHeaders' => 'Libraries/ActionSheetIOS/*.h', 'RCTAnimationHeaders' => 'Libraries/NativeAnimation/{Drivers/*,Nodes/*,*}.{h}', @@ -59,6 +58,7 @@ Pod::Spec.new do |s| "React/DevSupport/**/*", "React/Fabric/**/*", "React/Inspector/**/*", + "React/Tests/**/*", "React/CxxBridge/HermesExecutorFactory.*" # TODO(macOS GH#214) ss.ios.exclude_files = "React/**/RCTTV*.*", diff --git a/React/Base/RCTBridge.h b/React/Base/RCTBridge.h index c241b0b24a5827..c461d82b473b73 100644 --- a/React/Base/RCTBridge.h +++ b/React/Base/RCTBridge.h @@ -33,11 +33,6 @@ RCT_EXTERN NSString *const RCTJavaScriptWillStartExecutingNotification; */ RCT_EXTERN NSString *const RCTJavaScriptDidLoadNotification; -/** - * This notification fires every time the bridge has finished loading an additional JS bundle. - */ -RCT_EXTERN NSString *const RCTAdditionalJavaScriptDidLoadNotification; - /** * This notification fires when the bridge failed to load the JS bundle. The * `error` key can be used to determine the error that occurred. diff --git a/React/Base/RCTBridge.m b/React/Base/RCTBridge.m index 3241b5b019350e..c2c68be7901e0b 100644 --- a/React/Base/RCTBridge.m +++ b/React/Base/RCTBridge.m @@ -24,7 +24,6 @@ #import "RCTReloadCommand.h" #import "RCTUtils.h" -NSString *const RCTAdditionalJavaScriptDidLoadNotification = @"RCTAdditionalJavaScriptDidLoadNotification"; NSString *const RCTJavaScriptDidFailToLoadNotification = @"RCTJavaScriptDidFailToLoadNotification"; NSString *const RCTJavaScriptDidLoadNotification = @"RCTJavaScriptDidLoadNotification"; NSString *const RCTJavaScriptWillStartExecutingNotification = @"RCTJavaScriptWillStartExecutingNotification"; diff --git a/React/Base/RCTBundleURLProvider.mm b/React/Base/RCTBundleURLProvider.mm index 4be1f1f67fd4fd..7e511e1bdebc30 100644 --- a/React/Base/RCTBundleURLProvider.mm +++ b/React/Base/RCTBundleURLProvider.mm @@ -132,7 +132,7 @@ - (NSString *)packagerServerHost { NSString *location = [self jsLocation]; #if RCT_DEV_MENU - if (![RCTBundleURLProvider isPackagerRunning:location]) { + if ([location length] && ![RCTBundleURLProvider isPackagerRunning:location]) { location = nil; } #endif diff --git a/React/Base/RCTConvert.m b/React/Base/RCTConvert.m index 3a9b718a7a0d45..37b6a5b164f3c8 100644 --- a/React/Base/RCTConvert.m +++ b/React/Base/RCTConvert.m @@ -1320,7 +1320,11 @@ + (NSPropertyList)NSPropertyList:(id)json RCT_ENUM_CONVERTER( YGPositionType, - (@{@"absolute" : @(YGPositionTypeAbsolute), @"relative" : @(YGPositionTypeRelative)}), + (@{ + @"static" : @(YGPositionTypeStatic), + @"absolute" : @(YGPositionTypeAbsolute), + @"relative" : @(YGPositionTypeRelative) + }), YGPositionTypeRelative, intValue) diff --git a/React/Base/RCTJSScriptLoaderModule.h b/React/Base/RCTJSScriptLoaderModule.h new file mode 100644 index 00000000000000..a0ba36ed7dcc2e --- /dev/null +++ b/React/Base/RCTJSScriptLoaderModule.h @@ -0,0 +1,18 @@ +/* + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +@class RCTSource; + +/** + * This protocol should be adopted when a turbo module needs to tell React Native to load a script. + * In bridge-less React Native, it is a replacement for [_bridge loadAndExecuteSplitBundleURL:]. + */ +@protocol RCTJSScriptLoaderModule + +@property (nonatomic, copy, nonnull) void (^loadScript)(RCTSource *source); + +@end diff --git a/React/CoreModules/RCTDevSplitBundleLoader.h b/React/CoreModules/RCTDevSplitBundleLoader.h index d86f6244bb4fce..9ef40198aeafdc 100644 --- a/React/CoreModules/RCTDevSplitBundleLoader.h +++ b/React/CoreModules/RCTDevSplitBundleLoader.h @@ -6,7 +6,8 @@ */ #import +#import #import // TODO(macOS GH#774) -@interface RCTDevSplitBundleLoader : NSObject +@interface RCTDevSplitBundleLoader : NSObject @end diff --git a/React/CoreModules/RCTDevSplitBundleLoader.mm b/React/CoreModules/RCTDevSplitBundleLoader.mm index 73d0c98e692dff..4a2243e17c2725 100644 --- a/React/CoreModules/RCTDevSplitBundleLoader.mm +++ b/React/CoreModules/RCTDevSplitBundleLoader.mm @@ -12,6 +12,7 @@ #import #import #import +#import #import #import "CoreModulesPlugins.h" @@ -23,10 +24,11 @@ @interface RCTDevSplitBundleLoader () #if RCT_DEV_MENU -@implementation RCTDevSplitBundleLoader { -} +@implementation RCTDevSplitBundleLoader @synthesize bridge = _bridge; +@synthesize loadScript = _loadScript; +@synthesize turboModuleRegistry = _turboModuleRegistry; RCT_EXPORT_MODULE() @@ -46,13 +48,32 @@ - (void)setBridge:(RCTBridge *)bridge : (RCTPromiseRejectBlock)reject) { NSURL *sourceURL = [[RCTBundleURLProvider sharedSettings] jsBundleURLForSplitBundleRoot:bundlePath]; - [_bridge loadAndExecuteSplitBundleURL:sourceURL - onError:^(NSError *error) { - reject(@"E_BUNDLE_LOAD_ERROR", [error localizedDescription], error); - } - onComplete:^() { - resolve(@YES); - }]; + if (_bridge) { + [_bridge loadAndExecuteSplitBundleURL:sourceURL + onError:^(NSError *error) { + reject(@"E_BUNDLE_LOAD_ERROR", [error localizedDescription], error); + } + onComplete:^() { + resolve(@YES); + }]; + } else { + __weak __typeof(self) weakSelf = self; + [RCTJavaScriptLoader loadBundleAtURL:sourceURL + onProgress:^(RCTLoadingProgress *progressData) { + // TODO: Setup loading bar. + } + onComplete:^(NSError *error, RCTSource *source) { + if (error) { + reject(@"E_BUNDLE_LOAD_ERROR", [error localizedDescription], error); + return; + } + __typeof(self) strongSelf = weakSelf; + strongSelf->_loadScript(source); + RCTDevSettings *devSettings = [strongSelf->_turboModuleRegistry moduleForName:"RCTDevSettings"]; + [devSettings setupHMRClientWithAdditionalBundleURL:source.url]; + resolve(@YES); + }]; + } } - (std::shared_ptr)getTurboModule:(const ObjCTurboModule::InitParams &)params @@ -66,6 +87,8 @@ - (void)setBridge:(RCTBridge *)bridge @implementation RCTDevSplitBundleLoader +@synthesize loadScript = _loadScript; + + (NSString *)moduleName { return nil; diff --git a/React/CxxBridge/RCTCxxBridge.mm b/React/CxxBridge/RCTCxxBridge.mm index 8c975b95c0701f..fb964c1bca3cee 100644 --- a/React/CxxBridge/RCTCxxBridge.mm +++ b/React/CxxBridge/RCTCxxBridge.mm @@ -1047,10 +1047,6 @@ - (void)loadAndExecuteSplitBundleURL:(NSURL *)bundleURL [self enqueueApplicationScript:source.data url:source.url onComplete:^{ - [[NSNotificationCenter defaultCenter] - postNotificationName:RCTAdditionalJavaScriptDidLoadNotification - object:self->_parentBridge - userInfo:@{@"bridge" : self}]; [self.devSettings setupHMRClientWithAdditionalBundleURL:source.url]; onComplete(); }]; diff --git a/React/Fabric/Mounting/ComponentViews/ActivityIndicator/RCTActivityIndicatorViewComponentView.mm b/React/Fabric/Mounting/ComponentViews/ActivityIndicator/RCTActivityIndicatorViewComponentView.mm index a1eafa66906a47..dd79102526d9e5 100644 --- a/React/Fabric/Mounting/ComponentViews/ActivityIndicator/RCTActivityIndicatorViewComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/ActivityIndicator/RCTActivityIndicatorViewComponentView.mm @@ -7,9 +7,9 @@ #import "RCTActivityIndicatorViewComponentView.h" -#import -#import -#import +#import +#import +#import #import "FBRCTFabricComponentsPlugins.h" diff --git a/React/Fabric/Mounting/ComponentViews/Image/RCTImageComponentView.mm b/React/Fabric/Mounting/ComponentViews/Image/RCTImageComponentView.mm index 4e87e202fab898..f0a9ba293aa0c2 100644 --- a/React/Fabric/Mounting/ComponentViews/Image/RCTImageComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/Image/RCTImageComponentView.mm @@ -10,13 +10,13 @@ #import #import #import -#import -#import -#import -#import -#import -#import -#import +#import +#import +#import +#import +#import +#import +#import #import "RCTConversions.h" #import "RCTFabricComponentsPlugins.h" diff --git a/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryComponentView.mm b/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryComponentView.mm index cf24358e274c57..7ee2f208932540 100644 --- a/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryComponentView.mm @@ -11,8 +11,8 @@ #import #import #import -#import -#import +#import +#import #import "RCTInputAccessoryContentView.h" #import "RCTFabricComponentsPlugins.h" diff --git a/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.mm b/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.mm index 10e78de2937607..7db1533ca73e46 100644 --- a/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.mm @@ -8,8 +8,8 @@ #import "RCTLegacyViewManagerInteropComponentView.h" #import -#import -#import +#import +#import #import #import "RCTLegacyViewManagerInteropCoordinatorAdapter.h" diff --git a/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropCoordinatorAdapter.h b/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropCoordinatorAdapter.h index f919187dc1bcbd..56fc5c6dd4c45d 100644 --- a/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropCoordinatorAdapter.h +++ b/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropCoordinatorAdapter.h @@ -6,7 +6,7 @@ */ #import -#import +#import NS_ASSUME_NONNULL_BEGIN diff --git a/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.mm b/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.mm index 29b7b12e8990ae..2599f1a31fb163 100644 --- a/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.mm @@ -8,10 +8,10 @@ #import "RCTModalHostViewComponentView.h" #import -#import -#import -#import -#import +#import +#import +#import +#import #import "FBRCTFabricComponentsPlugins.h" #import "RCTConversions.h" diff --git a/React/Fabric/Mounting/ComponentViews/Root/RCTRootComponentView.mm b/React/Fabric/Mounting/ComponentViews/Root/RCTRootComponentView.mm index 9ffd6fb3f8cb54..820d4dfb6286bb 100644 --- a/React/Fabric/Mounting/ComponentViews/Root/RCTRootComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/Root/RCTRootComponentView.mm @@ -7,8 +7,8 @@ #import "RCTRootComponentView.h" -#import -#import +#import +#import using namespace facebook::react; diff --git a/React/Fabric/Mounting/ComponentViews/SafeAreaView/RCTSafeAreaViewComponentView.mm b/React/Fabric/Mounting/ComponentViews/SafeAreaView/RCTSafeAreaViewComponentView.mm index 6886660a73fd74..b3ef229906db3d 100644 --- a/React/Fabric/Mounting/ComponentViews/SafeAreaView/RCTSafeAreaViewComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/SafeAreaView/RCTSafeAreaViewComponentView.mm @@ -8,8 +8,8 @@ #import "RCTSafeAreaViewComponentView.h" #import -#import -#import +#import +#import #import "FBRCTFabricComponentsPlugins.h" #import "RCTConversions.h" #import "RCTFabricComponentsPlugins.h" diff --git a/React/Fabric/Mounting/ComponentViews/ScrollView/RCTPullToRefreshViewComponentView.mm b/React/Fabric/Mounting/ComponentViews/ScrollView/RCTPullToRefreshViewComponentView.mm index f8db5e3da23777..afcec45afa68cc 100644 --- a/React/Fabric/Mounting/ComponentViews/ScrollView/RCTPullToRefreshViewComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/ScrollView/RCTPullToRefreshViewComponentView.mm @@ -7,10 +7,10 @@ #import "RCTPullToRefreshViewComponentView.h" -#import -#import -#import -#import +#import +#import +#import +#import #import #import diff --git a/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm b/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm index 2d3e8c3802f761..21b7f2e46f1054 100644 --- a/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm @@ -11,12 +11,12 @@ #import #import -#import -#import -#import -#import -#import -#import +#import +#import +#import +#import +#import +#import #import "RCTConversions.h" #import "RCTEnhancedScrollView.h" diff --git a/React/Fabric/Mounting/ComponentViews/Slider/RCTSliderComponentView.mm b/React/Fabric/Mounting/ComponentViews/Slider/RCTSliderComponentView.mm index 48603345fc547b..fea74e18c146fc 100644 --- a/React/Fabric/Mounting/ComponentViews/Slider/RCTSliderComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/Slider/RCTSliderComponentView.mm @@ -9,9 +9,9 @@ #import #import -#import -#import -#import +#import +#import +#import #import "FBRCTFabricComponentsPlugins.h" diff --git a/React/Fabric/Mounting/ComponentViews/Switch/RCTSwitchComponentView.mm b/React/Fabric/Mounting/ComponentViews/Switch/RCTSwitchComponentView.mm index 4528488f52d3b8..2538f040476c78 100644 --- a/React/Fabric/Mounting/ComponentViews/Switch/RCTSwitchComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/Switch/RCTSwitchComponentView.mm @@ -7,10 +7,10 @@ #import "RCTSwitchComponentView.h" -#import -#import -#import -#import +#import +#import +#import +#import #import "FBRCTFabricComponentsPlugins.h" diff --git a/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentAccessibilityProvider.h b/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentAccessibilityProvider.h index 87573f789f5e17..d2b2fc0eb1fcda 100644 --- a/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentAccessibilityProvider.h +++ b/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentAccessibilityProvider.h @@ -7,9 +7,9 @@ #import -#import -#import -#import +#import +#import +#import #import "RCTParagraphComponentView.h" diff --git a/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentAccessibilityProvider.mm b/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentAccessibilityProvider.mm index 04adf1159ba3b2..3bffdd2429da4a 100644 --- a/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentAccessibilityProvider.mm +++ b/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentAccessibilityProvider.mm @@ -8,10 +8,10 @@ #import "RCTParagraphComponentAccessibilityProvider.h" #import -#import -#import -#import -#import +#import +#import +#import +#import #import "RCTConversions.h" #import "RCTFabricComponentsPlugins.h" diff --git a/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm b/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm index ba5a1f34c73ae3..7756a7761545d3 100644 --- a/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm @@ -8,15 +8,15 @@ #import "RCTParagraphComponentView.h" #import "RCTParagraphComponentAccessibilityProvider.h" -#import -#import -#import -#import -#import -#import -#import -#import -#import +#import +#import +#import +#import +#import +#import +#import +#import +#import #import #import "RCTConversions.h" diff --git a/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm b/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm index f23be7a94636dd..6cf72777384020 100644 --- a/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm @@ -7,10 +7,10 @@ #import "RCTTextInputComponentView.h" -#import -#import -#import -#import +#import +#import +#import +#import #import #import @@ -174,9 +174,7 @@ - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const & } if (newTextInputProps.traits.textContentType != oldTextInputProps.traits.textContentType) { - if (@available(iOS 10.0, *)) { - _backedTextInputView.textContentType = RCTUITextContentTypeFromString(newTextInputProps.traits.textContentType); - } + _backedTextInputView.textContentType = RCTUITextContentTypeFromString(newTextInputProps.traits.textContentType); } if (newTextInputProps.traits.passwordRules != oldTextInputProps.traits.passwordRules) { diff --git a/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.h b/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.h index 054bf41c811bbd..94191bfea35927 100644 --- a/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.h +++ b/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.h @@ -9,7 +9,7 @@ #import #import -#import +#import NS_ASSUME_NONNULL_BEGIN diff --git a/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.mm b/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.mm index 2540925b3d9e1f..51ead371f74443 100644 --- a/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.mm +++ b/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.mm @@ -42,10 +42,7 @@ void RCTCopyBackedTextInput( toTextInput.scrollEnabled = fromTextInput.scrollEnabled; toTextInput.secureTextEntry = fromTextInput.secureTextEntry; toTextInput.keyboardType = fromTextInput.keyboardType; - - if (@available(iOS 10.0, *)) { - toTextInput.textContentType = fromTextInput.textContentType; - } + toTextInput.textContentType = fromTextInput.textContentType; if (@available(iOS 12.0, *)) { toTextInput.passwordRules = fromTextInput.passwordRules; @@ -138,11 +135,7 @@ UIKeyboardType RCTUIKeyboardTypeFromKeyboardType(KeyboardType keyboardType) case KeyboardType::WebSearch: return UIKeyboardTypeWebSearch; case KeyboardType::ASCIICapableNumberPad: - if (@available(iOS 10.0, *)) { - return UIKeyboardTypeASCIICapableNumberPad; - } else { - return UIKeyboardTypeNumberPad; - } + return UIKeyboardTypeASCIICapableNumberPad; // Android-only case KeyboardType::VisiblePassword: return UIKeyboardTypeDefault; diff --git a/React/Fabric/Mounting/ComponentViews/UnimplementedComponent/RCTUnimplementedNativeComponentView.mm b/React/Fabric/Mounting/ComponentViews/UnimplementedComponent/RCTUnimplementedNativeComponentView.mm index c6728d57727347..09e8e3f7ed8482 100644 --- a/React/Fabric/Mounting/ComponentViews/UnimplementedComponent/RCTUnimplementedNativeComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/UnimplementedComponent/RCTUnimplementedNativeComponentView.mm @@ -7,9 +7,9 @@ #import "RCTUnimplementedNativeComponentView.h" -#import -#import -#import +#import +#import +#import using namespace facebook::react; diff --git a/React/Fabric/Mounting/ComponentViews/UnimplementedView/RCTUnimplementedViewComponentView.mm b/React/Fabric/Mounting/ComponentViews/UnimplementedView/RCTUnimplementedViewComponentView.mm index 6f617d0c482589..d7eaa6c62a54fc 100644 --- a/React/Fabric/Mounting/ComponentViews/UnimplementedView/RCTUnimplementedViewComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/UnimplementedView/RCTUnimplementedViewComponentView.mm @@ -7,12 +7,12 @@ #import "RCTUnimplementedViewComponentView.h" -#import -#import -#import +#import +#import +#import -#import -#import +#import +#import #import diff --git a/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.h b/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.h index af170a8a8b83f7..c574b1752c7ff8 100644 --- a/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.h +++ b/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.h @@ -10,11 +10,11 @@ #import #import #import -#import -#import -#import -#import -#import +#import +#import +#import +#import +#import NS_ASSUME_NONNULL_BEGIN diff --git a/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm b/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm index dfec3a599371db..40bbf2752dea9b 100644 --- a/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm @@ -10,9 +10,9 @@ #import #import #import -#import -#import -#import +#import +#import +#import #import "RCTConversions.h" #import "RCTFabricComponentsPlugins.h" diff --git a/React/Fabric/Mounting/RCTComponentViewFactory.h b/React/Fabric/Mounting/RCTComponentViewFactory.h index 638fd4e5bdedc5..745df38f2f4d3b 100644 --- a/React/Fabric/Mounting/RCTComponentViewFactory.h +++ b/React/Fabric/Mounting/RCTComponentViewFactory.h @@ -10,7 +10,7 @@ #import #import -#import +#import NS_ASSUME_NONNULL_BEGIN diff --git a/React/Fabric/Mounting/RCTComponentViewFactory.mm b/React/Fabric/Mounting/RCTComponentViewFactory.mm index e1566df29bf32b..88489f2b3cd900 100644 --- a/React/Fabric/Mounting/RCTComponentViewFactory.mm +++ b/React/Fabric/Mounting/RCTComponentViewFactory.mm @@ -13,8 +13,8 @@ #import #import -#import -#import +#import +#import #ifdef RN_DISABLE_OSS_PLUGIN_HEADER #import diff --git a/React/Fabric/Mounting/RCTComponentViewProtocol.h b/React/Fabric/Mounting/RCTComponentViewProtocol.h index 3fd2c3fccf5034..180b882a5d6f99 100644 --- a/React/Fabric/Mounting/RCTComponentViewProtocol.h +++ b/React/Fabric/Mounting/RCTComponentViewProtocol.h @@ -8,11 +8,11 @@ #import #import -#import -#import -#import -#import -#import +#import +#import +#import +#import +#import NS_ASSUME_NONNULL_BEGIN diff --git a/React/Fabric/Mounting/RCTComponentViewRegistry.h b/React/Fabric/Mounting/RCTComponentViewRegistry.h index 44b7773ea73ac9..7119449660da16 100644 --- a/React/Fabric/Mounting/RCTComponentViewRegistry.h +++ b/React/Fabric/Mounting/RCTComponentViewRegistry.h @@ -10,7 +10,7 @@ #import #import #import -#import +#import NS_ASSUME_NONNULL_BEGIN diff --git a/React/Fabric/Mounting/RCTMountingManager.h b/React/Fabric/Mounting/RCTMountingManager.h index 0e8771b8a8b907..0166914bed2949 100644 --- a/React/Fabric/Mounting/RCTMountingManager.h +++ b/React/Fabric/Mounting/RCTMountingManager.h @@ -9,10 +9,10 @@ #import #import -#import -#import -#import -#import +#import +#import +#import +#import NS_ASSUME_NONNULL_BEGIN diff --git a/React/Fabric/Mounting/RCTMountingManager.mm b/React/Fabric/Mounting/RCTMountingManager.mm index ebc361e849b197..6a886530487ad0 100644 --- a/React/Fabric/Mounting/RCTMountingManager.mm +++ b/React/Fabric/Mounting/RCTMountingManager.mm @@ -12,10 +12,10 @@ #import #import #import -#import -#import -#import -#import +#import +#import +#import +#import #import "RCTComponentViewProtocol.h" #import "RCTComponentViewRegistry.h" diff --git a/React/Fabric/Mounting/RCTMountingTransactionObserverCoordinator.h b/React/Fabric/Mounting/RCTMountingTransactionObserverCoordinator.h index 512febedf16c8e..31da581bfdffce 100644 --- a/React/Fabric/Mounting/RCTMountingTransactionObserverCoordinator.h +++ b/React/Fabric/Mounting/RCTMountingTransactionObserverCoordinator.h @@ -11,7 +11,7 @@ #import #import -#import +#import class RCTMountingTransactionObserverCoordinator final { public: diff --git a/React/Fabric/Mounting/RCTMountingTransactionObserving.h b/React/Fabric/Mounting/RCTMountingTransactionObserving.h index 0d87ce97de8043..477c97df02afec 100644 --- a/React/Fabric/Mounting/RCTMountingTransactionObserving.h +++ b/React/Fabric/Mounting/RCTMountingTransactionObserving.h @@ -7,7 +7,7 @@ #import -#import +#import NS_ASSUME_NONNULL_BEGIN diff --git a/React/Fabric/RCTConversions.h b/React/Fabric/RCTConversions.h index 421ff298eb5ecd..1882e6af496a79 100644 --- a/React/Fabric/RCTConversions.h +++ b/React/Fabric/RCTConversions.h @@ -7,12 +7,12 @@ #import -#import -#import -#import -#import -#import -#import +#import +#import +#import +#import +#import +#import NS_ASSUME_NONNULL_BEGIN diff --git a/React/Fabric/RCTImageResponseObserverProxy.h b/React/Fabric/RCTImageResponseObserverProxy.h index 37cc544fb09eb7..11197d46b21cb9 100644 --- a/React/Fabric/RCTImageResponseObserverProxy.h +++ b/React/Fabric/RCTImageResponseObserverProxy.h @@ -9,7 +9,7 @@ #import "RCTImageResponseDelegate.h" -#include +#include NS_ASSUME_NONNULL_BEGIN diff --git a/React/Fabric/RCTImageResponseObserverProxy.mm b/React/Fabric/RCTImageResponseObserverProxy.mm index 9bb1e323fd3150..4c74e2ea42f2bd 100644 --- a/React/Fabric/RCTImageResponseObserverProxy.mm +++ b/React/Fabric/RCTImageResponseObserverProxy.mm @@ -8,8 +8,8 @@ #import "RCTImageResponseObserverProxy.h" #import -#import -#import +#import +#import #import namespace facebook { diff --git a/React/Fabric/RCTScheduler.h b/React/Fabric/RCTScheduler.h index f85174c03f3877..bcdbf5483f67a5 100644 --- a/React/Fabric/RCTScheduler.h +++ b/React/Fabric/RCTScheduler.h @@ -9,12 +9,12 @@ #import #import -#import -#import -#import -#import -#import -#import +#import +#import +#import +#import +#import +#import #import NS_ASSUME_NONNULL_BEGIN diff --git a/React/Fabric/RCTScheduler.mm b/React/Fabric/RCTScheduler.mm index da0a3a5ca5f96e..27043b3da52d5a 100644 --- a/React/Fabric/RCTScheduler.mm +++ b/React/Fabric/RCTScheduler.mm @@ -7,11 +7,11 @@ #import "RCTScheduler.h" -#import -#import -#import -#import -#import +#import +#import +#import +#import +#import #include #import diff --git a/React/Fabric/RCTSurfacePresenter.mm b/React/Fabric/RCTSurfacePresenter.mm index 1b63e621cd595f..b8309ceddf905b 100644 --- a/React/Fabric/RCTSurfacePresenter.mm +++ b/React/Fabric/RCTSurfacePresenter.mm @@ -25,14 +25,14 @@ #import -#import -#import #import -#import -#import -#import -#import -#import +#import +#import +#import +#import +#import +#import +#import #import #import @@ -60,6 +60,33 @@ static inline LayoutContext RCTGetLayoutContext() .fontSizeMultiplier = RCTFontSizeMultiplier()}; } +static dispatch_queue_t RCTGetBackgroundQueue() +{ + static dispatch_queue_t queue; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + dispatch_queue_attr_t attr = + dispatch_queue_attr_make_with_qos_class(DISPATCH_QUEUE_SERIAL, QOS_CLASS_USER_INTERACTIVE, 0); + queue = dispatch_queue_create("com.facebook.react.background", attr); + }); + return queue; +} + +static BackgroundExecutor RCTGetBackgroundExecutor() +{ + return [](std::function &&callback) { + if (RCTIsMainQueue()) { + callback(); + return; + } + + auto copyableCallback = callback; + dispatch_async(RCTGetBackgroundQueue(), ^{ + copyableCallback(); + }); + }; +} + @interface RCTSurfacePresenter () @end @@ -314,6 +341,10 @@ - (RCTScheduler *)_createScheduler return std::make_unique(activities, owner); }; + if (reactNativeConfig && reactNativeConfig->getBool("react_fabric:enable_background_executor_ios")) { + toolbox.backgroundExecutor = RCTGetBackgroundExecutor(); + } + if (reactNativeConfig && reactNativeConfig->getBool("react_fabric:enable_run_loop_based_event_beat_ios")) { toolbox.synchronousEventBeatFactory = [runtimeExecutor](EventBeat::SharedOwnerBox const &ownerBox) { auto runLoopObserver = diff --git a/React/Fabric/RCTTouchableComponentViewProtocol.h b/React/Fabric/RCTTouchableComponentViewProtocol.h index ed635b41bf321d..78eb34c3b5906e 100644 --- a/React/Fabric/RCTTouchableComponentViewProtocol.h +++ b/React/Fabric/RCTTouchableComponentViewProtocol.h @@ -6,7 +6,7 @@ */ #import -#import +#import @protocol RCTTouchableComponentViewProtocol - (facebook::react::SharedTouchEventEmitter)touchEventEmitterAtPoint:(CGPoint)point; diff --git a/React/Fabric/Surface/RCTFabricSurface.h b/React/Fabric/Surface/RCTFabricSurface.h index 5895b02c20fed3..a4b7af7f705a0c 100644 --- a/React/Fabric/Surface/RCTFabricSurface.h +++ b/React/Fabric/Surface/RCTFabricSurface.h @@ -7,7 +7,7 @@ #import #import -#import +#import NS_ASSUME_NONNULL_BEGIN @@ -71,9 +71,7 @@ NS_ASSUME_NONNULL_BEGIN * A Surface object can be stopped and then restarted. * The starting process includes initializing all underlying React Native * infrastructure and running React app. - * Just initialized Surface object starts automatically, there is no need - * to call `start` explicitly. Surface also stops itself on deallocation - * automatically. + * Surface stops itself on deallocation automatically. * Returns YES in case of success. Returns NO if the Surface is already * started or stopped. */ diff --git a/React/Fabric/Utils/MainRunLoopEventBeat.h b/React/Fabric/Utils/MainRunLoopEventBeat.h index eeb2aeea4538e7..b0b7751f06ce7c 100644 --- a/React/Fabric/Utils/MainRunLoopEventBeat.h +++ b/React/Fabric/Utils/MainRunLoopEventBeat.h @@ -10,7 +10,7 @@ #include #include #include -#include +#include namespace facebook { namespace react { diff --git a/React/Fabric/Utils/RuntimeEventBeat.h b/React/Fabric/Utils/RuntimeEventBeat.h index d55980f40c604f..8bfdd0cdf9c472 100644 --- a/React/Fabric/Utils/RuntimeEventBeat.h +++ b/React/Fabric/Utils/RuntimeEventBeat.h @@ -8,7 +8,7 @@ #include #include #include -#include +#include namespace facebook { namespace react { diff --git a/React/React-RCTFabric.podspec b/React/React-RCTFabric.podspec index 915e1d167a0de0..59c3620869c3d2 100644 --- a/React/React-RCTFabric.podspec +++ b/React/React-RCTFabric.podspec @@ -30,7 +30,8 @@ Pod::Spec.new do |s| s.author = "Facebook, Inc. and its affiliates" s.platforms = { :ios => "10.0", :tvos => "10.0" } s.source = source - s.source_files = "Fabric/**/*.{c,h,m,mm,S,cpp}" + s.source_files = "Fabric/**/*.{c,h,m,mm,S,cpp}", + "Tests/**/*.{mm}" s.exclude_files = "**/tests/*", "**/android/*", s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags diff --git a/React/Tests/Text/RCTParagraphComponentViewTests.mm b/React/Tests/Text/RCTParagraphComponentViewTests.mm new file mode 100644 index 00000000000000..02aa19fa47e84f --- /dev/null +++ b/React/Tests/Text/RCTParagraphComponentViewTests.mm @@ -0,0 +1,398 @@ +/* + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#import +#import + +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import + +@interface RCTParagraphComponentAccessibilityProviderTests : XCTestCase + +@end + +using namespace facebook::react; + +//┌── RootShadowNode ─────────────────────────────┐ +//│ │ +//│┌─── ParagraphShadowNodeA ─────────────────────────┐ │ +//││ ┌─AA(AAA) ─────────┐ ┌─AB(ABA) ─┐ ┌─AC(ACA)────┐ │ │ +//││ │ Please check out │ │ Facebook │ │ and │ │ │ +//││ └──────────────────┘ └──────────┘ └────────────┘ │ │ +//││ ┌─AD(ADA) ──┐ ┌──AE(AEA) ──────────────────────┐ │ │ +//││ │ Instagram │ │ for a full description. │ │ │ +//││ └───────────┘ └────────────────────────────────┘ │ │ +//│└──────────────────────────────────────────────────┘ │ +//│ │ +//│ │ +//│┌── ParagraphShadowNodeB ──────────────────────────┐ │ +//││ ┌───BA(BAA) ───────────────────────────────────┐ │ │ +//││ │ Lorem ipsum dolor sit amet, consectetur │ │ │ +//││ │ adipiscing elit. Maecenas ut risus et sapien │ │ │ +//││ │ bibendum volutpat. Nulla facilisi. Cras │ │ │ +//││ │ imperdiet gravida tincidunt. │ │ │ +//││ └──────────────────────────────────────────────┘ │ │ +//││ ┌─BB(BBA) ─────────────────────────────────────┐ │ │ +//││ │ In tempor, tellus et vestibulum venenatis, │ │ │ +//││ │ lorem nunc eleifend lectus, a consectetur │ │ │ +//││ │ magna augue at arcu. │ │ │ +//││ └──────────────────────────────────────────────┘ │ │ +//│└──────────────────────────────────────────────────┘ │ +//│ │ +//│┌── ParagraphShadowNodeC ──────────────────────────┐ │ +//││ ┌─CA(CAA) ────────┐ │ │ +//││ │ Lorem ipsum │ │ │ +//││ └─────────────────┘ │ │ +//││ ┌─CB(CBA) ─────────────────────────────────────┐ │ │ +//││ │ dolor sit amet, consectetur adipiscing elit. │ │ │ +//││ │Maecenas ut risus et sapien bibendum volutpat.│ │ │ +//││ │ Nulla facilisi. Cras imperdiet gravida │ │ │ +//││ │ tincidunt. In tempor, tellus et vestibulum │ │ │ +//││ │ venenatis, lorem nunc eleifend lectus, a │ │ │ +//││ │ consectetur magna augue at arcu. │ │ │ +//││ └──────────────────────────────────────────────┘ │ │ +//││ ┌─CC(CCA) ────────┐ │ │ +//││ │ See Less │ │ │ +//││ └─────────────────┘ │ │ +//│└──────────────────────────────────────────────────┘ │ +//│ │ +//└─────────────────────────────────────────────────────┘ + +@implementation RCTParagraphComponentAccessibilityProviderTests { + std::shared_ptr builder_; + std::shared_ptr rootShadowNode_; + std::shared_ptr ParagrahShadowNodeA_; + std::shared_ptr ParagrahShadowNodeB_; + std::shared_ptr ParagrahShadowNodeC_; + std::shared_ptr TextShadowNodeAA_; + std::shared_ptr TextShadowNodeAB_; + std::shared_ptr TextShadowNodeAC_; + std::shared_ptr TextShadowNodeAD_; + std::shared_ptr TextShadowNodeAE_; + std::shared_ptr TextShadowNodeBA_; + std::shared_ptr TextShadowNodeBB_; + std::shared_ptr TextShadowNodeCA_; + std::shared_ptr TextShadowNodeCB_; + std::shared_ptr TextShadowNodeCC_; + std::shared_ptr RawTextShadowNodeAAA_; + std::shared_ptr RawTextShadowNodeABA_; + std::shared_ptr RawTextShadowNodeACA_; + std::shared_ptr RawTextShadowNodeADA_; + std::shared_ptr RawTextShadowNodeAEA_; + std::shared_ptr RawTextShadowNodeBAA_; + std::shared_ptr RawTextShadowNodeBBA_; + std::shared_ptr RawTextShadowNodeCAA_; + std::shared_ptr RawTextShadowNodeCBA_; + std::shared_ptr RawTextShadowNodeCCA_; +} + +- (void)setUp +{ + [super setUp]; + builder_ = std::make_shared((simpleComponentBuilder())); + auto element = + Element() + .reference(rootShadowNode_) + .tag(1) + .props([] { + auto sharedProps = std::make_shared(); + auto &props = *sharedProps; + props.layoutConstraints = LayoutConstraints{{0, 0}, {500, 500}}; + auto &yogaStyle = props.yogaStyle; + yogaStyle.dimensions()[YGDimensionWidth] = YGValue{200, YGUnitPoint}; + yogaStyle.dimensions()[YGDimensionHeight] = YGValue{200, YGUnitPoint}; + return sharedProps; + }) + .children({ + Element() + .reference(ParagrahShadowNodeA_) + .props([] { + auto sharedProps = std::make_shared(); + auto &props = *sharedProps; + auto &yogaStyle = props.yogaStyle; + yogaStyle.positionType() = YGPositionTypeAbsolute; + yogaStyle.position()[YGEdgeLeft] = YGValue{0, YGUnitPoint}; + yogaStyle.position()[YGEdgeTop] = YGValue{0, YGUnitPoint}; + yogaStyle.dimensions()[YGDimensionWidth] = YGValue{200, YGUnitPoint}; + yogaStyle.dimensions()[YGDimensionHeight] = YGValue{20, YGUnitPoint}; + return sharedProps; + }) + .children({ + Element() + .reference(TextShadowNodeAA_) + .props([] { + auto sharedProps = std::make_shared(); + return sharedProps; + }) + .children({Element().reference(RawTextShadowNodeAAA_).props([] { + auto sharedProps = std::make_shared(); + auto &props = *sharedProps; + props.text = "Please check out "; + return sharedProps; + })}), + Element() + .reference(TextShadowNodeAB_) + .props([] { + auto sharedProps = std::make_shared(); + auto &props = *sharedProps; + props.textAttributes.accessibilityRole = AccessibilityRole::Link; + return sharedProps; + }) + .children({Element().reference(RawTextShadowNodeABA_).props([] { + auto sharedProps = std::make_shared(); + auto &props = *sharedProps; + props.text = "facebook"; + return sharedProps; + })}), + Element() + .reference(TextShadowNodeAC_) + .props([] { + auto sharedProps = std::make_shared(); + return sharedProps; + }) + .children({Element().reference(RawTextShadowNodeACA_).props([] { + auto sharedProps = std::make_shared(); + auto &props = *sharedProps; + props.text = " and "; + return sharedProps; + })}), + Element() + .reference(TextShadowNodeAD_) + .props([] { + auto sharedProps = std::make_shared(); + auto &props = *sharedProps; + props.textAttributes.accessibilityRole = AccessibilityRole::Link; + return sharedProps; + }) + .children({Element().reference(RawTextShadowNodeADA_).props([] { + auto sharedProps = std::make_shared(); + auto &props = *sharedProps; + props.text = "instagram"; + return sharedProps; + })}), + Element() + .reference(TextShadowNodeAE_) + .props([] { + auto sharedProps = std::make_shared(); + return sharedProps; + }) + .children({Element().reference(RawTextShadowNodeAEA_).props([] { + auto sharedProps = std::make_shared(); + auto &props = *sharedProps; + props.text = " for a full description."; + return sharedProps; + })}), + }), + Element() + .reference(ParagrahShadowNodeB_) + .props([] { + auto sharedProps = std::make_shared(); + auto &props = *sharedProps; + auto &yogaStyle = props.yogaStyle; + yogaStyle.positionType() = YGPositionTypeAbsolute; + yogaStyle.position()[YGEdgeLeft] = YGValue{0, YGUnitPoint}; + yogaStyle.position()[YGEdgeTop] = YGValue{30, YGUnitPoint}; + yogaStyle.dimensions()[YGDimensionWidth] = YGValue{200, YGUnitPoint}; + yogaStyle.dimensions()[YGDimensionHeight] = YGValue{50, YGUnitPoint}; + return sharedProps; + }) + .children({ + Element() + .reference(TextShadowNodeBA_) + .props([] { + auto sharedProps = std::make_shared(); + auto &props = *sharedProps; + props.textAttributes.accessibilityRole = AccessibilityRole::Link; + return sharedProps; + }) + .children({Element().reference(RawTextShadowNodeBAA_).props([] { + auto sharedProps = std::make_shared(); + auto &props = *sharedProps; + props.text = + "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas ut risus et sapien bibendum volutpat. Nulla facilisi. Cras imperdiet gravida tincidunt. "; + return sharedProps; + })}), + Element() + .reference(TextShadowNodeBB_) + .props([] { + auto sharedProps = std::make_shared(); + return sharedProps; + }) + .children({Element().reference(RawTextShadowNodeBBA_).props([] { + auto sharedProps = std::make_shared(); + auto &props = *sharedProps; + props.text = + "In tempor, tellus et vestibulum venenatis, lorem nunc eleifend lectus, a consectetur magna augue at arcu."; + return sharedProps; + })}), + }), + Element() + .reference(ParagrahShadowNodeC_) + .props([] { + auto sharedProps = std::make_shared(); + auto &props = *sharedProps; + auto &yogaStyle = props.yogaStyle; + yogaStyle.positionType() = YGPositionTypeAbsolute; + yogaStyle.position()[YGEdgeLeft] = YGValue{0, YGUnitPoint}; + yogaStyle.position()[YGEdgeTop] = YGValue{90, YGUnitPoint}; + yogaStyle.dimensions()[YGDimensionWidth] = YGValue{200, YGUnitPoint}; + yogaStyle.dimensions()[YGDimensionHeight] = YGValue{50, YGUnitPoint}; + return sharedProps; + }) + .children({ + Element() + .reference(TextShadowNodeCA_) + .props([] { + auto sharedProps = std::make_shared(); + auto &props = *sharedProps; + props.textAttributes.accessibilityRole = AccessibilityRole::Link; + return sharedProps; + }) + .children({Element().reference(RawTextShadowNodeCAA_).props([] { + auto sharedProps = std::make_shared(); + auto &props = *sharedProps; + props.text = "Lorem ipsum"; + return sharedProps; + })}), + Element() + .reference(TextShadowNodeCB_) + .props([] { + auto sharedProps = std::make_shared(); + return sharedProps; + }) + .children({Element().reference(RawTextShadowNodeCBA_).props([] { + auto sharedProps = std::make_shared(); + auto &props = *sharedProps; + props.text = + " dolor sit amet, consectetur adipiscing elit. Maecenas ut risus et sapien bibendum volutpat. Nulla facilisi. Cras imperdiet gravida tincidunt. In tempor, tellus et vestibulum venenatis, lorem nunc eleifend lectus, a consectetur magna augue at arcu. "; + return sharedProps; + })}), + Element() + .reference(TextShadowNodeCC_) + .props([] { + auto sharedProps = std::make_shared(); + auto &props = *sharedProps; + props.textAttributes.accessibilityRole = AccessibilityRole::Button; + return sharedProps; + }) + .children({Element().reference(RawTextShadowNodeCCA_).props([] { + auto sharedProps = std::make_shared(); + auto &props = *sharedProps; + props.text = "See Less"; + return sharedProps; + })}), + }), + }); + builder_->build(element); + rootShadowNode_->layoutIfNeeded(); +} + +static ParagraphShadowNode::ConcreteState::Shared stateWithShadowNode( + std::shared_ptr paragraphShadowNode) +{ + auto sharedState = + std::static_pointer_cast(paragraphShadowNode->getState()); + return sharedState; +} + +- (void)testAttributedString +{ + ParagraphShadowNode::ConcreteState::Shared _stateA = stateWithShadowNode(ParagrahShadowNodeA_); + RCTParagraphComponentView *paragraphComponentViewA = [[RCTParagraphComponentView alloc] init]; + [paragraphComponentViewA updateState:_stateA oldState:nil]; + + ParagraphShadowNode::ConcreteState::Shared _stateB = stateWithShadowNode(ParagrahShadowNodeB_); + RCTParagraphComponentView *paragraphComponentViewB = [[RCTParagraphComponentView alloc] init]; + [paragraphComponentViewB updateState:_stateB oldState:nil]; + + ParagraphShadowNode::ConcreteState::Shared _stateC = stateWithShadowNode(ParagrahShadowNodeC_); + RCTParagraphComponentView *paragraphComponentViewC = [[RCTParagraphComponentView alloc] init]; + [paragraphComponentViewC updateState:_stateC oldState:nil]; + + // Check the correctness of attributedString + XCTAssert([[paragraphComponentViewA.attributedText string] + isEqual:@"Please check out facebook and instagram for a full description."]); + XCTAssertEqual(_stateA->getData().attributedString.getFragments().size(), 5); + + XCTAssert([[paragraphComponentViewB.attributedText string] + isEqual: + @"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas ut risus et sapien bibendum volutpat. Nulla facilisi. Cras imperdiet gravida tincidunt. In tempor, tellus et vestibulum venenatis, lorem nunc eleifend lectus, a consectetur magna augue at arcu."]); + XCTAssertEqual(_stateB->getData().attributedString.getFragments().size(), 2); + + XCTAssert([[paragraphComponentViewC.attributedText string] + isEqual: + @"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas ut risus et sapien bibendum volutpat. Nulla facilisi. Cras imperdiet gravida tincidunt. In tempor, tellus et vestibulum venenatis, lorem nunc eleifend lectus, a consectetur magna augue at arcu. See Less"]); + XCTAssertEqual(_stateC->getData().attributedString.getFragments().size(), 3); +} + +#pragma mark - Accessibility + +- (void)testAccessibilityMultipleLinks +{ + // initialize the paragraphComponentView to get the accessibilityElements + ParagraphShadowNode::ConcreteState::Shared _state = stateWithShadowNode(ParagrahShadowNodeA_); + RCTParagraphComponentView *paragraphComponentView = [[RCTParagraphComponentView alloc] init]; + [paragraphComponentView updateState:_state oldState:nil]; + + NSArray *elements = [paragraphComponentView accessibilityElements]; + + // check the number of accessibilityElements + XCTAssert( + elements.count == 3, @"Expected 4 accessibilityElements - one for the whole string, and the rest for the links"); + // check accessibility trait + XCTAssert( + elements[1].accessibilityTraits & UIAccessibilityTraitLink, + @"Expected the second accessibilityElement has link trait"); + XCTAssert( + elements[2].accessibilityTraits & UIAccessibilityTraitLink, + @"Expected the second accessibilityElement has link trait"); +} + +- (void)testAccessibilityLinkWrappingMultipleLines +{ + ParagraphShadowNode::ConcreteState::Shared _state = stateWithShadowNode(ParagrahShadowNodeB_); + RCTParagraphComponentView *paragraphComponentView = [[RCTParagraphComponentView alloc] init]; + [paragraphComponentView updateState:_state oldState:nil]; + + NSArray *elements = [paragraphComponentView accessibilityElements]; + XCTAssert(elements.count == 2, @"Expected 2 accessibilityElements - one for the whole string, and one for the link"); + XCTAssert( + elements[1].accessibilityTraits & UIAccessibilityTraitLink, + @"Expected the second accessibilityElement has link trait"); +} + +- (void)testAccessibilityTruncatedText +{ + ParagraphShadowNode::ConcreteState::Shared _state = stateWithShadowNode(ParagrahShadowNodeC_); + RCTParagraphComponentView *paragraphComponentView = [[RCTParagraphComponentView alloc] init]; + [paragraphComponentView updateState:_state oldState:nil]; + + NSArray *elements = [paragraphComponentView accessibilityElements]; + XCTAssert(elements.count == 2, @"Expected 2 accessibilityElements - one for the whole string, and one for the link"); + XCTAssert( + elements[1].accessibilityTraits & UIAccessibilityTraitLink, + @"Expected the second accessibilityElement has link trait"); +} + +@end diff --git a/ReactAndroid/build.gradle b/ReactAndroid/build.gradle index 23d9fd5912bc9a..133092d5a9632a 100644 --- a/ReactAndroid/build.gradle +++ b/ReactAndroid/build.gradle @@ -166,7 +166,7 @@ task prepareJSC { def jscPackagePath = findNodeModulePath(projectDir, "jsc-android") if (!jscPackagePath) { throw new GradleScriptException("Could not find the jsc-android npm package", null) - } + } def jscDist = file("$jscPackagePath/dist") if (!jscDist.exists()) { @@ -223,7 +223,7 @@ task downloadNdkBuildDependencies { def findNodeModulePath(baseDir, packageName) { def basePath = baseDir.toPath().normalize() // Node's module resolution algorithm searches up to the root directory, - // after which the base path will be null + // after which the base path will be null while (basePath) { def candidatePath = Paths.get(basePath.toString(), "node_modules", packageName) if (candidatePath.toFile().exists()) { @@ -382,7 +382,7 @@ android { } defaultConfig { - minSdkVersion(16) + minSdkVersion(19) targetSdkVersion(28) versionCode(1) versionName("1.0") @@ -468,3 +468,8 @@ dependencies { } apply(from: "release.gradle") +apply(from: "../architecture.gradle"); +generateNativeArtifactsFromJavaScript([ + enableCodegen: System.getenv("USE_CODEGEN"), + jsRootDir: "${file('../Libraries')}", +]) diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/BUCK b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/BUCK index 301a2fdd5db49d..6d16a702ecf400 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/BUCK +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/BUCK @@ -1,4 +1,4 @@ -load("//tools/build_defs/oss:rn_defs.bzl", "react_native_dep", "react_native_integration_tests_target", "react_native_target", "rn_android_library") +load("//tools/build_defs/oss:rn_defs.bzl", "react_native_android_toplevel_dep", "react_native_dep", "react_native_integration_tests_target", "react_native_target", "rn_android_library") rn_android_library( name = "testing", @@ -25,7 +25,7 @@ rn_android_library( react_native_dep("third-party/java/infer-annotations:infer-annotations"), react_native_dep("third-party/java/jsr-305:jsr-305"), react_native_dep("third-party/java/junit:junit"), - react_native_dep("third-party/java/mockito:mockito"), + react_native_android_toplevel_dep("third-party/java/mockito2:mockito2"), react_native_dep("third-party/java/testing-support-lib:runner"), react_native_integration_tests_target("java/com/facebook/react/testing/idledetection:idledetection"), react_native_integration_tests_target("java/com/facebook/react/testing/network:network"), diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/FabricUIManagerFactory.java b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/FabricUIManagerFactory.java index e8fdd56f5b8406..5d7e7b4fddc6a0 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/FabricUIManagerFactory.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/FabricUIManagerFactory.java @@ -7,7 +7,6 @@ package com.facebook.react.testing; -import com.facebook.react.bridge.JavaScriptContextHolder; import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.bridge.UIManager; import com.facebook.react.uimanager.ViewManagerRegistry; @@ -16,7 +15,5 @@ public interface FabricUIManagerFactory { UIManager getFabricUIManager( - ReactApplicationContext reactApplicationContext, - ViewManagerRegistry viewManagerRegistry, - JavaScriptContextHolder jsContext); + ReactApplicationContext reactApplicationContext, ViewManagerRegistry viewManagerRegistry); } diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactAppTestActivity.java b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactAppTestActivity.java index 614b341b0ec949..017094b8b61f50 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactAppTestActivity.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactAppTestActivity.java @@ -266,7 +266,7 @@ public UIManager get() { FabricUIManagerFactory factory = spec.getFabricUIManagerFactory(); return factory != null ? factory.getFabricUIManager( - reactApplicationContext, viewManagerRegistry, jsContext) + reactApplicationContext, viewManagerRegistry) : null; } }; diff --git a/ReactAndroid/src/main/java/com/facebook/fbreact/specs/NativeAnimatedTurboModuleSpec.java b/ReactAndroid/src/main/java/com/facebook/fbreact/specs/NativeAnimatedTurboModuleSpec.java new file mode 100644 index 00000000000000..a875589d80c242 --- /dev/null +++ b/ReactAndroid/src/main/java/com/facebook/fbreact/specs/NativeAnimatedTurboModuleSpec.java @@ -0,0 +1,90 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + *

This source code is licensed under the MIT license found in the LICENSE file in the root + * directory of this source tree. + * + *

Generated by an internal genrule from Flow types. + * + * @generated + * @nolint + */ + +package com.facebook.fbreact.specs; + +import com.facebook.react.bridge.Callback; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactContextBaseJavaModule; +import com.facebook.react.bridge.ReactMethod; +import com.facebook.react.bridge.ReactModuleWithSpec; +import com.facebook.react.bridge.ReadableMap; +import com.facebook.react.turbomodule.core.interfaces.TurboModule; + +public abstract class NativeAnimatedTurboModuleSpec extends ReactContextBaseJavaModule implements ReactModuleWithSpec, TurboModule { + public NativeAnimatedTurboModuleSpec(ReactApplicationContext reactContext) { + super(reactContext); + } + + @ReactMethod + public abstract void dropAnimatedNode(double tag); + + @ReactMethod + public abstract void connectAnimatedNodes(double parentTag, double childTag); + + @ReactMethod + public abstract void stopAnimation(double animationId); + + @ReactMethod + public abstract void removeListeners(double count); + + @ReactMethod + public abstract void disconnectAnimatedNodeFromView(double nodeTag, double viewTag); + + @ReactMethod + public abstract void removeAnimatedEventFromView(double viewTag, String eventName, + double animatedNodeTag); + + @ReactMethod + public abstract void flattenAnimatedNodeOffset(double nodeTag); + + @ReactMethod + public abstract void extractAnimatedNodeOffset(double nodeTag); + + @ReactMethod + public abstract void disconnectAnimatedNodes(double parentTag, double childTag); + + @ReactMethod + public abstract void setAnimatedNodeValue(double nodeTag, double value); + + @ReactMethod + public abstract void setAnimatedNodeOffset(double nodeTag, double offset); + + @ReactMethod + public abstract void restoreDefaultValues(double nodeTag); + + @ReactMethod + public abstract void startAnimatingNode(double animationId, double nodeTag, ReadableMap config, + Callback endCallback); + + @ReactMethod + public abstract void getValue(double tag, Callback saveValueCallback); + + @ReactMethod + public abstract void stopListeningToAnimatedNodeValue(double tag); + + @ReactMethod + public abstract void addAnimatedEventToView(double viewTag, String eventName, + ReadableMap eventMapping); + + @ReactMethod + public abstract void createAnimatedNode(double tag, ReadableMap config); + + @ReactMethod + public abstract void startListeningToAnimatedNodeValue(double tag); + + @ReactMethod + public abstract void connectAnimatedNodeToView(double nodeTag, double viewTag); + + @ReactMethod + public abstract void addListener(String eventName); +} diff --git a/ReactAndroid/src/main/java/com/facebook/fbreact/specs/jni/FBReactNativeSpec-generated.cpp b/ReactAndroid/src/main/java/com/facebook/fbreact/specs/jni/FBReactNativeSpec-generated.cpp index 732ca58778364a..e61f1dee002ce9 100644 --- a/ReactAndroid/src/main/java/com/facebook/fbreact/specs/jni/FBReactNativeSpec-generated.cpp +++ b/ReactAndroid/src/main/java/com/facebook/fbreact/specs/jni/FBReactNativeSpec-generated.cpp @@ -327,6 +327,159 @@ namespace facebook { + } + + } // namespace react +} // namespace facebook +namespace facebook { + namespace react { + + + static facebook::jsi::Value __hostFunction_NativeAnimatedTurboModuleSpecJSI_createAnimatedNode(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeJavaMethod(rt, VoidKind, "createAnimatedNode", "(DLcom/facebook/react/bridge/ReadableMap;)V", args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAnimatedTurboModuleSpecJSI_getValue(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeJavaMethod(rt, VoidKind, "getValue", "(DLcom/facebook/react/bridge/Callback;)V", args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAnimatedTurboModuleSpecJSI_startListeningToAnimatedNodeValue(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeJavaMethod(rt, VoidKind, "startListeningToAnimatedNodeValue", "(D)V", args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAnimatedTurboModuleSpecJSI_stopListeningToAnimatedNodeValue(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeJavaMethod(rt, VoidKind, "stopListeningToAnimatedNodeValue", "(D)V", args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAnimatedTurboModuleSpecJSI_connectAnimatedNodes(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeJavaMethod(rt, VoidKind, "connectAnimatedNodes", "(DD)V", args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAnimatedTurboModuleSpecJSI_disconnectAnimatedNodes(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeJavaMethod(rt, VoidKind, "disconnectAnimatedNodes", "(DD)V", args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAnimatedTurboModuleSpecJSI_startAnimatingNode(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeJavaMethod(rt, VoidKind, "startAnimatingNode", "(DDLcom/facebook/react/bridge/ReadableMap;Lcom/facebook/react/bridge/Callback;)V", args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAnimatedTurboModuleSpecJSI_stopAnimation(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeJavaMethod(rt, VoidKind, "stopAnimation", "(D)V", args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAnimatedTurboModuleSpecJSI_setAnimatedNodeValue(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeJavaMethod(rt, VoidKind, "setAnimatedNodeValue", "(DD)V", args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAnimatedTurboModuleSpecJSI_setAnimatedNodeOffset(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeJavaMethod(rt, VoidKind, "setAnimatedNodeOffset", "(DD)V", args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAnimatedTurboModuleSpecJSI_flattenAnimatedNodeOffset(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeJavaMethod(rt, VoidKind, "flattenAnimatedNodeOffset", "(D)V", args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAnimatedTurboModuleSpecJSI_extractAnimatedNodeOffset(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeJavaMethod(rt, VoidKind, "extractAnimatedNodeOffset", "(D)V", args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAnimatedTurboModuleSpecJSI_connectAnimatedNodeToView(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeJavaMethod(rt, VoidKind, "connectAnimatedNodeToView", "(DD)V", args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAnimatedTurboModuleSpecJSI_disconnectAnimatedNodeFromView(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeJavaMethod(rt, VoidKind, "disconnectAnimatedNodeFromView", "(DD)V", args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAnimatedTurboModuleSpecJSI_restoreDefaultValues(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeJavaMethod(rt, VoidKind, "restoreDefaultValues", "(D)V", args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAnimatedTurboModuleSpecJSI_dropAnimatedNode(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeJavaMethod(rt, VoidKind, "dropAnimatedNode", "(D)V", args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAnimatedTurboModuleSpecJSI_addAnimatedEventToView(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeJavaMethod(rt, VoidKind, "addAnimatedEventToView", "(DLjava/lang/String;Lcom/facebook/react/bridge/ReadableMap;)V", args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAnimatedTurboModuleSpecJSI_removeAnimatedEventFromView(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeJavaMethod(rt, VoidKind, "removeAnimatedEventFromView", "(DLjava/lang/String;D)V", args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAnimatedTurboModuleSpecJSI_addListener(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeJavaMethod(rt, VoidKind, "addListener", "(Ljava/lang/String;)V", args, count); + } + + static facebook::jsi::Value __hostFunction_NativeAnimatedTurboModuleSpecJSI_removeListeners(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeJavaMethod(rt, VoidKind, "removeListeners", "(D)V", args, count); + } + + + NativeAnimatedTurboModuleSpecJSI::NativeAnimatedTurboModuleSpecJSI(const JavaTurboModule::InitParams ¶ms) + : JavaTurboModule(params) { + + methodMap_["createAnimatedNode"] = MethodMetadata {2, __hostFunction_NativeAnimatedTurboModuleSpecJSI_createAnimatedNode}; + + + methodMap_["getValue"] = MethodMetadata {2, __hostFunction_NativeAnimatedTurboModuleSpecJSI_getValue}; + + + methodMap_["startListeningToAnimatedNodeValue"] = MethodMetadata {1, __hostFunction_NativeAnimatedTurboModuleSpecJSI_startListeningToAnimatedNodeValue}; + + + methodMap_["stopListeningToAnimatedNodeValue"] = MethodMetadata {1, __hostFunction_NativeAnimatedTurboModuleSpecJSI_stopListeningToAnimatedNodeValue}; + + + methodMap_["connectAnimatedNodes"] = MethodMetadata {2, __hostFunction_NativeAnimatedTurboModuleSpecJSI_connectAnimatedNodes}; + + + methodMap_["disconnectAnimatedNodes"] = MethodMetadata {2, __hostFunction_NativeAnimatedTurboModuleSpecJSI_disconnectAnimatedNodes}; + + + methodMap_["startAnimatingNode"] = MethodMetadata {4, __hostFunction_NativeAnimatedTurboModuleSpecJSI_startAnimatingNode}; + + + methodMap_["stopAnimation"] = MethodMetadata {1, __hostFunction_NativeAnimatedTurboModuleSpecJSI_stopAnimation}; + + + methodMap_["setAnimatedNodeValue"] = MethodMetadata {2, __hostFunction_NativeAnimatedTurboModuleSpecJSI_setAnimatedNodeValue}; + + + methodMap_["setAnimatedNodeOffset"] = MethodMetadata {2, __hostFunction_NativeAnimatedTurboModuleSpecJSI_setAnimatedNodeOffset}; + + + methodMap_["flattenAnimatedNodeOffset"] = MethodMetadata {1, __hostFunction_NativeAnimatedTurboModuleSpecJSI_flattenAnimatedNodeOffset}; + + + methodMap_["extractAnimatedNodeOffset"] = MethodMetadata {1, __hostFunction_NativeAnimatedTurboModuleSpecJSI_extractAnimatedNodeOffset}; + + + methodMap_["connectAnimatedNodeToView"] = MethodMetadata {2, __hostFunction_NativeAnimatedTurboModuleSpecJSI_connectAnimatedNodeToView}; + + + methodMap_["disconnectAnimatedNodeFromView"] = MethodMetadata {2, __hostFunction_NativeAnimatedTurboModuleSpecJSI_disconnectAnimatedNodeFromView}; + + + methodMap_["restoreDefaultValues"] = MethodMetadata {1, __hostFunction_NativeAnimatedTurboModuleSpecJSI_restoreDefaultValues}; + + + methodMap_["dropAnimatedNode"] = MethodMetadata {1, __hostFunction_NativeAnimatedTurboModuleSpecJSI_dropAnimatedNode}; + + + methodMap_["addAnimatedEventToView"] = MethodMetadata {3, __hostFunction_NativeAnimatedTurboModuleSpecJSI_addAnimatedEventToView}; + + + methodMap_["removeAnimatedEventFromView"] = MethodMetadata {3, __hostFunction_NativeAnimatedTurboModuleSpecJSI_removeAnimatedEventFromView}; + + + methodMap_["addListener"] = MethodMetadata {1, __hostFunction_NativeAnimatedTurboModuleSpecJSI_addListener}; + + + methodMap_["removeListeners"] = MethodMetadata {1, __hostFunction_NativeAnimatedTurboModuleSpecJSI_removeListeners}; + + + } } // namespace react diff --git a/ReactAndroid/src/main/java/com/facebook/fbreact/specs/jni/FBReactNativeSpec.h b/ReactAndroid/src/main/java/com/facebook/fbreact/specs/jni/FBReactNativeSpec.h index c94b5f5ef7d214..940c22e2f62c94 100644 --- a/ReactAndroid/src/main/java/com/facebook/fbreact/specs/jni/FBReactNativeSpec.h +++ b/ReactAndroid/src/main/java/com/facebook/fbreact/specs/jni/FBReactNativeSpec.h @@ -87,6 +87,20 @@ namespace facebook { } // namespace react } // namespace facebook +namespace facebook { + namespace react { + /** + * C++ class for module 'AnimatedTurboModule' + */ + + class JSI_EXPORT NativeAnimatedTurboModuleSpecJSI : public JavaTurboModule { + public: + NativeAnimatedTurboModuleSpecJSI(const JavaTurboModule::InitParams ¶ms); + + }; + } // namespace react +} // namespace facebook + namespace facebook { namespace react { /** diff --git a/ReactAndroid/src/main/java/com/facebook/hermes/reactexecutor/HermesExecutorFactory.java b/ReactAndroid/src/main/java/com/facebook/hermes/reactexecutor/HermesExecutorFactory.java index ce09abba961109..976af80b1eeb66 100644 --- a/ReactAndroid/src/main/java/com/facebook/hermes/reactexecutor/HermesExecutorFactory.java +++ b/ReactAndroid/src/main/java/com/facebook/hermes/reactexecutor/HermesExecutorFactory.java @@ -17,7 +17,7 @@ public class HermesExecutorFactory implements JavaScriptExecutorFactory { private final RuntimeConfig mConfig; public HermesExecutorFactory() { - this(null); + this(new RuntimeConfig(1024)); } public HermesExecutorFactory(RuntimeConfig config) { diff --git a/ReactAndroid/src/main/java/com/facebook/hermes/reactexecutor/RuntimeConfig.java b/ReactAndroid/src/main/java/com/facebook/hermes/reactexecutor/RuntimeConfig.java index 15349f1d8d0887..8300e5e55e0dc0 100644 --- a/ReactAndroid/src/main/java/com/facebook/hermes/reactexecutor/RuntimeConfig.java +++ b/ReactAndroid/src/main/java/com/facebook/hermes/reactexecutor/RuntimeConfig.java @@ -11,4 +11,10 @@ public final class RuntimeConfig { public long heapSizeMB; public boolean es6Proxy; + + RuntimeConfig() {} + + RuntimeConfig(long heapSizeMB) { + this.heapSizeMB = heapSizeMB; + } } diff --git a/ReactAndroid/src/main/java/com/facebook/react/animated/AdditionAnimatedNode.java b/ReactAndroid/src/main/java/com/facebook/react/animated/AdditionAnimatedNode.java index 413afbedab8bac..8dfa44b3eee512 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/animated/AdditionAnimatedNode.java +++ b/ReactAndroid/src/main/java/com/facebook/react/animated/AdditionAnimatedNode.java @@ -43,4 +43,14 @@ public void update() { } } } + + @Override + public String prettyPrint() { + return "AdditionAnimatedNode[" + + mTag + + "]: input nodes: " + + (mInputNodes != null ? mInputNodes.toString() : "null") + + " - super: " + + super.prettyPrint(); + } } diff --git a/ReactAndroid/src/main/java/com/facebook/react/animated/AnimatedNode.java b/ReactAndroid/src/main/java/com/facebook/react/animated/AnimatedNode.java index 15ef616dd65e71..cf053525317890 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/animated/AnimatedNode.java +++ b/ReactAndroid/src/main/java/com/facebook/react/animated/AnimatedNode.java @@ -57,4 +57,20 @@ public void onDetachedFromNode(AnimatedNode parent) {} * it can be used to calculate node's value. */ public void update() {} + + /** + * Pretty-printer for the AnimatedNode. Only called in production pre-crash for debug diagnostics. + */ + public abstract String prettyPrint(); + + public String prettyPrintWithChildren() { + String children = ""; + if (mChildren != null && mChildren.size() > 0) { + for (AnimatedNode child : mChildren) { + children += " " + child.mTag; + } + } + + return prettyPrint() + (children.length() > 0 ? " children: " + children : ""); + } } diff --git a/ReactAndroid/src/main/java/com/facebook/react/animated/DiffClampAnimatedNode.java b/ReactAndroid/src/main/java/com/facebook/react/animated/DiffClampAnimatedNode.java index 8d253e7cb49b90..3c53a920a47035 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/animated/DiffClampAnimatedNode.java +++ b/ReactAndroid/src/main/java/com/facebook/react/animated/DiffClampAnimatedNode.java @@ -46,4 +46,19 @@ private double getInputNodeValue() { return ((ValueAnimatedNode) animatedNode).getValue(); } + + public String prettyPrint() { + return "DiffClampAnimatedNode[" + + mTag + + "]: InputNodeTag: " + + mInputNodeTag + + " min: " + + mMin + + " max: " + + mMax + + " lastValue: " + + mLastValue + + " super: " + + super.prettyPrint(); + } } diff --git a/ReactAndroid/src/main/java/com/facebook/react/animated/DivisionAnimatedNode.java b/ReactAndroid/src/main/java/com/facebook/react/animated/DivisionAnimatedNode.java index 550073f7924591..51274fffeee6b4 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/animated/DivisionAnimatedNode.java +++ b/ReactAndroid/src/main/java/com/facebook/react/animated/DivisionAnimatedNode.java @@ -51,4 +51,14 @@ public void update() { } } } + + @Override + public String prettyPrint() { + return "DivisionAnimatedNode[" + + mTag + + "]: input nodes: " + + (mInputNodes != null ? mInputNodes.toString() : "null") + + " - super: " + + super.prettyPrint(); + } } diff --git a/ReactAndroid/src/main/java/com/facebook/react/animated/InterpolationAnimatedNode.java b/ReactAndroid/src/main/java/com/facebook/react/animated/InterpolationAnimatedNode.java index 8ee5c109bac128..89962bb683adf7 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/animated/InterpolationAnimatedNode.java +++ b/ReactAndroid/src/main/java/com/facebook/react/animated/InterpolationAnimatedNode.java @@ -249,4 +249,8 @@ public void update() { } } } + + public String prettyPrint() { + return "InterpolationAnimatedNode[" + mTag + "] super: " + super.prettyPrint(); + } } diff --git a/ReactAndroid/src/main/java/com/facebook/react/animated/ModulusAnimatedNode.java b/ReactAndroid/src/main/java/com/facebook/react/animated/ModulusAnimatedNode.java index 7834ae1d80b043..45c9848925bb26 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/animated/ModulusAnimatedNode.java +++ b/ReactAndroid/src/main/java/com/facebook/react/animated/ModulusAnimatedNode.java @@ -34,4 +34,15 @@ public void update() { "Illegal node ID set as an input for " + "Animated.modulus node"); } } + + public String prettyPrint() { + return "NativeAnimatedNodesManager[" + + mTag + + "] inputNode: " + + mInputNode + + " modulus: " + + mModulus + + " super: " + + super.prettyPrint(); + } } diff --git a/ReactAndroid/src/main/java/com/facebook/react/animated/MultiplicationAnimatedNode.java b/ReactAndroid/src/main/java/com/facebook/react/animated/MultiplicationAnimatedNode.java index aad404597bc6c0..f325105244d7dd 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/animated/MultiplicationAnimatedNode.java +++ b/ReactAndroid/src/main/java/com/facebook/react/animated/MultiplicationAnimatedNode.java @@ -43,4 +43,14 @@ public void update() { } } } + + @Override + public String prettyPrint() { + return "MultiplicationAnimatedNode[" + + mTag + + "]: input nodes: " + + (mInputNodes != null ? mInputNodes.toString() : "null") + + " - super: " + + super.prettyPrint(); + } } diff --git a/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedModule.java b/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedModule.java index 249bf3775899c1..e759b0269f7f81 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedModule.java @@ -88,16 +88,6 @@ public class NativeAnimatedModule extends NativeAnimatedModuleSpec private abstract class UIThreadOperation { abstract void execute(NativeAnimatedNodesManager animatedNodesManager); - - long mFrameNumber = -1; - - public void setFrameNumber(long frameNumber) { - mFrameNumber = frameNumber; - } - - public long getFrameNumber() { - return mFrameNumber; - } } @NonNull private final GuardedFrameCallback mAnimatedFrameCallback; @@ -113,8 +103,6 @@ public long getFrameNumber() { private @Nullable NativeAnimatedNodesManager mNodesManager; - private volatile long mFrameNumber = 0; - private long mDispatchedFrameNumber = 0; private boolean mInitializedForFabric = false; private boolean mInitializedForNonFabric = false; private @UIManagerType int mUIManagerType = UIManagerType.DEFAULT; @@ -169,25 +157,13 @@ public void onHostResume() { } private void addOperation(UIThreadOperation operation) { - operation.setFrameNumber(mFrameNumber); mOperations.add(operation); } private void addPreOperation(UIThreadOperation operation) { - operation.setFrameNumber(mFrameNumber); mPreOperations.add(operation); } - // For FabricUIManager only - @Override - public void didScheduleMountItems(UIManager uiManager) { - if (mUIManagerType != UIManagerType.FABRIC) { - return; - } - - mFrameNumber++; - } - // For FabricUIManager only @Override @UiThread @@ -196,22 +172,6 @@ public void didDispatchMountItems(UIManager uiManager) { return; } - // The problem we're trying to solve here: we could be in the middle of queueing - // a batch of related animation operations when Fabric flushes a batch of MountItems. - // It's visually bad if we execute half of the animation ops and then wait another frame - // (or more) to execute the rest. - // See mFrameNumber. If the dispatchedFrameNumber drifts too far - that - // is, if no MountItems are scheduled for a while, which can happen if a tree - // is committed but there are no changes - bring these counts back in sync and - // execute any queued operations. This number is arbitrary, but we want it low - // enough that the user shouldn't be able to see this delay in most cases. - mDispatchedFrameNumber++; - long currentFrameNo = mFrameNumber - 1; - if ((mDispatchedFrameNumber - mFrameNumber) > 2) { - mFrameNumber = mDispatchedFrameNumber; - currentFrameNo = mFrameNumber; - } - // This will execute all operations and preOperations queued // since the last time this was run, and will race with anything // being queued from the JS thread. That is, if the JS thread @@ -222,35 +182,13 @@ public void didDispatchMountItems(UIManager uiManager) { // is that `scheduleMountItems` happens as close to the JS commit as // possible, whereas execution of those same items might happen sometime // later on the UI thread while the JS thread keeps plugging along. - executeAllOperations(mPreOperations, currentFrameNo); - executeAllOperations(mOperations, currentFrameNo); + executeAllOperations(mPreOperations); + executeAllOperations(mOperations); } - private void executeAllOperations(Queue operationQueue, long maxFrameNumber) { + private void executeAllOperations(Queue operationQueue) { NativeAnimatedNodesManager nodesManager = getNodesManager(); while (true) { - // There is a race condition where `peek` may return a non-null value and isEmpty() is false, - // but `poll` returns a null value - it's not clear why since we only peek and poll on the UI - // thread, but it might be something that happens during teardown or a crash. Regardless, the - // root cause is not currently known so we're extra cautious here. - // It happens equally in Fabric and non-Fabric. - UIThreadOperation peekedOperation = operationQueue.peek(); - - // This is the same as operationQueue.isEmpty() - if (peekedOperation == null) { - return; - } - // The rest of the operations are for the next frame. - if (peekedOperation.getFrameNumber() > maxFrameNumber) { - return; - } - - // Since we apparently can't guarantee that there is still an operation on the queue, - // much less the same operation, we do a poll and another null check. If this isn't - // the same operation as the peeked operation, we can't do anything about it - we still - // need to execute it, we have no mechanism to put it at the front of the queue, and it - // won't cause any errors to execute it earlier than expected (just a bit of UI jank at worst) - // so we just continue happily along. UIThreadOperation polledOperation = operationQueue.poll(); if (polledOperation == null) { return; @@ -270,13 +208,11 @@ public void willDispatchViewUpdates(final UIManager uiManager) { return; } - final long frameNo = mFrameNumber++; - UIBlock preOperationsUIBlock = new UIBlock() { @Override public void execute(NativeViewHierarchyManager nativeViewHierarchyManager) { - executeAllOperations(mPreOperations, frameNo); + executeAllOperations(mPreOperations); } }; @@ -284,7 +220,7 @@ public void execute(NativeViewHierarchyManager nativeViewHierarchyManager) { new UIBlock() { @Override public void execute(NativeViewHierarchyManager nativeViewHierarchyManager) { - executeAllOperations(mOperations, frameNo); + executeAllOperations(mOperations); } }; @@ -734,10 +670,7 @@ public void disconnectAnimatedNodeFromView( if (ANIMATED_MODULE_DEBUG) { FLog.d( NAME, - "queue connectAnimatedNodeToView: disconnectAnimatedNodeFromView: " - + animatedNodeTag - + " viewTag: " - + viewTag); + "queue: disconnectAnimatedNodeFromView: " + animatedNodeTag + " viewTag: " + viewTag); } decrementInFlightAnimationsForViewTag(viewTag); @@ -749,7 +682,7 @@ public void execute(NativeAnimatedNodesManager animatedNodesManager) { if (ANIMATED_MODULE_DEBUG) { FLog.d( NAME, - "execute connectAnimatedNodeToView: disconnectAnimatedNodeFromView: " + "execute: disconnectAnimatedNodeFromView: " + animatedNodeTag + " viewTag: " + viewTag); @@ -826,7 +759,7 @@ public void removeAnimatedEventFromView( if (ANIMATED_MODULE_DEBUG) { FLog.d( NAME, - "queue addAnimatedEventToView: removeAnimatedEventFromView: " + "queue removeAnimatedEventFromView: viewTag: " + viewTag + " eventName: " + eventName @@ -843,7 +776,7 @@ public void execute(NativeAnimatedNodesManager animatedNodesManager) { if (ANIMATED_MODULE_DEBUG) { FLog.d( NAME, - "execute addAnimatedEventToView: removeAnimatedEventFromView: " + "execute removeAnimatedEventFromView: viewTag: " + viewTag + " eventName: " + eventName diff --git a/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedNodesManager.java b/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedNodesManager.java index 179a6f0a7664e7..dda6b1611dee3d 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedNodesManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedNodesManager.java @@ -23,7 +23,6 @@ import com.facebook.react.bridge.UIManager; import com.facebook.react.bridge.UiThreadUtil; import com.facebook.react.bridge.WritableMap; -import com.facebook.react.uimanager.IllegalViewOperationException; import com.facebook.react.uimanager.UIManagerHelper; import com.facebook.react.uimanager.common.UIManagerType; import com.facebook.react.uimanager.events.Event; @@ -54,7 +53,6 @@ /*package*/ class NativeAnimatedNodesManager implements EventDispatcherListener { private static final String TAG = "NativeAnimatedNodesManager"; - private static final int MAX_INCONSISTENT_FRAMES = 64; private final SparseArray mAnimatedNodes = new SparseArray<>(); private final SparseArray mActiveAnimations = new SparseArray<>(); @@ -64,13 +62,14 @@ private final Map> mEventDrivers = new HashMap<>(); private final ReactApplicationContext mReactApplicationContext; private int mAnimatedGraphBFSColor = 0; - private int mNumInconsistentFrames = 0; // Used to avoid allocating a new array on every frame in `runUpdates` and `onEventDispatch`. private final List mRunUpdateNodeList = new LinkedList<>(); private boolean mEventListenerInitializedForFabric = false; private boolean mEventListenerInitializedForNonFabric = false; + private boolean mWarnedAboutGraphTraversal = false; + public NativeAnimatedNodesManager(ReactApplicationContext reactApplicationContext) { mReactApplicationContext = reactApplicationContext; } @@ -646,7 +645,7 @@ private void updateNodes(List nodes) { } // Run main "update" loop - boolean errorsCaught = false; + int cyclesDetected = 0; while (!nodesQueue.isEmpty()) { AnimatedNode nextNode = nodesQueue.poll(); try { @@ -655,36 +654,15 @@ private void updateNodes(List nodes) { // Send property updates to native view manager ((PropsAnimatedNode) nextNode).updateView(); } - } catch (IllegalViewOperationException e) { + } catch (JSApplicationCausedNativeException e) { // An exception is thrown if the view hasn't been created yet. This can happen because - // views are - // created in batches. If this particular view didn't make it into a batch yet, the view - // won't - // exist and an exception will be thrown when attempting to start an animation on it. + // views are created in batches. If this particular view didn't make it into a batch yet, + // the view won't exist and an exception will be thrown when attempting to start an + // animation on it. // // Eat the exception rather than crashing. The impact is that we may drop one or more - // frames of the - // animation. + // frames of the animation. FLog.e(TAG, "Native animation workaround, frame lost as result of race condition", e); - } catch (JSApplicationCausedNativeException e) { - // In Fabric there can be race conditions between the JS thread setting up or tearing down - // animated nodes, and Fabric executing them on the UI thread, leading to temporary - // inconsistent - // states. We require that the inconsistency last for N frames before throwing these - // exceptions. - if (!errorsCaught) { - errorsCaught = true; - mNumInconsistentFrames++; - } - if (mNumInconsistentFrames > MAX_INCONSISTENT_FRAMES) { - throw new IllegalStateException(e); - } else { - FLog.e( - TAG, - "Swallowing exception due to potential race between JS and UI threads: inconsistent frame counter: " - + mNumInconsistentFrames, - e); - } } if (nextNode instanceof ValueAnimatedNode) { // Potentially send events to JS when the node's value is updated @@ -698,31 +676,54 @@ private void updateNodes(List nodes) { child.mBFSColor = mAnimatedGraphBFSColor; updatedNodesCount++; nodesQueue.add(child); + } else if (child.mBFSColor == mAnimatedGraphBFSColor) { + cyclesDetected++; } } } } - // Verify that we've visited *all* active nodes. Throw otherwise as this would mean there is a - // cycle in animated node graph. We also take advantage of the fact that all active nodes are - // visited in the step above so that all the nodes properties `mActiveIncomingNodes` are set to - // zero. + // Verify that we've visited *all* active nodes. Throw otherwise as this could mean there is a + // cycle in animated node graph, or that the graph is only partially set up. We also take + // advantage of the fact that all active nodes are visited in the step above so that all the + // nodes properties `mActiveIncomingNodes` are set to zero. // In Fabric there can be race conditions between the JS thread setting up or tearing down // animated nodes, and Fabric executing them on the UI thread, leading to temporary inconsistent - // states. We require that the inconsistency last for 64 frames before throwing this exception. + // states. if (activeNodesCount != updatedNodesCount) { - if (!errorsCaught) { - mNumInconsistentFrames++; + if (mWarnedAboutGraphTraversal) { + return; } - if (mNumInconsistentFrames > MAX_INCONSISTENT_FRAMES) { - throw new IllegalStateException( - "Looks like animated nodes graph has cycles, there are " - + activeNodesCount - + " but toposort visited only " - + updatedNodesCount); + mWarnedAboutGraphTraversal = true; + + // Before crashing or logging soft exception, log details about current graph setup + FLog.e(TAG, "Detected animation cycle or disconnected graph. "); + for (AnimatedNode node : nodes) { + FLog.e(TAG, node.prettyPrintWithChildren()); } - } else if (!errorsCaught) { - mNumInconsistentFrames = 0; + + // If we're running only in non-Fabric, we still throw an exception. + // In Fabric, it seems that animations enter an inconsistent state fairly often. + // We detect if the inconsistency is due to a cycle (a fatal error for which we must crash) + // or disconnected regions, indicating a partially-set-up animation graph, which is not + // fatal and can stay a warning. + String reason = + cyclesDetected > 0 ? "cycles (" + cyclesDetected + ")" : "disconnected regions"; + IllegalStateException ex = + new IllegalStateException( + "Looks like animated nodes graph has " + + reason + + ", there are " + + activeNodesCount + + " but toposort visited only " + + updatedNodesCount); + if (mEventListenerInitializedForFabric && cyclesDetected == 0) { + ReactSoftException.logSoftException(TAG, new ReactNoCrashSoftException(ex)); + } else { + throw ex; + } + } else { + mWarnedAboutGraphTraversal = false; } } } diff --git a/ReactAndroid/src/main/java/com/facebook/react/animated/PropsAnimatedNode.java b/ReactAndroid/src/main/java/com/facebook/react/animated/PropsAnimatedNode.java index e8f77e0dbafdad..1faa05856e8bde 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/animated/PropsAnimatedNode.java +++ b/ReactAndroid/src/main/java/com/facebook/react/animated/PropsAnimatedNode.java @@ -113,4 +113,15 @@ public final void updateView() { mUIManager.synchronouslyUpdateViewOnUIThread(mConnectedViewTag, mPropMap); } + + public String prettyPrint() { + return "PropsAnimatedNode[" + + mTag + + "] connectedViewTag: " + + mConnectedViewTag + + " mPropNodeMapping: " + + (mPropNodeMapping != null ? mPropNodeMapping.toString() : "null") + + " mPropMap: " + + (mPropMap != null ? mPropMap.toString() : "null"); + } } diff --git a/ReactAndroid/src/main/java/com/facebook/react/animated/StyleAnimatedNode.java b/ReactAndroid/src/main/java/com/facebook/react/animated/StyleAnimatedNode.java index 41c34254589bcd..c6f0affb9bd873 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/animated/StyleAnimatedNode.java +++ b/ReactAndroid/src/main/java/com/facebook/react/animated/StyleAnimatedNode.java @@ -49,4 +49,11 @@ public void collectViewUpdates(JavaOnlyMap propsMap) { } } } + + public String prettyPrint() { + return "StyleAnimatedNode[" + + mTag + + "] mPropMapping: " + + (mPropMapping != null ? mPropMapping.toString() : "null"); + } } diff --git a/ReactAndroid/src/main/java/com/facebook/react/animated/SubtractionAnimatedNode.java b/ReactAndroid/src/main/java/com/facebook/react/animated/SubtractionAnimatedNode.java index ab09ca3486f2ce..9ac939d5043d0d 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/animated/SubtractionAnimatedNode.java +++ b/ReactAndroid/src/main/java/com/facebook/react/animated/SubtractionAnimatedNode.java @@ -47,4 +47,14 @@ public void update() { } } } + + @Override + public String prettyPrint() { + return "SubtractionAnimatedNode[" + + mTag + + "]: input nodes: " + + (mInputNodes != null ? mInputNodes.toString() : "null") + + " - super: " + + super.prettyPrint(); + } } diff --git a/ReactAndroid/src/main/java/com/facebook/react/animated/TrackingAnimatedNode.java b/ReactAndroid/src/main/java/com/facebook/react/animated/TrackingAnimatedNode.java index 7af8acbb874fe3..dd204088042f74 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/animated/TrackingAnimatedNode.java +++ b/ReactAndroid/src/main/java/com/facebook/react/animated/TrackingAnimatedNode.java @@ -33,4 +33,18 @@ public void update() { mNativeAnimatedNodesManager.startAnimatingNode( mAnimationId, mValueNode, mAnimationConfig, null); } + + @Override + public String prettyPrint() { + return "TrackingAnimatedNode[" + + mTag + + "]: animationID: " + + mAnimationId + + " toValueNode: " + + mToValueNode + + " valueNode: " + + mValueNode + + " animationConfig: " + + mAnimationConfig; + } } diff --git a/ReactAndroid/src/main/java/com/facebook/react/animated/TransformAnimatedNode.java b/ReactAndroid/src/main/java/com/facebook/react/animated/TransformAnimatedNode.java index 22b308d67d756f..0f5317a1e9579c 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/animated/TransformAnimatedNode.java +++ b/ReactAndroid/src/main/java/com/facebook/react/animated/TransformAnimatedNode.java @@ -82,4 +82,12 @@ public void collectViewUpdates(JavaOnlyMap propsMap) { propsMap.putArray("transform", JavaOnlyArray.from(transforms)); } + + @Override + public String prettyPrint() { + return "TransformAnimatedNode[" + + mTag + + "]: mTransformConfigs: " + + (mTransformConfigs != null ? mTransformConfigs.toString() : "null"); + } } diff --git a/ReactAndroid/src/main/java/com/facebook/react/animated/ValueAnimatedNode.java b/ReactAndroid/src/main/java/com/facebook/react/animated/ValueAnimatedNode.java index 8567c432e33ad4..15acef1aa25c9f 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/animated/ValueAnimatedNode.java +++ b/ReactAndroid/src/main/java/com/facebook/react/animated/ValueAnimatedNode.java @@ -60,4 +60,8 @@ public void onValueUpdate() { public void setValueListener(@Nullable AnimatedNodeValueListener listener) { mValueListener = listener; } + + public String prettyPrint() { + return "ValueAnimatedNode[" + mTag + "]: value: " + mValue + " offset: " + mOffset; + } } diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/BackgroundExecutor.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/BackgroundExecutor.java new file mode 100644 index 00000000000000..8b5d7c942542ff --- /dev/null +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/BackgroundExecutor.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +package com.facebook.react.bridge; + +import com.facebook.proguard.annotations.DoNotStrip; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +@DoNotStrip +public class BackgroundExecutor { + private static final String TAG = "FabricBackgroundExecutor"; + private final ExecutorService mExecutorService; + + @DoNotStrip + private BackgroundExecutor() { + mExecutorService = Executors.newFixedThreadPool(1); + } + + @DoNotStrip + private void queueRunnable(Runnable runnable) { + // Very rarely, an NPE is hit here - probably has to do with deallocation + // race conditions and the JNI. + // It's not clear yet which of these is most prevalent, or if either is a concern. + // If we don't find these logs in production then we can probably safely remove the logging, + // but it's also cheap to leave it here. + + if (runnable == null) { + ReactSoftException.logSoftException(TAG, new ReactNoCrashSoftException("runnable is null")); + return; + } + + final ExecutorService executorService = mExecutorService; + if (executorService == null) { + ReactSoftException.logSoftException( + TAG, new ReactNoCrashSoftException("executorService is null")); + return; + } + + executorService.execute(runnable); + } +} diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContext.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContext.java index b74f9b4873df1d..1bbd069bce3749 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContext.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContext.java @@ -462,4 +462,15 @@ public JavaScriptContextHolder getJavaScriptContextHolder() { public @Nullable String getSourceURL() { return mCatalystInstance.getSourceURL(); } + + /** + * Register a JS segment after loading it from cache or server, make sure mCatalystInstance is + * properly initialised and not null before calling. + * + * @param segmentId + * @param path + */ + public void registerSegment(int segmentId, String path) { + Assertions.assertNotNull(mCatalystInstance).registerSegment(segmentId, path); + } } diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/UIManagerListener.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/UIManagerListener.java index c190e0a8c02d14..d08ab69b62d655 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/UIManagerListener.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/UIManagerListener.java @@ -16,6 +16,4 @@ public interface UIManagerListener { void willDispatchViewUpdates(UIManager uiManager); /* Called right after view updates are dispatched for a frame. */ void didDispatchMountItems(UIManager uiManager); - /* Called right after scheduleMountItems is called in Fabric, after a new tree is committed. */ - void didScheduleMountItems(UIManager uiManager); } diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/ReactQueueConfigurationSpec.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/ReactQueueConfigurationSpec.java index e51b4608425c89..dd31f88fd5fa16 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/ReactQueueConfigurationSpec.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/ReactQueueConfigurationSpec.java @@ -45,7 +45,7 @@ public static Builder builder() { public static ReactQueueConfigurationSpec createDefault() { MessageQueueThreadSpec spec = - Build.VERSION.SDK_INT < 21 + Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP ? MessageQueueThreadSpec.newBackgroundThreadSpec( "native_modules", LEGACY_STACK_SIZE_BYTES) : MessageQueueThreadSpec.newBackgroundThreadSpec("native_modules"); diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/Binding.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/Binding.java index c88b867df23bc1..827c59d2438b85 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/Binding.java +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/Binding.java @@ -11,7 +11,6 @@ import androidx.annotation.NonNull; import com.facebook.jni.HybridData; import com.facebook.proguard.annotations.DoNotStrip; -import com.facebook.react.bridge.JavaScriptContextHolder; import com.facebook.react.bridge.NativeMap; import com.facebook.react.bridge.RuntimeExecutor; import com.facebook.react.bridge.queue.MessageQueueThread; @@ -35,7 +34,6 @@ public Binding() { } private native void installFabricUIManager( - long jsContextNativePointer, RuntimeExecutor runtimeExecutor, Object uiManager, EventBeatManager eventBeatManager, @@ -76,7 +74,6 @@ public native void setConstraints( // TODO (T67721598) Remove the jsContext param once we've migrated to using RuntimeExecutor public void register( - @NonNull JavaScriptContextHolder jsContext, @NonNull RuntimeExecutor runtimeExecutor, @NonNull FabricUIManager fabricUIManager, @NonNull EventBeatManager eventBeatManager, @@ -85,7 +82,6 @@ public void register( @NonNull ReactNativeConfig reactNativeConfig) { fabricUIManager.setBinding(this); installFabricUIManager( - jsContext.get(), runtimeExecutor, fabricUIManager, eventBeatManager, diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricJSIModuleProvider.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricJSIModuleProvider.java index 136da3a752a3c1..8f3516f262b4b4 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricJSIModuleProvider.java +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricJSIModuleProvider.java @@ -10,7 +10,6 @@ import androidx.annotation.NonNull; import com.facebook.infer.annotation.Assertions; import com.facebook.react.bridge.JSIModuleProvider; -import com.facebook.react.bridge.JavaScriptContextHolder; import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.bridge.UIManager; import com.facebook.react.bridge.queue.MessageQueueThread; @@ -42,18 +41,15 @@ public class FabricJSIModuleProvider implements JSIModuleProvider { - @NonNull private final JavaScriptContextHolder mJSContext; @NonNull private final ReactApplicationContext mReactApplicationContext; @NonNull private final ComponentFactoryDelegate mComponentFactoryDelegate; @NonNull private final ReactNativeConfig mConfig; public FabricJSIModuleProvider( @NonNull ReactApplicationContext reactApplicationContext, - @NonNull JavaScriptContextHolder jsContext, @NonNull ComponentFactoryDelegate componentFactoryDelegate, @NonNull ReactNativeConfig config) { mReactApplicationContext = reactApplicationContext; - mJSContext = jsContext; mComponentFactoryDelegate = componentFactoryDelegate; mConfig = config; } @@ -74,7 +70,6 @@ public UIManager get() { .getJSQueueThread(); binding.register( - mJSContext, mReactApplicationContext.getCatalystInstance().getRuntimeExecutor(), uiManager, eventBeatManager, diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java index 603089a28d22d4..2cbaa95bf3ea68 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java @@ -587,12 +587,6 @@ private void scheduleMountItem( boolean isBatchMountItem = mountItem instanceof BatchMountItem; boolean shouldSchedule = !(isBatchMountItem && ((BatchMountItem) mountItem).getSize() == 0); - // In case of sync rendering, this could be called on the UI thread. Otherwise, - // it should ~always be called on the JS thread. - for (UIManagerListener listener : mListeners) { - listener.didScheduleMountItems(this); - } - if (isBatchMountItem) { mCommitStartTime = commitStartTime; mLayoutTime = layoutEndTime - layoutStartTime; @@ -757,6 +751,15 @@ private boolean surfaceActiveForExecution(int surfaceId, String context) { return mLastExecutedMountItemSurfaceIdActive; } + private static void printMountItem(MountItem mountItem, String prefix) { + // If a MountItem description is split across multiple lines, it's because it's a + // compound MountItem. Log each line separately. + String[] mountItemLines = mountItem.toString().split("\n"); + for (String m : mountItemLines) { + FLog.e(TAG, prefix + ": " + m); + } + } + @UiThread @ThreadConfined(UI) /** Nothing should call this directly except for `tryDispatchMountItems`. */ @@ -792,7 +795,7 @@ private boolean dispatchMountItems() { + viewCommandMountItemsToDispatch.size()); for (DispatchCommandMountItem command : viewCommandMountItemsToDispatch) { if (ENABLE_FABRIC_LOGS) { - FLog.d(TAG, "dispatchMountItems: Executing viewCommandMountItem: " + command.toString()); + printMountItem(command, "dispatchMountItems: Executing viewCommandMountItem"); } try { command.execute(mMountingManager); @@ -854,30 +857,37 @@ private boolean dispatchMountItems() { long batchedExecutionStartTime = SystemClock.uptimeMillis(); - for (MountItem mountItem : mountItemsToDispatch) { - if (ENABLE_FABRIC_LOGS) { - // If a MountItem description is split across multiple lines, it's because it's a compound - // MountItem. Log each line separately. - String[] mountItemLines = mountItem.toString().split("\n"); - for (String m : mountItemLines) { - FLog.d(TAG, "dispatchMountItems: Executing mountItem: " + m); + try { + for (MountItem mountItem : mountItemsToDispatch) { + if (ENABLE_FABRIC_LOGS) { + printMountItem(mountItem, "dispatchMountItems: Executing mountItem"); } - } - // Make sure surface associated with this MountItem has been started, and not stopped. - // TODO T68118357: clean up this logic and simplify this method overall - if (mountItem instanceof BatchMountItem) { - BatchMountItem batchMountItem = (BatchMountItem) mountItem; - if (!surfaceActiveForExecution( - batchMountItem.getRootTag(), "dispatchMountItems BatchMountItem")) { - batchMountItem.executeDeletes(mMountingManager); - continue; + // Make sure surface associated with this MountItem has been started, and not stopped. + // TODO T68118357: clean up this logic and simplify this method overall + if (mountItem instanceof BatchMountItem) { + BatchMountItem batchMountItem = (BatchMountItem) mountItem; + if (!surfaceActiveForExecution( + batchMountItem.getRootTag(), "dispatchMountItems BatchMountItem")) { + batchMountItem.executeDeletes(mMountingManager); + continue; + } } + + mountItem.execute(mMountingManager); + } + mBatchedExecutionTime += SystemClock.uptimeMillis() - batchedExecutionStartTime; + } catch (Throwable e) { + // If there's an exception, we want to log diagnostics in prod and rethrow + // If a MountItem description is split across multiple lines, it's because it's a compound + // MountItem. Log each line separately. + FLog.e(TAG, "dispatchMountItems: caught exception, displaying all MountItems"); + for (MountItem mountItem : mountItemsToDispatch) { + printMountItem(mountItem, "dispatchMountItems: mountItem"); } - mountItem.execute(mMountingManager); + throw e; } - mBatchedExecutionTime += SystemClock.uptimeMillis() - batchedExecutionStartTime; } Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE); diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/AsyncEventBeat.h b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/AsyncEventBeat.h index cf09e4d5a69fd7..ee02ffc31d8542 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/AsyncEventBeat.h +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/AsyncEventBeat.h @@ -8,8 +8,8 @@ #pragma once #include -#include -#include +#include +#include #include "EventBeatManager.h" diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/BUCK b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/BUCK index 7fc222b4702f8c..8652fd3f9ce9e7 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/BUCK +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/BUCK @@ -29,11 +29,11 @@ rn_xplat_cxx_library( deps = [ react_native_xplat_target("better:better"), react_native_xplat_target("config:config"), - react_native_xplat_target("fabric/animations:animations"), - react_native_xplat_target("fabric/uimanager:uimanager"), - react_native_xplat_target("fabric/scheduler:scheduler"), - react_native_xplat_target("fabric/componentregistry:componentregistry"), - react_native_xplat_target("fabric/components/scrollview:scrollview"), + react_native_xplat_target("react/renderer/animations:animations"), + react_native_xplat_target("react/renderer/uimanager:uimanager"), + react_native_xplat_target("react/renderer/scheduler:scheduler"), + react_native_xplat_target("react/renderer/componentregistry:componentregistry"), + react_native_xplat_target("react/renderer/components/scrollview:scrollview"), react_native_xplat_target("runtimeexecutor:runtimeexecutor"), react_native_target("jni/react/jni:jni"), "//xplat/fbsystrace:fbsystrace", diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.cpp b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.cpp index 715cf1bea97beb..eae4491ce9baa1 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.cpp +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.cpp @@ -15,17 +15,17 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -206,7 +206,6 @@ void Binding::setConstraints( } void Binding::installFabricUIManager( - jlong jsContextNativePointer, jni::alias_ref runtimeExecutorHolder, jni::alias_ref javaUIManager, EventBeatManager *eventBeatManager, @@ -240,24 +239,7 @@ void Binding::installFabricUIManager( auto sharedJSMessageQueueThread = std::make_shared(jsMessageQueueThread); - - bool useRuntimeExecutor = - config->getBool("react_fabric:use_shared_runtime_executor_android"); - - RuntimeExecutor runtimeExecutor; - if (useRuntimeExecutor) { - runtimeExecutor = runtimeExecutorHolder->cthis()->get(); - } else { - Runtime *runtime = (Runtime *)jsContextNativePointer; - runtimeExecutor = - [runtime, sharedJSMessageQueueThread]( - std::function &&callback) { - sharedJSMessageQueueThread->runOnQueue( - [runtime, callback = std::move(callback)]() { - callback(*runtime); - }); - }; - } + auto runtimeExecutor = runtimeExecutorHolder->cthis()->get(); // TODO: T31905686 Create synchronous Event Beat jni::global_ref localJavaUIManager = javaUIManager_; @@ -296,6 +278,12 @@ void Binding::installFabricUIManager( toolbox.synchronousEventBeatFactory = synchronousBeatFactory; toolbox.asynchronousEventBeatFactory = asynchronousBeatFactory; + if (reactNativeConfig_->getBool( + "react_fabric:enable_background_executor_android")) { + backgroundExecutor_ = std::make_unique(); + toolbox.backgroundExecutor = backgroundExecutor_->get(); + } + if (enableLayoutAnimations) { animationDriver_ = std::make_shared(this); } diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.h b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.h index 3d1d439f5e539b..f4131a9d1de610 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.h +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.h @@ -8,17 +8,18 @@ #pragma once #include -#include #include #include #include -#include -#include -#include +#include +#include +#include +#include #include #include #include "ComponentFactoryDelegate.h" #include "EventBeatManager.h" +#include "JBackgroundExecutor.h" namespace facebook { namespace react { @@ -53,7 +54,6 @@ class Binding : public jni::HybridClass, static jni::local_ref initHybrid(jni::alias_ref); void installFabricUIManager( - jlong jsContextNativePointer, jni::alias_ref runtimeExecutorHolder, jni::alias_ref javaUIManager, EventBeatManager *eventBeatManager, @@ -116,6 +116,7 @@ class Binding : public jni::HybridClass, virtual void onAllAnimationsComplete() override; LayoutAnimationDriver *getAnimationDriver(); std::shared_ptr animationDriver_; + std::unique_ptr backgroundExecutor_; std::shared_ptr scheduler_; std::mutex schedulerMutex_; diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/ComponentFactoryDelegate.cpp b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/ComponentFactoryDelegate.cpp index 0f4d4c08fb64c0..a1ac6e34db669f 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/ComponentFactoryDelegate.cpp +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/ComponentFactoryDelegate.cpp @@ -9,7 +9,7 @@ #include #include #include -#include +#include using namespace facebook::jsi; diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/ComponentFactoryDelegate.h b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/ComponentFactoryDelegate.h index aae5a8e5220b28..33218569ce9b45 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/ComponentFactoryDelegate.h +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/ComponentFactoryDelegate.h @@ -9,8 +9,8 @@ #include #include -#include -#include +#include +#include #include #include #include diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/EventBeatManager.h b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/EventBeatManager.h index 5ed943f226cec2..094424ec260140 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/EventBeatManager.h +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/EventBeatManager.h @@ -12,7 +12,7 @@ #include #include -#include +#include namespace facebook { namespace react { diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/EventEmitterWrapper.cpp b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/EventEmitterWrapper.cpp index fda61cd1c9a66e..19fe921a46b807 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/EventEmitterWrapper.cpp +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/EventEmitterWrapper.cpp @@ -33,4 +33,4 @@ void EventEmitterWrapper::registerNatives() { } } // namespace react -} // namespace facebook \ No newline at end of file +} // namespace facebook diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/EventEmitterWrapper.h b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/EventEmitterWrapper.h index 08809945270877..dcc84ea6320e16 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/EventEmitterWrapper.h +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/EventEmitterWrapper.h @@ -8,8 +8,8 @@ #pragma once #include -#include #include +#include namespace facebook { namespace react { diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/JBackgroundExecutor.cpp b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/JBackgroundExecutor.cpp new file mode 100644 index 00000000000000..39cb4a4e593685 --- /dev/null +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/JBackgroundExecutor.cpp @@ -0,0 +1,35 @@ +/* + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#include +#include + +#include "JBackgroundExecutor.h" + +namespace facebook { +namespace react { + +using namespace facebook::jni; + +using facebook::react::JNativeRunnable; +using facebook::react::Runnable; + +BackgroundExecutor JBackgroundExecutor::get() { + auto self = JBackgroundExecutor::create(); + + return [self](std::function &&runnable) { + static auto method = + findClassStatic(JBackgroundExecutor::JBackgroundExecutorJavaDescriptor) + ->getMethod("queueRunnable"); + + auto jrunnable = JNativeRunnable::newObjectCxxArgs(std::move(runnable)); + method(self, static_ref_cast(jrunnable).get()); + }; +} + +} // namespace react +} // namespace facebook diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/JBackgroundExecutor.h b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/JBackgroundExecutor.h new file mode 100644 index 00000000000000..31e7b89609fc76 --- /dev/null +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/JBackgroundExecutor.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#pragma once + +#include +#include + +namespace facebook { +namespace react { + +using namespace facebook::jni; + +class JBackgroundExecutor : public JavaClass { + public: + static auto constexpr kJavaDescriptor = + "Lcom/facebook/react/bridge/BackgroundExecutor;"; + + constexpr static auto JBackgroundExecutorJavaDescriptor = + "com/facebook/react/bridge/BackgroundExecutor"; + + static global_ref create() { + return make_global(newInstance()); + } + + BackgroundExecutor get(); +}; + +} // namespace react +} // namespace facebook diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/NodeStateWrapper.h b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/NodeStateWrapper.h index da7266e56f8cbc..672b8e95b16cef 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/NodeStateWrapper.h +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/NodeStateWrapper.h @@ -8,8 +8,8 @@ #pragma once #include -#include #include +#include namespace facebook { namespace react { diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/StateWrapperImpl.h b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/StateWrapperImpl.h index b2d15a350f5a80..056a11738ea087 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/StateWrapperImpl.h +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/StateWrapperImpl.h @@ -8,8 +8,8 @@ #pragma once #include -#include #include +#include namespace facebook { namespace react { diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/BatchMountItem.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/BatchMountItem.java index 7aebdd3d071aef..f4422ca54e0400 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/BatchMountItem.java +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/BatchMountItem.java @@ -8,6 +8,7 @@ package com.facebook.react.fabric.mounting.mountitems; import androidx.annotation.NonNull; +import com.facebook.common.logging.FLog; import com.facebook.proguard.annotations.DoNotStrip; import com.facebook.react.bridge.ReactMarker; import com.facebook.react.bridge.ReactMarkerConstants; @@ -25,6 +26,7 @@ */ @DoNotStrip public class BatchMountItem implements MountItem { + static final String TAG = "FabricBatchMountItem"; private final int mRootTag; @NonNull private final MountItem[] mMountItems; @@ -77,13 +79,24 @@ public void execute(@NonNull MountingManager mountingManager) { endMarkers(); } + /** + * In the case of teardown/stopSurface, we want to delete all views associated with a SurfaceID. + * It can be the case that a single BatchMountItem contains both the create *and* delete + * instruction for a view, so this needs to be failsafe. + * + * @param mountingManager + */ public void executeDeletes(@NonNull MountingManager mountingManager) { beginMarkers("deleteViews"); for (int mountItemIndex = 0; mountItemIndex < mSize; mountItemIndex++) { MountItem mountItem = mMountItems[mountItemIndex]; if (mountItem instanceof RemoveDeleteMultiMountItem) { - ((RemoveDeleteMultiMountItem) mountItem).executeDeletes(mountingManager, true); + try { + ((RemoveDeleteMultiMountItem) mountItem).executeDeletes(mountingManager, true); + } catch (RuntimeException e) { + FLog.e(TAG, "Ignoring deletion exception", e); + } } } diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/accessibilityinfo/AccessibilityInfoModule.java b/ReactAndroid/src/main/java/com/facebook/react/modules/accessibilityinfo/AccessibilityInfoModule.java index 1b8998a5977f18..8ecb0d81f44168 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/accessibilityinfo/AccessibilityInfoModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/accessibilityinfo/AccessibilityInfoModule.java @@ -90,12 +90,10 @@ public String getName() { return "AccessibilityInfo"; } + @TargetApi(Build.VERSION_CODES.KITKAT) private boolean getIsReduceMotionEnabledValue() { String value = - Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1 - ? null - : Settings.Global.getString( - mContentResolver, Settings.Global.TRANSITION_ANIMATION_SCALE); + Settings.Global.getString(mContentResolver, Settings.Global.TRANSITION_ANIMATION_SCALE); return value != null && value.equals("0.0"); } @@ -139,11 +137,10 @@ private void updateAndSendTouchExplorationChangeEvent(boolean enabled) { } @Override + @TargetApi(Build.VERSION_CODES.KITKAT) public void onHostResume() { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { - mAccessibilityManager.addTouchExplorationStateChangeListener( - mTouchExplorationStateChangeListener); - } + mAccessibilityManager.addTouchExplorationStateChangeListener( + mTouchExplorationStateChangeListener); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { Uri transitionUri = Settings.Global.getUriFor(Settings.Global.TRANSITION_ANIMATION_SCALE); @@ -155,15 +152,12 @@ public void onHostResume() { } @Override + @TargetApi(Build.VERSION_CODES.KITKAT) public void onHostPause() { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { - mAccessibilityManager.removeTouchExplorationStateChangeListener( - mTouchExplorationStateChangeListener); - } + mAccessibilityManager.removeTouchExplorationStateChangeListener( + mTouchExplorationStateChangeListener); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { - mContentResolver.unregisterContentObserver(animationScaleObserver); - } + mContentResolver.unregisterContentObserver(animationScaleObserver); } @Override diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/network/ForwardingCookieHandler.java b/ReactAndroid/src/main/java/com/facebook/react/modules/network/ForwardingCookieHandler.java index c77906f47e844a..d1fce6275e5e7f 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/network/ForwardingCookieHandler.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/network/ForwardingCookieHandler.java @@ -40,8 +40,9 @@ public class ForwardingCookieHandler extends CookieHandler { private static final String VERSION_ONE_HEADER = "Set-cookie2"; private static final String COOKIE_HEADER = "Cookie"; - // As CookieManager was synchronous before API 21 this class emulates the async behavior on <21. - private static final boolean USES_LEGACY_STORE = Build.VERSION.SDK_INT < 21; + // As CookieManager was synchronous before API 21 this class emulates the async behavior on < 21. + private static final boolean USES_LEGACY_STORE = + Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP; private final CookieSaver mCookieSaver; private final ReactContext mContext; @@ -100,6 +101,7 @@ protected void onPostExecuteGuarded(Boolean result) { } } + @TargetApi(Build.VERSION_CODES.LOLLIPOP) private void clearCookiesAsync(final Callback callback) { CookieManager cookieManager = getCookieManager(); if (cookieManager != null) { @@ -148,7 +150,7 @@ public void run() { } } - @TargetApi(21) + @TargetApi(Build.VERSION_CODES.LOLLIPOP) private void addCookieAsync(String url, String cookie) { CookieManager cookieManager = getCookieManager(); if (cookieManager != null) { @@ -266,7 +268,7 @@ public void run() { }); } - @TargetApi(21) + @TargetApi(Build.VERSION_CODES.LOLLIPOP) private void flush() { CookieManager cookieManager = getCookieManager(); if (cookieManager != null) { diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/network/OkHttpClientProvider.java b/ReactAndroid/src/main/java/com/facebook/react/modules/network/OkHttpClientProvider.java index 8205f96e47bd64..5515eeb8d95683 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/network/OkHttpClientProvider.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/network/OkHttpClientProvider.java @@ -116,8 +116,8 @@ public static OkHttpClient.Builder enableTls12OnPreLollipop(OkHttpClient.Builder specs.add(ConnectionSpec.CLEARTEXT); client.connectionSpecs(specs); - } catch (Exception exc) { - FLog.e("OkHttpClientProvider", "Error while enabling TLS 1.2", exc); + } catch (Exception ex) { + FLog.e("OkHttpClientProvider", "Error while enabling TLS 1.2", ex); } } diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/vibration/VibrationModule.java b/ReactAndroid/src/main/java/com/facebook/react/modules/vibration/VibrationModule.java index 909ced4fc61547..b911b7b0b50588 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/vibration/VibrationModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/vibration/VibrationModule.java @@ -9,6 +9,8 @@ import android.annotation.SuppressLint; import android.content.Context; +import android.os.Build; +import android.os.VibrationEffect; import android.os.Vibrator; import com.facebook.fbreact.specs.NativeVibrationSpec; import com.facebook.react.bridge.ReactApplicationContext; @@ -35,7 +37,13 @@ public void vibrate(double durationDouble) { int duration = (int) durationDouble; Vibrator v = (Vibrator) getReactApplicationContext().getSystemService(Context.VIBRATOR_SERVICE); - if (v != null) { + if (v == null) { + return; + } + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + v.vibrate(VibrationEffect.createOneShot(duration, VibrationEffect.DEFAULT_AMPLITUDE)); + } else { v.vibrate(duration); } } @@ -45,11 +53,18 @@ public void vibrateByPattern(ReadableArray pattern, double repeatDouble) { int repeat = (int) repeatDouble; Vibrator v = (Vibrator) getReactApplicationContext().getSystemService(Context.VIBRATOR_SERVICE); - if (v != null) { - long[] patternLong = new long[pattern.size()]; - for (int i = 0; i < pattern.size(); i++) { - patternLong[i] = pattern.getInt(i); - } + if (v == null) { + return; + } + + long[] patternLong = new long[pattern.size()]; + for (int i = 0; i < pattern.size(); i++) { + patternLong[i] = pattern.getInt(i); + } + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + v.vibrate(VibrationEffect.createWaveform(patternLong, repeat)); + } else { v.vibrate(patternLong, repeat); } } diff --git a/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/TurboModuleManager.java b/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/TurboModuleManager.java index bf1db2e6476ddd..35f393a82e4e90 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/TurboModuleManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/TurboModuleManager.java @@ -61,7 +61,8 @@ public TurboModuleManager( jsContext.get(), (CallInvokerHolderImpl) jsCallInvokerHolder, (CallInvokerHolderImpl) nativeCallInvokerHolder, - delegate); + delegate, + false); installJSIBindings(); mEagerInitModuleNames = @@ -155,7 +156,16 @@ public TurboModule getModule(String moduleName) { moduleHolder = mTurboModuleHolders.get(moduleName); } - return getModule(moduleName, moduleHolder); + TurboModulePerfLogger.moduleCreateStart(moduleName, moduleHolder.getModuleId()); + TurboModule module = getModule(moduleName, moduleHolder, true); + + if (module != null) { + TurboModulePerfLogger.moduleCreateEnd(moduleName, moduleHolder.getModuleId()); + } else { + TurboModulePerfLogger.moduleCreateFail(moduleName, moduleHolder.getModuleId()); + } + + return module; } /** @@ -166,11 +176,16 @@ public TurboModule getModule(String moduleName) { * initialized. */ @Nullable - private TurboModule getModule(String moduleName, @NonNull TurboModuleHolder moduleHolder) { + private TurboModule getModule( + String moduleName, @NonNull TurboModuleHolder moduleHolder, boolean shouldPerfLog) { boolean shouldCreateModule = false; synchronized (moduleHolder) { if (moduleHolder.isDoneCreatingModule()) { + if (shouldPerfLog) { + TurboModulePerfLogger.moduleCreateCacheHit(moduleName, moduleHolder.getModuleId()); + } + return moduleHolder.getModule(); } @@ -182,12 +197,16 @@ private TurboModule getModule(String moduleName, @NonNull TurboModuleHolder modu } if (shouldCreateModule) { + TurboModulePerfLogger.moduleCreateConstructStart(moduleName, moduleHolder.getModuleId()); TurboModule turboModule = mJavaModuleProvider.getModule(moduleName); if (turboModule == null) { turboModule = mCxxModuleProvider.getModule(moduleName); } + TurboModulePerfLogger.moduleCreateConstructEnd(moduleName, moduleHolder.getModuleId()); + TurboModulePerfLogger.moduleCreateSetUpStart(moduleName, moduleHolder.getModuleId()); + if (turboModule != null) { synchronized (moduleHolder) { moduleHolder.setModule(turboModule); @@ -205,6 +224,7 @@ private TurboModule getModule(String moduleName, @NonNull TurboModuleHolder modu "TurboModuleManager.getModule: TurboModule " + moduleName + " not found in delegate"); } + TurboModulePerfLogger.moduleCreateSetUpEnd(moduleName, moduleHolder.getModuleId()); synchronized (moduleHolder) { moduleHolder.endCreatingModule(); moduleHolder.notifyAll(); @@ -278,7 +298,8 @@ private native HybridData initHybrid( long jsContext, CallInvokerHolderImpl jsCallInvokerHolder, CallInvokerHolderImpl nativeCallInvokerHolder, - TurboModuleManagerDelegate tmmDelegate); + TurboModuleManagerDelegate tmmDelegate, + boolean enablePromiseAsyncDispatch); private native void installJSIBindings(); @@ -310,7 +331,7 @@ public void onCatalystInstanceDestroy() { * initialized. In this case, we should wait for initialization to complete, before destroying * the TurboModule. */ - final TurboModule turboModule = getModule(moduleName, moduleHolder); + final TurboModule turboModule = getModule(moduleName, moduleHolder, false); if (turboModule != null) { // TODO(T48014458): Rename this to invalidate() @@ -336,6 +357,17 @@ private static class TurboModuleHolder { private volatile TurboModule mModule = null; private volatile boolean mIsTryingToCreate = false; private volatile boolean mIsDoneCreatingModule = false; + private static volatile int sHolderCount = 0; + private volatile int mModuleId; + + public TurboModuleHolder() { + mModuleId = sHolderCount; + sHolderCount += 1; + } + + int getModuleId() { + return mModuleId; + } void setModule(@NonNull TurboModule module) { mModule = module; diff --git a/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/TurboModulePerfLogger.java b/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/TurboModulePerfLogger.java index 19d84a41a5a963..fdb95884b3cf01 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/TurboModulePerfLogger.java +++ b/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/TurboModulePerfLogger.java @@ -72,6 +72,12 @@ public static void moduleCreateEnd(String moduleName, int id) { } } + public static void moduleCreateFail(String moduleName, int id) { + if (sNativeModulePerfLogger != null) { + sNativeModulePerfLogger.moduleCreateFail(moduleName, id); + } + } + private static native void jniEnableCppLogging(NativeModulePerfLogger perfLogger); public static void enableLogging(NativeModulePerfLogger perfLogger) { diff --git a/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni/ReactCommon/TurboModuleManager.cpp b/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni/ReactCommon/TurboModuleManager.cpp index c2a3b76df36d3c..131b41b075ecb3 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni/ReactCommon/TurboModuleManager.cpp +++ b/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni/ReactCommon/TurboModuleManager.cpp @@ -39,10 +39,13 @@ jni::local_ref TurboModuleManager::initHybrid( jlong jsContext, jni::alias_ref jsCallInvokerHolder, jni::alias_ref nativeCallInvokerHolder, - jni::alias_ref delegate) { + jni::alias_ref delegate, + bool enablePromiseAsyncDispatch) { auto jsCallInvoker = jsCallInvokerHolder->cthis()->getCallInvoker(); auto nativeCallInvoker = nativeCallInvokerHolder->cthis()->getCallInvoker(); + JavaTurboModule::enablePromiseAsyncDispatch(enablePromiseAsyncDispatch); + return makeCxxInstance( jThis, (jsi::Runtime *)jsContext, @@ -70,7 +73,8 @@ void TurboModuleManager::installJSIBindings() { nativeCallInvoker_ = std::weak_ptr(nativeCallInvoker_), delegate_ = jni::make_weak(delegate_), javaPart_ = jni::make_weak(javaPart_)]( - const std::string &name) -> std::shared_ptr { + const std::string &name, + const jsi::Value *schema) -> std::shared_ptr { auto turboModuleCache = turboModuleCache_.lock(); auto jsCallInvoker = jsCallInvoker_.lock(); auto nativeCallInvoker = nativeCallInvoker_.lock(); diff --git a/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni/ReactCommon/TurboModuleManager.h b/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni/ReactCommon/TurboModuleManager.h index 4c5a89eb43c43e..899d2a1d1cf8e4 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni/ReactCommon/TurboModuleManager.h +++ b/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni/ReactCommon/TurboModuleManager.h @@ -30,7 +30,8 @@ class TurboModuleManager : public jni::HybridClass { jlong jsContext, jni::alias_ref jsCallInvokerHolder, jni::alias_ref nativeCallInvokerHolder, - jni::alias_ref delegate); + jni::alias_ref delegate, + bool enablePromiseAsyncDispatch); static void registerNatives(); private: diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/BUCK b/ReactAndroid/src/main/java/com/facebook/react/uimanager/BUCK index 09e0e6ea4ec460..985aeb4e9ed375 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/BUCK +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/BUCK @@ -69,9 +69,11 @@ rn_android_library( "PUBLIC", ], deps = [ + react_native_dep("libraries/fbcore/src/main/java/com/facebook/common/logging:logging"), react_native_dep("third-party/java/infer-annotations:infer-annotations"), react_native_dep("third-party/android/androidx:annotation"), react_native_dep("third-party/java/jsr-305:jsr-305"), react_native_target("java/com/facebook/react/bridge:bridge"), + react_native_target("java/com/facebook/react/common:common"), ], ) diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/DisplayMetricsHolder.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/DisplayMetricsHolder.java index 92b4e414d2207a..b629caa15155ef 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/DisplayMetricsHolder.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/DisplayMetricsHolder.java @@ -13,8 +13,10 @@ import android.view.Display; import android.view.WindowManager; import androidx.annotation.Nullable; +import com.facebook.common.logging.FLog; import com.facebook.infer.annotation.Assertions; import com.facebook.react.bridge.WritableNativeMap; +import com.facebook.react.common.ReactConstants; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.HashMap; @@ -80,7 +82,13 @@ public static void initDisplayMetrics(Context context) { screenDisplayMetrics.widthPixels = (Integer) mGetRawW.invoke(display); screenDisplayMetrics.heightPixels = (Integer) mGetRawH.invoke(display); } catch (InvocationTargetException | IllegalAccessException | NoSuchMethodException e) { - throw new RuntimeException("Error getting real dimensions for API level < 17", e); + // this may not be 100% accurate, but it's all we've got + screenDisplayMetrics.widthPixels = display.getWidth(); + screenDisplayMetrics.heightPixels = display.getHeight(); + FLog.e( + ReactConstants.TAG, + "Unable to access getRawHeight and getRawWidth to get real dimensions.", + e); } } DisplayMetricsHolder.setScreenDisplayMetrics(screenDisplayMetrics); diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/LayoutShadowNode.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/LayoutShadowNode.java index ebafab7078054d..5c6a7bff7d9024 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/LayoutShadowNode.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/LayoutShadowNode.java @@ -779,6 +779,11 @@ public void setPosition(@Nullable String position) { } switch (position) { + case "static": + { + setPositionType(YogaPositionType.STATIC); + break; + } case "relative": { setPositionType(YogaPositionType.RELATIVE); diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.java b/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.java index c6db70340f8ff9..83f39fd86d1687 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.java @@ -17,7 +17,6 @@ import android.graphics.Rect; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; -import android.os.Build; import android.view.FocusFinder; import android.view.KeyEvent; import android.view.MotionEvent; @@ -960,50 +959,46 @@ public void reactSmoothScrollTo(int x, int y) { // of the animation. This means that, for example, if the user is scrolling rapidly, multiple // pages could be considered part of one animation, causing some page animations to be animated // very rapidly - looking like they're not animated at all. - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { - if (mScrollAnimator != null) { - mScrollAnimator.cancel(); - } + if (mScrollAnimator != null) { + mScrollAnimator.cancel(); + } - mFinalAnimatedPositionScrollX = x; - mFinalAnimatedPositionScrollY = y; - PropertyValuesHolder scrollX = PropertyValuesHolder.ofInt("scrollX", getScrollX(), x); - PropertyValuesHolder scrollY = PropertyValuesHolder.ofInt("scrollY", getScrollY(), y); - mScrollAnimator = ObjectAnimator.ofPropertyValuesHolder(scrollX, scrollY); - mScrollAnimator.setDuration( - ReactScrollViewHelper.getDefaultScrollAnimationDuration(getContext())); - mScrollAnimator.addUpdateListener( - new ValueAnimator.AnimatorUpdateListener() { - @Override - public void onAnimationUpdate(ValueAnimator valueAnimator) { - int scrollValueX = (Integer) valueAnimator.getAnimatedValue("scrollX"); - int scrollValueY = (Integer) valueAnimator.getAnimatedValue("scrollY"); - scrollTo(scrollValueX, scrollValueY); - } - }); - mScrollAnimator.addListener( - new Animator.AnimatorListener() { - @Override - public void onAnimationStart(Animator animator) {} - - @Override - public void onAnimationEnd(Animator animator) { - mFinalAnimatedPositionScrollX = -1; - mFinalAnimatedPositionScrollY = -1; - mScrollAnimator = null; - updateStateOnScroll(); - } + mFinalAnimatedPositionScrollX = x; + mFinalAnimatedPositionScrollY = y; + PropertyValuesHolder scrollX = PropertyValuesHolder.ofInt("scrollX", getScrollX(), x); + PropertyValuesHolder scrollY = PropertyValuesHolder.ofInt("scrollY", getScrollY(), y); + mScrollAnimator = ObjectAnimator.ofPropertyValuesHolder(scrollX, scrollY); + mScrollAnimator.setDuration( + ReactScrollViewHelper.getDefaultScrollAnimationDuration(getContext())); + mScrollAnimator.addUpdateListener( + new ValueAnimator.AnimatorUpdateListener() { + @Override + public void onAnimationUpdate(ValueAnimator valueAnimator) { + int scrollValueX = (Integer) valueAnimator.getAnimatedValue("scrollX"); + int scrollValueY = (Integer) valueAnimator.getAnimatedValue("scrollY"); + scrollTo(scrollValueX, scrollValueY); + } + }); + mScrollAnimator.addListener( + new Animator.AnimatorListener() { + @Override + public void onAnimationStart(Animator animator) {} - @Override - public void onAnimationCancel(Animator animator) {} + @Override + public void onAnimationEnd(Animator animator) { + mFinalAnimatedPositionScrollX = -1; + mFinalAnimatedPositionScrollY = -1; + mScrollAnimator = null; + updateStateOnScroll(); + } - @Override - public void onAnimationRepeat(Animator animator) {} - }); - mScrollAnimator.start(); - } else { - smoothScrollTo(x, y); - } + @Override + public void onAnimationCancel(Animator animator) {} + + @Override + public void onAnimationRepeat(Animator animator) {} + }); + mScrollAnimator.start(); updateStateOnScroll(x, y); setPendingContentOffsets(x, y); } diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java b/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java index 5016bafe25e4ee..3d0410638c031e 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java @@ -16,7 +16,6 @@ import android.graphics.Rect; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; -import android.os.Build; import android.view.KeyEvent; import android.view.MotionEvent; import android.view.View; @@ -86,7 +85,7 @@ public class ReactScrollView extends ScrollView private @Nullable List mSnapOffsets; private boolean mSnapToStart = true; private boolean mSnapToEnd = true; - private View mContentView; + private @Nullable View mContentView; private ReactViewBackgroundManager mReactBackgroundManager; private int pendingContentOffsetX = UNSET_CONTENT_OFFSET; private int pendingContentOffsetY = UNSET_CONTENT_OFFSET; @@ -831,50 +830,46 @@ public void reactSmoothScrollTo(int x, int y) { // of the animation. This means that, for example, if the user is scrolling rapidly, multiple // pages could be considered part of one animation, causing some page animations to be animated // very rapidly - looking like they're not animated at all. - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { - if (mScrollAnimator != null) { - mScrollAnimator.cancel(); - } + if (mScrollAnimator != null) { + mScrollAnimator.cancel(); + } + + mFinalAnimatedPositionScrollX = x; + mFinalAnimatedPositionScrollY = y; + PropertyValuesHolder scrollX = PropertyValuesHolder.ofInt("scrollX", getScrollX(), x); + PropertyValuesHolder scrollY = PropertyValuesHolder.ofInt("scrollY", getScrollY(), y); + mScrollAnimator = ObjectAnimator.ofPropertyValuesHolder(scrollX, scrollY); + mScrollAnimator.setDuration( + ReactScrollViewHelper.getDefaultScrollAnimationDuration(getContext())); + mScrollAnimator.addUpdateListener( + new ValueAnimator.AnimatorUpdateListener() { + @Override + public void onAnimationUpdate(ValueAnimator valueAnimator) { + int scrollValueX = (Integer) valueAnimator.getAnimatedValue("scrollX"); + int scrollValueY = (Integer) valueAnimator.getAnimatedValue("scrollY"); + scrollTo(scrollValueX, scrollValueY); + } + }); + mScrollAnimator.addListener( + new Animator.AnimatorListener() { + @Override + public void onAnimationStart(Animator animator) {} - mFinalAnimatedPositionScrollX = x; - mFinalAnimatedPositionScrollY = y; - PropertyValuesHolder scrollX = PropertyValuesHolder.ofInt("scrollX", getScrollX(), x); - PropertyValuesHolder scrollY = PropertyValuesHolder.ofInt("scrollY", getScrollY(), y); - mScrollAnimator = ObjectAnimator.ofPropertyValuesHolder(scrollX, scrollY); - mScrollAnimator.setDuration( - ReactScrollViewHelper.getDefaultScrollAnimationDuration(getContext())); - mScrollAnimator.addUpdateListener( - new ValueAnimator.AnimatorUpdateListener() { - @Override - public void onAnimationUpdate(ValueAnimator valueAnimator) { - int scrollValueX = (Integer) valueAnimator.getAnimatedValue("scrollX"); - int scrollValueY = (Integer) valueAnimator.getAnimatedValue("scrollY"); - scrollTo(scrollValueX, scrollValueY); - } - }); - mScrollAnimator.addListener( - new Animator.AnimatorListener() { - @Override - public void onAnimationStart(Animator animator) {} - - @Override - public void onAnimationEnd(Animator animator) { - mFinalAnimatedPositionScrollX = -1; - mFinalAnimatedPositionScrollY = -1; - mScrollAnimator = null; - updateStateOnScroll(); - } + @Override + public void onAnimationEnd(Animator animator) { + mFinalAnimatedPositionScrollX = -1; + mFinalAnimatedPositionScrollY = -1; + mScrollAnimator = null; + updateStateOnScroll(); + } - @Override - public void onAnimationCancel(Animator animator) {} + @Override + public void onAnimationCancel(Animator animator) {} - @Override - public void onAnimationRepeat(Animator animator) {} - }); - mScrollAnimator.start(); - } else { - smoothScrollTo(x, y); - } + @Override + public void onAnimationRepeat(Animator animator) {} + }); + mScrollAnimator.start(); updateStateOnScroll(x, y); setPendingContentOffsets(x, y); } diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewBackgroundDrawable.java b/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewBackgroundDrawable.java index 163103eb868cb8..4f1d2fdb85f3db 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewBackgroundDrawable.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewBackgroundDrawable.java @@ -7,6 +7,9 @@ package com.facebook.react.views.view; +import static android.os.Build.VERSION_CODES.KITKAT; + +import android.annotation.TargetApi; import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; @@ -375,43 +378,41 @@ private void drawRoundedBackgroundWithBorders(Canvas canvas) { canvas.clipPath(mOuterClipPathForBorderRadius, Region.Op.INTERSECT); canvas.clipPath(mInnerClipPathForBorderRadius, Region.Op.DIFFERENCE); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { - final boolean isRTL = getResolvedLayoutDirection() == View.LAYOUT_DIRECTION_RTL; - int colorStart = getBorderColor(Spacing.START); - int colorEnd = getBorderColor(Spacing.END); + final boolean isRTL = getResolvedLayoutDirection() == View.LAYOUT_DIRECTION_RTL; + int colorStart = getBorderColor(Spacing.START); + int colorEnd = getBorderColor(Spacing.END); - if (I18nUtil.getInstance().doLeftAndRightSwapInRTL(mContext)) { - if (!isBorderColorDefined(Spacing.START)) { - colorStart = colorLeft; - } + if (I18nUtil.getInstance().doLeftAndRightSwapInRTL(mContext)) { + if (!isBorderColorDefined(Spacing.START)) { + colorStart = colorLeft; + } - if (!isBorderColorDefined(Spacing.END)) { - colorEnd = colorRight; - } + if (!isBorderColorDefined(Spacing.END)) { + colorEnd = colorRight; + } - final int directionAwareColorLeft = isRTL ? colorEnd : colorStart; - final int directionAwareColorRight = isRTL ? colorStart : colorEnd; + final int directionAwareColorLeft = isRTL ? colorEnd : colorStart; + final int directionAwareColorRight = isRTL ? colorStart : colorEnd; + colorLeft = directionAwareColorLeft; + colorRight = directionAwareColorRight; + } else { + final int directionAwareColorLeft = isRTL ? colorEnd : colorStart; + final int directionAwareColorRight = isRTL ? colorStart : colorEnd; + + final boolean isColorStartDefined = isBorderColorDefined(Spacing.START); + final boolean isColorEndDefined = isBorderColorDefined(Spacing.END); + final boolean isDirectionAwareColorLeftDefined = + isRTL ? isColorEndDefined : isColorStartDefined; + final boolean isDirectionAwareColorRightDefined = + isRTL ? isColorStartDefined : isColorEndDefined; + + if (isDirectionAwareColorLeftDefined) { colorLeft = directionAwareColorLeft; + } + + if (isDirectionAwareColorRightDefined) { colorRight = directionAwareColorRight; - } else { - final int directionAwareColorLeft = isRTL ? colorEnd : colorStart; - final int directionAwareColorRight = isRTL ? colorStart : colorEnd; - - final boolean isColorStartDefined = isBorderColorDefined(Spacing.START); - final boolean isColorEndDefined = isBorderColorDefined(Spacing.END); - final boolean isDirectionAwareColorLeftDefined = - isRTL ? isColorEndDefined : isColorStartDefined; - final boolean isDirectionAwareColorRightDefined = - isRTL ? isColorStartDefined : isColorEndDefined; - - if (isDirectionAwareColorLeftDefined) { - colorLeft = directionAwareColorLeft; - } - - if (isDirectionAwareColorRightDefined) { - colorRight = directionAwareColorRight; - } } } @@ -1236,6 +1237,7 @@ private int getBorderColor(int position) { return ReactViewBackgroundDrawable.colorFromAlphaAndRGBComponents(alpha, rgb); } + @TargetApi(KITKAT) public RectF getDirectionAwareBorderInsets() { final float borderWidth = getBorderWidthOrDefaultTo(0, Spacing.ALL); final float borderTopWidth = getBorderWidthOrDefaultTo(borderWidth, Spacing.TOP); @@ -1243,7 +1245,7 @@ public RectF getDirectionAwareBorderInsets() { float borderLeftWidth = getBorderWidthOrDefaultTo(borderWidth, Spacing.LEFT); float borderRightWidth = getBorderWidthOrDefaultTo(borderWidth, Spacing.RIGHT); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && mBorderWidth != null) { + if (mBorderWidth != null) { final boolean isRTL = getResolvedLayoutDirection() == View.LAYOUT_DIRECTION_RTL; float borderStartWidth = mBorderWidth.getRaw(Spacing.START); float borderEndWidth = mBorderWidth.getRaw(Spacing.END); diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewGroup.java b/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewGroup.java index a8f162163a8562..f8fc85cf5826c8 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewGroup.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewGroup.java @@ -53,6 +53,7 @@ * Backing for a React View. Has support for borders, but since borders aren't common, lazy * initializes most of the storage needed for them. */ +@TargetApi(Build.VERSION_CODES.KITKAT) public class ReactViewGroup extends ViewGroup implements ReactInterceptingViewGroup, ReactClippingViewGroup, @@ -145,10 +146,8 @@ protected void onLayout(boolean changed, int left, int top, int right, int botto @Override public void onRtlPropertiesChanged(int layoutDirection) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { - if (mReactBackgroundDrawable != null) { - mReactBackgroundDrawable.setResolvedLayoutDirection(mLayoutDirection); - } + if (mReactBackgroundDrawable != null) { + mReactBackgroundDrawable.setResolvedLayoutDirection(mLayoutDirection); } } @@ -256,33 +255,11 @@ public void setBorderColor(int position, float rgb, float alpha) { public void setBorderRadius(float borderRadius) { ReactViewBackgroundDrawable backgroundDrawable = getOrCreateReactViewBackground(); backgroundDrawable.setRadius(borderRadius); - - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2) { - final int UPDATED_LAYER_TYPE = - backgroundDrawable.hasRoundedBorders() - ? View.LAYER_TYPE_SOFTWARE - : View.LAYER_TYPE_HARDWARE; - - if (UPDATED_LAYER_TYPE != getLayerType()) { - setLayerType(UPDATED_LAYER_TYPE, null); - } - } } public void setBorderRadius(float borderRadius, int position) { ReactViewBackgroundDrawable backgroundDrawable = getOrCreateReactViewBackground(); backgroundDrawable.setRadius(borderRadius, position); - - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2) { - final int UPDATED_LAYER_TYPE = - backgroundDrawable.hasRoundedBorders() - ? View.LAYER_TYPE_SOFTWARE - : View.LAYER_TYPE_HARDWARE; - - if (UPDATED_LAYER_TYPE != getLayerType()) { - setLayerType(UPDATED_LAYER_TYPE, null); - } - } } public void setBorderStyle(@Nullable String style) { @@ -656,13 +633,9 @@ private ReactViewBackgroundDrawable getOrCreateReactViewBackground() { updateBackgroundDrawable(layerDrawable); } - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { - mLayoutDirection = - I18nUtil.getInstance().isRTL(getContext()) - ? LAYOUT_DIRECTION_RTL - : LAYOUT_DIRECTION_LTR; - mReactBackgroundDrawable.setResolvedLayoutDirection(mLayoutDirection); - } + mLayoutDirection = + I18nUtil.getInstance().isRTL(getContext()) ? LAYOUT_DIRECTION_RTL : LAYOUT_DIRECTION_LTR; + mReactBackgroundDrawable.setResolvedLayoutDirection(mLayoutDirection); } return mReactBackgroundDrawable; } @@ -764,76 +737,74 @@ private void dispatchOverflowDraw(Canvas canvas) { mReactBackgroundDrawable.getBorderRadiusOrDefaultTo( borderRadius, ReactViewBackgroundDrawable.BorderRadiusLocation.BOTTOM_RIGHT); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { - final boolean isRTL = mLayoutDirection == View.LAYOUT_DIRECTION_RTL; - float topStartBorderRadius = - mReactBackgroundDrawable.getBorderRadius( - ReactViewBackgroundDrawable.BorderRadiusLocation.TOP_START); - float topEndBorderRadius = - mReactBackgroundDrawable.getBorderRadius( - ReactViewBackgroundDrawable.BorderRadiusLocation.TOP_END); - float bottomStartBorderRadius = - mReactBackgroundDrawable.getBorderRadius( - ReactViewBackgroundDrawable.BorderRadiusLocation.BOTTOM_START); - float bottomEndBorderRadius = - mReactBackgroundDrawable.getBorderRadius( - ReactViewBackgroundDrawable.BorderRadiusLocation.BOTTOM_END); - - if (I18nUtil.getInstance().doLeftAndRightSwapInRTL(getContext())) { - if (YogaConstants.isUndefined(topStartBorderRadius)) { - topStartBorderRadius = topLeftBorderRadius; - } - - if (YogaConstants.isUndefined(topEndBorderRadius)) { - topEndBorderRadius = topRightBorderRadius; - } - - if (YogaConstants.isUndefined(bottomStartBorderRadius)) { - bottomStartBorderRadius = bottomLeftBorderRadius; - } - - if (YogaConstants.isUndefined(bottomEndBorderRadius)) { - bottomEndBorderRadius = bottomRightBorderRadius; - } - - final float directionAwareTopLeftRadius = - isRTL ? topEndBorderRadius : topStartBorderRadius; - final float directionAwareTopRightRadius = - isRTL ? topStartBorderRadius : topEndBorderRadius; - final float directionAwareBottomLeftRadius = - isRTL ? bottomEndBorderRadius : bottomStartBorderRadius; - final float directionAwareBottomRightRadius = - isRTL ? bottomStartBorderRadius : bottomEndBorderRadius; + final boolean isRTL = mLayoutDirection == View.LAYOUT_DIRECTION_RTL; + float topStartBorderRadius = + mReactBackgroundDrawable.getBorderRadius( + ReactViewBackgroundDrawable.BorderRadiusLocation.TOP_START); + float topEndBorderRadius = + mReactBackgroundDrawable.getBorderRadius( + ReactViewBackgroundDrawable.BorderRadiusLocation.TOP_END); + float bottomStartBorderRadius = + mReactBackgroundDrawable.getBorderRadius( + ReactViewBackgroundDrawable.BorderRadiusLocation.BOTTOM_START); + float bottomEndBorderRadius = + mReactBackgroundDrawable.getBorderRadius( + ReactViewBackgroundDrawable.BorderRadiusLocation.BOTTOM_END); + + if (I18nUtil.getInstance().doLeftAndRightSwapInRTL(getContext())) { + if (YogaConstants.isUndefined(topStartBorderRadius)) { + topStartBorderRadius = topLeftBorderRadius; + } + if (YogaConstants.isUndefined(topEndBorderRadius)) { + topEndBorderRadius = topRightBorderRadius; + } + + if (YogaConstants.isUndefined(bottomStartBorderRadius)) { + bottomStartBorderRadius = bottomLeftBorderRadius; + } + + if (YogaConstants.isUndefined(bottomEndBorderRadius)) { + bottomEndBorderRadius = bottomRightBorderRadius; + } + + final float directionAwareTopLeftRadius = + isRTL ? topEndBorderRadius : topStartBorderRadius; + final float directionAwareTopRightRadius = + isRTL ? topStartBorderRadius : topEndBorderRadius; + final float directionAwareBottomLeftRadius = + isRTL ? bottomEndBorderRadius : bottomStartBorderRadius; + final float directionAwareBottomRightRadius = + isRTL ? bottomStartBorderRadius : bottomEndBorderRadius; + + topLeftBorderRadius = directionAwareTopLeftRadius; + topRightBorderRadius = directionAwareTopRightRadius; + bottomLeftBorderRadius = directionAwareBottomLeftRadius; + bottomRightBorderRadius = directionAwareBottomRightRadius; + } else { + final float directionAwareTopLeftRadius = + isRTL ? topEndBorderRadius : topStartBorderRadius; + final float directionAwareTopRightRadius = + isRTL ? topStartBorderRadius : topEndBorderRadius; + final float directionAwareBottomLeftRadius = + isRTL ? bottomEndBorderRadius : bottomStartBorderRadius; + final float directionAwareBottomRightRadius = + isRTL ? bottomStartBorderRadius : bottomEndBorderRadius; + + if (!YogaConstants.isUndefined(directionAwareTopLeftRadius)) { topLeftBorderRadius = directionAwareTopLeftRadius; + } + + if (!YogaConstants.isUndefined(directionAwareTopRightRadius)) { topRightBorderRadius = directionAwareTopRightRadius; + } + + if (!YogaConstants.isUndefined(directionAwareBottomLeftRadius)) { bottomLeftBorderRadius = directionAwareBottomLeftRadius; + } + + if (!YogaConstants.isUndefined(directionAwareBottomRightRadius)) { bottomRightBorderRadius = directionAwareBottomRightRadius; - } else { - final float directionAwareTopLeftRadius = - isRTL ? topEndBorderRadius : topStartBorderRadius; - final float directionAwareTopRightRadius = - isRTL ? topStartBorderRadius : topEndBorderRadius; - final float directionAwareBottomLeftRadius = - isRTL ? bottomEndBorderRadius : bottomStartBorderRadius; - final float directionAwareBottomRightRadius = - isRTL ? bottomStartBorderRadius : bottomEndBorderRadius; - - if (!YogaConstants.isUndefined(directionAwareTopLeftRadius)) { - topLeftBorderRadius = directionAwareTopLeftRadius; - } - - if (!YogaConstants.isUndefined(directionAwareTopRightRadius)) { - topRightBorderRadius = directionAwareTopRightRadius; - } - - if (!YogaConstants.isUndefined(directionAwareBottomLeftRadius)) { - bottomLeftBorderRadius = directionAwareBottomLeftRadius; - } - - if (!YogaConstants.isUndefined(directionAwareBottomRightRadius)) { - bottomRightBorderRadius = directionAwareBottomRightRadius; - } } } diff --git a/ReactAndroid/src/main/java/com/facebook/yoga/YogaPositionType.java b/ReactAndroid/src/main/java/com/facebook/yoga/YogaPositionType.java index 00354f5cb22da5..d61c3244fa20d1 100644 --- a/ReactAndroid/src/main/java/com/facebook/yoga/YogaPositionType.java +++ b/ReactAndroid/src/main/java/com/facebook/yoga/YogaPositionType.java @@ -8,8 +8,9 @@ package com.facebook.yoga; public enum YogaPositionType { - RELATIVE(0), - ABSOLUTE(1); + STATIC(0), + RELATIVE(1), + ABSOLUTE(2); private final int mIntValue; @@ -23,8 +24,9 @@ public int intValue() { public static YogaPositionType fromInt(int value) { switch (value) { - case 0: return RELATIVE; - case 1: return ABSOLUTE; + case 0: return STATIC; + case 1: return RELATIVE; + case 2: return ABSOLUTE; default: throw new IllegalArgumentException("Unknown enum value: " + value); } } diff --git a/ReactAndroid/src/main/third-party/java/mockito2/BUCK b/ReactAndroid/src/main/third-party/java/mockito2/BUCK index 2427938b973112..4d2ea058b7713f 100644 --- a/ReactAndroid/src/main/third-party/java/mockito2/BUCK +++ b/ReactAndroid/src/main/third-party/java/mockito2/BUCK @@ -25,10 +25,17 @@ fb_native.remote_file( rn_prebuilt_jar( name = "byte-buddy", - binary_jar = ":byte-buddy-binary.jar", + binary_jar = ":byte-buddy-binary-with-module-info-stripped", visibility = ["//ReactAndroid/..."], ) +# Strip module-info.class because some Android tooling cannot parse the file. Matches configuration in fbandroid. +fb_native.genrule( + name = "byte-buddy-binary-with-module-info-stripped", + out = "byte-buddy-binary-with-module-info-stripped.jar", + cmd = "cp $(location :byte-buddy-binary.jar) \"$OUT\" && zip -d \"$OUT\" META-INF/versions/9/module-info.class", +) + fb_native.remote_file( name = "byte-buddy-binary.jar", sha1 = "211a2b4d3df1eeef2a6cacf78d74a1f725e7a840", @@ -37,10 +44,17 @@ fb_native.remote_file( rn_prebuilt_jar( name = "byte-buddy-agent", - binary_jar = ":byte-buddy-agent-binary.jar", + binary_jar = ":byte-buddy-agent-with-module-info-stripped", visibility = ["//ReactAndroid/..."], ) +# Strip module-info.class because some Android tooling cannot parse the file. Matches configuration in fbandroid. +fb_native.genrule( + name = "byte-buddy-agent-with-module-info-stripped", + out = "byte-buddy-agent-with-module-info-stripped.jar", + cmd = "cp $(location :byte-buddy-agent-binary.jar) \"$OUT\" && zip -d \"$OUT\" META-INF/versions/9/module-info.class", +) + fb_native.remote_file( name = "byte-buddy-agent-binary.jar", sha1 = "9674aba5ee793e54b864952b001166848da0f26b", diff --git a/ReactCommon/hermes/inspector/Inspector.cpp b/ReactCommon/hermes/inspector/Inspector.cpp index 14cb76cad3f943..21b7bd2108de11 100644 --- a/ReactCommon/hermes/inspector/Inspector.cpp +++ b/ReactCommon/hermes/inspector/Inspector.cpp @@ -351,6 +351,9 @@ folly::Future Inspector::setBreakpoint( debugger::SourceLocation loc, folly::Optional condition) { auto promise = std::make_shared>(); + // Automatically re-enable breakpoints since the user presumably wants this + // to start triggering. + breakpointsActive_ = true; executor_->add([this, loc, condition, promise] { setBreakpointOnExecutor(loc, condition, promise); @@ -453,6 +456,14 @@ folly::Future Inspector::setPauseOnLoads( return promise->getFuture(); }; +folly::Future Inspector::setBreakpointsActive(bool active) { + // Same logic as setPauseOnLoads. + auto promise = std::make_shared>(); + breakpointsActive_ = active; + promise->setValue(); + return promise->getFuture(); +}; + bool Inspector::shouldPauseOnThisScriptLoad() { switch (pauseOnLoadMode_) { case None: diff --git a/ReactCommon/hermes/inspector/Inspector.h b/ReactCommon/hermes/inspector/Inspector.h index ac00e670e74095..5d98588286d8c7 100644 --- a/ReactCommon/hermes/inspector/Inspector.h +++ b/ReactCommon/hermes/inspector/Inspector.h @@ -208,6 +208,12 @@ class Inspector : public facebook::hermes::debugger::EventObserver, */ folly::Future setPauseOnLoads(const PauseOnLoadMode mode); + /** + * Set whether breakpoints are active (pause when hit). This does not require + * runtime modifications, but returns a future for consistency. + */ + folly::Future setBreakpointsActive(bool active); + /** * If called during a script load event, return true if we should pause. * Assumed to be called from a script load event where we already hold @@ -326,6 +332,9 @@ class Inspector : public facebook::hermes::debugger::EventObserver, // Whether we should enter a paused state when a script loads. PauseOnLoadMode pauseOnLoadMode_ = PauseOnLoadMode::None; + // Whether or not we should pause on breakpoints. + bool breakpointsActive_ = true; + // All scripts loaded in to the VM, along with whether we've notified the // client about the script yet. struct LoadedScriptInfo { diff --git a/ReactCommon/hermes/inspector/InspectorState.cpp b/ReactCommon/hermes/inspector/InspectorState.cpp index 38042872472c83..07e005ede5b497 100644 --- a/ReactCommon/hermes/inspector/InspectorState.cpp +++ b/ReactCommon/hermes/inspector/InspectorState.cpp @@ -254,6 +254,12 @@ std::pair InspectorState::Running::didPause( pendingEvalPromise_->setValue( inspector_.debugger_.getProgramState().getEvalResult()); pendingEvalPromise_.reset(); + } else if ( + reason == debugger::PauseReason::Breakpoint && + !inspector_.breakpointsActive_) { + // We hit a user defined breakpoint, but breakpoints have been deactivated. + return std::make_pair( + nullptr, makeContinueCommand()); } else /* other cases imply a transition to Pause */ { return std::make_pair( InspectorState::Paused::make(inspector_), nullptr); diff --git a/ReactCommon/hermes/inspector/chrome/Connection.cpp b/ReactCommon/hermes/inspector/chrome/Connection.cpp index 6beac456b64fcf..980f355c9f4c7a 100644 --- a/ReactCommon/hermes/inspector/chrome/Connection.cpp +++ b/ReactCommon/hermes/inspector/chrome/Connection.cpp @@ -81,6 +81,7 @@ class Connection::Impl : public inspector::InspectorObserver, void handle(const m::debugger::ResumeRequest &req) override; void handle(const m::debugger::SetBreakpointRequest &req) override; void handle(const m::debugger::SetBreakpointByUrlRequest &req) override; + void handle(const m::debugger::SetBreakpointsActiveRequest &req) override; void handle( const m::debugger::SetInstrumentationBreakpointRequest &req) override; void handle(const m::debugger::SetPauseOnExceptionsRequest &req) override; @@ -659,6 +660,16 @@ void Connection::Impl::handle( .thenError(sendErrorToClient(req.id)); } +void Connection::Impl::handle( + const m::debugger::SetBreakpointsActiveRequest &req) { + inspector_->setBreakpointsActive(req.active) + .via(executor_.get()) + .thenValue([this, id = req.id](const Unit &unit) { + sendResponseToClient(m::makeOkResponse(id)); + }) + .thenError(sendErrorToClient(req.id)); +} + bool Connection::Impl::isVirtualBreakpointId(const std::string &id) { return id.rfind(kVirtualBreakpointPrefix, 0) == 0; } diff --git a/ReactCommon/hermes/inspector/chrome/MessageTypes.cpp b/ReactCommon/hermes/inspector/chrome/MessageTypes.cpp index e136e1c8f194a9..fa97e98ed87f76 100644 --- a/ReactCommon/hermes/inspector/chrome/MessageTypes.cpp +++ b/ReactCommon/hermes/inspector/chrome/MessageTypes.cpp @@ -1,5 +1,5 @@ // Copyright 2004-present Facebook. All Rights Reserved. -// @generated SignedSource<> +// @generated SignedSource<> #include "MessageTypes.h" @@ -35,6 +35,8 @@ std::unique_ptr Request::fromJsonThrowOnError(const std::string &str) { {"Debugger.setBreakpoint", makeUnique}, {"Debugger.setBreakpointByUrl", makeUnique}, + {"Debugger.setBreakpointsActive", + makeUnique}, {"Debugger.setInstrumentationBreakpoint", makeUnique}, {"Debugger.setPauseOnExceptions", @@ -509,6 +511,35 @@ void debugger::SetBreakpointByUrlRequest::accept( handler.handle(*this); } +debugger::SetBreakpointsActiveRequest::SetBreakpointsActiveRequest() + : Request("Debugger.setBreakpointsActive") {} + +debugger::SetBreakpointsActiveRequest::SetBreakpointsActiveRequest( + const dynamic &obj) + : Request("Debugger.setBreakpointsActive") { + assign(id, obj, "id"); + assign(method, obj, "method"); + + dynamic params = obj.at("params"); + assign(active, params, "active"); +} + +dynamic debugger::SetBreakpointsActiveRequest::toDynamic() const { + dynamic params = dynamic::object; + put(params, "active", active); + + dynamic obj = dynamic::object; + put(obj, "id", id); + put(obj, "method", method); + put(obj, "params", std::move(params)); + return obj; +} + +void debugger::SetBreakpointsActiveRequest::accept( + RequestHandler &handler) const { + handler.handle(*this); +} + debugger::SetInstrumentationBreakpointRequest:: SetInstrumentationBreakpointRequest() : Request("Debugger.setInstrumentationBreakpoint") {} diff --git a/ReactCommon/hermes/inspector/chrome/MessageTypes.h b/ReactCommon/hermes/inspector/chrome/MessageTypes.h index d7e38d81a49d13..fdb6270f11a7c4 100644 --- a/ReactCommon/hermes/inspector/chrome/MessageTypes.h +++ b/ReactCommon/hermes/inspector/chrome/MessageTypes.h @@ -1,5 +1,5 @@ // Copyright 2004-present Facebook. All Rights Reserved. -// @generated SignedSource<<356df52df2a053b5254f0e039cc36a7b>> +// @generated SignedSource<<0563169b47d73a70d7540528f28d1d13>> #pragma once @@ -38,6 +38,7 @@ struct SetBreakpointByUrlRequest; struct SetBreakpointByUrlResponse; struct SetBreakpointRequest; struct SetBreakpointResponse; +struct SetBreakpointsActiveRequest; struct SetInstrumentationBreakpointRequest; struct SetInstrumentationBreakpointResponse; struct SetPauseOnExceptionsRequest; @@ -89,6 +90,7 @@ struct RequestHandler { virtual void handle(const debugger::ResumeRequest &req) = 0; virtual void handle(const debugger::SetBreakpointRequest &req) = 0; virtual void handle(const debugger::SetBreakpointByUrlRequest &req) = 0; + virtual void handle(const debugger::SetBreakpointsActiveRequest &req) = 0; virtual void handle( const debugger::SetInstrumentationBreakpointRequest &req) = 0; virtual void handle(const debugger::SetPauseOnExceptionsRequest &req) = 0; @@ -116,6 +118,7 @@ struct NoopRequestHandler : public RequestHandler { void handle(const debugger::ResumeRequest &req) override {} void handle(const debugger::SetBreakpointRequest &req) override {} void handle(const debugger::SetBreakpointByUrlRequest &req) override {} + void handle(const debugger::SetBreakpointsActiveRequest &req) override {} void handle( const debugger::SetInstrumentationBreakpointRequest &req) override {} void handle(const debugger::SetPauseOnExceptionsRequest &req) override {} @@ -354,6 +357,16 @@ struct debugger::SetBreakpointByUrlRequest : public Request { folly::Optional condition; }; +struct debugger::SetBreakpointsActiveRequest : public Request { + SetBreakpointsActiveRequest(); + explicit SetBreakpointsActiveRequest(const folly::dynamic &obj); + + folly::dynamic toDynamic() const override; + void accept(RequestHandler &handler) const override; + + bool active{}; +}; + struct debugger::SetInstrumentationBreakpointRequest : public Request { SetInstrumentationBreakpointRequest(); explicit SetInstrumentationBreakpointRequest(const folly::dynamic &obj); diff --git a/ReactCommon/hermes/inspector/chrome/tests/ConnectionTests.cpp b/ReactCommon/hermes/inspector/chrome/tests/ConnectionTests.cpp index 9d5abc5962a413..b97bf2cccd414d 100644 --- a/ReactCommon/hermes/inspector/chrome/tests/ConnectionTests.cpp +++ b/ReactCommon/hermes/inspector/chrome/tests/ConnectionTests.cpp @@ -750,6 +750,70 @@ TEST(ConnectionTests, testSetBreakpointById) { expectNotification(conn); } +TEST(ConnectionTests, testActivateBreakpoints) { + TestContext context; + AsyncHermesRuntime &asyncRuntime = context.runtime(); + SyncConnection &conn = context.conn(); + int msgId = 1; + + asyncRuntime.executeScriptAsync(R"( + debugger; // line 1 + x=100 // 2 + debugger; // 3 + x=101; // 4 + )"); + + send(conn, ++msgId); + expectExecutionContextCreated(conn); + auto script = expectNotification(conn); + + expectPaused(conn, "other", {{"global", 1, 1}}); + + // Set breakpoint #1 + m::debugger::SetBreakpointRequest req; + req.id = ++msgId; + req.location.scriptId = script.scriptId; + req.location.lineNumber = 2; + conn.send(req.toJson()); + expectResponse(conn, req.id); + + // Set breakpoint #2 + req.id = ++msgId; + req.location.scriptId = script.scriptId; + req.location.lineNumber = 4; + conn.send(req.toJson()); + expectResponse(conn, req.id); + + // Disable breakpoints + m::debugger::SetBreakpointsActiveRequest activeReq; + activeReq.id = ++msgId; + activeReq.active = false; + conn.send(activeReq.toJson()); + expectResponse(conn, activeReq.id); + + // Resume + send(conn, ++msgId); + expectNotification(conn); + + // Expect first breakpoint to be skipped, now hitting line #3 + expectPaused(conn, "other", {{"global", 3, 1}}); + + // Re-enable breakpoints + activeReq.id = ++msgId; + activeReq.active = true; + conn.send(activeReq.toJson()); + expectResponse(conn, activeReq.id); + + // Resume and expect breakpoints to trigger again + send(conn, ++msgId); + expectNotification(conn); + expectPaused(conn, "other", {{"global", 4, 1}}); + + // Continue and exit + send(conn, ++msgId); + expectNotification(conn); +} + TEST(ConnectionTests, testSetBreakpointByIdWithColumnInIndenting) { TestContext context; AsyncHermesRuntime &asyncRuntime = context.runtime(); diff --git a/ReactCommon/hermes/inspector/tools/message_types.txt b/ReactCommon/hermes/inspector/tools/message_types.txt index 02efcce5f1bc50..7807ac5b01799a 100644 --- a/ReactCommon/hermes/inspector/tools/message_types.txt +++ b/ReactCommon/hermes/inspector/tools/message_types.txt @@ -10,6 +10,7 @@ Debugger.resumed Debugger.scriptParsed Debugger.setBreakpoint Debugger.setBreakpointByUrl +Debugger.setBreakpointsActive Debugger.setInstrumentationBreakpoint Debugger.setPauseOnExceptions Debugger.stepInto diff --git a/ReactCommon/fabric/.clang-tidy b/ReactCommon/react/renderer/.clang-tidy similarity index 100% rename from ReactCommon/fabric/.clang-tidy rename to ReactCommon/react/renderer/.clang-tidy diff --git a/ReactCommon/fabric/animations/BUCK b/ReactCommon/react/renderer/animations/BUCK similarity index 72% rename from ReactCommon/fabric/animations/BUCK rename to ReactCommon/react/renderer/animations/BUCK index 123fb6c45e2386..93bc2e7ef3f672 100644 --- a/ReactCommon/fabric/animations/BUCK +++ b/ReactCommon/react/renderer/animations/BUCK @@ -29,7 +29,7 @@ rn_xplat_cxx_library( [ ("", "*.h"), ], - prefix = "react/animations", + prefix = "react/renderer/animations", ), compiler_flags = [ "-fexceptions", @@ -59,12 +59,12 @@ rn_xplat_cxx_library( "//xplat/jsi:JSIDynamic", "//xplat/jsi:jsi", react_native_xplat_target("config:config"), - react_native_xplat_target("fabric/componentregistry:componentregistry"), - react_native_xplat_target("fabric/components/view:view"), - react_native_xplat_target("fabric/core:core"), - react_native_xplat_target("fabric/debug:debug"), - react_native_xplat_target("fabric/mounting:mounting"), - react_native_xplat_target("fabric/uimanager:uimanager"), + react_native_xplat_target("react/renderer/componentregistry:componentregistry"), + react_native_xplat_target("react/renderer/components/view:view"), + react_native_xplat_target("react/renderer/core:core"), + react_native_xplat_target("react/renderer/debug:debug"), + react_native_xplat_target("react/renderer/mounting:mounting"), + react_native_xplat_target("react/renderer/uimanager:uimanager"), react_native_xplat_target("runtimeexecutor:runtimeexecutor"), ], ) @@ -86,11 +86,11 @@ fb_xplat_cxx_test( "//xplat/folly:molly", "//xplat/third-party/gmock:gtest", react_native_xplat_target("config:config"), - react_native_xplat_target("fabric/components/activityindicator:activityindicator"), - react_native_xplat_target("fabric/components/image:image"), - react_native_xplat_target("fabric/components/root:root"), - react_native_xplat_target("fabric/components/scrollview:scrollview"), - react_native_xplat_target("fabric/components/view:view"), + react_native_xplat_target("react/renderer/components/activityindicator:activityindicator"), + react_native_xplat_target("react/renderer/components/image:image"), + react_native_xplat_target("react/renderer/components/root:root"), + react_native_xplat_target("react/renderer/components/scrollview:scrollview"), + react_native_xplat_target("react/renderer/components/view:view"), "//xplat/js/react-native-github:generated_components-rncore", ], ) diff --git a/ReactCommon/fabric/animations/LayoutAnimationDriver.cpp b/ReactCommon/react/renderer/animations/LayoutAnimationDriver.cpp similarity index 90% rename from ReactCommon/fabric/animations/LayoutAnimationDriver.cpp rename to ReactCommon/react/renderer/animations/LayoutAnimationDriver.cpp index a1e1da95644aef..727ffc49a97496 100644 --- a/ReactCommon/fabric/animations/LayoutAnimationDriver.cpp +++ b/ReactCommon/react/renderer/animations/LayoutAnimationDriver.cpp @@ -10,19 +10,19 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include #include diff --git a/ReactCommon/fabric/animations/LayoutAnimationDriver.h b/ReactCommon/react/renderer/animations/LayoutAnimationDriver.h similarity index 73% rename from ReactCommon/fabric/animations/LayoutAnimationDriver.h rename to ReactCommon/react/renderer/animations/LayoutAnimationDriver.h index 3aa04f99163bca..525d4a7f804127 100644 --- a/ReactCommon/fabric/animations/LayoutAnimationDriver.h +++ b/ReactCommon/react/renderer/animations/LayoutAnimationDriver.h @@ -7,12 +7,12 @@ #pragma once -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include diff --git a/ReactCommon/fabric/animations/LayoutAnimationKeyFrameManager.cpp b/ReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.cpp similarity index 96% rename from ReactCommon/fabric/animations/LayoutAnimationKeyFrameManager.cpp rename to ReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.cpp index 9d97fb1d533e41..42c5ff05a94df1 100644 --- a/ReactCommon/fabric/animations/LayoutAnimationKeyFrameManager.cpp +++ b/ReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.cpp @@ -10,20 +10,20 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include #include @@ -600,7 +600,7 @@ LayoutAnimationKeyFrameManager::pullTransaction( mutation.type == ShadowViewMutation::Type::Insert) { // Indices for immediate INSERT mutations must be adjusted to insert // at higher indices if previous animations have deferred removals - // before the insertion indect + // before the insertion index // TODO: refactor to reduce code duplication if (mutation.type == ShadowViewMutation::Type::Insert) { int adjustedIndex = mutation.index; @@ -766,12 +766,14 @@ LayoutAnimationKeyFrameManager::pullTransaction( // tree hierarchy). { int adjustedIndex = mutation.index; + int adjustment = 0; for (auto &otherMutation : mutations) { if (otherMutation.type == ShadowViewMutation::Type::Insert && - otherMutation.parentShadowView.tag == parentTag) { - if (otherMutation.index <= adjustedIndex && - !mutatedViewIsVirtual(otherMutation)) { + otherMutation.parentShadowView.tag == parentTag && + !mutatedViewIsVirtual(otherMutation)) { + if (otherMutation.index <= adjustedIndex) { adjustedIndex++; + adjustment++; } else { // If we are delaying this remove instruction, conversely, // we must adjust upward the insertion index of any INSERT @@ -802,9 +804,16 @@ LayoutAnimationKeyFrameManager::pullTransaction( } const auto &delayedFinalMutation = *animatedKeyFrame.finalMutationForKeyFrame; + + // Note: we add the "adjustment" we've accumulated to the + // `delayedFinalMutation.index` before comparing. Since + // "adjustment" is caused by Insert MountItems that we are + // about to execute, but haven't yet, the delayed mutation's + // index *will* be adjusted right after this. if (delayedFinalMutation.type == ShadowViewMutation::Type::Remove && - delayedFinalMutation.index <= adjustedIndex) { + (delayedFinalMutation.index + adjustment) <= + adjustedIndex) { adjustedIndex++; } } diff --git a/ReactCommon/fabric/animations/LayoutAnimationKeyFrameManager.h b/ReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.h similarity index 92% rename from ReactCommon/fabric/animations/LayoutAnimationKeyFrameManager.h rename to ReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.h index 73906fb65ef1e2..8de5eef1fd485a 100644 --- a/ReactCommon/fabric/animations/LayoutAnimationKeyFrameManager.h +++ b/ReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.h @@ -7,15 +7,15 @@ #pragma once -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/attributedstring/AttributedString.cpp b/ReactCommon/react/renderer/attributedstring/AttributedString.cpp similarity index 98% rename from ReactCommon/fabric/attributedstring/AttributedString.cpp rename to ReactCommon/react/renderer/attributedstring/AttributedString.cpp index 57120d063c4e86..e04c041dbd2f15 100644 --- a/ReactCommon/fabric/attributedstring/AttributedString.cpp +++ b/ReactCommon/react/renderer/attributedstring/AttributedString.cpp @@ -7,7 +7,7 @@ #include "AttributedString.h" -#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/attributedstring/AttributedString.h b/ReactCommon/react/renderer/attributedstring/AttributedString.h similarity index 93% rename from ReactCommon/fabric/attributedstring/AttributedString.h rename to ReactCommon/react/renderer/attributedstring/AttributedString.h index 9da9d2f260e736..f3ed7922383722 100644 --- a/ReactCommon/fabric/attributedstring/AttributedString.h +++ b/ReactCommon/react/renderer/attributedstring/AttributedString.h @@ -12,11 +12,11 @@ #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/attributedstring/AttributedStringBox.cpp b/ReactCommon/react/renderer/attributedstring/AttributedStringBox.cpp similarity index 100% rename from ReactCommon/fabric/attributedstring/AttributedStringBox.cpp rename to ReactCommon/react/renderer/attributedstring/AttributedStringBox.cpp diff --git a/ReactCommon/fabric/attributedstring/AttributedStringBox.h b/ReactCommon/react/renderer/attributedstring/AttributedStringBox.h similarity index 97% rename from ReactCommon/fabric/attributedstring/AttributedStringBox.h rename to ReactCommon/react/renderer/attributedstring/AttributedStringBox.h index 8b7d4da1c59d19..7965a7d6d288fd 100644 --- a/ReactCommon/fabric/attributedstring/AttributedStringBox.h +++ b/ReactCommon/react/renderer/attributedstring/AttributedStringBox.h @@ -9,7 +9,7 @@ #include -#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/attributedstring/BUCK b/ReactCommon/react/renderer/attributedstring/BUCK similarity index 86% rename from ReactCommon/fabric/attributedstring/BUCK rename to ReactCommon/react/renderer/attributedstring/BUCK index f65fe7e2611b01..971f983506eb98 100644 --- a/ReactCommon/fabric/attributedstring/BUCK +++ b/ReactCommon/react/renderer/attributedstring/BUCK @@ -29,7 +29,7 @@ rn_xplat_cxx_library( [ ("", "*.h"), ], - prefix = "react/attributedstring", + prefix = "react/renderer/attributedstring", ), compiler_flags = [ "-fexceptions", @@ -56,10 +56,10 @@ rn_xplat_cxx_library( "//xplat/folly:memory", "//xplat/folly:molly", react_native_xplat_target("utils:utils"), - react_native_xplat_target("fabric/debug:debug"), - react_native_xplat_target("fabric/core:core"), - react_native_xplat_target("fabric/graphics:graphics"), - react_native_xplat_target("fabric/mounting:mounting"), + react_native_xplat_target("react/renderer/debug:debug"), + react_native_xplat_target("react/renderer/core:core"), + react_native_xplat_target("react/renderer/graphics:graphics"), + react_native_xplat_target("react/renderer/mounting:mounting"), ], ) diff --git a/ReactCommon/fabric/attributedstring/ParagraphAttributes.cpp b/ReactCommon/react/renderer/attributedstring/ParagraphAttributes.cpp similarity index 91% rename from ReactCommon/fabric/attributedstring/ParagraphAttributes.cpp rename to ReactCommon/react/renderer/attributedstring/ParagraphAttributes.cpp index f33662b81d65a4..fe64a462aa3e84 100644 --- a/ReactCommon/fabric/attributedstring/ParagraphAttributes.cpp +++ b/ReactCommon/react/renderer/attributedstring/ParagraphAttributes.cpp @@ -7,9 +7,9 @@ #include "ParagraphAttributes.h" -#include -#include -#include +#include +#include +#include #include namespace facebook { diff --git a/ReactCommon/fabric/attributedstring/ParagraphAttributes.h b/ReactCommon/react/renderer/attributedstring/ParagraphAttributes.h similarity index 93% rename from ReactCommon/fabric/attributedstring/ParagraphAttributes.h rename to ReactCommon/react/renderer/attributedstring/ParagraphAttributes.h index 585696033618ce..a5666035eff6fb 100644 --- a/ReactCommon/fabric/attributedstring/ParagraphAttributes.h +++ b/ReactCommon/react/renderer/attributedstring/ParagraphAttributes.h @@ -10,9 +10,9 @@ #include #include -#include -#include -#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/attributedstring/TextAttributes.cpp b/ReactCommon/react/renderer/attributedstring/TextAttributes.cpp similarity index 97% rename from ReactCommon/fabric/attributedstring/TextAttributes.cpp rename to ReactCommon/react/renderer/attributedstring/TextAttributes.cpp index c30817a8ea8ad6..5a7de8fbf9ab97 100644 --- a/ReactCommon/fabric/attributedstring/TextAttributes.cpp +++ b/ReactCommon/react/renderer/attributedstring/TextAttributes.cpp @@ -7,13 +7,13 @@ #include "TextAttributes.h" -#include -#include -#include +#include +#include +#include #include #include -#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/attributedstring/TextAttributes.h b/ReactCommon/react/renderer/attributedstring/TextAttributes.h similarity index 76% rename from ReactCommon/fabric/attributedstring/TextAttributes.h rename to ReactCommon/react/renderer/attributedstring/TextAttributes.h index 2589d89dfd9131..f15f11416f364c 100644 --- a/ReactCommon/fabric/attributedstring/TextAttributes.h +++ b/ReactCommon/react/renderer/attributedstring/TextAttributes.h @@ -12,12 +12,12 @@ #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include namespace facebook { namespace react { @@ -46,38 +46,38 @@ class TextAttributes : public DebugStringConvertible { std::string fontFamily{""}; Float fontSize{std::numeric_limits::quiet_NaN()}; Float fontSizeMultiplier{std::numeric_limits::quiet_NaN()}; - folly::Optional fontWeight{}; - folly::Optional fontStyle{}; - folly::Optional fontVariant{}; - folly::Optional allowFontScaling{}; + better::optional fontWeight{}; + better::optional fontStyle{}; + better::optional fontVariant{}; + better::optional allowFontScaling{}; Float letterSpacing{std::numeric_limits::quiet_NaN()}; // Paragraph Styles Float lineHeight{std::numeric_limits::quiet_NaN()}; - folly::Optional alignment{}; - folly::Optional baseWritingDirection{}; + better::optional alignment{}; + better::optional baseWritingDirection{}; // Decoration SharedColor textDecorationColor{}; - folly::Optional textDecorationLineType{}; - folly::Optional textDecorationLineStyle{}; - folly::Optional textDecorationLinePattern{}; + better::optional textDecorationLineType{}; + better::optional textDecorationLineStyle{}; + better::optional textDecorationLinePattern{}; // Shadow // TODO: Use `Point` type instead of `Size` for `textShadowOffset` attribute. - folly::Optional textShadowOffset{}; + better::optional textShadowOffset{}; Float textShadowRadius{std::numeric_limits::quiet_NaN()}; SharedColor textShadowColor{}; // Special - folly::Optional isHighlighted{}; + better::optional isHighlighted{}; // TODO T59221129: document where this value comes from and how it is set. // It's not clear if this is being used properly, or if it's being set at all. // Currently, it is intentionally *not* being set as part of BaseTextProps // construction. - folly::Optional layoutDirection{}; - folly::Optional accessibilityRole{}; + better::optional layoutDirection{}; + better::optional accessibilityRole{}; #pragma mark - Operations diff --git a/ReactCommon/fabric/attributedstring/conversions.h b/ReactCommon/react/renderer/attributedstring/conversions.h similarity index 97% rename from ReactCommon/fabric/attributedstring/conversions.h rename to ReactCommon/react/renderer/attributedstring/conversions.h index 9e7d484ade0f84..26c8b5f37f0799 100644 --- a/ReactCommon/fabric/attributedstring/conversions.h +++ b/ReactCommon/react/renderer/attributedstring/conversions.h @@ -9,17 +9,17 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include diff --git a/ReactCommon/fabric/attributedstring/primitives.h b/ReactCommon/react/renderer/attributedstring/primitives.h similarity index 100% rename from ReactCommon/fabric/attributedstring/primitives.h rename to ReactCommon/react/renderer/attributedstring/primitives.h diff --git a/ReactCommon/fabric/attributedstring/tests/AttributedStringTest.cpp b/ReactCommon/react/renderer/attributedstring/tests/AttributedStringTest.cpp similarity index 85% rename from ReactCommon/fabric/attributedstring/tests/AttributedStringTest.cpp rename to ReactCommon/react/renderer/attributedstring/tests/AttributedStringTest.cpp index 4c47930297465e..9e84969713d080 100644 --- a/ReactCommon/fabric/attributedstring/tests/AttributedStringTest.cpp +++ b/ReactCommon/react/renderer/attributedstring/tests/AttributedStringTest.cpp @@ -9,10 +9,10 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/attributedstring/tests/ParagraphAttributesTest.cpp b/ReactCommon/react/renderer/attributedstring/tests/ParagraphAttributesTest.cpp similarity index 84% rename from ReactCommon/fabric/attributedstring/tests/ParagraphAttributesTest.cpp rename to ReactCommon/react/renderer/attributedstring/tests/ParagraphAttributesTest.cpp index e722045797cb2b..56378937062f11 100644 --- a/ReactCommon/fabric/attributedstring/tests/ParagraphAttributesTest.cpp +++ b/ReactCommon/react/renderer/attributedstring/tests/ParagraphAttributesTest.cpp @@ -9,9 +9,9 @@ #include #include -#include -#include -#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/attributedstring/tests/TextAttributesTest.cpp b/ReactCommon/react/renderer/attributedstring/tests/TextAttributesTest.cpp similarity index 81% rename from ReactCommon/fabric/attributedstring/tests/TextAttributesTest.cpp rename to ReactCommon/react/renderer/attributedstring/tests/TextAttributesTest.cpp index 3355af625987a0..7c25e0c7278ad9 100644 --- a/ReactCommon/fabric/attributedstring/tests/TextAttributesTest.cpp +++ b/ReactCommon/react/renderer/attributedstring/tests/TextAttributesTest.cpp @@ -9,10 +9,10 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/componentregistry/BUCK b/ReactCommon/react/renderer/componentregistry/BUCK similarity index 89% rename from ReactCommon/fabric/componentregistry/BUCK rename to ReactCommon/react/renderer/componentregistry/BUCK index d993cb0e59d7c9..25316447438e65 100644 --- a/ReactCommon/fabric/componentregistry/BUCK +++ b/ReactCommon/react/renderer/componentregistry/BUCK @@ -28,7 +28,7 @@ rn_xplat_cxx_library( [ ("", "*.h"), ], - prefix = "react/componentregistry", + prefix = "react/renderer/componentregistry", ), compiler_flags = [ "-fexceptions", @@ -55,8 +55,8 @@ rn_xplat_cxx_library( "//xplat/folly:molly", "//xplat/jsi:JSIDynamic", "//xplat/jsi:jsi", - react_native_xplat_target("fabric/core:core"), - react_native_xplat_target("fabric/debug:debug"), + react_native_xplat_target("react/renderer/core:core"), + react_native_xplat_target("react/renderer/debug:debug"), react_native_xplat_target("utils:utils"), ], ) diff --git a/ReactCommon/fabric/componentregistry/ComponentDescriptorFactory.h b/ReactCommon/react/renderer/componentregistry/ComponentDescriptorFactory.h similarity index 89% rename from ReactCommon/fabric/componentregistry/ComponentDescriptorFactory.h rename to ReactCommon/react/renderer/componentregistry/ComponentDescriptorFactory.h index 5b506acfbdf304..d152fb981bfbba 100644 --- a/ReactCommon/fabric/componentregistry/ComponentDescriptorFactory.h +++ b/ReactCommon/react/renderer/componentregistry/ComponentDescriptorFactory.h @@ -9,8 +9,8 @@ #include -#include -#include +#include +#include #include #include "ComponentDescriptorRegistry.h" diff --git a/ReactCommon/fabric/componentregistry/ComponentDescriptorProvider.h b/ReactCommon/react/renderer/componentregistry/ComponentDescriptorProvider.h similarity index 95% rename from ReactCommon/fabric/componentregistry/ComponentDescriptorProvider.h rename to ReactCommon/react/renderer/componentregistry/ComponentDescriptorProvider.h index a1636eba02ac62..c321d4af91691c 100644 --- a/ReactCommon/fabric/componentregistry/ComponentDescriptorProvider.h +++ b/ReactCommon/react/renderer/componentregistry/ComponentDescriptorProvider.h @@ -7,8 +7,8 @@ #pragma once -#include -#include +#include +#include #include namespace facebook { diff --git a/ReactCommon/fabric/componentregistry/ComponentDescriptorProviderRegistry.cpp b/ReactCommon/react/renderer/componentregistry/ComponentDescriptorProviderRegistry.cpp similarity index 100% rename from ReactCommon/fabric/componentregistry/ComponentDescriptorProviderRegistry.cpp rename to ReactCommon/react/renderer/componentregistry/ComponentDescriptorProviderRegistry.cpp diff --git a/ReactCommon/fabric/componentregistry/ComponentDescriptorProviderRegistry.h b/ReactCommon/react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h similarity index 91% rename from ReactCommon/fabric/componentregistry/ComponentDescriptorProviderRegistry.h rename to ReactCommon/react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h index 40be7eb6ad0a4f..769f0f3b91c7e7 100644 --- a/ReactCommon/fabric/componentregistry/ComponentDescriptorProviderRegistry.h +++ b/ReactCommon/react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h @@ -9,9 +9,9 @@ #include -#include -#include -#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/componentregistry/ComponentDescriptorRegistry.cpp b/ReactCommon/react/renderer/componentregistry/ComponentDescriptorRegistry.cpp similarity index 98% rename from ReactCommon/fabric/componentregistry/ComponentDescriptorRegistry.cpp rename to ReactCommon/react/renderer/componentregistry/ComponentDescriptorRegistry.cpp index 2081886c660a9e..8499e3ca24c9d2 100644 --- a/ReactCommon/fabric/componentregistry/ComponentDescriptorRegistry.cpp +++ b/ReactCommon/react/renderer/componentregistry/ComponentDescriptorRegistry.cpp @@ -7,8 +7,8 @@ #include "ComponentDescriptorRegistry.h" -#include -#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/componentregistry/ComponentDescriptorRegistry.h b/ReactCommon/react/renderer/componentregistry/ComponentDescriptorRegistry.h similarity index 95% rename from ReactCommon/fabric/componentregistry/ComponentDescriptorRegistry.h rename to ReactCommon/react/renderer/componentregistry/ComponentDescriptorRegistry.h index 07e211d7d0f0a4..29dac6f371ef16 100644 --- a/ReactCommon/fabric/componentregistry/ComponentDescriptorRegistry.h +++ b/ReactCommon/react/renderer/componentregistry/ComponentDescriptorRegistry.h @@ -12,8 +12,8 @@ #include #include -#include -#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/activityindicator/BUCK b/ReactCommon/react/renderer/components/activityindicator/BUCK similarity index 84% rename from ReactCommon/fabric/components/activityindicator/BUCK rename to ReactCommon/react/renderer/components/activityindicator/BUCK index 47d57870130a0c..3b69438539ecc6 100644 --- a/ReactCommon/fabric/components/activityindicator/BUCK +++ b/ReactCommon/react/renderer/components/activityindicator/BUCK @@ -27,7 +27,7 @@ rn_xplat_cxx_library( [ ("", "*.h"), ], - prefix = "react/components/activityindicator", + prefix = "react/renderer/components/activityindicator", ), compiler_flags = [ "-fexceptions", @@ -53,10 +53,10 @@ rn_xplat_cxx_library( "//xplat/folly:memory", "//xplat/folly:molly", YOGA_CXX_TARGET, - react_native_xplat_target("fabric/debug:debug"), - react_native_xplat_target("fabric/core:core"), - react_native_xplat_target("fabric/graphics:graphics"), - react_native_xplat_target("fabric/components/view:view"), + react_native_xplat_target("react/renderer/debug:debug"), + react_native_xplat_target("react/renderer/core:core"), + react_native_xplat_target("react/renderer/graphics:graphics"), + react_native_xplat_target("react/renderer/components/view:view"), ], ) diff --git a/ReactCommon/fabric/components/activityindicator/conversions.h b/ReactCommon/react/renderer/components/activityindicator/conversions.h similarity index 92% rename from ReactCommon/fabric/components/activityindicator/conversions.h rename to ReactCommon/react/renderer/components/activityindicator/conversions.h index a985d26419e604..f1c2e49ad8d7e0 100644 --- a/ReactCommon/fabric/components/activityindicator/conversions.h +++ b/ReactCommon/react/renderer/components/activityindicator/conversions.h @@ -8,7 +8,7 @@ #pragma once #include -#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/image/BUCK b/ReactCommon/react/renderer/components/image/BUCK similarity index 82% rename from ReactCommon/fabric/components/image/BUCK rename to ReactCommon/react/renderer/components/image/BUCK index 43b8f54739565a..682ea9ddb22312 100644 --- a/ReactCommon/fabric/components/image/BUCK +++ b/ReactCommon/react/renderer/components/image/BUCK @@ -27,7 +27,7 @@ rn_xplat_cxx_library( [ ("", "*.h"), ], - prefix = "react/components/image", + prefix = "react/renderer/components/image", ), compiler_flags = [ "-fexceptions", @@ -53,11 +53,11 @@ rn_xplat_cxx_library( "//xplat/folly:memory", "//xplat/folly:molly", YOGA_CXX_TARGET, - react_native_xplat_target("fabric/debug:debug"), - react_native_xplat_target("fabric/core:core"), - react_native_xplat_target("fabric/graphics:graphics"), - react_native_xplat_target("fabric/imagemanager:imagemanager"), - react_native_xplat_target("fabric/components/view:view"), + react_native_xplat_target("react/renderer/debug:debug"), + react_native_xplat_target("react/renderer/core:core"), + react_native_xplat_target("react/renderer/graphics:graphics"), + react_native_xplat_target("react/renderer/imagemanager:imagemanager"), + react_native_xplat_target("react/renderer/components/view:view"), ], ) diff --git a/ReactCommon/fabric/components/image/ImageComponentDescriptor.h b/ReactCommon/react/renderer/components/image/ImageComponentDescriptor.h similarity index 87% rename from ReactCommon/fabric/components/image/ImageComponentDescriptor.h rename to ReactCommon/react/renderer/components/image/ImageComponentDescriptor.h index 15057a0bff4202..1e2b6708649ff2 100644 --- a/ReactCommon/fabric/components/image/ImageComponentDescriptor.h +++ b/ReactCommon/react/renderer/components/image/ImageComponentDescriptor.h @@ -7,9 +7,9 @@ #pragma once -#include -#include -#include +#include +#include +#include #include namespace facebook { diff --git a/ReactCommon/fabric/components/image/ImageEventEmitter.cpp b/ReactCommon/react/renderer/components/image/ImageEventEmitter.cpp similarity index 100% rename from ReactCommon/fabric/components/image/ImageEventEmitter.cpp rename to ReactCommon/react/renderer/components/image/ImageEventEmitter.cpp diff --git a/ReactCommon/fabric/components/image/ImageEventEmitter.h b/ReactCommon/react/renderer/components/image/ImageEventEmitter.h similarity index 90% rename from ReactCommon/fabric/components/image/ImageEventEmitter.h rename to ReactCommon/react/renderer/components/image/ImageEventEmitter.h index a99fb5d531c607..13bc446ee9eb6e 100644 --- a/ReactCommon/fabric/components/image/ImageEventEmitter.h +++ b/ReactCommon/react/renderer/components/image/ImageEventEmitter.h @@ -7,7 +7,7 @@ #pragma once -#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/image/ImageProps.cpp b/ReactCommon/react/renderer/components/image/ImageProps.cpp similarity index 86% rename from ReactCommon/fabric/components/image/ImageProps.cpp rename to ReactCommon/react/renderer/components/image/ImageProps.cpp index 109ac9e8c07728..c716b786f7d390 100644 --- a/ReactCommon/fabric/components/image/ImageProps.cpp +++ b/ReactCommon/react/renderer/components/image/ImageProps.cpp @@ -5,9 +5,9 @@ * LICENSE file in the root directory of this source tree. */ -#include -#include -#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/image/ImageProps.h b/ReactCommon/react/renderer/components/image/ImageProps.h similarity index 82% rename from ReactCommon/fabric/components/image/ImageProps.h rename to ReactCommon/react/renderer/components/image/ImageProps.h index 4edff0dc8d574a..7ed6ac4e1800e1 100644 --- a/ReactCommon/fabric/components/image/ImageProps.h +++ b/ReactCommon/react/renderer/components/image/ImageProps.h @@ -5,9 +5,9 @@ * LICENSE file in the root directory of this source tree. */ -#include -#include -#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/image/ImageShadowNode.cpp b/ReactCommon/react/renderer/components/image/ImageShadowNode.cpp similarity index 95% rename from ReactCommon/fabric/components/image/ImageShadowNode.cpp rename to ReactCommon/react/renderer/components/image/ImageShadowNode.cpp index 4a00f2c1bf23ca..fe20bc78845db6 100644 --- a/ReactCommon/fabric/components/image/ImageShadowNode.cpp +++ b/ReactCommon/react/renderer/components/image/ImageShadowNode.cpp @@ -8,8 +8,8 @@ #include #include -#include -#include +#include +#include #include "ImageState.h" namespace facebook { diff --git a/ReactCommon/fabric/components/image/ImageShadowNode.h b/ReactCommon/react/renderer/components/image/ImageShadowNode.h similarity index 81% rename from ReactCommon/fabric/components/image/ImageShadowNode.h rename to ReactCommon/react/renderer/components/image/ImageShadowNode.h index 9ebcbdc97ada63..0e60f78deef2dd 100644 --- a/ReactCommon/fabric/components/image/ImageShadowNode.h +++ b/ReactCommon/react/renderer/components/image/ImageShadowNode.h @@ -7,12 +7,12 @@ #pragma once -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/image/ImageState.cpp b/ReactCommon/react/renderer/components/image/ImageState.cpp similarity index 100% rename from ReactCommon/fabric/components/image/ImageState.cpp rename to ReactCommon/react/renderer/components/image/ImageState.cpp diff --git a/ReactCommon/fabric/components/image/ImageState.h b/ReactCommon/react/renderer/components/image/ImageState.h similarity index 92% rename from ReactCommon/fabric/components/image/ImageState.h rename to ReactCommon/react/renderer/components/image/ImageState.h index e41a9f5be48c3d..8dfa5d6f902173 100644 --- a/ReactCommon/fabric/components/image/ImageState.h +++ b/ReactCommon/react/renderer/components/image/ImageState.h @@ -8,8 +8,8 @@ #pragma once #include -#include -#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/image/conversions.h b/ReactCommon/react/renderer/components/image/conversions.h similarity index 97% rename from ReactCommon/fabric/components/image/conversions.h rename to ReactCommon/react/renderer/components/image/conversions.h index 2c0757267d260f..a77d40fad489e1 100644 --- a/ReactCommon/fabric/components/image/conversions.h +++ b/ReactCommon/react/renderer/components/image/conversions.h @@ -9,8 +9,8 @@ #include #include -#include -#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/image/tests/ImageTest.cpp b/ReactCommon/react/renderer/components/image/tests/ImageTest.cpp similarity index 100% rename from ReactCommon/fabric/components/image/tests/ImageTest.cpp rename to ReactCommon/react/renderer/components/image/tests/ImageTest.cpp diff --git a/ReactCommon/fabric/components/inputaccessory/BUCK b/ReactCommon/react/renderer/components/inputaccessory/BUCK similarity index 90% rename from ReactCommon/fabric/components/inputaccessory/BUCK rename to ReactCommon/react/renderer/components/inputaccessory/BUCK index 7db6c8ae3e02cc..c1debab5958b03 100644 --- a/ReactCommon/fabric/components/inputaccessory/BUCK +++ b/ReactCommon/react/renderer/components/inputaccessory/BUCK @@ -22,7 +22,7 @@ rn_xplat_cxx_library( [ ("", "*.h"), ], - prefix = "react/components/inputaccessory", + prefix = "react/renderer/components/inputaccessory", ), compiler_flags = [ "-fexceptions", @@ -41,7 +41,7 @@ rn_xplat_cxx_library( ], visibility = ["PUBLIC"], deps = [ - react_native_xplat_target("fabric/core:core"), + react_native_xplat_target("react/renderer/core:core"), "//xplat/js/react-native-github:generated_components-rncore", ], ) diff --git a/ReactCommon/fabric/components/inputaccessory/InputAccessoryComponentDescriptor.h b/ReactCommon/react/renderer/components/inputaccessory/InputAccessoryComponentDescriptor.h similarity index 90% rename from ReactCommon/fabric/components/inputaccessory/InputAccessoryComponentDescriptor.h rename to ReactCommon/react/renderer/components/inputaccessory/InputAccessoryComponentDescriptor.h index a850b1639aba0a..e92cf6e5bf94db 100644 --- a/ReactCommon/fabric/components/inputaccessory/InputAccessoryComponentDescriptor.h +++ b/ReactCommon/react/renderer/components/inputaccessory/InputAccessoryComponentDescriptor.h @@ -7,8 +7,8 @@ #pragma once -#include -#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/inputaccessory/InputAccessoryShadowNode.cpp b/ReactCommon/react/renderer/components/inputaccessory/InputAccessoryShadowNode.cpp similarity index 100% rename from ReactCommon/fabric/components/inputaccessory/InputAccessoryShadowNode.cpp rename to ReactCommon/react/renderer/components/inputaccessory/InputAccessoryShadowNode.cpp diff --git a/ReactCommon/fabric/components/inputaccessory/InputAccessoryShadowNode.h b/ReactCommon/react/renderer/components/inputaccessory/InputAccessoryShadowNode.h similarity index 79% rename from ReactCommon/fabric/components/inputaccessory/InputAccessoryShadowNode.h rename to ReactCommon/react/renderer/components/inputaccessory/InputAccessoryShadowNode.h index 5a7f6679c79901..d0afebc23ad16a 100644 --- a/ReactCommon/fabric/components/inputaccessory/InputAccessoryShadowNode.h +++ b/ReactCommon/react/renderer/components/inputaccessory/InputAccessoryShadowNode.h @@ -7,10 +7,10 @@ #pragma once -#include -#include -#include -#include +#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/inputaccessory/InputAccessoryState.h b/ReactCommon/react/renderer/components/inputaccessory/InputAccessoryState.h similarity index 78% rename from ReactCommon/fabric/components/inputaccessory/InputAccessoryState.h rename to ReactCommon/react/renderer/components/inputaccessory/InputAccessoryState.h index 5d1ae67a63ef21..928bff3128e57c 100644 --- a/ReactCommon/fabric/components/inputaccessory/InputAccessoryState.h +++ b/ReactCommon/react/renderer/components/inputaccessory/InputAccessoryState.h @@ -7,9 +7,9 @@ #pragma once -#include -#include -#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/legacyviewmanagerinterop/BUCK b/ReactCommon/react/renderer/components/legacyviewmanagerinterop/BUCK similarity index 86% rename from ReactCommon/fabric/components/legacyviewmanagerinterop/BUCK rename to ReactCommon/react/renderer/components/legacyviewmanagerinterop/BUCK index 3cd958bb17889e..6a76b1098695f2 100644 --- a/ReactCommon/fabric/components/legacyviewmanagerinterop/BUCK +++ b/ReactCommon/react/renderer/components/legacyviewmanagerinterop/BUCK @@ -25,7 +25,7 @@ rn_xplat_cxx_library( [ ("", "*.h"), ], - prefix = "react/components/legacyviewmanagerinterop", + prefix = "react/renderer/components/legacyviewmanagerinterop", ), compiler_flags = [ "-fexceptions", @@ -46,8 +46,8 @@ rn_xplat_cxx_library( deps = [ "//xplat/folly:headers_only", "//xplat/folly:memory", - react_native_xplat_target("fabric/core:core"), - react_native_xplat_target("fabric/components/view:view"), + react_native_xplat_target("react/renderer/core:core"), + react_native_xplat_target("react/renderer/components/view:view"), "//xplat/js/react-native-github:generated_components-rncore", ], ) diff --git a/ReactCommon/fabric/components/legacyviewmanagerinterop/LegacyViewManagerInteropComponentDescriptor.h b/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropComponentDescriptor.h similarity index 85% rename from ReactCommon/fabric/components/legacyviewmanagerinterop/LegacyViewManagerInteropComponentDescriptor.h rename to ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropComponentDescriptor.h index 8ce315f7cc9116..67d1291a10ef43 100644 --- a/ReactCommon/fabric/components/legacyviewmanagerinterop/LegacyViewManagerInteropComponentDescriptor.h +++ b/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropComponentDescriptor.h @@ -7,8 +7,8 @@ #pragma once -#include -#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/legacyviewmanagerinterop/LegacyViewManagerInteropComponentDescriptor.mm b/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropComponentDescriptor.mm similarity index 100% rename from ReactCommon/fabric/components/legacyviewmanagerinterop/LegacyViewManagerInteropComponentDescriptor.mm rename to ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropComponentDescriptor.mm diff --git a/ReactCommon/fabric/components/legacyviewmanagerinterop/LegacyViewManagerInteropShadowNode.cpp b/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropShadowNode.cpp similarity index 100% rename from ReactCommon/fabric/components/legacyviewmanagerinterop/LegacyViewManagerInteropShadowNode.cpp rename to ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropShadowNode.cpp diff --git a/ReactCommon/fabric/components/legacyviewmanagerinterop/LegacyViewManagerInteropShadowNode.h b/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropShadowNode.h similarity index 61% rename from ReactCommon/fabric/components/legacyviewmanagerinterop/LegacyViewManagerInteropShadowNode.h rename to ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropShadowNode.h index dc357894b26320..5667ed003f0054 100644 --- a/ReactCommon/fabric/components/legacyviewmanagerinterop/LegacyViewManagerInteropShadowNode.h +++ b/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropShadowNode.h @@ -7,10 +7,10 @@ #pragma once -#include -#include -#include -#include +#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/legacyviewmanagerinterop/LegacyViewManagerInteropState.h b/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropState.h similarity index 100% rename from ReactCommon/fabric/components/legacyviewmanagerinterop/LegacyViewManagerInteropState.h rename to ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropState.h diff --git a/ReactCommon/fabric/components/legacyviewmanagerinterop/LegacyViewManagerInteropState.mm b/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropState.mm similarity index 100% rename from ReactCommon/fabric/components/legacyviewmanagerinterop/LegacyViewManagerInteropState.mm rename to ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropState.mm diff --git a/ReactCommon/fabric/components/legacyviewmanagerinterop/LegacyViewManagerInteropViewEventEmitter.cpp b/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropViewEventEmitter.cpp similarity index 100% rename from ReactCommon/fabric/components/legacyviewmanagerinterop/LegacyViewManagerInteropViewEventEmitter.cpp rename to ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropViewEventEmitter.cpp diff --git a/ReactCommon/fabric/components/legacyviewmanagerinterop/LegacyViewManagerInteropViewEventEmitter.h b/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropViewEventEmitter.h similarity index 87% rename from ReactCommon/fabric/components/legacyviewmanagerinterop/LegacyViewManagerInteropViewEventEmitter.h rename to ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropViewEventEmitter.h index 031e2765b1850f..8d0e0e29bb59b2 100644 --- a/ReactCommon/fabric/components/legacyviewmanagerinterop/LegacyViewManagerInteropViewEventEmitter.h +++ b/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropViewEventEmitter.h @@ -10,8 +10,8 @@ #include #include -#include -#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/legacyviewmanagerinterop/LegacyViewManagerInteropViewProps.cpp b/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropViewProps.cpp similarity index 100% rename from ReactCommon/fabric/components/legacyviewmanagerinterop/LegacyViewManagerInteropViewProps.cpp rename to ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropViewProps.cpp diff --git a/ReactCommon/fabric/components/legacyviewmanagerinterop/LegacyViewManagerInteropViewProps.h b/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropViewProps.h similarity index 92% rename from ReactCommon/fabric/components/legacyviewmanagerinterop/LegacyViewManagerInteropViewProps.h rename to ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropViewProps.h index bc6827f461c331..9b56571e579b6e 100644 --- a/ReactCommon/fabric/components/legacyviewmanagerinterop/LegacyViewManagerInteropViewProps.h +++ b/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropViewProps.h @@ -6,7 +6,7 @@ */ #include -#include +#include #include namespace facebook { diff --git a/ReactCommon/fabric/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.h b/ReactCommon/react/renderer/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.h similarity index 100% rename from ReactCommon/fabric/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.h rename to ReactCommon/react/renderer/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.h diff --git a/ReactCommon/fabric/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.mm b/ReactCommon/react/renderer/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.mm similarity index 100% rename from ReactCommon/fabric/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.mm rename to ReactCommon/react/renderer/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.mm diff --git a/ReactCommon/fabric/components/modal/BUCK b/ReactCommon/react/renderer/components/modal/BUCK similarity index 72% rename from ReactCommon/fabric/components/modal/BUCK rename to ReactCommon/react/renderer/components/modal/BUCK index b79d40c04b55ef..f2865199207d7f 100644 --- a/ReactCommon/fabric/components/modal/BUCK +++ b/ReactCommon/react/renderer/components/modal/BUCK @@ -29,7 +29,7 @@ rn_xplat_cxx_library( [ ("", "*.h"), ], - prefix = "react/components/modal", + prefix = "react/renderer/components/modal", ), compiler_flags = [ "-fexceptions", @@ -42,7 +42,7 @@ rn_xplat_cxx_library( ("", "*.h"), ("platform/android", "*.h"), ], - prefix = "react/components/modal", + prefix = "react/renderer/components/modal", ), fbandroid_headers = glob( ["platform/android/*.h"], @@ -58,7 +58,7 @@ rn_xplat_cxx_library( ("", "*.h"), ("platform/ios", "*.h"), ], - prefix = "react/components/modal", + prefix = "react/renderer/components/modal", ), labels = ["supermodule:xplat/default/public.react_native.infra"], macosx_tests_override = [], @@ -75,14 +75,14 @@ rn_xplat_cxx_library( "//xplat/folly:memory", "//xplat/folly:molly", YOGA_CXX_TARGET, - react_native_xplat_target("fabric/debug:debug"), - react_native_xplat_target("fabric/core:core"), - react_native_xplat_target("fabric/components/image:image"), - react_native_xplat_target("fabric/components/view:view"), - react_native_xplat_target("fabric/graphics:graphics"), - react_native_xplat_target("fabric/imagemanager:imagemanager"), - react_native_xplat_target("fabric/uimanager:uimanager"), - react_native_xplat_target("fabric/componentregistry:componentregistry"), + react_native_xplat_target("react/renderer/debug:debug"), + react_native_xplat_target("react/renderer/core:core"), + react_native_xplat_target("react/renderer/components/image:image"), + react_native_xplat_target("react/renderer/components/view:view"), + react_native_xplat_target("react/renderer/graphics:graphics"), + react_native_xplat_target("react/renderer/imagemanager:imagemanager"), + react_native_xplat_target("react/renderer/uimanager:uimanager"), + react_native_xplat_target("react/renderer/componentregistry:componentregistry"), "//xplat/js/react-native-github:generated_components-rncore", ], ) diff --git a/ReactCommon/fabric/components/modal/ModalHostViewComponentDescriptor.h b/ReactCommon/react/renderer/components/modal/ModalHostViewComponentDescriptor.h similarity index 91% rename from ReactCommon/fabric/components/modal/ModalHostViewComponentDescriptor.h rename to ReactCommon/react/renderer/components/modal/ModalHostViewComponentDescriptor.h index f1616fb7abb550..e821c911d38879 100644 --- a/ReactCommon/fabric/components/modal/ModalHostViewComponentDescriptor.h +++ b/ReactCommon/react/renderer/components/modal/ModalHostViewComponentDescriptor.h @@ -8,8 +8,8 @@ #pragma once #include -#include -#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/modal/ModalHostViewShadowNode.cpp b/ReactCommon/react/renderer/components/modal/ModalHostViewShadowNode.cpp similarity index 76% rename from ReactCommon/fabric/components/modal/ModalHostViewShadowNode.cpp rename to ReactCommon/react/renderer/components/modal/ModalHostViewShadowNode.cpp index 011ad310247481..fffaf8047e9ed4 100644 --- a/ReactCommon/fabric/components/modal/ModalHostViewShadowNode.cpp +++ b/ReactCommon/react/renderer/components/modal/ModalHostViewShadowNode.cpp @@ -7,8 +7,8 @@ #include "ModalHostViewShadowNode.h" -#include -#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/modal/ModalHostViewShadowNode.h b/ReactCommon/react/renderer/components/modal/ModalHostViewShadowNode.h similarity index 79% rename from ReactCommon/fabric/components/modal/ModalHostViewShadowNode.h rename to ReactCommon/react/renderer/components/modal/ModalHostViewShadowNode.h index a5b6a67974154b..ad02fd26aafdf4 100644 --- a/ReactCommon/fabric/components/modal/ModalHostViewShadowNode.h +++ b/ReactCommon/react/renderer/components/modal/ModalHostViewShadowNode.h @@ -7,10 +7,10 @@ #pragma once -#include -#include -#include -#include +#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/modal/ModalHostViewState.cpp b/ReactCommon/react/renderer/components/modal/ModalHostViewState.cpp similarity index 100% rename from ReactCommon/fabric/components/modal/ModalHostViewState.cpp rename to ReactCommon/react/renderer/components/modal/ModalHostViewState.cpp diff --git a/ReactCommon/fabric/components/modal/ModalHostViewState.h b/ReactCommon/react/renderer/components/modal/ModalHostViewState.h similarity index 87% rename from ReactCommon/fabric/components/modal/ModalHostViewState.h rename to ReactCommon/react/renderer/components/modal/ModalHostViewState.h index fc0533fbba30c4..51e3677ff5459b 100644 --- a/ReactCommon/fabric/components/modal/ModalHostViewState.h +++ b/ReactCommon/react/renderer/components/modal/ModalHostViewState.h @@ -7,9 +7,9 @@ #pragma once -#include -#include -#include +#include +#include +#include #ifdef ANDROID #include diff --git a/ReactCommon/fabric/components/picker/BUCK b/ReactCommon/react/renderer/components/picker/BUCK similarity index 84% rename from ReactCommon/fabric/components/picker/BUCK rename to ReactCommon/react/renderer/components/picker/BUCK index 280aed2d07ccbc..d83a54ff910ff1 100644 --- a/ReactCommon/fabric/components/picker/BUCK +++ b/ReactCommon/react/renderer/components/picker/BUCK @@ -32,7 +32,7 @@ rn_xplat_cxx_library( ("", "*.h"), ("androidpicker", "*.h"), ], - prefix = "react/components/androidpicker", + prefix = "react/renderer/components/androidpicker", ), compiler_flags = [ "-fexceptions", @@ -61,12 +61,12 @@ rn_xplat_cxx_library( "//xplat/folly:memory", "//xplat/folly:molly", YOGA_CXX_TARGET, - react_native_xplat_target("fabric/debug:debug"), - react_native_xplat_target("fabric/core:core"), - react_native_xplat_target("fabric/graphics:graphics"), - react_native_xplat_target("fabric/components/view:view"), - react_native_xplat_target("fabric/uimanager:uimanager"), - react_native_xplat_target("fabric/componentregistry:componentregistry"), + react_native_xplat_target("react/renderer/debug:debug"), + react_native_xplat_target("react/renderer/core:core"), + react_native_xplat_target("react/renderer/graphics:graphics"), + react_native_xplat_target("react/renderer/components/view:view"), + react_native_xplat_target("react/renderer/uimanager:uimanager"), + react_native_xplat_target("react/renderer/componentregistry:componentregistry"), "//xplat/js/react-native-github:generated_components-rncore", ], ) diff --git a/ReactCommon/fabric/components/picker/androidpicker/AndroidDialogPickerComponentDescriptor.h b/ReactCommon/react/renderer/components/picker/androidpicker/AndroidDialogPickerComponentDescriptor.h similarity index 87% rename from ReactCommon/fabric/components/picker/androidpicker/AndroidDialogPickerComponentDescriptor.h rename to ReactCommon/react/renderer/components/picker/androidpicker/AndroidDialogPickerComponentDescriptor.h index c83b7ed3df153e..0c5622241fca7a 100644 --- a/ReactCommon/fabric/components/picker/androidpicker/AndroidDialogPickerComponentDescriptor.h +++ b/ReactCommon/react/renderer/components/picker/androidpicker/AndroidDialogPickerComponentDescriptor.h @@ -9,7 +9,7 @@ #include "AndroidDialogPickerShadowNode.h" -#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/picker/androidpicker/AndroidDialogPickerEventEmitter.cpp b/ReactCommon/react/renderer/components/picker/androidpicker/AndroidDialogPickerEventEmitter.cpp similarity index 100% rename from ReactCommon/fabric/components/picker/androidpicker/AndroidDialogPickerEventEmitter.cpp rename to ReactCommon/react/renderer/components/picker/androidpicker/AndroidDialogPickerEventEmitter.cpp diff --git a/ReactCommon/fabric/components/picker/androidpicker/AndroidDialogPickerEventEmitter.h b/ReactCommon/react/renderer/components/picker/androidpicker/AndroidDialogPickerEventEmitter.h similarity index 89% rename from ReactCommon/fabric/components/picker/androidpicker/AndroidDialogPickerEventEmitter.h rename to ReactCommon/react/renderer/components/picker/androidpicker/AndroidDialogPickerEventEmitter.h index 9ea91f192cdf4e..37781f4b5a8e5e 100644 --- a/ReactCommon/fabric/components/picker/androidpicker/AndroidDialogPickerEventEmitter.h +++ b/ReactCommon/react/renderer/components/picker/androidpicker/AndroidDialogPickerEventEmitter.h @@ -7,7 +7,7 @@ #pragma once -#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/picker/androidpicker/AndroidDialogPickerProps.cpp b/ReactCommon/react/renderer/components/picker/androidpicker/AndroidDialogPickerProps.cpp similarity index 89% rename from ReactCommon/fabric/components/picker/androidpicker/AndroidDialogPickerProps.cpp rename to ReactCommon/react/renderer/components/picker/androidpicker/AndroidDialogPickerProps.cpp index 8996776d939d8e..c44238843b03e2 100644 --- a/ReactCommon/fabric/components/picker/androidpicker/AndroidDialogPickerProps.cpp +++ b/ReactCommon/react/renderer/components/picker/androidpicker/AndroidDialogPickerProps.cpp @@ -7,8 +7,8 @@ #include "AndroidDialogPickerProps.h" -#include -#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/picker/androidpicker/AndroidDialogPickerProps.h b/ReactCommon/react/renderer/components/picker/androidpicker/AndroidDialogPickerProps.h similarity index 90% rename from ReactCommon/fabric/components/picker/androidpicker/AndroidDialogPickerProps.h rename to ReactCommon/react/renderer/components/picker/androidpicker/AndroidDialogPickerProps.h index 33aa151d8719d9..e4868a7f67633a 100644 --- a/ReactCommon/fabric/components/picker/androidpicker/AndroidDialogPickerProps.h +++ b/ReactCommon/react/renderer/components/picker/androidpicker/AndroidDialogPickerProps.h @@ -7,10 +7,10 @@ #pragma once -#include -#include -#include -#include +#include +#include +#include +#include #include #include diff --git a/ReactCommon/fabric/components/picker/androidpicker/AndroidDialogPickerShadowNode.cpp b/ReactCommon/react/renderer/components/picker/androidpicker/AndroidDialogPickerShadowNode.cpp similarity index 100% rename from ReactCommon/fabric/components/picker/androidpicker/AndroidDialogPickerShadowNode.cpp rename to ReactCommon/react/renderer/components/picker/androidpicker/AndroidDialogPickerShadowNode.cpp diff --git a/ReactCommon/fabric/components/picker/androidpicker/AndroidDialogPickerShadowNode.h b/ReactCommon/react/renderer/components/picker/androidpicker/AndroidDialogPickerShadowNode.h similarity index 90% rename from ReactCommon/fabric/components/picker/androidpicker/AndroidDialogPickerShadowNode.h rename to ReactCommon/react/renderer/components/picker/androidpicker/AndroidDialogPickerShadowNode.h index d0483996dc338e..e819b923e80a60 100644 --- a/ReactCommon/fabric/components/picker/androidpicker/AndroidDialogPickerShadowNode.h +++ b/ReactCommon/react/renderer/components/picker/androidpicker/AndroidDialogPickerShadowNode.h @@ -10,7 +10,7 @@ #include "AndroidDialogPickerEventEmitter.h" #include "AndroidDialogPickerProps.h" -#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/picker/androidpicker/AndroidDropdownPickerComponentDescriptor.h b/ReactCommon/react/renderer/components/picker/androidpicker/AndroidDropdownPickerComponentDescriptor.h similarity index 88% rename from ReactCommon/fabric/components/picker/androidpicker/AndroidDropdownPickerComponentDescriptor.h rename to ReactCommon/react/renderer/components/picker/androidpicker/AndroidDropdownPickerComponentDescriptor.h index f3ec83aead8369..cbad671add261c 100644 --- a/ReactCommon/fabric/components/picker/androidpicker/AndroidDropdownPickerComponentDescriptor.h +++ b/ReactCommon/react/renderer/components/picker/androidpicker/AndroidDropdownPickerComponentDescriptor.h @@ -9,7 +9,7 @@ #include "AndroidDropdownPickerShadowNode.h" -#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/picker/androidpicker/AndroidDropdownPickerEventEmitter.cpp b/ReactCommon/react/renderer/components/picker/androidpicker/AndroidDropdownPickerEventEmitter.cpp similarity index 100% rename from ReactCommon/fabric/components/picker/androidpicker/AndroidDropdownPickerEventEmitter.cpp rename to ReactCommon/react/renderer/components/picker/androidpicker/AndroidDropdownPickerEventEmitter.cpp diff --git a/ReactCommon/fabric/components/picker/androidpicker/AndroidDropdownPickerEventEmitter.h b/ReactCommon/react/renderer/components/picker/androidpicker/AndroidDropdownPickerEventEmitter.h similarity index 89% rename from ReactCommon/fabric/components/picker/androidpicker/AndroidDropdownPickerEventEmitter.h rename to ReactCommon/react/renderer/components/picker/androidpicker/AndroidDropdownPickerEventEmitter.h index 01db35b11997d7..356203b1c6edf0 100644 --- a/ReactCommon/fabric/components/picker/androidpicker/AndroidDropdownPickerEventEmitter.h +++ b/ReactCommon/react/renderer/components/picker/androidpicker/AndroidDropdownPickerEventEmitter.h @@ -7,7 +7,7 @@ #pragma once -#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/picker/androidpicker/AndroidDropdownPickerProps.cpp b/ReactCommon/react/renderer/components/picker/androidpicker/AndroidDropdownPickerProps.cpp similarity index 89% rename from ReactCommon/fabric/components/picker/androidpicker/AndroidDropdownPickerProps.cpp rename to ReactCommon/react/renderer/components/picker/androidpicker/AndroidDropdownPickerProps.cpp index 4aa8883e71cf86..b305b024210690 100644 --- a/ReactCommon/fabric/components/picker/androidpicker/AndroidDropdownPickerProps.cpp +++ b/ReactCommon/react/renderer/components/picker/androidpicker/AndroidDropdownPickerProps.cpp @@ -7,8 +7,8 @@ #include "AndroidDropdownPickerProps.h" -#include -#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/picker/androidpicker/AndroidDropdownPickerProps.h b/ReactCommon/react/renderer/components/picker/androidpicker/AndroidDropdownPickerProps.h similarity index 90% rename from ReactCommon/fabric/components/picker/androidpicker/AndroidDropdownPickerProps.h rename to ReactCommon/react/renderer/components/picker/androidpicker/AndroidDropdownPickerProps.h index 94af9d84cf4aeb..3e66603c4ee7b8 100644 --- a/ReactCommon/fabric/components/picker/androidpicker/AndroidDropdownPickerProps.h +++ b/ReactCommon/react/renderer/components/picker/androidpicker/AndroidDropdownPickerProps.h @@ -7,10 +7,10 @@ #pragma once -#include -#include -#include -#include +#include +#include +#include +#include #include #include diff --git a/ReactCommon/fabric/components/picker/androidpicker/AndroidDropdownPickerShadowNode.cpp b/ReactCommon/react/renderer/components/picker/androidpicker/AndroidDropdownPickerShadowNode.cpp similarity index 100% rename from ReactCommon/fabric/components/picker/androidpicker/AndroidDropdownPickerShadowNode.cpp rename to ReactCommon/react/renderer/components/picker/androidpicker/AndroidDropdownPickerShadowNode.cpp diff --git a/ReactCommon/fabric/components/picker/androidpicker/AndroidDropdownPickerShadowNode.h b/ReactCommon/react/renderer/components/picker/androidpicker/AndroidDropdownPickerShadowNode.h similarity index 90% rename from ReactCommon/fabric/components/picker/androidpicker/AndroidDropdownPickerShadowNode.h rename to ReactCommon/react/renderer/components/picker/androidpicker/AndroidDropdownPickerShadowNode.h index bf1661414ed228..5c4ac182798c0f 100644 --- a/ReactCommon/fabric/components/picker/androidpicker/AndroidDropdownPickerShadowNode.h +++ b/ReactCommon/react/renderer/components/picker/androidpicker/AndroidDropdownPickerShadowNode.h @@ -10,7 +10,7 @@ #include "AndroidDropdownPickerEventEmitter.h" #include "AndroidDropdownPickerProps.h" -#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/root/BUCK b/ReactCommon/react/renderer/components/root/BUCK similarity index 85% rename from ReactCommon/fabric/components/root/BUCK rename to ReactCommon/react/renderer/components/root/BUCK index bef67507464974..551366f61d5372 100644 --- a/ReactCommon/fabric/components/root/BUCK +++ b/ReactCommon/react/renderer/components/root/BUCK @@ -27,7 +27,7 @@ rn_xplat_cxx_library( [ ("", "*.h"), ], - prefix = "react/components/root", + prefix = "react/renderer/components/root", ), compiler_flags = [ "-fexceptions", @@ -53,10 +53,10 @@ rn_xplat_cxx_library( "//xplat/folly:memory", "//xplat/folly:molly", YOGA_CXX_TARGET, - react_native_xplat_target("fabric/debug:debug"), - react_native_xplat_target("fabric/core:core"), - react_native_xplat_target("fabric/graphics:graphics"), - react_native_xplat_target("fabric/components/view:view"), + react_native_xplat_target("react/renderer/debug:debug"), + react_native_xplat_target("react/renderer/core:core"), + react_native_xplat_target("react/renderer/graphics:graphics"), + react_native_xplat_target("react/renderer/components/view:view"), ], ) diff --git a/ReactCommon/fabric/components/root/RootComponentDescriptor.h b/ReactCommon/react/renderer/components/root/RootComponentDescriptor.h similarity index 75% rename from ReactCommon/fabric/components/root/RootComponentDescriptor.h rename to ReactCommon/react/renderer/components/root/RootComponentDescriptor.h index f0b3f5006cab9c..7d8cb7b2b277eb 100644 --- a/ReactCommon/fabric/components/root/RootComponentDescriptor.h +++ b/ReactCommon/react/renderer/components/root/RootComponentDescriptor.h @@ -7,8 +7,8 @@ #pragma once -#include -#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/root/RootProps.cpp b/ReactCommon/react/renderer/components/root/RootProps.cpp similarity index 84% rename from ReactCommon/fabric/components/root/RootProps.cpp rename to ReactCommon/react/renderer/components/root/RootProps.cpp index a39298fbb8134e..beb6af92cbf2d4 100644 --- a/ReactCommon/fabric/components/root/RootProps.cpp +++ b/ReactCommon/react/renderer/components/root/RootProps.cpp @@ -7,8 +7,8 @@ #include "RootProps.h" -#include -#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/root/RootProps.h b/ReactCommon/react/renderer/components/root/RootProps.h similarity index 82% rename from ReactCommon/fabric/components/root/RootProps.h rename to ReactCommon/react/renderer/components/root/RootProps.h index 3cffe6256a057e..d3e2ea2dc056a1 100644 --- a/ReactCommon/fabric/components/root/RootProps.h +++ b/ReactCommon/react/renderer/components/root/RootProps.h @@ -9,9 +9,9 @@ #include -#include -#include -#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/root/RootShadowNode.cpp b/ReactCommon/react/renderer/components/root/RootShadowNode.cpp similarity index 91% rename from ReactCommon/fabric/components/root/RootShadowNode.cpp rename to ReactCommon/react/renderer/components/root/RootShadowNode.cpp index 99bbfa2a9e66f5..511f9ac270e156 100644 --- a/ReactCommon/fabric/components/root/RootShadowNode.cpp +++ b/ReactCommon/react/renderer/components/root/RootShadowNode.cpp @@ -7,8 +7,8 @@ #include "RootShadowNode.h" -#include -#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/root/RootShadowNode.h b/ReactCommon/react/renderer/components/root/RootShadowNode.h similarity index 88% rename from ReactCommon/fabric/components/root/RootShadowNode.h rename to ReactCommon/react/renderer/components/root/RootShadowNode.h index f1a7b11d90122e..18bdb393ded83e 100644 --- a/ReactCommon/fabric/components/root/RootShadowNode.h +++ b/ReactCommon/react/renderer/components/root/RootShadowNode.h @@ -9,9 +9,9 @@ #include -#include -#include -#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/root/tests/RootShadowNodeTest.cpp b/ReactCommon/react/renderer/components/root/tests/RootShadowNodeTest.cpp similarity index 100% rename from ReactCommon/fabric/components/root/tests/RootShadowNodeTest.cpp rename to ReactCommon/react/renderer/components/root/tests/RootShadowNodeTest.cpp diff --git a/ReactCommon/fabric/components/safeareaview/BUCK b/ReactCommon/react/renderer/components/safeareaview/BUCK similarity index 90% rename from ReactCommon/fabric/components/safeareaview/BUCK rename to ReactCommon/react/renderer/components/safeareaview/BUCK index 033f987770f11d..3c62e99a01a267 100644 --- a/ReactCommon/fabric/components/safeareaview/BUCK +++ b/ReactCommon/react/renderer/components/safeareaview/BUCK @@ -22,7 +22,7 @@ rn_xplat_cxx_library( [ ("", "*.h"), ], - prefix = "react/components/safeareaview", + prefix = "react/renderer/components/safeareaview", ), compiler_flags = [ "-fexceptions", @@ -41,7 +41,7 @@ rn_xplat_cxx_library( ], visibility = ["PUBLIC"], deps = [ - react_native_xplat_target("fabric/core:core"), + react_native_xplat_target("react/renderer/core:core"), "//xplat/js/react-native-github:generated_components-rncore", ], ) diff --git a/ReactCommon/fabric/components/safeareaview/SafeAreaViewComponentDescriptor.h b/ReactCommon/react/renderer/components/safeareaview/SafeAreaViewComponentDescriptor.h similarity index 91% rename from ReactCommon/fabric/components/safeareaview/SafeAreaViewComponentDescriptor.h rename to ReactCommon/react/renderer/components/safeareaview/SafeAreaViewComponentDescriptor.h index 23b1e37c2892e2..5cf2f960a8a254 100644 --- a/ReactCommon/fabric/components/safeareaview/SafeAreaViewComponentDescriptor.h +++ b/ReactCommon/react/renderer/components/safeareaview/SafeAreaViewComponentDescriptor.h @@ -7,8 +7,8 @@ #pragma once -#include -#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/safeareaview/SafeAreaViewShadowNode.cpp b/ReactCommon/react/renderer/components/safeareaview/SafeAreaViewShadowNode.cpp similarity index 100% rename from ReactCommon/fabric/components/safeareaview/SafeAreaViewShadowNode.cpp rename to ReactCommon/react/renderer/components/safeareaview/SafeAreaViewShadowNode.cpp diff --git a/ReactCommon/fabric/components/safeareaview/SafeAreaViewShadowNode.h b/ReactCommon/react/renderer/components/safeareaview/SafeAreaViewShadowNode.h similarity index 78% rename from ReactCommon/fabric/components/safeareaview/SafeAreaViewShadowNode.h rename to ReactCommon/react/renderer/components/safeareaview/SafeAreaViewShadowNode.h index 1f09c463b63606..cbed9509ed72c9 100644 --- a/ReactCommon/fabric/components/safeareaview/SafeAreaViewShadowNode.h +++ b/ReactCommon/react/renderer/components/safeareaview/SafeAreaViewShadowNode.h @@ -7,10 +7,10 @@ #pragma once -#include -#include -#include -#include +#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/safeareaview/SafeAreaViewState.cpp b/ReactCommon/react/renderer/components/safeareaview/SafeAreaViewState.cpp similarity index 100% rename from ReactCommon/fabric/components/safeareaview/SafeAreaViewState.cpp rename to ReactCommon/react/renderer/components/safeareaview/SafeAreaViewState.cpp diff --git a/ReactCommon/fabric/components/safeareaview/SafeAreaViewState.h b/ReactCommon/react/renderer/components/safeareaview/SafeAreaViewState.h similarity index 91% rename from ReactCommon/fabric/components/safeareaview/SafeAreaViewState.h rename to ReactCommon/react/renderer/components/safeareaview/SafeAreaViewState.h index 536341989fc6b4..6b4c0c008059cb 100644 --- a/ReactCommon/fabric/components/safeareaview/SafeAreaViewState.h +++ b/ReactCommon/react/renderer/components/safeareaview/SafeAreaViewState.h @@ -7,7 +7,7 @@ #pragma once -#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/scrollview/BUCK b/ReactCommon/react/renderer/components/scrollview/BUCK similarity index 85% rename from ReactCommon/fabric/components/scrollview/BUCK rename to ReactCommon/react/renderer/components/scrollview/BUCK index 8ffd81f4003892..20700db5057ed1 100644 --- a/ReactCommon/fabric/components/scrollview/BUCK +++ b/ReactCommon/react/renderer/components/scrollview/BUCK @@ -30,7 +30,7 @@ rn_xplat_cxx_library( [ ("", "*.h"), ], - prefix = "react/components/scrollview", + prefix = "react/renderer/components/scrollview", ), compiler_flags = [ "-fexceptions", @@ -57,10 +57,10 @@ rn_xplat_cxx_library( "//xplat/folly:memory", "//xplat/folly:molly", YOGA_CXX_TARGET, - react_native_xplat_target("fabric/debug:debug"), - react_native_xplat_target("fabric/core:core"), - react_native_xplat_target("fabric/graphics:graphics"), - react_native_xplat_target("fabric/components/view:view"), + react_native_xplat_target("react/renderer/debug:debug"), + react_native_xplat_target("react/renderer/core:core"), + react_native_xplat_target("react/renderer/graphics:graphics"), + react_native_xplat_target("react/renderer/components/view:view"), ], ) diff --git a/ReactCommon/fabric/components/scrollview/RCTComponentViewHelpers.h b/ReactCommon/react/renderer/components/scrollview/RCTComponentViewHelpers.h similarity index 100% rename from ReactCommon/fabric/components/scrollview/RCTComponentViewHelpers.h rename to ReactCommon/react/renderer/components/scrollview/RCTComponentViewHelpers.h diff --git a/ReactCommon/fabric/components/scrollview/ScrollViewComponentDescriptor.h b/ReactCommon/react/renderer/components/scrollview/ScrollViewComponentDescriptor.h similarity index 74% rename from ReactCommon/fabric/components/scrollview/ScrollViewComponentDescriptor.h rename to ReactCommon/react/renderer/components/scrollview/ScrollViewComponentDescriptor.h index b81cb510b10c47..43b74b08dc335d 100644 --- a/ReactCommon/fabric/components/scrollview/ScrollViewComponentDescriptor.h +++ b/ReactCommon/react/renderer/components/scrollview/ScrollViewComponentDescriptor.h @@ -7,8 +7,8 @@ #pragma once -#include -#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/scrollview/ScrollViewEventEmitter.cpp b/ReactCommon/react/renderer/components/scrollview/ScrollViewEventEmitter.cpp similarity index 100% rename from ReactCommon/fabric/components/scrollview/ScrollViewEventEmitter.cpp rename to ReactCommon/react/renderer/components/scrollview/ScrollViewEventEmitter.cpp diff --git a/ReactCommon/fabric/components/scrollview/ScrollViewEventEmitter.h b/ReactCommon/react/renderer/components/scrollview/ScrollViewEventEmitter.h similarity index 89% rename from ReactCommon/fabric/components/scrollview/ScrollViewEventEmitter.h rename to ReactCommon/react/renderer/components/scrollview/ScrollViewEventEmitter.h index f03f5dc2849976..f822702a5a7d1e 100644 --- a/ReactCommon/fabric/components/scrollview/ScrollViewEventEmitter.h +++ b/ReactCommon/react/renderer/components/scrollview/ScrollViewEventEmitter.h @@ -10,9 +10,9 @@ #include #include -#include -#include -#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/scrollview/ScrollViewProps.cpp b/ReactCommon/react/renderer/components/scrollview/ScrollViewProps.cpp similarity index 97% rename from ReactCommon/fabric/components/scrollview/ScrollViewProps.cpp rename to ReactCommon/react/renderer/components/scrollview/ScrollViewProps.cpp index fdedc739e7c058..51a772ee56e5e2 100644 --- a/ReactCommon/fabric/components/scrollview/ScrollViewProps.cpp +++ b/ReactCommon/react/renderer/components/scrollview/ScrollViewProps.cpp @@ -7,11 +7,11 @@ #include "ScrollViewProps.h" -#include -#include -#include +#include +#include +#include -#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/scrollview/ScrollViewProps.h b/ReactCommon/react/renderer/components/scrollview/ScrollViewProps.h similarity index 93% rename from ReactCommon/fabric/components/scrollview/ScrollViewProps.h rename to ReactCommon/react/renderer/components/scrollview/ScrollViewProps.h index a6c08781f918c0..8513bab4a4a881 100644 --- a/ReactCommon/fabric/components/scrollview/ScrollViewProps.h +++ b/ReactCommon/react/renderer/components/scrollview/ScrollViewProps.h @@ -7,8 +7,8 @@ #pragma once -#include -#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/scrollview/ScrollViewShadowNode.cpp b/ReactCommon/react/renderer/components/scrollview/ScrollViewShadowNode.cpp similarity index 81% rename from ReactCommon/fabric/components/scrollview/ScrollViewShadowNode.cpp rename to ReactCommon/react/renderer/components/scrollview/ScrollViewShadowNode.cpp index 8691181b171039..a421f8c9de0d00 100644 --- a/ReactCommon/fabric/components/scrollview/ScrollViewShadowNode.cpp +++ b/ReactCommon/react/renderer/components/scrollview/ScrollViewShadowNode.cpp @@ -7,7 +7,7 @@ #include "ScrollViewShadowNode.h" -#include +#include namespace facebook { namespace react { @@ -37,11 +37,9 @@ void ScrollViewShadowNode::layout(LayoutContext layoutContext) { updateStateIfNeeded(); } -Transform ScrollViewShadowNode::getTransform() const { - auto transform = ConcreteViewShadowNode::getTransform(); +Point ScrollViewShadowNode::getContentOriginOffset() const { auto contentOffset = getStateData().contentOffset; - return transform * - Transform::Translate(-contentOffset.x, -contentOffset.y, 0); + return {-contentOffset.x, -contentOffset.y}; } } // namespace react diff --git a/ReactCommon/fabric/components/scrollview/ScrollViewShadowNode.h b/ReactCommon/react/renderer/components/scrollview/ScrollViewShadowNode.h similarity index 70% rename from ReactCommon/fabric/components/scrollview/ScrollViewShadowNode.h rename to ReactCommon/react/renderer/components/scrollview/ScrollViewShadowNode.h index 25ac5045ab282d..19172a9e74be7f 100644 --- a/ReactCommon/fabric/components/scrollview/ScrollViewShadowNode.h +++ b/ReactCommon/react/renderer/components/scrollview/ScrollViewShadowNode.h @@ -7,11 +7,11 @@ #pragma once -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include namespace facebook { namespace react { @@ -32,7 +32,7 @@ class ScrollViewShadowNode final : public ConcreteViewShadowNode< #pragma mark - LayoutableShadowNode void layout(LayoutContext layoutContext) override; - Transform getTransform() const override; + Point getContentOriginOffset() const override; private: void updateStateIfNeeded(); diff --git a/ReactCommon/fabric/components/scrollview/ScrollViewState.cpp b/ReactCommon/react/renderer/components/scrollview/ScrollViewState.cpp similarity index 100% rename from ReactCommon/fabric/components/scrollview/ScrollViewState.cpp rename to ReactCommon/react/renderer/components/scrollview/ScrollViewState.cpp diff --git a/ReactCommon/fabric/components/scrollview/ScrollViewState.h b/ReactCommon/react/renderer/components/scrollview/ScrollViewState.h similarity index 95% rename from ReactCommon/fabric/components/scrollview/ScrollViewState.h rename to ReactCommon/react/renderer/components/scrollview/ScrollViewState.h index 3a6023499e6cf1..d2ec294a239e4f 100644 --- a/ReactCommon/fabric/components/scrollview/ScrollViewState.h +++ b/ReactCommon/react/renderer/components/scrollview/ScrollViewState.h @@ -7,7 +7,7 @@ #pragma once -#include +#include #include diff --git a/ReactCommon/fabric/components/scrollview/conversions.h b/ReactCommon/react/renderer/components/scrollview/conversions.h similarity index 97% rename from ReactCommon/fabric/components/scrollview/conversions.h rename to ReactCommon/react/renderer/components/scrollview/conversions.h index f3fb5206366083..4d23000e23cbdd 100644 --- a/ReactCommon/fabric/components/scrollview/conversions.h +++ b/ReactCommon/react/renderer/components/scrollview/conversions.h @@ -8,7 +8,7 @@ #pragma once #include -#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/scrollview/primitives.h b/ReactCommon/react/renderer/components/scrollview/primitives.h similarity index 100% rename from ReactCommon/fabric/components/scrollview/primitives.h rename to ReactCommon/react/renderer/components/scrollview/primitives.h diff --git a/ReactCommon/fabric/components/scrollview/tests/ScrollViewTest.cpp b/ReactCommon/react/renderer/components/scrollview/tests/ScrollViewTest.cpp similarity index 100% rename from ReactCommon/fabric/components/scrollview/tests/ScrollViewTest.cpp rename to ReactCommon/react/renderer/components/scrollview/tests/ScrollViewTest.cpp diff --git a/ReactCommon/fabric/components/slider/BUCK b/ReactCommon/react/renderer/components/slider/BUCK similarity index 79% rename from ReactCommon/fabric/components/slider/BUCK rename to ReactCommon/react/renderer/components/slider/BUCK index 4f736a12d5160c..05c3232fda5d3e 100644 --- a/ReactCommon/fabric/components/slider/BUCK +++ b/ReactCommon/react/renderer/components/slider/BUCK @@ -31,7 +31,7 @@ rn_xplat_cxx_library( [ ("", "*.h"), ], - prefix = "react/components/slider", + prefix = "react/renderer/components/slider", ), compiler_flags = [ "-fexceptions", @@ -48,7 +48,7 @@ rn_xplat_cxx_library( ("", "*.h"), ("platform/android", "*.h"), ], - prefix = "react/components/slider", + prefix = "react/renderer/components/slider", ), fbandroid_headers = glob( ["platform/android/*.h"], @@ -64,7 +64,7 @@ rn_xplat_cxx_library( ("", "*.h"), ("platform/ios", "*.h"), ], - prefix = "react/components/slider", + prefix = "react/renderer/components/slider", ), ios_headers = glob( ["platform/ios/*.h"], @@ -86,14 +86,14 @@ rn_xplat_cxx_library( "//xplat/folly:memory", "//xplat/folly:molly", YOGA_CXX_TARGET, - react_native_xplat_target("fabric/debug:debug"), - react_native_xplat_target("fabric/core:core"), - react_native_xplat_target("fabric/components/image:image"), - react_native_xplat_target("fabric/components/view:view"), - react_native_xplat_target("fabric/graphics:graphics"), - react_native_xplat_target("fabric/imagemanager:imagemanager"), - react_native_xplat_target("fabric/uimanager:uimanager"), - react_native_xplat_target("fabric/componentregistry:componentregistry"), + react_native_xplat_target("react/renderer/debug:debug"), + react_native_xplat_target("react/renderer/core:core"), + react_native_xplat_target("react/renderer/components/image:image"), + react_native_xplat_target("react/renderer/components/view:view"), + react_native_xplat_target("react/renderer/graphics:graphics"), + react_native_xplat_target("react/renderer/imagemanager:imagemanager"), + react_native_xplat_target("react/renderer/uimanager:uimanager"), + react_native_xplat_target("react/renderer/componentregistry:componentregistry"), "//xplat/js/react-native-github:generated_components-rncore", ], ) diff --git a/ReactCommon/fabric/components/slider/SliderComponentDescriptor.h b/ReactCommon/react/renderer/components/slider/SliderComponentDescriptor.h similarity index 90% rename from ReactCommon/fabric/components/slider/SliderComponentDescriptor.h rename to ReactCommon/react/renderer/components/slider/SliderComponentDescriptor.h index 30f8fd434595c8..687ea411a0c06c 100644 --- a/ReactCommon/fabric/components/slider/SliderComponentDescriptor.h +++ b/ReactCommon/react/renderer/components/slider/SliderComponentDescriptor.h @@ -7,9 +7,9 @@ #pragma once -#include -#include -#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/slider/SliderShadowNode.cpp b/ReactCommon/react/renderer/components/slider/SliderShadowNode.cpp similarity index 98% rename from ReactCommon/fabric/components/slider/SliderShadowNode.cpp rename to ReactCommon/react/renderer/components/slider/SliderShadowNode.cpp index 38929b89cfce43..15803f26f3de52 100644 --- a/ReactCommon/fabric/components/slider/SliderShadowNode.cpp +++ b/ReactCommon/react/renderer/components/slider/SliderShadowNode.cpp @@ -7,7 +7,7 @@ #include "SliderShadowNode.h" -#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/slider/SliderShadowNode.h b/ReactCommon/react/renderer/components/slider/SliderShadowNode.h similarity index 83% rename from ReactCommon/fabric/components/slider/SliderShadowNode.h rename to ReactCommon/react/renderer/components/slider/SliderShadowNode.h index 53ed30d82d0282..82ab4d0b1dc6c2 100644 --- a/ReactCommon/fabric/components/slider/SliderShadowNode.h +++ b/ReactCommon/react/renderer/components/slider/SliderShadowNode.h @@ -7,13 +7,13 @@ #pragma once -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/slider/SliderState.cpp b/ReactCommon/react/renderer/components/slider/SliderState.cpp similarity index 100% rename from ReactCommon/fabric/components/slider/SliderState.cpp rename to ReactCommon/react/renderer/components/slider/SliderState.cpp diff --git a/ReactCommon/fabric/components/slider/SliderState.h b/ReactCommon/react/renderer/components/slider/SliderState.h similarity index 95% rename from ReactCommon/fabric/components/slider/SliderState.h rename to ReactCommon/react/renderer/components/slider/SliderState.h index 1d5c803a404bd6..4aa4927faf64c1 100644 --- a/ReactCommon/fabric/components/slider/SliderState.h +++ b/ReactCommon/react/renderer/components/slider/SliderState.h @@ -8,8 +8,8 @@ #pragma once #include -#include -#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/slider/platform/android/SliderMeasurementsManager.cpp b/ReactCommon/react/renderer/components/slider/platform/android/SliderMeasurementsManager.cpp similarity index 97% rename from ReactCommon/fabric/components/slider/platform/android/SliderMeasurementsManager.cpp rename to ReactCommon/react/renderer/components/slider/platform/android/SliderMeasurementsManager.cpp index 60640edf5793f0..0f7322ad0efbbf 100644 --- a/ReactCommon/fabric/components/slider/platform/android/SliderMeasurementsManager.cpp +++ b/ReactCommon/react/renderer/components/slider/platform/android/SliderMeasurementsManager.cpp @@ -8,8 +8,8 @@ #include "SliderMeasurementsManager.h" #include -#include #include +#include using namespace facebook::jni; diff --git a/ReactCommon/fabric/components/slider/platform/android/SliderMeasurementsManager.h b/ReactCommon/react/renderer/components/slider/platform/android/SliderMeasurementsManager.h similarity index 89% rename from ReactCommon/fabric/components/slider/platform/android/SliderMeasurementsManager.h rename to ReactCommon/react/renderer/components/slider/platform/android/SliderMeasurementsManager.h index 8bd4db64f97f75..19ba0c4f7de293 100644 --- a/ReactCommon/fabric/components/slider/platform/android/SliderMeasurementsManager.h +++ b/ReactCommon/react/renderer/components/slider/platform/android/SliderMeasurementsManager.h @@ -7,8 +7,8 @@ #pragma once -#include -#include +#include +#include #include namespace facebook { diff --git a/ReactCommon/fabric/components/slider/platform/ios/SliderMeasurementsManager.cpp b/ReactCommon/react/renderer/components/slider/platform/ios/SliderMeasurementsManager.cpp similarity index 100% rename from ReactCommon/fabric/components/slider/platform/ios/SliderMeasurementsManager.cpp rename to ReactCommon/react/renderer/components/slider/platform/ios/SliderMeasurementsManager.cpp diff --git a/ReactCommon/fabric/components/slider/platform/ios/SliderMeasurementsManager.h b/ReactCommon/react/renderer/components/slider/platform/ios/SliderMeasurementsManager.h similarity index 87% rename from ReactCommon/fabric/components/slider/platform/ios/SliderMeasurementsManager.h rename to ReactCommon/react/renderer/components/slider/platform/ios/SliderMeasurementsManager.h index fb37871c7cb58b..f78ff2bb2704ca 100644 --- a/ReactCommon/fabric/components/slider/platform/ios/SliderMeasurementsManager.h +++ b/ReactCommon/react/renderer/components/slider/platform/ios/SliderMeasurementsManager.h @@ -7,8 +7,8 @@ #pragma once -#include -#include +#include +#include #include namespace facebook { diff --git a/ReactCommon/fabric/components/slider/tests/SliderTest.cpp b/ReactCommon/react/renderer/components/slider/tests/SliderTest.cpp similarity index 100% rename from ReactCommon/fabric/components/slider/tests/SliderTest.cpp rename to ReactCommon/react/renderer/components/slider/tests/SliderTest.cpp diff --git a/ReactCommon/fabric/components/switch/BUCK b/ReactCommon/react/renderer/components/switch/BUCK similarity index 84% rename from ReactCommon/fabric/components/switch/BUCK rename to ReactCommon/react/renderer/components/switch/BUCK index c3a23b7811836c..67b258e98a6670 100644 --- a/ReactCommon/fabric/components/switch/BUCK +++ b/ReactCommon/react/renderer/components/switch/BUCK @@ -32,7 +32,7 @@ rn_xplat_cxx_library( ("", "*.h"), ("androidswitch", "*.h"), ], - prefix = "react/components/androidswitch", + prefix = "react/renderer/components/androidswitch", ), compiler_flags = [ "-fexceptions", @@ -61,12 +61,12 @@ rn_xplat_cxx_library( "//xplat/folly:memory", "//xplat/folly:molly", YOGA_CXX_TARGET, - react_native_xplat_target("fabric/debug:debug"), - react_native_xplat_target("fabric/core:core"), - react_native_xplat_target("fabric/graphics:graphics"), - react_native_xplat_target("fabric/components/view:view"), - react_native_xplat_target("fabric/uimanager:uimanager"), - react_native_xplat_target("fabric/componentregistry:componentregistry"), + react_native_xplat_target("react/renderer/debug:debug"), + react_native_xplat_target("react/renderer/core:core"), + react_native_xplat_target("react/renderer/graphics:graphics"), + react_native_xplat_target("react/renderer/components/view:view"), + react_native_xplat_target("react/renderer/uimanager:uimanager"), + react_native_xplat_target("react/renderer/componentregistry:componentregistry"), "//xplat/js/react-native-github:generated_components-rncore", ], ) diff --git a/ReactCommon/fabric/components/switch/androidswitch/AndroidSwitchComponentDescriptor.h b/ReactCommon/react/renderer/components/switch/androidswitch/AndroidSwitchComponentDescriptor.h similarity index 96% rename from ReactCommon/fabric/components/switch/androidswitch/AndroidSwitchComponentDescriptor.h rename to ReactCommon/react/renderer/components/switch/androidswitch/AndroidSwitchComponentDescriptor.h index 0cc69dee54c0a4..42a249017da917 100644 --- a/ReactCommon/fabric/components/switch/androidswitch/AndroidSwitchComponentDescriptor.h +++ b/ReactCommon/react/renderer/components/switch/androidswitch/AndroidSwitchComponentDescriptor.h @@ -10,7 +10,7 @@ #include "AndroidSwitchMeasurementsManager.h" #include "AndroidSwitchShadowNode.h" -#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/switch/androidswitch/AndroidSwitchMeasurementsManager.cpp b/ReactCommon/react/renderer/components/switch/androidswitch/AndroidSwitchMeasurementsManager.cpp similarity index 97% rename from ReactCommon/fabric/components/switch/androidswitch/AndroidSwitchMeasurementsManager.cpp rename to ReactCommon/react/renderer/components/switch/androidswitch/AndroidSwitchMeasurementsManager.cpp index b16f62b3f165d7..1d8d53e9c16d97 100644 --- a/ReactCommon/fabric/components/switch/androidswitch/AndroidSwitchMeasurementsManager.cpp +++ b/ReactCommon/react/renderer/components/switch/androidswitch/AndroidSwitchMeasurementsManager.cpp @@ -8,8 +8,8 @@ #include "AndroidSwitchMeasurementsManager.h" #include -#include #include +#include using namespace facebook::jni; diff --git a/ReactCommon/fabric/components/switch/androidswitch/AndroidSwitchMeasurementsManager.h b/ReactCommon/react/renderer/components/switch/androidswitch/AndroidSwitchMeasurementsManager.h similarity index 87% rename from ReactCommon/fabric/components/switch/androidswitch/AndroidSwitchMeasurementsManager.h rename to ReactCommon/react/renderer/components/switch/androidswitch/AndroidSwitchMeasurementsManager.h index f13d4c9c01ffcc..1d7672df504e1f 100644 --- a/ReactCommon/fabric/components/switch/androidswitch/AndroidSwitchMeasurementsManager.h +++ b/ReactCommon/react/renderer/components/switch/androidswitch/AndroidSwitchMeasurementsManager.h @@ -7,8 +7,8 @@ #pragma once -#include -#include +#include +#include #include namespace facebook { diff --git a/ReactCommon/fabric/components/switch/androidswitch/AndroidSwitchShadowNode.cpp b/ReactCommon/react/renderer/components/switch/androidswitch/AndroidSwitchShadowNode.cpp similarity index 100% rename from ReactCommon/fabric/components/switch/androidswitch/AndroidSwitchShadowNode.cpp rename to ReactCommon/react/renderer/components/switch/androidswitch/AndroidSwitchShadowNode.cpp diff --git a/ReactCommon/fabric/components/switch/androidswitch/AndroidSwitchShadowNode.h b/ReactCommon/react/renderer/components/switch/androidswitch/AndroidSwitchShadowNode.h similarity index 87% rename from ReactCommon/fabric/components/switch/androidswitch/AndroidSwitchShadowNode.h rename to ReactCommon/react/renderer/components/switch/androidswitch/AndroidSwitchShadowNode.h index e65ce7caabf417..f002902dd64456 100644 --- a/ReactCommon/fabric/components/switch/androidswitch/AndroidSwitchShadowNode.h +++ b/ReactCommon/react/renderer/components/switch/androidswitch/AndroidSwitchShadowNode.h @@ -9,9 +9,9 @@ #include "AndroidSwitchMeasurementsManager.h" -#include -#include -#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/text/BUCK b/ReactCommon/react/renderer/components/text/BUCK similarity index 79% rename from ReactCommon/fabric/components/text/BUCK rename to ReactCommon/react/renderer/components/text/BUCK index f7d5ded2085661..f8a47669a4ce09 100644 --- a/ReactCommon/fabric/components/text/BUCK +++ b/ReactCommon/react/renderer/components/text/BUCK @@ -34,7 +34,7 @@ rn_xplat_cxx_library( ("text", "*.h"), ("rawtext", "*.h"), ], - prefix = "react/components/text", + prefix = "react/renderer/components/text", ), compiler_flags = [ "-fexceptions", @@ -62,14 +62,14 @@ rn_xplat_cxx_library( "//xplat/folly:molly", YOGA_CXX_TARGET, react_native_xplat_target("utils:utils"), - react_native_xplat_target("fabric/attributedstring:attributedstring"), - react_native_xplat_target("fabric/core:core"), - react_native_xplat_target("fabric/debug:debug"), - react_native_xplat_target("fabric/graphics:graphics"), - react_native_xplat_target("fabric/textlayoutmanager:textlayoutmanager"), - react_native_xplat_target("fabric/components/view:view"), - react_native_xplat_target("fabric/uimanager:uimanager"), - react_native_xplat_target("fabric/componentregistry:componentregistry"), + react_native_xplat_target("react/renderer/attributedstring:attributedstring"), + react_native_xplat_target("react/renderer/core:core"), + react_native_xplat_target("react/renderer/debug:debug"), + react_native_xplat_target("react/renderer/graphics:graphics"), + react_native_xplat_target("react/renderer/textlayoutmanager:textlayoutmanager"), + react_native_xplat_target("react/renderer/components/view:view"), + react_native_xplat_target("react/renderer/uimanager:uimanager"), + react_native_xplat_target("react/renderer/componentregistry:componentregistry"), ], ) diff --git a/ReactCommon/fabric/components/text/basetext/BaseTextProps.cpp b/ReactCommon/react/renderer/components/text/basetext/BaseTextProps.cpp similarity index 95% rename from ReactCommon/fabric/components/text/basetext/BaseTextProps.cpp rename to ReactCommon/react/renderer/components/text/basetext/BaseTextProps.cpp index 51fd3821e23acf..cae5c975a3d506 100644 --- a/ReactCommon/fabric/components/text/basetext/BaseTextProps.cpp +++ b/ReactCommon/react/renderer/components/text/basetext/BaseTextProps.cpp @@ -7,10 +7,10 @@ #include "BaseTextProps.h" -#include -#include -#include -#include +#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/text/basetext/BaseTextProps.h b/ReactCommon/react/renderer/components/text/basetext/BaseTextProps.h similarity index 80% rename from ReactCommon/fabric/components/text/basetext/BaseTextProps.h rename to ReactCommon/react/renderer/components/text/basetext/BaseTextProps.h index 5554277f2daa1a..4e4fefbafe5838 100644 --- a/ReactCommon/fabric/components/text/basetext/BaseTextProps.h +++ b/ReactCommon/react/renderer/components/text/basetext/BaseTextProps.h @@ -7,10 +7,10 @@ #pragma once -#include -#include -#include -#include +#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/text/basetext/BaseTextShadowNode.cpp b/ReactCommon/react/renderer/components/text/basetext/BaseTextShadowNode.cpp similarity index 90% rename from ReactCommon/fabric/components/text/basetext/BaseTextShadowNode.cpp rename to ReactCommon/react/renderer/components/text/basetext/BaseTextShadowNode.cpp index e892881c43d588..638317f19a4062 100644 --- a/ReactCommon/fabric/components/text/basetext/BaseTextShadowNode.cpp +++ b/ReactCommon/react/renderer/components/text/basetext/BaseTextShadowNode.cpp @@ -7,11 +7,11 @@ #include "BaseTextShadowNode.h" -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/text/basetext/BaseTextShadowNode.h b/ReactCommon/react/renderer/components/text/basetext/BaseTextShadowNode.h similarity index 93% rename from ReactCommon/fabric/components/text/basetext/BaseTextShadowNode.h rename to ReactCommon/react/renderer/components/text/basetext/BaseTextShadowNode.h index be95f4cacf1af6..49d8733645c874 100644 --- a/ReactCommon/fabric/components/text/basetext/BaseTextShadowNode.h +++ b/ReactCommon/react/renderer/components/text/basetext/BaseTextShadowNode.h @@ -7,8 +7,8 @@ #pragma once -#include -#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/text/paragraph/ParagraphComponentDescriptor.h b/ReactCommon/react/renderer/components/text/paragraph/ParagraphComponentDescriptor.h similarity index 91% rename from ReactCommon/fabric/components/text/paragraph/ParagraphComponentDescriptor.h rename to ReactCommon/react/renderer/components/text/paragraph/ParagraphComponentDescriptor.h index 0ec89c568312f8..d2e925f4c8c80a 100644 --- a/ReactCommon/fabric/components/text/paragraph/ParagraphComponentDescriptor.h +++ b/ReactCommon/react/renderer/components/text/paragraph/ParagraphComponentDescriptor.h @@ -9,10 +9,10 @@ #include "ParagraphShadowNode.h" -#include #include -#include -#include +#include +#include +#include #include namespace facebook { diff --git a/ReactCommon/fabric/components/text/paragraph/ParagraphProps.cpp b/ReactCommon/react/renderer/components/text/paragraph/ParagraphProps.cpp similarity index 85% rename from ReactCommon/fabric/components/text/paragraph/ParagraphProps.cpp rename to ReactCommon/react/renderer/components/text/paragraph/ParagraphProps.cpp index fc731707084b53..5d8652d2f1f866 100644 --- a/ReactCommon/fabric/components/text/paragraph/ParagraphProps.cpp +++ b/ReactCommon/react/renderer/components/text/paragraph/ParagraphProps.cpp @@ -7,10 +7,10 @@ #include "ParagraphProps.h" -#include -#include -#include -#include +#include +#include +#include +#include #include diff --git a/ReactCommon/fabric/components/text/paragraph/ParagraphProps.h b/ReactCommon/react/renderer/components/text/paragraph/ParagraphProps.h similarity index 83% rename from ReactCommon/fabric/components/text/paragraph/ParagraphProps.h rename to ReactCommon/react/renderer/components/text/paragraph/ParagraphProps.h index 235b80c13b2f78..07622f7e99f02e 100644 --- a/ReactCommon/fabric/components/text/paragraph/ParagraphProps.h +++ b/ReactCommon/react/renderer/components/text/paragraph/ParagraphProps.h @@ -10,10 +10,10 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/text/paragraph/ParagraphShadowNode.cpp b/ReactCommon/react/renderer/components/text/paragraph/ParagraphShadowNode.cpp similarity index 97% rename from ReactCommon/fabric/components/text/paragraph/ParagraphShadowNode.cpp rename to ReactCommon/react/renderer/components/text/paragraph/ParagraphShadowNode.cpp index c81e1c1b4f0e93..6ad8568534cd41 100644 --- a/ReactCommon/fabric/components/text/paragraph/ParagraphShadowNode.cpp +++ b/ReactCommon/react/renderer/components/text/paragraph/ParagraphShadowNode.cpp @@ -9,10 +9,10 @@ #include -#include -#include -#include -#include +#include +#include +#include +#include #include "ParagraphState.h" diff --git a/ReactCommon/fabric/components/text/paragraph/ParagraphShadowNode.h b/ReactCommon/react/renderer/components/text/paragraph/ParagraphShadowNode.h similarity index 86% rename from ReactCommon/fabric/components/text/paragraph/ParagraphShadowNode.h rename to ReactCommon/react/renderer/components/text/paragraph/ParagraphShadowNode.h index 3e4441b0075805..a3d0ce0c6e9958 100644 --- a/ReactCommon/fabric/components/text/paragraph/ParagraphShadowNode.h +++ b/ReactCommon/react/renderer/components/text/paragraph/ParagraphShadowNode.h @@ -8,14 +8,14 @@ #pragma once #include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/text/paragraph/ParagraphState.cpp b/ReactCommon/react/renderer/components/text/paragraph/ParagraphState.cpp similarity index 77% rename from ReactCommon/fabric/components/text/paragraph/ParagraphState.cpp rename to ReactCommon/react/renderer/components/text/paragraph/ParagraphState.cpp index 59f4072defac19..c91bb6e480f41e 100644 --- a/ReactCommon/fabric/components/text/paragraph/ParagraphState.cpp +++ b/ReactCommon/react/renderer/components/text/paragraph/ParagraphState.cpp @@ -7,8 +7,8 @@ #include "ParagraphState.h" -#include -#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/text/paragraph/ParagraphState.h b/ReactCommon/react/renderer/components/text/paragraph/ParagraphState.h similarity index 88% rename from ReactCommon/fabric/components/text/paragraph/ParagraphState.h rename to ReactCommon/react/renderer/components/text/paragraph/ParagraphState.h index f3dcf3abfa1c1c..8f320af68e6a1f 100644 --- a/ReactCommon/fabric/components/text/paragraph/ParagraphState.h +++ b/ReactCommon/react/renderer/components/text/paragraph/ParagraphState.h @@ -7,9 +7,9 @@ #pragma once -#include -#include -#include +#include +#include +#include #ifdef ANDROID #include diff --git a/ReactCommon/fabric/components/text/paragraph/conversions.h b/ReactCommon/react/renderer/components/text/paragraph/conversions.h similarity index 85% rename from ReactCommon/fabric/components/text/paragraph/conversions.h rename to ReactCommon/react/renderer/components/text/paragraph/conversions.h index 9e1f2f1f918c43..0d44cd762143c6 100644 --- a/ReactCommon/fabric/components/text/paragraph/conversions.h +++ b/ReactCommon/react/renderer/components/text/paragraph/conversions.h @@ -6,8 +6,8 @@ */ #include -#include -#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/text/rawtext/RawTextComponentDescriptor.h b/ReactCommon/react/renderer/components/text/rawtext/RawTextComponentDescriptor.h similarity index 75% rename from ReactCommon/fabric/components/text/rawtext/RawTextComponentDescriptor.h rename to ReactCommon/react/renderer/components/text/rawtext/RawTextComponentDescriptor.h index 1f002070346ca5..5a437ec89612b4 100644 --- a/ReactCommon/fabric/components/text/rawtext/RawTextComponentDescriptor.h +++ b/ReactCommon/react/renderer/components/text/rawtext/RawTextComponentDescriptor.h @@ -7,8 +7,8 @@ #pragma once -#include -#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/text/rawtext/RawTextProps.cpp b/ReactCommon/react/renderer/components/text/rawtext/RawTextProps.cpp similarity index 86% rename from ReactCommon/fabric/components/text/rawtext/RawTextProps.cpp rename to ReactCommon/react/renderer/components/text/rawtext/RawTextProps.cpp index 71cc7ded956e37..d54292bc527c6a 100644 --- a/ReactCommon/fabric/components/text/rawtext/RawTextProps.cpp +++ b/ReactCommon/react/renderer/components/text/rawtext/RawTextProps.cpp @@ -7,8 +7,8 @@ #include "RawTextProps.h" -#include -#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/text/rawtext/RawTextProps.h b/ReactCommon/react/renderer/components/text/rawtext/RawTextProps.h similarity index 85% rename from ReactCommon/fabric/components/text/rawtext/RawTextProps.h rename to ReactCommon/react/renderer/components/text/rawtext/RawTextProps.h index 88a1538bd8b525..4b98953a0a262d 100644 --- a/ReactCommon/fabric/components/text/rawtext/RawTextProps.h +++ b/ReactCommon/react/renderer/components/text/rawtext/RawTextProps.h @@ -9,8 +9,8 @@ #include -#include -#include +#include +#include namespace facebook { namespace react { @@ -26,7 +26,7 @@ class RawTextProps : public Props { #pragma mark - Props - const std::string text{}; + std::string text{}; #pragma mark - DebugStringConvertible diff --git a/ReactCommon/fabric/components/text/rawtext/RawTextShadowNode.cpp b/ReactCommon/react/renderer/components/text/rawtext/RawTextShadowNode.cpp similarity index 100% rename from ReactCommon/fabric/components/text/rawtext/RawTextShadowNode.cpp rename to ReactCommon/react/renderer/components/text/rawtext/RawTextShadowNode.cpp diff --git a/ReactCommon/fabric/components/text/rawtext/RawTextShadowNode.h b/ReactCommon/react/renderer/components/text/rawtext/RawTextShadowNode.h similarity index 86% rename from ReactCommon/fabric/components/text/rawtext/RawTextShadowNode.h rename to ReactCommon/react/renderer/components/text/rawtext/RawTextShadowNode.h index e93368a8c69f3f..b11297ee3533e8 100644 --- a/ReactCommon/fabric/components/text/rawtext/RawTextShadowNode.h +++ b/ReactCommon/react/renderer/components/text/rawtext/RawTextShadowNode.h @@ -7,8 +7,8 @@ #pragma once -#include -#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/text/tests/ParagraphLocalDataTest.cpp b/ReactCommon/react/renderer/components/text/tests/ParagraphLocalDataTest.cpp similarity index 83% rename from ReactCommon/fabric/components/text/tests/ParagraphLocalDataTest.cpp rename to ReactCommon/react/renderer/components/text/tests/ParagraphLocalDataTest.cpp index 36692ac33e4fa0..24e51148450f3c 100644 --- a/ReactCommon/fabric/components/text/tests/ParagraphLocalDataTest.cpp +++ b/ReactCommon/react/renderer/components/text/tests/ParagraphLocalDataTest.cpp @@ -9,11 +9,11 @@ #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/text/tests/TextTest.cpp b/ReactCommon/react/renderer/components/text/tests/TextTest.cpp similarity index 100% rename from ReactCommon/fabric/components/text/tests/TextTest.cpp rename to ReactCommon/react/renderer/components/text/tests/TextTest.cpp diff --git a/ReactCommon/fabric/components/text/text/TextComponentDescriptor.h b/ReactCommon/react/renderer/components/text/text/TextComponentDescriptor.h similarity index 75% rename from ReactCommon/fabric/components/text/text/TextComponentDescriptor.h rename to ReactCommon/react/renderer/components/text/text/TextComponentDescriptor.h index c43013b4b6c315..12e6b54512e145 100644 --- a/ReactCommon/fabric/components/text/text/TextComponentDescriptor.h +++ b/ReactCommon/react/renderer/components/text/text/TextComponentDescriptor.h @@ -7,8 +7,8 @@ #pragma once -#include -#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/text/text/TextProps.cpp b/ReactCommon/react/renderer/components/text/text/TextProps.cpp similarity index 100% rename from ReactCommon/fabric/components/text/text/TextProps.cpp rename to ReactCommon/react/renderer/components/text/text/TextProps.cpp diff --git a/ReactCommon/fabric/components/text/text/TextProps.h b/ReactCommon/react/renderer/components/text/text/TextProps.h similarity index 70% rename from ReactCommon/fabric/components/text/text/TextProps.h rename to ReactCommon/react/renderer/components/text/text/TextProps.h index 3960004baee66a..31e7be2a84fdf1 100644 --- a/ReactCommon/fabric/components/text/text/TextProps.h +++ b/ReactCommon/react/renderer/components/text/text/TextProps.h @@ -7,11 +7,11 @@ #pragma once -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/text/text/TextShadowNode.cpp b/ReactCommon/react/renderer/components/text/text/TextShadowNode.cpp similarity index 100% rename from ReactCommon/fabric/components/text/text/TextShadowNode.cpp rename to ReactCommon/react/renderer/components/text/text/TextShadowNode.cpp diff --git a/ReactCommon/fabric/components/text/text/TextShadowNode.h b/ReactCommon/react/renderer/components/text/text/TextShadowNode.h similarity index 85% rename from ReactCommon/fabric/components/text/text/TextShadowNode.h rename to ReactCommon/react/renderer/components/text/text/TextShadowNode.h index 76d333223ab87f..15d1fc308c5bcf 100644 --- a/ReactCommon/fabric/components/text/text/TextShadowNode.h +++ b/ReactCommon/react/renderer/components/text/text/TextShadowNode.h @@ -9,10 +9,10 @@ #include -#include -#include -#include -#include +#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/textinput/BUCK b/ReactCommon/react/renderer/components/textinput/BUCK similarity index 74% rename from ReactCommon/fabric/components/textinput/BUCK rename to ReactCommon/react/renderer/components/textinput/BUCK index 49df25270c9066..c495d90365ee01 100644 --- a/ReactCommon/fabric/components/textinput/BUCK +++ b/ReactCommon/react/renderer/components/textinput/BUCK @@ -31,7 +31,7 @@ rn_xplat_cxx_library( ("", "*.h"), ("androidtextinput", "*.h"), ], - prefix = "react/components/androidtextinput", + prefix = "react/renderer/components/androidtextinput", ), compiler_flags = [ "-fexceptions", @@ -59,17 +59,17 @@ rn_xplat_cxx_library( "//xplat/folly:molly", YOGA_CXX_TARGET, react_native_xplat_target("utils:utils"), - react_native_xplat_target("fabric/attributedstring:attributedstring"), - react_native_xplat_target("fabric/core:core"), - react_native_xplat_target("fabric/debug:debug"), - react_native_xplat_target("fabric/graphics:graphics"), - react_native_xplat_target("fabric/textlayoutmanager:textlayoutmanager"), - react_native_xplat_target("fabric/components/text:text"), - react_native_xplat_target("fabric/components/view:view"), - react_native_xplat_target("fabric/components/image:image"), - react_native_xplat_target("fabric/uimanager:uimanager"), - react_native_xplat_target("fabric/componentregistry:componentregistry"), - react_native_xplat_target("fabric/imagemanager:imagemanager"), + react_native_xplat_target("react/renderer/attributedstring:attributedstring"), + react_native_xplat_target("react/renderer/core:core"), + react_native_xplat_target("react/renderer/debug:debug"), + react_native_xplat_target("react/renderer/graphics:graphics"), + react_native_xplat_target("react/renderer/textlayoutmanager:textlayoutmanager"), + react_native_xplat_target("react/renderer/components/text:text"), + react_native_xplat_target("react/renderer/components/view:view"), + react_native_xplat_target("react/renderer/components/image:image"), + react_native_xplat_target("react/renderer/uimanager:uimanager"), + react_native_xplat_target("react/renderer/componentregistry:componentregistry"), + react_native_xplat_target("react/renderer/imagemanager:imagemanager"), ], ) diff --git a/ReactCommon/fabric/components/textinput/androidtextinput/AndroidTextInputComponentDescriptor.h b/ReactCommon/react/renderer/components/textinput/androidtextinput/AndroidTextInputComponentDescriptor.h similarity index 99% rename from ReactCommon/fabric/components/textinput/androidtextinput/AndroidTextInputComponentDescriptor.h rename to ReactCommon/react/renderer/components/textinput/androidtextinput/AndroidTextInputComponentDescriptor.h index 1644fc6b625261..3918684ed6015e 100644 --- a/ReactCommon/fabric/components/textinput/androidtextinput/AndroidTextInputComponentDescriptor.h +++ b/ReactCommon/react/renderer/components/textinput/androidtextinput/AndroidTextInputComponentDescriptor.h @@ -8,7 +8,7 @@ #pragma once #include -#include +#include #include "AndroidTextInputShadowNode.h" #include diff --git a/ReactCommon/fabric/components/textinput/androidtextinput/AndroidTextInputEventEmitter.cpp b/ReactCommon/react/renderer/components/textinput/androidtextinput/AndroidTextInputEventEmitter.cpp similarity index 100% rename from ReactCommon/fabric/components/textinput/androidtextinput/AndroidTextInputEventEmitter.cpp rename to ReactCommon/react/renderer/components/textinput/androidtextinput/AndroidTextInputEventEmitter.cpp diff --git a/ReactCommon/fabric/components/textinput/androidtextinput/AndroidTextInputEventEmitter.h b/ReactCommon/react/renderer/components/textinput/androidtextinput/AndroidTextInputEventEmitter.h similarity index 98% rename from ReactCommon/fabric/components/textinput/androidtextinput/AndroidTextInputEventEmitter.h rename to ReactCommon/react/renderer/components/textinput/androidtextinput/AndroidTextInputEventEmitter.h index fd643e44c9c6c3..b99192b244f861 100644 --- a/ReactCommon/fabric/components/textinput/androidtextinput/AndroidTextInputEventEmitter.h +++ b/ReactCommon/react/renderer/components/textinput/androidtextinput/AndroidTextInputEventEmitter.h @@ -7,7 +7,7 @@ #pragma once -#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/textinput/androidtextinput/AndroidTextInputProps.cpp b/ReactCommon/react/renderer/components/textinput/androidtextinput/AndroidTextInputProps.cpp similarity index 98% rename from ReactCommon/fabric/components/textinput/androidtextinput/AndroidTextInputProps.cpp rename to ReactCommon/react/renderer/components/textinput/androidtextinput/AndroidTextInputProps.cpp index 670bbffa36e758..c3907cd9a70d4f 100644 --- a/ReactCommon/fabric/components/textinput/androidtextinput/AndroidTextInputProps.cpp +++ b/ReactCommon/react/renderer/components/textinput/androidtextinput/AndroidTextInputProps.cpp @@ -6,9 +6,9 @@ */ #include "AndroidTextInputProps.h" -#include -#include -#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/textinput/androidtextinput/AndroidTextInputProps.h b/ReactCommon/react/renderer/components/textinput/androidtextinput/AndroidTextInputProps.h similarity index 89% rename from ReactCommon/fabric/components/textinput/androidtextinput/AndroidTextInputProps.h rename to ReactCommon/react/renderer/components/textinput/androidtextinput/AndroidTextInputProps.h index acd185b0d85c6b..18f0bcf4ac60a1 100644 --- a/ReactCommon/fabric/components/textinput/androidtextinput/AndroidTextInputProps.h +++ b/ReactCommon/react/renderer/components/textinput/androidtextinput/AndroidTextInputProps.h @@ -7,18 +7,18 @@ #pragma once -// #include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include +// #include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include #include #include diff --git a/ReactCommon/fabric/components/textinput/androidtextinput/AndroidTextInputShadowNode.cpp b/ReactCommon/react/renderer/components/textinput/androidtextinput/AndroidTextInputShadowNode.cpp similarity index 95% rename from ReactCommon/fabric/components/textinput/androidtextinput/AndroidTextInputShadowNode.cpp rename to ReactCommon/react/renderer/components/textinput/androidtextinput/AndroidTextInputShadowNode.cpp index dadeb8977b2d6b..ca3a97dc96a9aa 100644 --- a/ReactCommon/fabric/components/textinput/androidtextinput/AndroidTextInputShadowNode.cpp +++ b/ReactCommon/react/renderer/components/textinput/androidtextinput/AndroidTextInputShadowNode.cpp @@ -8,13 +8,13 @@ #include "AndroidTextInputShadowNode.h" #include -#include -#include -#include -#include -#include -#include #include +#include +#include +#include +#include +#include +#include using namespace facebook::jni; diff --git a/ReactCommon/fabric/components/textinput/androidtextinput/AndroidTextInputShadowNode.h b/ReactCommon/react/renderer/components/textinput/androidtextinput/AndroidTextInputShadowNode.h similarity index 92% rename from ReactCommon/fabric/components/textinput/androidtextinput/AndroidTextInputShadowNode.h rename to ReactCommon/react/renderer/components/textinput/androidtextinput/AndroidTextInputShadowNode.h index 45714febee6d2f..ac322666e0f452 100644 --- a/ReactCommon/fabric/components/textinput/androidtextinput/AndroidTextInputShadowNode.h +++ b/ReactCommon/react/renderer/components/textinput/androidtextinput/AndroidTextInputShadowNode.h @@ -11,10 +11,10 @@ #include "AndroidTextInputProps.h" #include "AndroidTextInputState.h" -#include +#include #include -#include +#include namespace facebook { namespace react { @@ -81,7 +81,7 @@ class AndroidTextInputShadowNode : public ConcreteViewShadowNode< * Cached attributed string that represents the content of the subtree started * from the node. */ - mutable folly::Optional cachedAttributedString_{}; + mutable better::optional cachedAttributedString_{}; }; } // namespace react diff --git a/ReactCommon/fabric/components/textinput/androidtextinput/AndroidTextInputState.cpp b/ReactCommon/react/renderer/components/textinput/androidtextinput/AndroidTextInputState.cpp similarity index 86% rename from ReactCommon/fabric/components/textinput/androidtextinput/AndroidTextInputState.cpp rename to ReactCommon/react/renderer/components/textinput/androidtextinput/AndroidTextInputState.cpp index 4e37be0aa6fc74..d5106ef5fed786 100644 --- a/ReactCommon/fabric/components/textinput/androidtextinput/AndroidTextInputState.cpp +++ b/ReactCommon/react/renderer/components/textinput/androidtextinput/AndroidTextInputState.cpp @@ -7,8 +7,8 @@ #include "AndroidTextInputState.h" -#include -#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/textinput/androidtextinput/AndroidTextInputState.h b/ReactCommon/react/renderer/components/textinput/androidtextinput/AndroidTextInputState.h similarity index 97% rename from ReactCommon/fabric/components/textinput/androidtextinput/AndroidTextInputState.h rename to ReactCommon/react/renderer/components/textinput/androidtextinput/AndroidTextInputState.h index d9505729de892b..3f60eb0bbab342 100644 --- a/ReactCommon/fabric/components/textinput/androidtextinput/AndroidTextInputState.h +++ b/ReactCommon/react/renderer/components/textinput/androidtextinput/AndroidTextInputState.h @@ -7,9 +7,9 @@ #pragma once -#include -#include -#include +#include +#include +#include #ifdef ANDROID #include diff --git a/ReactCommon/fabric/components/textinput/iostextinput/BUCK b/ReactCommon/react/renderer/components/textinput/iostextinput/BUCK similarity index 74% rename from ReactCommon/fabric/components/textinput/iostextinput/BUCK rename to ReactCommon/react/renderer/components/textinput/iostextinput/BUCK index f432474e0b2f9a..058e8b60db4948 100644 --- a/ReactCommon/fabric/components/textinput/iostextinput/BUCK +++ b/ReactCommon/react/renderer/components/textinput/iostextinput/BUCK @@ -31,7 +31,7 @@ rn_xplat_cxx_library( ("", "*.h"), ], # TODO(shergin) T26519801 Figure out better directories structure - prefix = "react/components/iostextinput", + prefix = "react/renderer/components/iostextinput", ), compiler_flags = [ "-fexceptions", @@ -59,17 +59,17 @@ rn_xplat_cxx_library( "//xplat/folly:molly", YOGA_CXX_TARGET, react_native_xplat_target("utils:utils"), - react_native_xplat_target("fabric/attributedstring:attributedstring"), - react_native_xplat_target("fabric/core:core"), - react_native_xplat_target("fabric/debug:debug"), - react_native_xplat_target("fabric/graphics:graphics"), - react_native_xplat_target("fabric/textlayoutmanager:textlayoutmanager"), - react_native_xplat_target("fabric/components/text:text"), - react_native_xplat_target("fabric/components/view:view"), - react_native_xplat_target("fabric/components/image:image"), - react_native_xplat_target("fabric/uimanager:uimanager"), - react_native_xplat_target("fabric/componentregistry:componentregistry"), - react_native_xplat_target("fabric/imagemanager:imagemanager"), + react_native_xplat_target("react/renderer/attributedstring:attributedstring"), + react_native_xplat_target("react/renderer/core:core"), + react_native_xplat_target("react/renderer/debug:debug"), + react_native_xplat_target("react/renderer/graphics:graphics"), + react_native_xplat_target("react/renderer/textlayoutmanager:textlayoutmanager"), + react_native_xplat_target("react/renderer/components/text:text"), + react_native_xplat_target("react/renderer/components/view:view"), + react_native_xplat_target("react/renderer/components/image:image"), + react_native_xplat_target("react/renderer/uimanager:uimanager"), + react_native_xplat_target("react/renderer/componentregistry:componentregistry"), + react_native_xplat_target("react/renderer/imagemanager:imagemanager"), ], ) diff --git a/ReactCommon/fabric/components/textinput/iostextinput/TextInputComponentDescriptor.h b/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputComponentDescriptor.h similarity index 90% rename from ReactCommon/fabric/components/textinput/iostextinput/TextInputComponentDescriptor.h rename to ReactCommon/react/renderer/components/textinput/iostextinput/TextInputComponentDescriptor.h index d602d02704132b..9614fd5712d5b8 100644 --- a/ReactCommon/fabric/components/textinput/iostextinput/TextInputComponentDescriptor.h +++ b/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputComponentDescriptor.h @@ -7,8 +7,8 @@ #pragma once -#include -#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/textinput/iostextinput/TextInputEventEmitter.cpp b/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputEventEmitter.cpp similarity index 100% rename from ReactCommon/fabric/components/textinput/iostextinput/TextInputEventEmitter.cpp rename to ReactCommon/react/renderer/components/textinput/iostextinput/TextInputEventEmitter.cpp diff --git a/ReactCommon/fabric/components/textinput/iostextinput/TextInputEventEmitter.h b/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputEventEmitter.h similarity index 92% rename from ReactCommon/fabric/components/textinput/iostextinput/TextInputEventEmitter.h rename to ReactCommon/react/renderer/components/textinput/iostextinput/TextInputEventEmitter.h index 3a143dfbd1d92a..6e5ecd44342ead 100644 --- a/ReactCommon/fabric/components/textinput/iostextinput/TextInputEventEmitter.h +++ b/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputEventEmitter.h @@ -7,8 +7,8 @@ #pragma once -#include -#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/textinput/iostextinput/TextInputProps.cpp b/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputProps.cpp similarity index 92% rename from ReactCommon/fabric/components/textinput/iostextinput/TextInputProps.cpp rename to ReactCommon/react/renderer/components/textinput/iostextinput/TextInputProps.cpp index 972c3768e0d134..e102f463bf4057 100644 --- a/ReactCommon/fabric/components/textinput/iostextinput/TextInputProps.cpp +++ b/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputProps.cpp @@ -7,10 +7,10 @@ #include "TextInputProps.h" -#include -#include -#include -#include +#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/textinput/iostextinput/TextInputProps.h b/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputProps.h similarity index 71% rename from ReactCommon/fabric/components/textinput/iostextinput/TextInputProps.h rename to ReactCommon/react/renderer/components/textinput/iostextinput/TextInputProps.h index 9109a2ae49d450..a12503ff669998 100644 --- a/ReactCommon/fabric/components/textinput/iostextinput/TextInputProps.h +++ b/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputProps.h @@ -7,16 +7,16 @@ #pragma once -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include namespace facebook { diff --git a/ReactCommon/fabric/components/textinput/iostextinput/TextInputShadowNode.cpp b/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputShadowNode.cpp similarity index 93% rename from ReactCommon/fabric/components/textinput/iostextinput/TextInputShadowNode.cpp rename to ReactCommon/react/renderer/components/textinput/iostextinput/TextInputShadowNode.cpp index 8cce95c0af4095..4e771d9e5e5780 100644 --- a/ReactCommon/fabric/components/textinput/iostextinput/TextInputShadowNode.cpp +++ b/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputShadowNode.cpp @@ -7,11 +7,11 @@ #include "TextInputShadowNode.h" -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/textinput/iostextinput/TextInputShadowNode.h b/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputShadowNode.h similarity index 82% rename from ReactCommon/fabric/components/textinput/iostextinput/TextInputShadowNode.h rename to ReactCommon/react/renderer/components/textinput/iostextinput/TextInputShadowNode.h index 035d692379ae70..4924c4f8b6b3b5 100644 --- a/ReactCommon/fabric/components/textinput/iostextinput/TextInputShadowNode.h +++ b/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputShadowNode.h @@ -7,13 +7,13 @@ #pragma once -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include namespace facebook { diff --git a/ReactCommon/fabric/components/textinput/iostextinput/TextInputState.cpp b/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputState.cpp similarity index 100% rename from ReactCommon/fabric/components/textinput/iostextinput/TextInputState.cpp rename to ReactCommon/react/renderer/components/textinput/iostextinput/TextInputState.cpp diff --git a/ReactCommon/fabric/components/textinput/iostextinput/TextInputState.h b/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputState.h similarity index 87% rename from ReactCommon/fabric/components/textinput/iostextinput/TextInputState.h rename to ReactCommon/react/renderer/components/textinput/iostextinput/TextInputState.h index d5085854f06bfc..31ea9c77a2aa03 100644 --- a/ReactCommon/fabric/components/textinput/iostextinput/TextInputState.h +++ b/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputState.h @@ -7,9 +7,9 @@ #pragma once -#include -#include -#include +#include +#include +#include #ifdef ANDROID #include diff --git a/ReactCommon/fabric/components/textinput/iostextinput/conversions.h b/ReactCommon/react/renderer/components/textinput/iostextinput/conversions.h similarity index 97% rename from ReactCommon/fabric/components/textinput/iostextinput/conversions.h rename to ReactCommon/react/renderer/components/textinput/iostextinput/conversions.h index e4daf98f4c65bd..85d2fe926e7742 100644 --- a/ReactCommon/fabric/components/textinput/iostextinput/conversions.h +++ b/ReactCommon/react/renderer/components/textinput/iostextinput/conversions.h @@ -7,8 +7,8 @@ #pragma once -#include -#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/textinput/iostextinput/primitives.h b/ReactCommon/react/renderer/components/textinput/iostextinput/primitives.h similarity index 100% rename from ReactCommon/fabric/components/textinput/iostextinput/primitives.h rename to ReactCommon/react/renderer/components/textinput/iostextinput/primitives.h diff --git a/ReactCommon/fabric/components/textinput/iostextinput/propsConversions.h b/ReactCommon/react/renderer/components/textinput/iostextinput/propsConversions.h similarity index 96% rename from ReactCommon/fabric/components/textinput/iostextinput/propsConversions.h rename to ReactCommon/react/renderer/components/textinput/iostextinput/propsConversions.h index 6b5150d0aae095..4de4dc98d987ce 100644 --- a/ReactCommon/fabric/components/textinput/iostextinput/propsConversions.h +++ b/ReactCommon/react/renderer/components/textinput/iostextinput/propsConversions.h @@ -7,8 +7,8 @@ #pragma once -#include -#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/unimplementedview/BUCK b/ReactCommon/react/renderer/components/unimplementedview/BUCK similarity index 87% rename from ReactCommon/fabric/components/unimplementedview/BUCK rename to ReactCommon/react/renderer/components/unimplementedview/BUCK index 001f9607cdc532..128195f1d948a8 100644 --- a/ReactCommon/fabric/components/unimplementedview/BUCK +++ b/ReactCommon/react/renderer/components/unimplementedview/BUCK @@ -27,7 +27,7 @@ rn_xplat_cxx_library( [ ("", "*.h"), ], - prefix = "react/components/unimplementedview", + prefix = "react/renderer/components/unimplementedview", ), compiler_flags = [ "-fexceptions", @@ -53,9 +53,9 @@ rn_xplat_cxx_library( "//xplat/folly:memory", "//xplat/folly:molly", YOGA_CXX_TARGET, - react_native_xplat_target("fabric/debug:debug"), - react_native_xplat_target("fabric/core:core"), - react_native_xplat_target("fabric/components/view:view"), + react_native_xplat_target("react/renderer/debug:debug"), + react_native_xplat_target("react/renderer/core:core"), + react_native_xplat_target("react/renderer/components/view:view"), ], ) diff --git a/ReactCommon/fabric/components/unimplementedview/UnimplementedViewComponentDescriptor.cpp b/ReactCommon/react/renderer/components/unimplementedview/UnimplementedViewComponentDescriptor.cpp similarity index 100% rename from ReactCommon/fabric/components/unimplementedview/UnimplementedViewComponentDescriptor.cpp rename to ReactCommon/react/renderer/components/unimplementedview/UnimplementedViewComponentDescriptor.cpp diff --git a/ReactCommon/fabric/components/unimplementedview/UnimplementedViewComponentDescriptor.h b/ReactCommon/react/renderer/components/unimplementedview/UnimplementedViewComponentDescriptor.h similarity index 87% rename from ReactCommon/fabric/components/unimplementedview/UnimplementedViewComponentDescriptor.h rename to ReactCommon/react/renderer/components/unimplementedview/UnimplementedViewComponentDescriptor.h index 53b1235959f8e8..b2de61f3b1c935 100644 --- a/ReactCommon/fabric/components/unimplementedview/UnimplementedViewComponentDescriptor.h +++ b/ReactCommon/react/renderer/components/unimplementedview/UnimplementedViewComponentDescriptor.h @@ -7,8 +7,8 @@ #pragma once -#include -#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/unimplementedview/UnimplementedViewProps.cpp b/ReactCommon/react/renderer/components/unimplementedview/UnimplementedViewProps.cpp similarity index 85% rename from ReactCommon/fabric/components/unimplementedview/UnimplementedViewProps.cpp rename to ReactCommon/react/renderer/components/unimplementedview/UnimplementedViewProps.cpp index 2d0d01c7a468f4..b5033818f156ee 100644 --- a/ReactCommon/fabric/components/unimplementedview/UnimplementedViewProps.cpp +++ b/ReactCommon/react/renderer/components/unimplementedview/UnimplementedViewProps.cpp @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/unimplementedview/UnimplementedViewProps.h b/ReactCommon/react/renderer/components/unimplementedview/UnimplementedViewProps.h similarity index 93% rename from ReactCommon/fabric/components/unimplementedview/UnimplementedViewProps.h rename to ReactCommon/react/renderer/components/unimplementedview/UnimplementedViewProps.h index 610157276ecdc5..637769f62f1a73 100644 --- a/ReactCommon/fabric/components/unimplementedview/UnimplementedViewProps.h +++ b/ReactCommon/react/renderer/components/unimplementedview/UnimplementedViewProps.h @@ -7,7 +7,7 @@ #pragma once -#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/unimplementedview/UnimplementedViewShadowNode.cpp b/ReactCommon/react/renderer/components/unimplementedview/UnimplementedViewShadowNode.cpp similarity index 100% rename from ReactCommon/fabric/components/unimplementedview/UnimplementedViewShadowNode.cpp rename to ReactCommon/react/renderer/components/unimplementedview/UnimplementedViewShadowNode.cpp diff --git a/ReactCommon/fabric/components/unimplementedview/UnimplementedViewShadowNode.h b/ReactCommon/react/renderer/components/unimplementedview/UnimplementedViewShadowNode.h similarity index 76% rename from ReactCommon/fabric/components/unimplementedview/UnimplementedViewShadowNode.h rename to ReactCommon/react/renderer/components/unimplementedview/UnimplementedViewShadowNode.h index 136b5e08e513ae..f176f68fc4ae3f 100644 --- a/ReactCommon/fabric/components/unimplementedview/UnimplementedViewShadowNode.h +++ b/ReactCommon/react/renderer/components/unimplementedview/UnimplementedViewShadowNode.h @@ -7,8 +7,8 @@ #pragma once -#include -#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/view/BUCK b/ReactCommon/react/renderer/components/view/BUCK similarity index 81% rename from ReactCommon/fabric/components/view/BUCK rename to ReactCommon/react/renderer/components/view/BUCK index 49b6f31659831c..b729ca907cea0f 100644 --- a/ReactCommon/fabric/components/view/BUCK +++ b/ReactCommon/react/renderer/components/view/BUCK @@ -33,7 +33,7 @@ rn_xplat_cxx_library( ("root", "*.h"), ("yoga", "*.h"), ], - prefix = "react/components/view", + prefix = "react/renderer/components/view", ), compiler_flags = [ "-fexceptions", @@ -60,9 +60,9 @@ rn_xplat_cxx_library( "//xplat/folly:memory", "//xplat/folly:molly", YOGA_CXX_TARGET, - react_native_xplat_target("fabric/core:core"), - react_native_xplat_target("fabric/debug:debug"), - react_native_xplat_target("fabric/graphics:graphics"), + react_native_xplat_target("react/renderer/core:core"), + react_native_xplat_target("react/renderer/debug:debug"), + react_native_xplat_target("react/renderer/graphics:graphics"), ], ) @@ -80,8 +80,8 @@ fb_xplat_cxx_test( platforms = (ANDROID, APPLE, CXX), deps = [ "//xplat/third-party/gmock:gtest", - react_native_xplat_target("fabric/element:element"), - react_native_xplat_target("fabric/components/root:root"), - react_native_xplat_target("fabric/components/view:view"), + react_native_xplat_target("react/renderer/element:element"), + react_native_xplat_target("react/renderer/components/root:root"), + react_native_xplat_target("react/renderer/components/view:view"), ], ) diff --git a/ReactCommon/fabric/components/view/ConcreteViewShadowNode.h b/ReactCommon/react/renderer/components/view/ConcreteViewShadowNode.h similarity index 82% rename from ReactCommon/fabric/components/view/ConcreteViewShadowNode.h rename to ReactCommon/react/renderer/components/view/ConcreteViewShadowNode.h index 9fd77d342ea2b6..0fe2def64c9413 100644 --- a/ReactCommon/fabric/components/view/ConcreteViewShadowNode.h +++ b/ReactCommon/react/renderer/components/view/ConcreteViewShadowNode.h @@ -7,14 +7,14 @@ #pragma once -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include namespace facebook { namespace react { @@ -105,13 +105,18 @@ class ConcreteViewShadowNode : public ConcreteShadowNode< void initialize() noexcept { auto &props = BaseShadowNode::getConcreteProps(); - BaseShadowNode::orderIndex_ = props.zIndex; - if (props.yogaStyle.display() == YGDisplayNone) { BaseShadowNode::traits_.set(ShadowNodeTraits::Trait::Hidden); } else { BaseShadowNode::traits_.unset(ShadowNodeTraits::Trait::Hidden); } + + // `zIndex` is only defined for non-`static` positioned views. + if (props.yogaStyle.positionType() != YGPositionTypeStatic) { + BaseShadowNode::orderIndex_ = props.zIndex.value_or(0); + } else { + BaseShadowNode::orderIndex_ = 0; + } } }; diff --git a/ReactCommon/fabric/components/view/Touch.cpp b/ReactCommon/react/renderer/components/view/Touch.cpp similarity index 100% rename from ReactCommon/fabric/components/view/Touch.cpp rename to ReactCommon/react/renderer/components/view/Touch.cpp diff --git a/ReactCommon/fabric/components/view/Touch.h b/ReactCommon/react/renderer/components/view/Touch.h similarity index 93% rename from ReactCommon/fabric/components/view/Touch.h rename to ReactCommon/react/renderer/components/view/Touch.h index 866850deb3d995..91b6db7522b552 100644 --- a/ReactCommon/fabric/components/view/Touch.h +++ b/ReactCommon/react/renderer/components/view/Touch.h @@ -7,9 +7,9 @@ #pragma once -#include -#include -#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/view/TouchEvent.cpp b/ReactCommon/react/renderer/components/view/TouchEvent.cpp similarity index 100% rename from ReactCommon/fabric/components/view/TouchEvent.cpp rename to ReactCommon/react/renderer/components/view/TouchEvent.cpp diff --git a/ReactCommon/fabric/components/view/TouchEvent.h b/ReactCommon/react/renderer/components/view/TouchEvent.h similarity index 91% rename from ReactCommon/fabric/components/view/TouchEvent.h rename to ReactCommon/react/renderer/components/view/TouchEvent.h index 86022f2b875aab..4725fa4eec4d32 100644 --- a/ReactCommon/fabric/components/view/TouchEvent.h +++ b/ReactCommon/react/renderer/components/view/TouchEvent.h @@ -7,11 +7,11 @@ #pragma once -#include +#include #include -#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/view/TouchEventEmitter.cpp b/ReactCommon/react/renderer/components/view/TouchEventEmitter.cpp similarity index 100% rename from ReactCommon/fabric/components/view/TouchEventEmitter.cpp rename to ReactCommon/react/renderer/components/view/TouchEventEmitter.cpp diff --git a/ReactCommon/fabric/components/view/TouchEventEmitter.h b/ReactCommon/react/renderer/components/view/TouchEventEmitter.h similarity index 76% rename from ReactCommon/fabric/components/view/TouchEventEmitter.h rename to ReactCommon/react/renderer/components/view/TouchEventEmitter.h index f43d5a3037f923..54a29049039994 100644 --- a/ReactCommon/fabric/components/view/TouchEventEmitter.h +++ b/ReactCommon/react/renderer/components/view/TouchEventEmitter.h @@ -7,11 +7,11 @@ #pragma once -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/view/ViewComponentDescriptor.h b/ReactCommon/react/renderer/components/view/ViewComponentDescriptor.h similarity index 88% rename from ReactCommon/fabric/components/view/ViewComponentDescriptor.h rename to ReactCommon/react/renderer/components/view/ViewComponentDescriptor.h index 006081daf3d2de..fd078e656c89b1 100644 --- a/ReactCommon/fabric/components/view/ViewComponentDescriptor.h +++ b/ReactCommon/react/renderer/components/view/ViewComponentDescriptor.h @@ -7,8 +7,8 @@ #pragma once -#include -#include +#include +#include #include "ViewProps.h" #include "ViewPropsInterpolation.h" diff --git a/ReactCommon/fabric/components/view/ViewEventEmitter.cpp b/ReactCommon/react/renderer/components/view/ViewEventEmitter.cpp similarity index 100% rename from ReactCommon/fabric/components/view/ViewEventEmitter.cpp rename to ReactCommon/react/renderer/components/view/ViewEventEmitter.cpp diff --git a/ReactCommon/fabric/components/view/ViewEventEmitter.h b/ReactCommon/react/renderer/components/view/ViewEventEmitter.h similarity index 90% rename from ReactCommon/fabric/components/view/ViewEventEmitter.h rename to ReactCommon/react/renderer/components/view/ViewEventEmitter.h index 608755c5053e61..0aa1f5e588eba2 100644 --- a/ReactCommon/fabric/components/view/ViewEventEmitter.h +++ b/ReactCommon/react/renderer/components/view/ViewEventEmitter.h @@ -10,8 +10,8 @@ #include #include -#include -#include +#include +#include #include "TouchEventEmitter.h" diff --git a/ReactCommon/fabric/components/view/ViewProps.cpp b/ReactCommon/react/renderer/components/view/ViewProps.cpp similarity index 94% rename from ReactCommon/fabric/components/view/ViewProps.cpp rename to ReactCommon/react/renderer/components/view/ViewProps.cpp index f391c7094931b8..a7c4a4b0b72381 100644 --- a/ReactCommon/fabric/components/view/ViewProps.cpp +++ b/ReactCommon/react/renderer/components/view/ViewProps.cpp @@ -9,11 +9,11 @@ #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include namespace facebook { namespace react { @@ -184,7 +184,8 @@ SharedDebugStringConvertibleList ViewProps::getDebugProps() const { return AccessibilityProps::getDebugProps() + YogaStylableProps::getDebugProps() + SharedDebugStringConvertibleList{ - debugStringConvertibleItem("zIndex", zIndex, defaultViewProps.zIndex), + debugStringConvertibleItem( + "zIndex", zIndex, defaultViewProps.zIndex.value_or(0)), debugStringConvertibleItem( "opacity", opacity, defaultViewProps.opacity), debugStringConvertibleItem( diff --git a/ReactCommon/fabric/components/view/ViewProps.h b/ReactCommon/react/renderer/components/view/ViewProps.h similarity index 78% rename from ReactCommon/fabric/components/view/ViewProps.h rename to ReactCommon/react/renderer/components/view/ViewProps.h index 6d004213414569..997353b23b7723 100644 --- a/ReactCommon/fabric/components/view/ViewProps.h +++ b/ReactCommon/react/renderer/components/view/ViewProps.h @@ -7,14 +7,14 @@ #pragma once -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include namespace facebook { namespace react { @@ -50,7 +50,7 @@ class ViewProps : public YogaStylableProps, public AccessibilityProps { Transform transform{}; BackfaceVisibility backfaceVisibility{}; bool shouldRasterize{}; - int zIndex{}; + better::optional zIndex{}; // Events PointerEventsMode pointerEvents{}; diff --git a/ReactCommon/fabric/components/view/ViewPropsInterpolation.h b/ReactCommon/react/renderer/components/view/ViewPropsInterpolation.h similarity index 100% rename from ReactCommon/fabric/components/view/ViewPropsInterpolation.h rename to ReactCommon/react/renderer/components/view/ViewPropsInterpolation.h diff --git a/ReactCommon/fabric/components/view/ViewShadowNode.cpp b/ReactCommon/react/renderer/components/view/ViewShadowNode.cpp similarity index 93% rename from ReactCommon/fabric/components/view/ViewShadowNode.cpp rename to ReactCommon/react/renderer/components/view/ViewShadowNode.cpp index 421f69c7c8bd97..60aa53f5dbde38 100644 --- a/ReactCommon/fabric/components/view/ViewShadowNode.cpp +++ b/ReactCommon/react/renderer/components/view/ViewShadowNode.cpp @@ -6,7 +6,7 @@ */ #include "ViewShadowNode.h" -#include +#include namespace facebook { namespace react { @@ -44,8 +44,8 @@ void ViewShadowNode::initialize() noexcept { !viewProps.nativeId.empty() || viewProps.accessible || viewProps.opacity != 1.0 || viewProps.transform != Transform{} || viewProps.elevation != 0 || - (viewProps.zIndex != 0 && - viewProps.yogaStyle.positionType() == YGPositionTypeAbsolute) || + (viewProps.zIndex.has_value() && + viewProps.yogaStyle.positionType() != YGPositionTypeStatic) || viewProps.yogaStyle.display() == YGDisplayNone || viewProps.getClipsContentToBounds() || isColorMeaningful(viewProps.shadowColor) || diff --git a/ReactCommon/fabric/components/view/ViewShadowNode.h b/ReactCommon/react/renderer/components/view/ViewShadowNode.h similarity index 89% rename from ReactCommon/fabric/components/view/ViewShadowNode.h rename to ReactCommon/react/renderer/components/view/ViewShadowNode.h index 8d27e37143ff2a..0ccf2116e4477a 100644 --- a/ReactCommon/fabric/components/view/ViewShadowNode.h +++ b/ReactCommon/react/renderer/components/view/ViewShadowNode.h @@ -7,8 +7,8 @@ #pragma once -#include -#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/view/accessibility/AccessibilityPrimitives.h b/ReactCommon/react/renderer/components/view/accessibility/AccessibilityPrimitives.h similarity index 88% rename from ReactCommon/fabric/components/view/accessibility/AccessibilityPrimitives.h rename to ReactCommon/react/renderer/components/view/accessibility/AccessibilityPrimitives.h index 5cd1997f99868a..96aa8b2e48156a 100644 --- a/ReactCommon/fabric/components/view/accessibility/AccessibilityPrimitives.h +++ b/ReactCommon/react/renderer/components/view/accessibility/AccessibilityPrimitives.h @@ -47,12 +47,17 @@ constexpr enum AccessibilityTraits operator&( struct AccessibilityState { bool disabled{false}; bool selected{false}; + enum { Unchecked, Checked, Mixed } checked{Unchecked}; + bool busy{false}; + bool expanded{false}; }; constexpr bool operator==( AccessibilityState const &lhs, AccessibilityState const &rhs) { - return lhs.disabled == rhs.disabled && lhs.selected == rhs.selected; + return lhs.disabled == rhs.disabled && lhs.selected == rhs.selected && + lhs.checked == rhs.checked && lhs.busy == rhs.busy && + lhs.expanded == rhs.expanded; } constexpr bool operator!=( diff --git a/ReactCommon/fabric/components/view/accessibility/AccessibilityProps.cpp b/ReactCommon/react/renderer/components/view/accessibility/AccessibilityProps.cpp similarity index 92% rename from ReactCommon/fabric/components/view/accessibility/AccessibilityProps.cpp rename to ReactCommon/react/renderer/components/view/accessibility/AccessibilityProps.cpp index 584e599b2dfaa3..aa4c1f47795cdd 100644 --- a/ReactCommon/fabric/components/view/accessibility/AccessibilityProps.cpp +++ b/ReactCommon/react/renderer/components/view/accessibility/AccessibilityProps.cpp @@ -7,10 +7,10 @@ #include "AccessibilityProps.h" -#include -#include -#include -#include +#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/view/accessibility/AccessibilityProps.h b/ReactCommon/react/renderer/components/view/accessibility/AccessibilityProps.h similarity index 85% rename from ReactCommon/fabric/components/view/accessibility/AccessibilityProps.h rename to ReactCommon/react/renderer/components/view/accessibility/AccessibilityProps.h index 59537b1d01861d..4235e7cdd6c4f8 100644 --- a/ReactCommon/fabric/components/view/accessibility/AccessibilityProps.h +++ b/ReactCommon/react/renderer/components/view/accessibility/AccessibilityProps.h @@ -7,10 +7,10 @@ #pragma once -#include -#include -#include -#include +#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/view/accessibility/accessibilityPropsConversions.h b/ReactCommon/react/renderer/components/view/accessibility/accessibilityPropsConversions.h similarity index 82% rename from ReactCommon/fabric/components/view/accessibility/accessibilityPropsConversions.h rename to ReactCommon/react/renderer/components/view/accessibility/accessibilityPropsConversions.h index 3c2fa76193ebd6..e112ec34e20a52 100644 --- a/ReactCommon/fabric/components/view/accessibility/accessibilityPropsConversions.h +++ b/ReactCommon/react/renderer/components/view/accessibility/accessibilityPropsConversions.h @@ -8,8 +8,8 @@ #pragma once #include -#include -#include +#include +#include namespace facebook { namespace react { @@ -120,6 +120,28 @@ inline void fromRawValue(const RawValue &value, AccessibilityState &result) { if (disabled != map.end()) { fromRawValue(disabled->second, result.disabled); } + auto checked = map.find("checked"); + if (checked != map.end()) { + if (checked->second.hasType()) { + if ((std::string)checked->second == "mixed") { + result.checked = AccessibilityState::Mixed; + } + } else if (checked->second.hasType()) { + if ((bool)checked->second == true) { + result.checked = AccessibilityState::Checked; + } else { + result.checked = AccessibilityState::Unchecked; + } + } + } + auto busy = map.find("busy"); + if (busy != map.end()) { + fromRawValue(busy->second, result.busy); + } + auto expanded = map.find("expanded"); + if (expanded != map.end()) { + fromRawValue(expanded->second, result.expanded); + } } inline std::string toString( diff --git a/ReactCommon/fabric/components/view/conversions.h b/ReactCommon/react/renderer/components/view/conversions.h similarity index 97% rename from ReactCommon/fabric/components/view/conversions.h rename to ReactCommon/react/renderer/components/view/conversions.h index 5a3cb1a8cc22e6..93eb658be343e3 100644 --- a/ReactCommon/fabric/components/view/conversions.h +++ b/ReactCommon/react/renderer/components/view/conversions.h @@ -8,13 +8,14 @@ #pragma once #include +#include #include #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include @@ -95,9 +96,9 @@ inline YGValue yogaStyleValueFromFloat( return {(float)value, unit}; } -inline folly::Optional optionalFloatFromYogaValue( +inline better::optional optionalFloatFromYogaValue( const YGValue value, - folly::Optional base = {}) { + better::optional base = {}) { switch (value.unit) { case YGUnitUndefined: return {}; @@ -105,9 +106,9 @@ inline folly::Optional optionalFloatFromYogaValue( return floatFromYogaFloat(value.value); case YGUnitPercent: return base.has_value() - ? folly::Optional( + ? better::optional( base.value() * floatFromYogaFloat(value.value)) - : folly::Optional(); + : better::optional(); case YGUnitAuto: return {}; } @@ -276,6 +277,10 @@ inline void fromRawValue(const RawValue &value, YGAlign &result) { inline void fromRawValue(const RawValue &value, YGPositionType &result) { assert(value.hasType()); auto stringValue = (std::string)value; + if (stringValue == "static") { + result = YGPositionTypeStatic; + return; + } if (stringValue == "relative") { result = YGPositionTypeRelative; return; @@ -615,6 +620,8 @@ inline std::string toString(const YGAlign &value) { inline std::string toString(const YGPositionType &value) { switch (value) { + case YGPositionTypeStatic: + return "static"; case YGPositionTypeRelative: return "relative"; case YGPositionTypeAbsolute: diff --git a/ReactCommon/fabric/components/view/primitives.h b/ReactCommon/react/renderer/components/view/primitives.h similarity index 96% rename from ReactCommon/fabric/components/view/primitives.h rename to ReactCommon/react/renderer/components/view/primitives.h index b748e35b182834..f50f37e71fa9e3 100644 --- a/ReactCommon/fabric/components/view/primitives.h +++ b/ReactCommon/react/renderer/components/view/primitives.h @@ -7,9 +7,9 @@ #pragma once -#include -#include -#include +#include +#include +#include #include #include @@ -25,7 +25,7 @@ enum class BorderStyle { Solid, Dotted, Dashed }; template struct CascadedRectangleEdges { using Counterpart = RectangleEdges; - using OptionalT = folly::Optional; + using OptionalT = better::optional; OptionalT left{}; OptionalT top{}; @@ -85,7 +85,7 @@ struct CascadedRectangleEdges { template struct CascadedRectangleCorners { using Counterpart = RectangleCorners; - using OptionalT = folly::Optional; + using OptionalT = better::optional; OptionalT topLeft{}; OptionalT topRight{}; diff --git a/ReactCommon/fabric/components/view/propsConversions.h b/ReactCommon/react/renderer/components/view/propsConversions.h similarity index 98% rename from ReactCommon/fabric/components/view/propsConversions.h rename to ReactCommon/react/renderer/components/view/propsConversions.h index a21e3a95937142..89acb27348a632 100644 --- a/ReactCommon/fabric/components/view/propsConversions.h +++ b/ReactCommon/react/renderer/components/view/propsConversions.h @@ -7,8 +7,8 @@ #pragma once -#include -#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/view/tests/LayoutTest.cpp b/ReactCommon/react/renderer/components/view/tests/LayoutTest.cpp similarity index 96% rename from ReactCommon/fabric/components/view/tests/LayoutTest.cpp rename to ReactCommon/react/renderer/components/view/tests/LayoutTest.cpp index f309557e5d19c6..840547d8e66838 100644 --- a/ReactCommon/fabric/components/view/tests/LayoutTest.cpp +++ b/ReactCommon/react/renderer/components/view/tests/LayoutTest.cpp @@ -7,12 +7,12 @@ #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/view/tests/ViewTest.cpp b/ReactCommon/react/renderer/components/view/tests/ViewTest.cpp similarity index 93% rename from ReactCommon/fabric/components/view/tests/ViewTest.cpp rename to ReactCommon/react/renderer/components/view/tests/ViewTest.cpp index 2224bc6829498c..0b99e92624286a 100644 --- a/ReactCommon/fabric/components/view/tests/ViewTest.cpp +++ b/ReactCommon/react/renderer/components/view/tests/ViewTest.cpp @@ -10,13 +10,13 @@ #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include namespace facebook { namespace react { @@ -109,7 +109,7 @@ TEST_F(YogaDirtyFlagTest, changingNonLayoutSubPropsMustNotDirtyYogaNode) { props.foregroundColor = whiteColor(); props.backgroundColor = blackColor(); props.opacity = props.opacity + 0.042; - props.zIndex = props.zIndex + 42; + props.zIndex = props.zIndex.value_or(0) + 42; props.shouldRasterize = !props.shouldRasterize; props.collapsable = !props.collapsable; diff --git a/ReactCommon/fabric/components/view/yoga/YogaLayoutableShadowNode.cpp b/ReactCommon/react/renderer/components/view/yoga/YogaLayoutableShadowNode.cpp similarity index 98% rename from ReactCommon/fabric/components/view/yoga/YogaLayoutableShadowNode.cpp rename to ReactCommon/react/renderer/components/view/yoga/YogaLayoutableShadowNode.cpp index f17a8e41bed25a..b1bf74c1f333bc 100644 --- a/ReactCommon/fabric/components/view/yoga/YogaLayoutableShadowNode.cpp +++ b/ReactCommon/react/renderer/components/view/yoga/YogaLayoutableShadowNode.cpp @@ -6,12 +6,12 @@ */ #include "YogaLayoutableShadowNode.h" -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include #include diff --git a/ReactCommon/fabric/components/view/yoga/YogaLayoutableShadowNode.h b/ReactCommon/react/renderer/components/view/yoga/YogaLayoutableShadowNode.h similarity index 95% rename from ReactCommon/fabric/components/view/yoga/YogaLayoutableShadowNode.h rename to ReactCommon/react/renderer/components/view/yoga/YogaLayoutableShadowNode.h index 5566e10590f0d5..634c839df48150 100644 --- a/ReactCommon/fabric/components/view/yoga/YogaLayoutableShadowNode.h +++ b/ReactCommon/react/renderer/components/view/yoga/YogaLayoutableShadowNode.h @@ -12,12 +12,12 @@ #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/components/view/yoga/YogaStylableProps.cpp b/ReactCommon/react/renderer/components/view/yoga/YogaStylableProps.cpp similarity index 93% rename from ReactCommon/fabric/components/view/yoga/YogaStylableProps.cpp rename to ReactCommon/react/renderer/components/view/yoga/YogaStylableProps.cpp index 08da2474757d4a..8fe909a188aced 100644 --- a/ReactCommon/fabric/components/view/yoga/YogaStylableProps.cpp +++ b/ReactCommon/react/renderer/components/view/yoga/YogaStylableProps.cpp @@ -7,10 +7,10 @@ #include "YogaStylableProps.h" -#include -#include -#include -#include +#include +#include +#include +#include #include #include diff --git a/ReactCommon/fabric/components/view/yoga/YogaStylableProps.h b/ReactCommon/react/renderer/components/view/yoga/YogaStylableProps.h similarity index 87% rename from ReactCommon/fabric/components/view/yoga/YogaStylableProps.h rename to ReactCommon/react/renderer/components/view/yoga/YogaStylableProps.h index d45b23713aaef8..d272f0693461b7 100644 --- a/ReactCommon/fabric/components/view/yoga/YogaStylableProps.h +++ b/ReactCommon/react/renderer/components/view/yoga/YogaStylableProps.h @@ -9,8 +9,8 @@ #include -#include -#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/core/BUCK b/ReactCommon/react/renderer/core/BUCK similarity index 82% rename from ReactCommon/fabric/core/BUCK rename to ReactCommon/react/renderer/core/BUCK index 948f56912cb165..7d5f6c65bde51d 100644 --- a/ReactCommon/fabric/core/BUCK +++ b/ReactCommon/react/renderer/core/BUCK @@ -36,7 +36,7 @@ rn_xplat_cxx_library( ("shadownode", "*.h"), ("state", "*.h"), ], - prefix = "react/core", + prefix = "react/renderer/core", ), compiler_flags = [ "-fexceptions", @@ -65,8 +65,8 @@ rn_xplat_cxx_library( "//xplat/jsi:JSIDynamic", "//xplat/jsi:jsi", react_native_xplat_target("utils:utils"), - react_native_xplat_target("fabric/debug:debug"), - react_native_xplat_target("fabric/graphics:graphics"), + react_native_xplat_target("react/renderer/debug:debug"), + react_native_xplat_target("react/renderer/graphics:graphics"), ], ) @@ -84,12 +84,12 @@ fb_xplat_cxx_test( platforms = (ANDROID, APPLE, CXX), deps = [ "//xplat/folly:molly", - "//xplat/js/react-native-github/ReactCommon/fabric/element:element", - react_native_xplat_target("fabric/components/view:view"), - react_native_xplat_target("fabric/components/scrollview:scrollview"), - react_native_xplat_target("fabric/components/text:text"), + "//xplat/js/react-native-github/ReactCommon/react/renderer/element:element", + react_native_xplat_target("react/renderer/components/view:view"), + react_native_xplat_target("react/renderer/components/scrollview:scrollview"), + react_native_xplat_target("react/renderer/components/text:text"), "//xplat/third-party/gmock:gtest", - react_native_xplat_target("fabric/components/view:view"), + react_native_xplat_target("react/renderer/components/view:view"), ":core", ], ) @@ -112,7 +112,7 @@ fb_xplat_cxx_binary( deps = [ "//xplat/third-party/benchmark:benchmark", react_native_xplat_target("utils:utils"), - react_native_xplat_target("fabric/components/view:view"), + react_native_xplat_target("react/renderer/components/view:view"), ":core", ], ) diff --git a/ReactCommon/fabric/core/componentdescriptor/ComponentDescriptor.cpp b/ReactCommon/react/renderer/core/componentdescriptor/ComponentDescriptor.cpp similarity index 100% rename from ReactCommon/fabric/core/componentdescriptor/ComponentDescriptor.cpp rename to ReactCommon/react/renderer/core/componentdescriptor/ComponentDescriptor.cpp diff --git a/ReactCommon/fabric/core/componentdescriptor/ComponentDescriptor.h b/ReactCommon/react/renderer/core/componentdescriptor/ComponentDescriptor.h similarity index 94% rename from ReactCommon/fabric/core/componentdescriptor/ComponentDescriptor.h rename to ReactCommon/react/renderer/core/componentdescriptor/ComponentDescriptor.h index 9d47425bc9b2c4..04ad7f27bb5658 100644 --- a/ReactCommon/fabric/core/componentdescriptor/ComponentDescriptor.h +++ b/ReactCommon/react/renderer/core/componentdescriptor/ComponentDescriptor.h @@ -7,12 +7,12 @@ #pragma once -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include namespace facebook { diff --git a/ReactCommon/fabric/core/componentdescriptor/ConcreteComponentDescriptor.h b/ReactCommon/react/renderer/core/componentdescriptor/ConcreteComponentDescriptor.h similarity index 95% rename from ReactCommon/fabric/core/componentdescriptor/ConcreteComponentDescriptor.h rename to ReactCommon/react/renderer/core/componentdescriptor/ConcreteComponentDescriptor.h index e987de792eb575..497cf561e3d8ca 100644 --- a/ReactCommon/fabric/core/componentdescriptor/ConcreteComponentDescriptor.h +++ b/ReactCommon/react/renderer/core/componentdescriptor/ConcreteComponentDescriptor.h @@ -10,12 +10,12 @@ #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/core/conversions.h b/ReactCommon/react/renderer/core/conversions.h similarity index 96% rename from ReactCommon/fabric/core/conversions.h rename to ReactCommon/react/renderer/core/conversions.h index 6dada1df0b3350..9dc3daa994fa89 100644 --- a/ReactCommon/fabric/core/conversions.h +++ b/ReactCommon/react/renderer/core/conversions.h @@ -7,7 +7,7 @@ #pragma once -#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/core/events/BatchedEventQueue.cpp b/ReactCommon/react/renderer/core/events/BatchedEventQueue.cpp similarity index 100% rename from ReactCommon/fabric/core/events/BatchedEventQueue.cpp rename to ReactCommon/react/renderer/core/events/BatchedEventQueue.cpp diff --git a/ReactCommon/fabric/core/events/BatchedEventQueue.h b/ReactCommon/react/renderer/core/events/BatchedEventQueue.h similarity index 94% rename from ReactCommon/fabric/core/events/BatchedEventQueue.h rename to ReactCommon/react/renderer/core/events/BatchedEventQueue.h index af8348c0d66abf..2acabd8600b746 100644 --- a/ReactCommon/fabric/core/events/BatchedEventQueue.h +++ b/ReactCommon/react/renderer/core/events/BatchedEventQueue.h @@ -7,7 +7,7 @@ #pragma once -#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/core/events/EventBeat.cpp b/ReactCommon/react/renderer/core/events/EventBeat.cpp similarity index 100% rename from ReactCommon/fabric/core/events/EventBeat.cpp rename to ReactCommon/react/renderer/core/events/EventBeat.cpp diff --git a/ReactCommon/fabric/core/events/EventBeat.h b/ReactCommon/react/renderer/core/events/EventBeat.h similarity index 100% rename from ReactCommon/fabric/core/events/EventBeat.h rename to ReactCommon/react/renderer/core/events/EventBeat.h diff --git a/ReactCommon/fabric/core/events/EventDispatcher.cpp b/ReactCommon/react/renderer/core/events/EventDispatcher.cpp similarity index 98% rename from ReactCommon/fabric/core/events/EventDispatcher.cpp rename to ReactCommon/react/renderer/core/events/EventDispatcher.cpp index 5ccd35e569122e..8ece2ab3a07aff 100644 --- a/ReactCommon/fabric/core/events/EventDispatcher.cpp +++ b/ReactCommon/react/renderer/core/events/EventDispatcher.cpp @@ -7,7 +7,7 @@ #include "EventDispatcher.h" -#include +#include #include "BatchedEventQueue.h" #include "RawEvent.h" diff --git a/ReactCommon/fabric/core/events/EventDispatcher.h b/ReactCommon/react/renderer/core/events/EventDispatcher.h similarity index 84% rename from ReactCommon/fabric/core/events/EventDispatcher.h rename to ReactCommon/react/renderer/core/events/EventDispatcher.h index f9f161bd50e75d..d3fb37c132754f 100644 --- a/ReactCommon/fabric/core/events/EventDispatcher.h +++ b/ReactCommon/react/renderer/core/events/EventDispatcher.h @@ -10,13 +10,13 @@ #include #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/core/events/EventEmitter.cpp b/ReactCommon/react/renderer/core/events/EventEmitter.cpp similarity index 98% rename from ReactCommon/fabric/core/events/EventEmitter.cpp rename to ReactCommon/react/renderer/core/events/EventEmitter.cpp index 007911fcc593c2..54a0c8154b2acb 100644 --- a/ReactCommon/fabric/core/events/EventEmitter.cpp +++ b/ReactCommon/react/renderer/core/events/EventEmitter.cpp @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include "RawEvent.h" diff --git a/ReactCommon/fabric/core/events/EventEmitter.h b/ReactCommon/react/renderer/core/events/EventEmitter.h similarity index 93% rename from ReactCommon/fabric/core/events/EventEmitter.h rename to ReactCommon/react/renderer/core/events/EventEmitter.h index 14475e01a019d3..55bdf8f040158c 100644 --- a/ReactCommon/fabric/core/events/EventEmitter.h +++ b/ReactCommon/react/renderer/core/events/EventEmitter.h @@ -11,10 +11,10 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/core/events/EventHandler.h b/ReactCommon/react/renderer/core/events/EventHandler.h similarity index 100% rename from ReactCommon/fabric/core/events/EventHandler.h rename to ReactCommon/react/renderer/core/events/EventHandler.h diff --git a/ReactCommon/fabric/core/events/EventPipe.h b/ReactCommon/react/renderer/core/events/EventPipe.h similarity index 85% rename from ReactCommon/fabric/core/events/EventPipe.h rename to ReactCommon/react/renderer/core/events/EventPipe.h index c539f60590b0c7..b0264579ae0409 100644 --- a/ReactCommon/fabric/core/events/EventPipe.h +++ b/ReactCommon/react/renderer/core/events/EventPipe.h @@ -11,8 +11,8 @@ #include #include -#include -#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/core/events/EventPriority.h b/ReactCommon/react/renderer/core/events/EventPriority.h similarity index 100% rename from ReactCommon/fabric/core/events/EventPriority.h rename to ReactCommon/react/renderer/core/events/EventPriority.h diff --git a/ReactCommon/fabric/core/events/EventQueue.cpp b/ReactCommon/react/renderer/core/events/EventQueue.cpp similarity index 100% rename from ReactCommon/fabric/core/events/EventQueue.cpp rename to ReactCommon/react/renderer/core/events/EventQueue.cpp diff --git a/ReactCommon/fabric/core/events/EventQueue.h b/ReactCommon/react/renderer/core/events/EventQueue.h similarity index 88% rename from ReactCommon/fabric/core/events/EventQueue.h rename to ReactCommon/react/renderer/core/events/EventQueue.h index 64722d7e02b359..ab6bac9ac3bbf2 100644 --- a/ReactCommon/fabric/core/events/EventQueue.h +++ b/ReactCommon/react/renderer/core/events/EventQueue.h @@ -12,11 +12,11 @@ #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/core/events/EventTarget.cpp b/ReactCommon/react/renderer/core/events/EventTarget.cpp similarity index 100% rename from ReactCommon/fabric/core/events/EventTarget.cpp rename to ReactCommon/react/renderer/core/events/EventTarget.cpp diff --git a/ReactCommon/fabric/core/events/EventTarget.h b/ReactCommon/react/renderer/core/events/EventTarget.h similarity index 100% rename from ReactCommon/fabric/core/events/EventTarget.h rename to ReactCommon/react/renderer/core/events/EventTarget.h diff --git a/ReactCommon/fabric/core/events/RawEvent.cpp b/ReactCommon/react/renderer/core/events/RawEvent.cpp similarity index 100% rename from ReactCommon/fabric/core/events/RawEvent.cpp rename to ReactCommon/react/renderer/core/events/RawEvent.cpp diff --git a/ReactCommon/fabric/core/events/RawEvent.h b/ReactCommon/react/renderer/core/events/RawEvent.h similarity index 86% rename from ReactCommon/fabric/core/events/RawEvent.h rename to ReactCommon/react/renderer/core/events/RawEvent.h index 8ac0800b586d14..03286a2ac089c4 100644 --- a/ReactCommon/fabric/core/events/RawEvent.h +++ b/ReactCommon/react/renderer/core/events/RawEvent.h @@ -10,8 +10,8 @@ #include #include -#include -#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/core/events/UnbatchedEventQueue.cpp b/ReactCommon/react/renderer/core/events/UnbatchedEventQueue.cpp similarity index 100% rename from ReactCommon/fabric/core/events/UnbatchedEventQueue.cpp rename to ReactCommon/react/renderer/core/events/UnbatchedEventQueue.cpp diff --git a/ReactCommon/fabric/core/events/UnbatchedEventQueue.h b/ReactCommon/react/renderer/core/events/UnbatchedEventQueue.h similarity index 92% rename from ReactCommon/fabric/core/events/UnbatchedEventQueue.h rename to ReactCommon/react/renderer/core/events/UnbatchedEventQueue.h index d4158862d8f7b6..7bf94054658b69 100644 --- a/ReactCommon/fabric/core/events/UnbatchedEventQueue.h +++ b/ReactCommon/react/renderer/core/events/UnbatchedEventQueue.h @@ -7,7 +7,7 @@ #pragma once -#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/core/events/ValueFactory.h b/ReactCommon/react/renderer/core/events/ValueFactory.h similarity index 100% rename from ReactCommon/fabric/core/events/ValueFactory.h rename to ReactCommon/react/renderer/core/events/ValueFactory.h diff --git a/ReactCommon/fabric/core/layout/LayoutConstraints.cpp b/ReactCommon/react/renderer/core/layout/LayoutConstraints.cpp similarity index 100% rename from ReactCommon/fabric/core/layout/LayoutConstraints.cpp rename to ReactCommon/react/renderer/core/layout/LayoutConstraints.cpp diff --git a/ReactCommon/fabric/core/layout/LayoutConstraints.h b/ReactCommon/react/renderer/core/layout/LayoutConstraints.h similarity index 93% rename from ReactCommon/fabric/core/layout/LayoutConstraints.h rename to ReactCommon/react/renderer/core/layout/LayoutConstraints.h index cb483e5bd28966..5f838b5e4f2bab 100644 --- a/ReactCommon/fabric/core/layout/LayoutConstraints.h +++ b/ReactCommon/react/renderer/core/layout/LayoutConstraints.h @@ -10,8 +10,8 @@ #include #include -#include -#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/core/layout/LayoutContext.h b/ReactCommon/react/renderer/core/layout/LayoutContext.h similarity index 94% rename from ReactCommon/fabric/core/layout/LayoutContext.h rename to ReactCommon/react/renderer/core/layout/LayoutContext.h index 42b011fca7fcf3..e23ac5aceb630b 100644 --- a/ReactCommon/fabric/core/layout/LayoutContext.h +++ b/ReactCommon/react/renderer/core/layout/LayoutContext.h @@ -9,8 +9,8 @@ #include -#include -#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/core/layout/LayoutMetrics.h b/ReactCommon/react/renderer/core/layout/LayoutMetrics.h similarity index 94% rename from ReactCommon/fabric/core/layout/LayoutMetrics.h rename to ReactCommon/react/renderer/core/layout/LayoutMetrics.h index d4708a899fbcbd..603a56beab867e 100644 --- a/ReactCommon/fabric/core/layout/LayoutMetrics.h +++ b/ReactCommon/react/renderer/core/layout/LayoutMetrics.h @@ -7,8 +7,8 @@ #pragma once -#include -#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/core/layout/LayoutPrimitives.h b/ReactCommon/react/renderer/core/layout/LayoutPrimitives.h similarity index 100% rename from ReactCommon/fabric/core/layout/LayoutPrimitives.h rename to ReactCommon/react/renderer/core/layout/LayoutPrimitives.h diff --git a/ReactCommon/fabric/core/layout/LayoutableShadowNode.cpp b/ReactCommon/react/renderer/core/layout/LayoutableShadowNode.cpp similarity index 91% rename from ReactCommon/fabric/core/layout/LayoutableShadowNode.cpp rename to ReactCommon/react/renderer/core/layout/LayoutableShadowNode.cpp index 7841a03a29dc7c..46c7388ee437e6 100644 --- a/ReactCommon/fabric/core/layout/LayoutableShadowNode.cpp +++ b/ReactCommon/react/renderer/core/layout/LayoutableShadowNode.cpp @@ -7,12 +7,12 @@ #include "LayoutableShadowNode.h" -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include namespace facebook { namespace react { @@ -84,7 +84,7 @@ LayoutMetrics LayoutableShadowNode::computeRelativeLayoutMetrics( // Step 3. // Iterating on a list of nodes computing compound offset. auto size = shadowNodeList.size(); - for (int i = 0; i < size; i++) { + for (size_t i = 0; i < size; i++) { auto currentShadowNode = traitCast(shadowNodeList.at(i)); @@ -104,6 +104,10 @@ LayoutMetrics LayoutableShadowNode::computeRelativeLayoutMetrics( } resultFrame.origin += currentFrame.origin; + + if (i != 0 && policy.includeTransform) { + resultFrame.origin += currentShadowNode->getContentOriginOffset(); + } } return layoutMetrics; @@ -147,6 +151,10 @@ Transform LayoutableShadowNode::getTransform() const { return Transform::Identity(); } +Point LayoutableShadowNode::getContentOriginOffset() const { + return {0, 0}; +} + LayoutMetrics LayoutableShadowNode::getRelativeLayoutMetrics( LayoutableShadowNode const &ancestorLayoutableShadowNode, LayoutInspectingPolicy policy) const { @@ -217,13 +225,15 @@ ShadowNode::Shared LayoutableShadowNode::findNodeAtPoint( return nullptr; } auto frame = layoutableShadowNode->getLayoutMetrics().frame; - auto isPointInside = frame.containsPoint(point); + auto transformedFrame = frame * layoutableShadowNode->getTransform(); + auto isPointInside = transformedFrame.containsPoint(point); if (!isPointInside) { return nullptr; } - auto newPoint = point - frame.origin * layoutableShadowNode->getTransform(); + auto newPoint = point - transformedFrame.origin - + layoutableShadowNode->getContentOriginOffset(); for (const auto &childShadowNode : node->getChildren()) { auto hitView = findNodeAtPoint(childShadowNode, newPoint); if (hitView) { diff --git a/ReactCommon/fabric/core/layout/LayoutableShadowNode.h b/ReactCommon/react/renderer/core/layout/LayoutableShadowNode.h similarity index 92% rename from ReactCommon/fabric/core/layout/LayoutableShadowNode.h rename to ReactCommon/react/renderer/core/layout/LayoutableShadowNode.h index 1bcd163ead7e1f..37625bfae87aee 100644 --- a/ReactCommon/fabric/core/layout/LayoutableShadowNode.h +++ b/ReactCommon/react/renderer/core/layout/LayoutableShadowNode.h @@ -13,12 +13,12 @@ #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include namespace facebook { namespace react { @@ -115,6 +115,13 @@ class LayoutableShadowNode : public ShadowNode { */ virtual Transform getTransform() const; + /* + * Returns offset which is applied to children's origin in + * `LayoutableShadowNode::getRelativeLayoutMetrics` and + * `LayoutableShadowNode::findNodeAtPoint`. + */ + virtual Point getContentOriginOffset() const; + /* * Returns layout metrics relatively to the given ancestor node. * Uses `computeRelativeLayoutMetrics()` under the hood. diff --git a/ReactCommon/fabric/core/primitives/RawProps.cpp b/ReactCommon/react/renderer/core/primitives/RawProps.cpp similarity index 97% rename from ReactCommon/fabric/core/primitives/RawProps.cpp rename to ReactCommon/react/renderer/core/primitives/RawProps.cpp index 6588e753e930aa..fd55f40c0c5a13 100644 --- a/ReactCommon/fabric/core/primitives/RawProps.cpp +++ b/ReactCommon/react/renderer/core/primitives/RawProps.cpp @@ -7,7 +7,7 @@ #include "RawProps.h" -#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/core/primitives/RawProps.h b/ReactCommon/react/renderer/core/primitives/RawProps.h similarity index 96% rename from ReactCommon/fabric/core/primitives/RawProps.h rename to ReactCommon/react/renderer/core/primitives/RawProps.h index 3b518176f8907b..152f7528f9d216 100644 --- a/ReactCommon/fabric/core/primitives/RawProps.h +++ b/ReactCommon/react/renderer/core/primitives/RawProps.h @@ -16,9 +16,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include namespace facebook { diff --git a/ReactCommon/fabric/core/primitives/RawPropsKey.cpp b/ReactCommon/react/renderer/core/primitives/RawPropsKey.cpp similarity index 96% rename from ReactCommon/fabric/core/primitives/RawPropsKey.cpp rename to ReactCommon/react/renderer/core/primitives/RawPropsKey.cpp index 5b1683e0b4a4a3..505eca510eb64f 100644 --- a/ReactCommon/fabric/core/primitives/RawPropsKey.cpp +++ b/ReactCommon/react/renderer/core/primitives/RawPropsKey.cpp @@ -10,7 +10,7 @@ #include #include -#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/core/primitives/RawPropsKey.h b/ReactCommon/react/renderer/core/primitives/RawPropsKey.h similarity index 94% rename from ReactCommon/fabric/core/primitives/RawPropsKey.h rename to ReactCommon/react/renderer/core/primitives/RawPropsKey.h index b05b7f4e783d16..097b153dd518b1 100644 --- a/ReactCommon/fabric/core/primitives/RawPropsKey.h +++ b/ReactCommon/react/renderer/core/primitives/RawPropsKey.h @@ -9,7 +9,7 @@ #include -#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/core/primitives/RawPropsKeyMap.cpp b/ReactCommon/react/renderer/core/primitives/RawPropsKeyMap.cpp similarity index 100% rename from ReactCommon/fabric/core/primitives/RawPropsKeyMap.cpp rename to ReactCommon/react/renderer/core/primitives/RawPropsKeyMap.cpp diff --git a/ReactCommon/fabric/core/primitives/RawPropsKeyMap.h b/ReactCommon/react/renderer/core/primitives/RawPropsKeyMap.h similarity index 94% rename from ReactCommon/fabric/core/primitives/RawPropsKeyMap.h rename to ReactCommon/react/renderer/core/primitives/RawPropsKeyMap.h index 82dd163f34aada..3c300a314090f1 100644 --- a/ReactCommon/fabric/core/primitives/RawPropsKeyMap.h +++ b/ReactCommon/react/renderer/core/primitives/RawPropsKeyMap.h @@ -9,8 +9,8 @@ #include -#include -#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/core/primitives/RawPropsParser.cpp b/ReactCommon/react/renderer/core/primitives/RawPropsParser.cpp similarity index 99% rename from ReactCommon/fabric/core/primitives/RawPropsParser.cpp rename to ReactCommon/react/renderer/core/primitives/RawPropsParser.cpp index 3fa24485e626b0..96fe38b8ccd783 100644 --- a/ReactCommon/fabric/core/primitives/RawPropsParser.cpp +++ b/ReactCommon/react/renderer/core/primitives/RawPropsParser.cpp @@ -8,7 +8,7 @@ #include "RawPropsParser.h" #include -#include +#include #ifndef NDEBUG #include diff --git a/ReactCommon/fabric/core/primitives/RawPropsParser.h b/ReactCommon/react/renderer/core/primitives/RawPropsParser.h similarity index 86% rename from ReactCommon/fabric/core/primitives/RawPropsParser.h rename to ReactCommon/react/renderer/core/primitives/RawPropsParser.h index 38f43495e5d516..4dc557b708f9f4 100644 --- a/ReactCommon/fabric/core/primitives/RawPropsParser.h +++ b/ReactCommon/react/renderer/core/primitives/RawPropsParser.h @@ -9,12 +9,12 @@ #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/core/primitives/RawPropsPrimitives.h b/ReactCommon/react/renderer/core/primitives/RawPropsPrimitives.h similarity index 100% rename from ReactCommon/fabric/core/primitives/RawPropsPrimitives.h rename to ReactCommon/react/renderer/core/primitives/RawPropsPrimitives.h diff --git a/ReactCommon/fabric/core/primitives/RawValue.cpp b/ReactCommon/react/renderer/core/primitives/RawValue.cpp similarity index 100% rename from ReactCommon/fabric/core/primitives/RawValue.cpp rename to ReactCommon/react/renderer/core/primitives/RawValue.cpp diff --git a/ReactCommon/fabric/core/primitives/RawValue.h b/ReactCommon/react/renderer/core/primitives/RawValue.h similarity index 100% rename from ReactCommon/fabric/core/primitives/RawValue.h rename to ReactCommon/react/renderer/core/primitives/RawValue.h diff --git a/ReactCommon/fabric/core/primitives/ReactPrimitives.h b/ReactCommon/react/renderer/core/primitives/ReactPrimitives.h similarity index 92% rename from ReactCommon/fabric/core/primitives/ReactPrimitives.h rename to ReactCommon/react/renderer/core/primitives/ReactPrimitives.h index f38489dc3c702f..d72fa25d593010 100644 --- a/ReactCommon/fabric/core/primitives/ReactPrimitives.h +++ b/ReactCommon/react/renderer/core/primitives/ReactPrimitives.h @@ -8,8 +8,8 @@ #pragma once #include -#include -#include +#include +#include #include #include diff --git a/ReactCommon/fabric/core/primitives/Sealable.cpp b/ReactCommon/react/renderer/core/primitives/Sealable.cpp similarity index 100% rename from ReactCommon/fabric/core/primitives/Sealable.cpp rename to ReactCommon/react/renderer/core/primitives/Sealable.cpp diff --git a/ReactCommon/fabric/core/primitives/Sealable.h b/ReactCommon/react/renderer/core/primitives/Sealable.h similarity index 100% rename from ReactCommon/fabric/core/primitives/Sealable.h rename to ReactCommon/react/renderer/core/primitives/Sealable.h diff --git a/ReactCommon/fabric/core/propsConversions.h b/ReactCommon/react/renderer/core/propsConversions.h similarity index 94% rename from ReactCommon/fabric/core/propsConversions.h rename to ReactCommon/react/renderer/core/propsConversions.h index 468c83a6dedc62..cb3f1665fc0fb5 100644 --- a/ReactCommon/fabric/core/propsConversions.h +++ b/ReactCommon/react/renderer/core/propsConversions.h @@ -10,10 +10,10 @@ #include #include #include -#include -#include -#include -#include +#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/core/shadownode/ConcreteShadowNode.h b/ReactCommon/react/renderer/core/shadownode/ConcreteShadowNode.h similarity index 95% rename from ReactCommon/fabric/core/shadownode/ConcreteShadowNode.h rename to ReactCommon/react/renderer/core/shadownode/ConcreteShadowNode.h index 7edb2e567830a3..bc23ed0cfca46a 100644 --- a/ReactCommon/fabric/core/shadownode/ConcreteShadowNode.h +++ b/ReactCommon/react/renderer/core/shadownode/ConcreteShadowNode.h @@ -7,10 +7,10 @@ #pragma once -#include -#include -#include -#include +#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/core/shadownode/Props.cpp b/ReactCommon/react/renderer/core/shadownode/Props.cpp similarity index 92% rename from ReactCommon/fabric/core/shadownode/Props.cpp rename to ReactCommon/react/renderer/core/shadownode/Props.cpp index bb4a057b62871d..79d6777691f368 100644 --- a/ReactCommon/fabric/core/shadownode/Props.cpp +++ b/ReactCommon/react/renderer/core/shadownode/Props.cpp @@ -8,7 +8,7 @@ #include "Props.h" #include -#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/core/shadownode/Props.h b/ReactCommon/react/renderer/core/shadownode/Props.h similarity index 88% rename from ReactCommon/fabric/core/shadownode/Props.h rename to ReactCommon/react/renderer/core/shadownode/Props.h index 6e0f46b3785ee2..5653509fd7adf3 100644 --- a/ReactCommon/fabric/core/shadownode/Props.h +++ b/ReactCommon/react/renderer/core/shadownode/Props.h @@ -9,9 +9,9 @@ #include -#include -#include -#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/core/shadownode/ShadowNode.cpp b/ReactCommon/react/renderer/core/shadownode/ShadowNode.cpp similarity index 97% rename from ReactCommon/fabric/core/shadownode/ShadowNode.cpp rename to ReactCommon/react/renderer/core/shadownode/ShadowNode.cpp index 9f3618ddf466f3..8d93a0f9ec0049 100644 --- a/ReactCommon/fabric/core/shadownode/ShadowNode.cpp +++ b/ReactCommon/react/renderer/core/shadownode/ShadowNode.cpp @@ -10,10 +10,10 @@ #include -#include -#include -#include -#include +#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/core/shadownode/ShadowNode.h b/ReactCommon/react/renderer/core/shadownode/ShadowNode.h similarity index 95% rename from ReactCommon/fabric/core/shadownode/ShadowNode.h rename to ReactCommon/react/renderer/core/shadownode/ShadowNode.h index 30710ec0e468e4..ce83ccf1e5bdbf 100644 --- a/ReactCommon/fabric/core/shadownode/ShadowNode.h +++ b/ReactCommon/react/renderer/core/shadownode/ShadowNode.h @@ -12,14 +12,14 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/core/shadownode/ShadowNodeFamily.cpp b/ReactCommon/react/renderer/core/shadownode/ShadowNodeFamily.cpp similarity index 97% rename from ReactCommon/fabric/core/shadownode/ShadowNodeFamily.cpp rename to ReactCommon/react/renderer/core/shadownode/ShadowNodeFamily.cpp index fe2aaa84a753b4..c76b3ab8d3aec7 100644 --- a/ReactCommon/fabric/core/shadownode/ShadowNodeFamily.cpp +++ b/ReactCommon/react/renderer/core/shadownode/ShadowNodeFamily.cpp @@ -8,8 +8,8 @@ #include "ShadowNodeFamily.h" #include "ShadowNode.h" -#include -#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/core/shadownode/ShadowNodeFamily.h b/ReactCommon/react/renderer/core/shadownode/ShadowNodeFamily.h similarity index 96% rename from ReactCommon/fabric/core/shadownode/ShadowNodeFamily.h rename to ReactCommon/react/renderer/core/shadownode/ShadowNodeFamily.h index 1bf431061cb6b8..ad3ecf0e36d09d 100644 --- a/ReactCommon/fabric/core/shadownode/ShadowNodeFamily.h +++ b/ReactCommon/react/renderer/core/shadownode/ShadowNodeFamily.h @@ -11,9 +11,9 @@ #include -#include -#include -#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/core/shadownode/ShadowNodeFamilyFragment.cpp b/ReactCommon/react/renderer/core/shadownode/ShadowNodeFamilyFragment.cpp similarity index 94% rename from ReactCommon/fabric/core/shadownode/ShadowNodeFamilyFragment.cpp rename to ReactCommon/react/renderer/core/shadownode/ShadowNodeFamilyFragment.cpp index 5ef1494d0060d4..a16da43177392b 100644 --- a/ReactCommon/fabric/core/shadownode/ShadowNodeFamilyFragment.cpp +++ b/ReactCommon/react/renderer/core/shadownode/ShadowNodeFamilyFragment.cpp @@ -7,7 +7,7 @@ #include "ShadowNodeFamilyFragment.h" -#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/core/shadownode/ShadowNodeFamilyFragment.h b/ReactCommon/react/renderer/core/shadownode/ShadowNodeFamilyFragment.h similarity index 93% rename from ReactCommon/fabric/core/shadownode/ShadowNodeFamilyFragment.h rename to ReactCommon/react/renderer/core/shadownode/ShadowNodeFamilyFragment.h index 3c9c667d0b5c70..af380d6ff6c5d1 100644 --- a/ReactCommon/fabric/core/shadownode/ShadowNodeFamilyFragment.h +++ b/ReactCommon/react/renderer/core/shadownode/ShadowNodeFamilyFragment.h @@ -7,8 +7,8 @@ #pragma once -#include -#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/core/shadownode/ShadowNodeFragment.cpp b/ReactCommon/react/renderer/core/shadownode/ShadowNodeFragment.cpp similarity index 100% rename from ReactCommon/fabric/core/shadownode/ShadowNodeFragment.cpp rename to ReactCommon/react/renderer/core/shadownode/ShadowNodeFragment.cpp diff --git a/ReactCommon/fabric/core/shadownode/ShadowNodeFragment.h b/ReactCommon/react/renderer/core/shadownode/ShadowNodeFragment.h similarity index 89% rename from ReactCommon/fabric/core/shadownode/ShadowNodeFragment.h rename to ReactCommon/react/renderer/core/shadownode/ShadowNodeFragment.h index afa54425b950d0..6fbdc49451c708 100644 --- a/ReactCommon/fabric/core/shadownode/ShadowNodeFragment.h +++ b/ReactCommon/react/renderer/core/shadownode/ShadowNodeFragment.h @@ -7,11 +7,11 @@ #pragma once -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/core/shadownode/ShadowNodeTraits.cpp b/ReactCommon/react/renderer/core/shadownode/ShadowNodeTraits.cpp similarity index 100% rename from ReactCommon/fabric/core/shadownode/ShadowNodeTraits.cpp rename to ReactCommon/react/renderer/core/shadownode/ShadowNodeTraits.cpp diff --git a/ReactCommon/fabric/core/shadownode/ShadowNodeTraits.h b/ReactCommon/react/renderer/core/shadownode/ShadowNodeTraits.h similarity index 100% rename from ReactCommon/fabric/core/shadownode/ShadowNodeTraits.h rename to ReactCommon/react/renderer/core/shadownode/ShadowNodeTraits.h diff --git a/ReactCommon/fabric/core/state/ConcreteState.h b/ReactCommon/react/renderer/core/state/ConcreteState.h similarity index 98% rename from ReactCommon/fabric/core/state/ConcreteState.h rename to ReactCommon/react/renderer/core/state/ConcreteState.h index 8f5c582ce14af4..6b8c73cbc355a0 100644 --- a/ReactCommon/fabric/core/state/ConcreteState.h +++ b/ReactCommon/react/renderer/core/state/ConcreteState.h @@ -10,7 +10,7 @@ #include #include -#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/core/state/State.cpp b/ReactCommon/react/renderer/core/state/State.cpp similarity index 85% rename from ReactCommon/fabric/core/state/State.cpp rename to ReactCommon/react/renderer/core/state/State.cpp index d8407cb7e64afe..e740557d362093 100644 --- a/ReactCommon/fabric/core/state/State.cpp +++ b/ReactCommon/react/renderer/core/state/State.cpp @@ -7,10 +7,10 @@ #include "State.h" -#include -#include -#include -#include +#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/core/state/State.h b/ReactCommon/react/renderer/core/state/State.h similarity index 98% rename from ReactCommon/fabric/core/state/State.h rename to ReactCommon/react/renderer/core/state/State.h index 7e700da7e879d6..c0472fec057bf5 100644 --- a/ReactCommon/fabric/core/state/State.h +++ b/ReactCommon/react/renderer/core/state/State.h @@ -11,7 +11,7 @@ #include #endif -#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/core/state/StateData.h b/ReactCommon/react/renderer/core/state/StateData.h similarity index 100% rename from ReactCommon/fabric/core/state/StateData.h rename to ReactCommon/react/renderer/core/state/StateData.h diff --git a/ReactCommon/fabric/core/state/StatePipe.h b/ReactCommon/react/renderer/core/state/StatePipe.h similarity index 89% rename from ReactCommon/fabric/core/state/StatePipe.h rename to ReactCommon/react/renderer/core/state/StatePipe.h index 1b0436cfbd35dc..ac79fad1a1d947 100644 --- a/ReactCommon/fabric/core/state/StatePipe.h +++ b/ReactCommon/react/renderer/core/state/StatePipe.h @@ -9,7 +9,7 @@ #include -#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/core/state/StateUpdate.cpp b/ReactCommon/react/renderer/core/state/StateUpdate.cpp similarity index 100% rename from ReactCommon/fabric/core/state/StateUpdate.cpp rename to ReactCommon/react/renderer/core/state/StateUpdate.cpp diff --git a/ReactCommon/fabric/core/state/StateUpdate.h b/ReactCommon/react/renderer/core/state/StateUpdate.h similarity index 93% rename from ReactCommon/fabric/core/state/StateUpdate.h rename to ReactCommon/react/renderer/core/state/StateUpdate.h index 3873890b610172..5e52cdc575aa81 100644 --- a/ReactCommon/fabric/core/state/StateUpdate.h +++ b/ReactCommon/react/renderer/core/state/StateUpdate.h @@ -9,7 +9,7 @@ #include -#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/core/tests/ComponentDescriptorTest.cpp b/ReactCommon/react/renderer/core/tests/ComponentDescriptorTest.cpp similarity index 100% rename from ReactCommon/fabric/core/tests/ComponentDescriptorTest.cpp rename to ReactCommon/react/renderer/core/tests/ComponentDescriptorTest.cpp diff --git a/ReactCommon/fabric/core/tests/FindNodeAtPointTest.cpp b/ReactCommon/react/renderer/core/tests/FindNodeAtPointTest.cpp similarity index 71% rename from ReactCommon/fabric/core/tests/FindNodeAtPointTest.cpp rename to ReactCommon/react/renderer/core/tests/FindNodeAtPointTest.cpp index ec5540a6badceb..79787b4bf9bfef 100644 --- a/ReactCommon/fabric/core/tests/FindNodeAtPointTest.cpp +++ b/ReactCommon/react/renderer/core/tests/FindNodeAtPointTest.cpp @@ -10,6 +10,25 @@ using namespace facebook::react; +/* + *┌─────────────────────────┐ + *│nodeA_ │ + *│ │ + *│ │ + *│ │ + *│ │ + *│ │ + *│ │ + *│ ┌────────────────┐ │ + *│ │nodeAA_ │ │ + *│ │ │ │ + *│ │ ┌───────┐ │ │ + *│ │ │nodeAA_│ │ │ + *│ │ │ │ │ │ + *│ │ └───────┘ │ │ + *│ └────────────────┘ │ + *└─────────────────────────┘ + */ class FindNodeAtPointTest : public ::testing::Test { protected: FindNodeAtPointTest() @@ -102,21 +121,19 @@ TEST_F(FindNodeAtPointTest, withoutTransform) { LayoutableShadowNode::findNodeAtPoint(nodeA_, {1001, 1001}), nullptr); } -// Uncomment once T69368852 is resolved. -// TEST_F(FindNodeAtPointTest, viewIsTranslated) { -// nodeA_->_transform = -// Transform::Identity() * Transform::Translate(-100, -100, 0); +TEST_F(FindNodeAtPointTest, viewIsTranslated) { + nodeA_->_contentOriginOffset = {-100, -100}; -// EXPECT_EQ( -// LayoutableShadowNode::findNodeAtPoint(nodeA_, {15, 15})->getTag(), -// nodeAAA_->getTag()); -// EXPECT_EQ(LayoutableShadowNode::findNodeAtPoint(nodeA_, {5, 5}), nodeAA_); -// } + EXPECT_EQ( + LayoutableShadowNode::findNodeAtPoint(nodeA_, {15, 15})->getTag(), + nodeAAA_->getTag()); + EXPECT_EQ(LayoutableShadowNode::findNodeAtPoint(nodeA_, {5, 5}), nodeAA_); +} -// TEST_F(FindNodeAtPointTest, viewIsScaled) { -// nodeAAA_->_transform = Transform::Identity() * Transform::Scale(0.5, 0.5, -// 0); +TEST_F(FindNodeAtPointTest, viewIsScaled) { + nodeAAA_->_transform = Transform::Identity() * Transform::Scale(0.5, 0.5, 0); -// EXPECT_EQ(LayoutableShadowNode::findNodeAtPoint(nodeA_, {119, -// 119})->getTag(), nodeAA_->getTag()); -// } + EXPECT_EQ( + LayoutableShadowNode::findNodeAtPoint(nodeA_, {119, 119})->getTag(), + nodeAA_->getTag()); +} diff --git a/ReactCommon/fabric/core/tests/LayoutableShadowNodeTest.cpp b/ReactCommon/react/renderer/core/tests/LayoutableShadowNodeTest.cpp similarity index 90% rename from ReactCommon/fabric/core/tests/LayoutableShadowNodeTest.cpp rename to ReactCommon/react/renderer/core/tests/LayoutableShadowNodeTest.cpp index 924c7adad05937..e7de41aa74b7bd 100644 --- a/ReactCommon/fabric/core/tests/LayoutableShadowNodeTest.cpp +++ b/ReactCommon/react/renderer/core/tests/LayoutableShadowNodeTest.cpp @@ -130,6 +130,35 @@ TEST_F(LayoutableShadowNodeTest, relativeLayoutMetrics) { EXPECT_EQ(relativeLayoutMetrics.frame.origin.y, 20); } +/* + * ┌────────┐ + * │nodeA_ │ + * │ ┌─────┴───┐ + * │ │nodeAA_ │ + * │ │ │ + * └──┤ │ + * │ │ + * └─────────┘ + */ +TEST_F(LayoutableShadowNodeTest, contentOriginOffset) { + auto layoutMetrics = EmptyLayoutMetrics; + layoutMetrics.frame.origin = {10, 20}; + layoutMetrics.frame.size = {100, 200}; + nodeA_->_contentOriginOffset = {10, 10}; + nodeA_->setLayoutMetrics(layoutMetrics); + nodeAA_->setLayoutMetrics(layoutMetrics); + + auto relativeLayoutMetrics = nodeAA_->getRelativeLayoutMetrics(*nodeA_, {}); + + EXPECT_EQ(relativeLayoutMetrics.frame.origin.x, 20); + EXPECT_EQ(relativeLayoutMetrics.frame.origin.y, 30); + + relativeLayoutMetrics = nodeAA_->getRelativeLayoutMetrics(*nodeA_, {false}); + + EXPECT_EQ(relativeLayoutMetrics.frame.origin.x, 10); + EXPECT_EQ(relativeLayoutMetrics.frame.origin.y, 20); +} + /* * ┌────────────────────────┐ * │nodeA_ │ @@ -149,6 +178,10 @@ TEST_F(LayoutableShadowNodeTest, relativeLayoutMetricsOnTransformedNode) { nodeAA_->_transform = Transform::Scale(0.5, 0.5, 1); nodeAA_->setLayoutMetrics(layoutMetrics); + layoutMetrics.frame.origin = {10, 20}; + layoutMetrics.frame.size = {50, 100}; + nodeAAA_->setLayoutMetrics(layoutMetrics); + auto relativeLayoutMetrics = nodeAA_->getRelativeLayoutMetrics(*nodeA_, {}); EXPECT_EQ(relativeLayoutMetrics.frame.origin.x, 35); diff --git a/ReactCommon/fabric/core/tests/PrimitivesTest.cpp b/ReactCommon/react/renderer/core/tests/PrimitivesTest.cpp similarity index 96% rename from ReactCommon/fabric/core/tests/PrimitivesTest.cpp rename to ReactCommon/react/renderer/core/tests/PrimitivesTest.cpp index 49c4f4bd93384e..f3b4d9bafbea0e 100644 --- a/ReactCommon/fabric/core/tests/PrimitivesTest.cpp +++ b/ReactCommon/react/renderer/core/tests/PrimitivesTest.cpp @@ -8,7 +8,7 @@ #include #include -#include +#include using namespace facebook::react; diff --git a/ReactCommon/fabric/core/tests/RawPropsTest.cpp b/ReactCommon/react/renderer/core/tests/RawPropsTest.cpp similarity index 98% rename from ReactCommon/fabric/core/tests/RawPropsTest.cpp rename to ReactCommon/react/renderer/core/tests/RawPropsTest.cpp index 7a5ecb1f94b9c4..48a8726662b641 100644 --- a/ReactCommon/fabric/core/tests/RawPropsTest.cpp +++ b/ReactCommon/react/renderer/core/tests/RawPropsTest.cpp @@ -8,9 +8,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include "TestComponent.h" diff --git a/ReactCommon/fabric/core/tests/ShadowNodeFamilyTest.cpp b/ReactCommon/react/renderer/core/tests/ShadowNodeFamilyTest.cpp similarity index 89% rename from ReactCommon/fabric/core/tests/ShadowNodeFamilyTest.cpp rename to ReactCommon/react/renderer/core/tests/ShadowNodeFamilyTest.cpp index 26f5c861fa2f4b..0009baeed7b09e 100644 --- a/ReactCommon/fabric/core/tests/ShadowNodeFamilyTest.cpp +++ b/ReactCommon/react/renderer/core/tests/ShadowNodeFamilyTest.cpp @@ -9,10 +9,10 @@ #include -#include -#include -#include -#include +#include +#include +#include +#include using namespace facebook::react; diff --git a/ReactCommon/fabric/core/tests/ShadowNodeTest.cpp b/ReactCommon/react/renderer/core/tests/ShadowNodeTest.cpp similarity index 98% rename from ReactCommon/fabric/core/tests/ShadowNodeTest.cpp rename to ReactCommon/react/renderer/core/tests/ShadowNodeTest.cpp index 3f0c74ebc280f2..7039e56cfdfa8b 100644 --- a/ReactCommon/fabric/core/tests/ShadowNodeTest.cpp +++ b/ReactCommon/react/renderer/core/tests/ShadowNodeTest.cpp @@ -8,8 +8,8 @@ #include #include -#include -#include +#include +#include #include "TestComponent.h" diff --git a/ReactCommon/fabric/core/tests/TestComponent.h b/ReactCommon/react/renderer/core/tests/TestComponent.h similarity index 74% rename from ReactCommon/fabric/core/tests/TestComponent.h rename to ReactCommon/react/renderer/core/tests/TestComponent.h index e71d46ffb1ae26..936fe0167cbe0a 100644 --- a/ReactCommon/fabric/core/tests/TestComponent.h +++ b/ReactCommon/react/renderer/core/tests/TestComponent.h @@ -10,12 +10,12 @@ #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include using namespace facebook::react; @@ -58,6 +58,12 @@ class TestShadowNode : public ConcreteViewShadowNode< Transform getTransform() const override { return _transform; } + + facebook::react::Point _contentOriginOffset{}; + + facebook::react::Point getContentOriginOffset() const override { + return _contentOriginOffset; + } }; class TestComponentDescriptor diff --git a/ReactCommon/fabric/core/tests/benchmarks/RawPropsBenchmark.cpp b/ReactCommon/react/renderer/core/tests/benchmarks/RawPropsBenchmark.cpp similarity index 93% rename from ReactCommon/fabric/core/tests/benchmarks/RawPropsBenchmark.cpp rename to ReactCommon/react/renderer/core/tests/benchmarks/RawPropsBenchmark.cpp index 457c769ee8c555..2f7f6e96242e65 100644 --- a/ReactCommon/fabric/core/tests/benchmarks/RawPropsBenchmark.cpp +++ b/ReactCommon/react/renderer/core/tests/benchmarks/RawPropsBenchmark.cpp @@ -8,9 +8,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include #include #include diff --git a/ReactCommon/fabric/core/tests/traitCastTest.cpp b/ReactCommon/react/renderer/core/tests/traitCastTest.cpp similarity index 89% rename from ReactCommon/fabric/core/tests/traitCastTest.cpp rename to ReactCommon/react/renderer/core/tests/traitCastTest.cpp index 49a2f64d47a21c..f4af650f4993fb 100644 --- a/ReactCommon/fabric/core/tests/traitCastTest.cpp +++ b/ReactCommon/react/renderer/core/tests/traitCastTest.cpp @@ -7,14 +7,14 @@ #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include -#include -#include +#include +#include using namespace facebook::react; diff --git a/ReactCommon/fabric/debug/BUCK b/ReactCommon/react/renderer/debug/BUCK similarity index 93% rename from ReactCommon/fabric/debug/BUCK rename to ReactCommon/react/renderer/debug/BUCK index af8ed5594dbc08..9950f239cc5579 100644 --- a/ReactCommon/fabric/debug/BUCK +++ b/ReactCommon/react/renderer/debug/BUCK @@ -10,6 +10,7 @@ load( "fb_xplat_cxx_test", "get_apple_compiler_flags", "get_apple_inspector_flags", + "react_native_xplat_target", "rn_xplat_cxx_library", "subdir_glob", ) @@ -31,7 +32,7 @@ rn_xplat_cxx_library( [ ("", "*.h"), ], - prefix = "react/debug", + prefix = "react/renderer/debug", ), compiler_flags = [ "-fexceptions", @@ -56,6 +57,7 @@ rn_xplat_cxx_library( "//xplat/folly:headers_only", "//xplat/folly:memory", "//xplat/folly:molly", + react_native_xplat_target("better:better"), ], ) diff --git a/ReactCommon/fabric/debug/DebugStringConvertible.cpp b/ReactCommon/react/renderer/debug/DebugStringConvertible.cpp similarity index 100% rename from ReactCommon/fabric/debug/DebugStringConvertible.cpp rename to ReactCommon/react/renderer/debug/DebugStringConvertible.cpp diff --git a/ReactCommon/fabric/debug/DebugStringConvertible.h b/ReactCommon/react/renderer/debug/DebugStringConvertible.h similarity index 100% rename from ReactCommon/fabric/debug/DebugStringConvertible.h rename to ReactCommon/react/renderer/debug/DebugStringConvertible.h diff --git a/ReactCommon/fabric/debug/DebugStringConvertibleItem.cpp b/ReactCommon/react/renderer/debug/DebugStringConvertibleItem.cpp similarity index 100% rename from ReactCommon/fabric/debug/DebugStringConvertibleItem.cpp rename to ReactCommon/react/renderer/debug/DebugStringConvertibleItem.cpp diff --git a/ReactCommon/fabric/debug/DebugStringConvertibleItem.h b/ReactCommon/react/renderer/debug/DebugStringConvertibleItem.h similarity index 95% rename from ReactCommon/fabric/debug/DebugStringConvertibleItem.h rename to ReactCommon/react/renderer/debug/DebugStringConvertibleItem.h index 6769aa6b564f71..600113d810a46b 100644 --- a/ReactCommon/fabric/debug/DebugStringConvertibleItem.h +++ b/ReactCommon/react/renderer/debug/DebugStringConvertibleItem.h @@ -9,7 +9,7 @@ #include -#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/debug/SystraceSection.h b/ReactCommon/react/renderer/debug/SystraceSection.h similarity index 100% rename from ReactCommon/fabric/debug/SystraceSection.h rename to ReactCommon/react/renderer/debug/SystraceSection.h diff --git a/ReactCommon/fabric/debug/debugStringConvertibleUtils.h b/ReactCommon/react/renderer/debug/debugStringConvertibleUtils.h similarity index 89% rename from ReactCommon/fabric/debug/debugStringConvertibleUtils.h rename to ReactCommon/react/renderer/debug/debugStringConvertibleUtils.h index 9d005cc32d2594..a41054e2207ba6 100644 --- a/ReactCommon/fabric/debug/debugStringConvertibleUtils.h +++ b/ReactCommon/react/renderer/debug/debugStringConvertibleUtils.h @@ -7,13 +7,14 @@ #pragma once +#include #include #include #include #include -#include -#include +#include +#include namespace facebook { namespace react { @@ -33,7 +34,7 @@ debugStringConvertibleItem(std::string name, T value, T defaultValue = {}) { template inline SharedDebugStringConvertible debugStringConvertibleItem( std::string name, - folly::Optional value, + better::optional value, T defaultValue = {}) { if (!value.hasValue()) { return nullptr; diff --git a/ReactCommon/fabric/debug/tests/DebugStringConvertibleTest.cpp b/ReactCommon/react/renderer/debug/tests/DebugStringConvertibleTest.cpp similarity index 98% rename from ReactCommon/fabric/debug/tests/DebugStringConvertibleTest.cpp rename to ReactCommon/react/renderer/debug/tests/DebugStringConvertibleTest.cpp index f0d64744fcb3b2..1220542c01e23f 100644 --- a/ReactCommon/fabric/debug/tests/DebugStringConvertibleTest.cpp +++ b/ReactCommon/react/renderer/debug/tests/DebugStringConvertibleTest.cpp @@ -8,7 +8,7 @@ #include #include -#include +#include using namespace facebook::react; diff --git a/ReactCommon/fabric/element/BUCK b/ReactCommon/react/renderer/element/BUCK similarity index 66% rename from ReactCommon/fabric/element/BUCK rename to ReactCommon/react/renderer/element/BUCK index c5fc20db81a342..23db67759aed23 100644 --- a/ReactCommon/fabric/element/BUCK +++ b/ReactCommon/react/renderer/element/BUCK @@ -29,7 +29,7 @@ rn_xplat_cxx_library( [ ("", "*.h"), ], - prefix = "react/element", + prefix = "react/renderer/element", ), compiler_flags = [ "-fexceptions", @@ -51,15 +51,15 @@ rn_xplat_cxx_library( visibility = ["PUBLIC"], deps = [ "//xplat/fbsystrace:fbsystrace", - react_native_xplat_target("fabric/components/view:view"), - react_native_xplat_target("fabric/components/root:root"), - react_native_xplat_target("fabric/components/view:view"), - react_native_xplat_target("fabric/components/scrollview:scrollview"), - react_native_xplat_target("fabric/components/text:text"), - react_native_xplat_target("fabric/uimanager:uimanager"), - react_native_xplat_target("fabric/componentregistry:componentregistry"), - react_native_xplat_target("fabric/core:core"), - react_native_xplat_target("fabric/debug:debug"), + react_native_xplat_target("react/renderer/components/view:view"), + react_native_xplat_target("react/renderer/components/root:root"), + react_native_xplat_target("react/renderer/components/view:view"), + react_native_xplat_target("react/renderer/components/scrollview:scrollview"), + react_native_xplat_target("react/renderer/components/text:text"), + react_native_xplat_target("react/renderer/uimanager:uimanager"), + react_native_xplat_target("react/renderer/componentregistry:componentregistry"), + react_native_xplat_target("react/renderer/core:core"), + react_native_xplat_target("react/renderer/debug:debug"), react_native_xplat_target("utils:utils"), ], ) @@ -79,8 +79,8 @@ fb_xplat_cxx_test( deps = [ ":element", "//xplat/third-party/gmock:gtest", - react_native_xplat_target("fabric/components/root:root"), - react_native_xplat_target("fabric/components/view:view"), - react_native_xplat_target("fabric/components/scrollview:scrollview"), + react_native_xplat_target("react/renderer/components/root:root"), + react_native_xplat_target("react/renderer/components/view:view"), + react_native_xplat_target("react/renderer/components/scrollview:scrollview"), ], ) diff --git a/ReactCommon/fabric/element/ComponentBuilder.cpp b/ReactCommon/react/renderer/element/ComponentBuilder.cpp similarity index 100% rename from ReactCommon/fabric/element/ComponentBuilder.cpp rename to ReactCommon/react/renderer/element/ComponentBuilder.cpp diff --git a/ReactCommon/fabric/element/ComponentBuilder.h b/ReactCommon/react/renderer/element/ComponentBuilder.h similarity index 78% rename from ReactCommon/fabric/element/ComponentBuilder.h rename to ReactCommon/react/renderer/element/ComponentBuilder.h index cafbaaa019cf23..b47ba81bd5c45b 100644 --- a/ReactCommon/fabric/element/ComponentBuilder.h +++ b/ReactCommon/react/renderer/element/ComponentBuilder.h @@ -9,14 +9,14 @@ #include -#include -#include -#include -#include -#include - -#include -#include +#include +#include +#include +#include +#include + +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/element/Element.cpp b/ReactCommon/react/renderer/element/Element.cpp similarity index 100% rename from ReactCommon/fabric/element/Element.cpp rename to ReactCommon/react/renderer/element/Element.cpp diff --git a/ReactCommon/fabric/element/Element.h b/ReactCommon/react/renderer/element/Element.h similarity index 97% rename from ReactCommon/fabric/element/Element.h rename to ReactCommon/react/renderer/element/Element.h index 156716880f5e83..babe33cd6e4607 100644 --- a/ReactCommon/fabric/element/Element.h +++ b/ReactCommon/react/renderer/element/Element.h @@ -10,9 +10,9 @@ #include #include -#include +#include -#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/element/ElementFragment.cpp b/ReactCommon/react/renderer/element/ElementFragment.cpp similarity index 100% rename from ReactCommon/fabric/element/ElementFragment.cpp rename to ReactCommon/react/renderer/element/ElementFragment.cpp diff --git a/ReactCommon/fabric/element/ElementFragment.h b/ReactCommon/react/renderer/element/ElementFragment.h similarity index 96% rename from ReactCommon/fabric/element/ElementFragment.h rename to ReactCommon/react/renderer/element/ElementFragment.h index b1438698a495d5..7fee1e01be63c1 100644 --- a/ReactCommon/fabric/element/ElementFragment.h +++ b/ReactCommon/react/renderer/element/ElementFragment.h @@ -11,7 +11,7 @@ #include #include -#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/element/testUtils.h b/ReactCommon/react/renderer/element/testUtils.h similarity index 71% rename from ReactCommon/fabric/element/testUtils.h rename to ReactCommon/react/renderer/element/testUtils.h index 2c32cbd60e8144..e6fc9446c58e6a 100644 --- a/ReactCommon/fabric/element/testUtils.h +++ b/ReactCommon/react/renderer/element/testUtils.h @@ -7,14 +7,14 @@ #pragma once -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/element/tests/ElementTest.cpp b/ReactCommon/react/renderer/element/tests/ElementTest.cpp similarity index 88% rename from ReactCommon/fabric/element/tests/ElementTest.cpp rename to ReactCommon/react/renderer/element/tests/ElementTest.cpp index 3ed6c7f8fcc2b3..ad79f4b6565738 100644 --- a/ReactCommon/fabric/element/tests/ElementTest.cpp +++ b/ReactCommon/react/renderer/element/tests/ElementTest.cpp @@ -9,12 +9,12 @@ #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include using namespace facebook::react; diff --git a/ReactCommon/fabric/graphics/BUCK b/ReactCommon/react/renderer/graphics/BUCK similarity index 94% rename from ReactCommon/fabric/graphics/BUCK rename to ReactCommon/react/renderer/graphics/BUCK index a495bd817ac30c..9760d341a23c07 100644 --- a/ReactCommon/fabric/graphics/BUCK +++ b/ReactCommon/react/renderer/graphics/BUCK @@ -31,7 +31,7 @@ rn_xplat_cxx_library( [ ("", "*.h"), ], - prefix = "react/graphics", + prefix = "react/renderer/graphics", ), compiler_flags = [ "-fexceptions", @@ -43,7 +43,7 @@ rn_xplat_cxx_library( [ ("platform/cxx", "**/*.h"), ], - prefix = "react/graphics", + prefix = "react/renderer/graphics", ), cxx_srcs = glob( [ @@ -54,7 +54,7 @@ rn_xplat_cxx_library( [ ("platform/cxx", "**/*.h"), ], - prefix = "react/graphics", + prefix = "react/renderer/graphics", ), fbandroid_srcs = glob( [ @@ -72,7 +72,7 @@ rn_xplat_cxx_library( [ ("platform/ios", "*.h"), ], - prefix = "react/graphics", + prefix = "react/renderer/graphics", ), ios_frameworks = [ "$SDKROOT/System/Library/Frameworks/CoreGraphics.framework", diff --git a/ReactCommon/fabric/graphics/ColorComponents.h b/ReactCommon/react/renderer/graphics/ColorComponents.h similarity index 100% rename from ReactCommon/fabric/graphics/ColorComponents.h rename to ReactCommon/react/renderer/graphics/ColorComponents.h diff --git a/ReactCommon/fabric/graphics/Geometry.h b/ReactCommon/react/renderer/graphics/Geometry.h similarity index 56% rename from ReactCommon/fabric/graphics/Geometry.h rename to ReactCommon/react/renderer/graphics/Geometry.h index 16777b67855a8a..db3c3de4ffb1fa 100644 --- a/ReactCommon/fabric/graphics/Geometry.h +++ b/ReactCommon/react/renderer/graphics/Geometry.h @@ -7,12 +7,12 @@ #pragma once -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/graphics/Point.h b/ReactCommon/react/renderer/graphics/Point.h similarity index 97% rename from ReactCommon/fabric/graphics/Point.h rename to ReactCommon/react/renderer/graphics/Point.h index a0637ac54b75e7..41c0c4d0e280a0 100644 --- a/ReactCommon/fabric/graphics/Point.h +++ b/ReactCommon/react/renderer/graphics/Point.h @@ -10,7 +10,7 @@ #include #include -#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/graphics/React-graphics.podspec b/ReactCommon/react/renderer/graphics/React-graphics.podspec similarity index 100% rename from ReactCommon/fabric/graphics/React-graphics.podspec rename to ReactCommon/react/renderer/graphics/React-graphics.podspec diff --git a/ReactCommon/fabric/graphics/Rect.h b/ReactCommon/react/renderer/graphics/Rect.h similarity index 95% rename from ReactCommon/fabric/graphics/Rect.h rename to ReactCommon/react/renderer/graphics/Rect.h index 93b049b5c2b3c5..20efdfddf9ae1b 100644 --- a/ReactCommon/fabric/graphics/Rect.h +++ b/ReactCommon/react/renderer/graphics/Rect.h @@ -10,9 +10,9 @@ #include #include -#include -#include -#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/graphics/RectangleCorners.h b/ReactCommon/react/renderer/graphics/RectangleCorners.h similarity index 97% rename from ReactCommon/fabric/graphics/RectangleCorners.h rename to ReactCommon/react/renderer/graphics/RectangleCorners.h index 6d174f921423f0..c3932cd67620ec 100644 --- a/ReactCommon/fabric/graphics/RectangleCorners.h +++ b/ReactCommon/react/renderer/graphics/RectangleCorners.h @@ -10,7 +10,7 @@ #include #include -#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/graphics/RectangleEdges.h b/ReactCommon/react/renderer/graphics/RectangleEdges.h similarity index 96% rename from ReactCommon/fabric/graphics/RectangleEdges.h rename to ReactCommon/react/renderer/graphics/RectangleEdges.h index d4db57752a5cb8..b99b8645576a2b 100644 --- a/ReactCommon/fabric/graphics/RectangleEdges.h +++ b/ReactCommon/react/renderer/graphics/RectangleEdges.h @@ -10,8 +10,8 @@ #include #include -#include -#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/graphics/Size.h b/ReactCommon/react/renderer/graphics/Size.h similarity index 92% rename from ReactCommon/fabric/graphics/Size.h rename to ReactCommon/react/renderer/graphics/Size.h index ad537db1771437..9c093cfd8ca894 100644 --- a/ReactCommon/fabric/graphics/Size.h +++ b/ReactCommon/react/renderer/graphics/Size.h @@ -10,8 +10,8 @@ #include #include -#include -#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/graphics/Transform.cpp b/ReactCommon/react/renderer/graphics/Transform.cpp similarity index 100% rename from ReactCommon/fabric/graphics/Transform.cpp rename to ReactCommon/react/renderer/graphics/Transform.cpp diff --git a/ReactCommon/fabric/graphics/Transform.h b/ReactCommon/react/renderer/graphics/Transform.h similarity index 98% rename from ReactCommon/fabric/graphics/Transform.h rename to ReactCommon/react/renderer/graphics/Transform.h index 7d14a635afbdfd..993f188a815522 100644 --- a/ReactCommon/fabric/graphics/Transform.h +++ b/ReactCommon/react/renderer/graphics/Transform.h @@ -11,8 +11,8 @@ #include #include -#include -#include +#include +#include #ifdef ANDROID #include diff --git a/ReactCommon/fabric/graphics/conversions.h b/ReactCommon/react/renderer/graphics/conversions.h similarity index 96% rename from ReactCommon/fabric/graphics/conversions.h rename to ReactCommon/react/renderer/graphics/conversions.h index 4806feec890a90..6fa241a4fa394d 100644 --- a/ReactCommon/fabric/graphics/conversions.h +++ b/ReactCommon/react/renderer/graphics/conversions.h @@ -9,9 +9,9 @@ #include #include -#include -#include -#include +#include +#include +#include namespace facebook { namespace react { @@ -26,7 +26,7 @@ inline void fromRawValue(const RawValue &value, SharedColor &result) { if (value.hasType()) { auto argb = (int64_t)value; - auto ratio = 256.f; + auto ratio = 255.f; alpha = ((argb >> 24) & 0xFF) / ratio; red = ((argb >> 16) & 0xFF) / ratio; green = ((argb >> 8) & 0xFF) / ratio; @@ -49,7 +49,7 @@ inline void fromRawValue(const RawValue &value, SharedColor &result) { inline folly::dynamic toDynamic(const SharedColor &color) { ColorComponents components = colorComponentsFromColor(color); - auto ratio = 256.f; + auto ratio = 255.f; return ( ((int)(components.alpha * ratio) & 0xff) << 24 | ((int)(components.red * ratio) & 0xff) << 16 | @@ -61,7 +61,7 @@ inline folly::dynamic toDynamic(const SharedColor &color) { inline std::string toString(const SharedColor &value) { ColorComponents components = colorComponentsFromColor(value); - auto ratio = 256.f; + auto ratio = 255.f; return "rgba(" + folly::to(round(components.red * ratio)) + ", " + folly::to(round(components.green * ratio)) + ", " + folly::to(round(components.blue * ratio)) + ", " + diff --git a/ReactCommon/fabric/graphics/platform/cxx/Color.cpp b/ReactCommon/react/renderer/graphics/platform/cxx/Color.cpp similarity index 100% rename from ReactCommon/fabric/graphics/platform/cxx/Color.cpp rename to ReactCommon/react/renderer/graphics/platform/cxx/Color.cpp diff --git a/ReactCommon/fabric/graphics/platform/cxx/Color.h b/ReactCommon/react/renderer/graphics/platform/cxx/Color.h similarity index 97% rename from ReactCommon/fabric/graphics/platform/cxx/Color.h rename to ReactCommon/react/renderer/graphics/platform/cxx/Color.h index b4a2dd3cf3026d..86196c6a40487f 100644 --- a/ReactCommon/fabric/graphics/platform/cxx/Color.h +++ b/ReactCommon/react/renderer/graphics/platform/cxx/Color.h @@ -10,7 +10,7 @@ #include #include -#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/graphics/platform/cxx/Float.h b/ReactCommon/react/renderer/graphics/platform/cxx/Float.h similarity index 100% rename from ReactCommon/fabric/graphics/platform/cxx/Float.h rename to ReactCommon/react/renderer/graphics/platform/cxx/Float.h diff --git a/ReactCommon/fabric/graphics/platform/ios/Color.cpp b/ReactCommon/react/renderer/graphics/platform/ios/Color.cpp similarity index 100% rename from ReactCommon/fabric/graphics/platform/ios/Color.cpp rename to ReactCommon/react/renderer/graphics/platform/ios/Color.cpp diff --git a/ReactCommon/fabric/graphics/platform/ios/Color.h b/ReactCommon/react/renderer/graphics/platform/ios/Color.h similarity index 86% rename from ReactCommon/fabric/graphics/platform/ios/Color.h rename to ReactCommon/react/renderer/graphics/platform/ios/Color.h index 54da5a4c9c0be8..abaf98f4245e56 100644 --- a/ReactCommon/fabric/graphics/platform/ios/Color.h +++ b/ReactCommon/react/renderer/graphics/platform/ios/Color.h @@ -10,8 +10,8 @@ #include #include -#include -#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/graphics/platform/ios/Float.h b/ReactCommon/react/renderer/graphics/platform/ios/Float.h similarity index 100% rename from ReactCommon/fabric/graphics/platform/ios/Float.h rename to ReactCommon/react/renderer/graphics/platform/ios/Float.h diff --git a/ReactCommon/fabric/graphics/rounding.h b/ReactCommon/react/renderer/graphics/rounding.h similarity index 98% rename from ReactCommon/fabric/graphics/rounding.h rename to ReactCommon/react/renderer/graphics/rounding.h index 4d948213be27cd..8427303fe8a308 100644 --- a/ReactCommon/fabric/graphics/rounding.h +++ b/ReactCommon/react/renderer/graphics/rounding.h @@ -7,7 +7,7 @@ #pragma once -#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/graphics/tests/GraphicsTest.cpp b/ReactCommon/react/renderer/graphics/tests/GraphicsTest.cpp similarity index 100% rename from ReactCommon/fabric/graphics/tests/GraphicsTest.cpp rename to ReactCommon/react/renderer/graphics/tests/GraphicsTest.cpp diff --git a/ReactCommon/fabric/graphics/tests/TransformTest.cpp b/ReactCommon/react/renderer/graphics/tests/TransformTest.cpp similarity index 97% rename from ReactCommon/fabric/graphics/tests/TransformTest.cpp rename to ReactCommon/react/renderer/graphics/tests/TransformTest.cpp index 29188bd1fc99b9..c11c0c2b701146 100644 --- a/ReactCommon/fabric/graphics/tests/TransformTest.cpp +++ b/ReactCommon/react/renderer/graphics/tests/TransformTest.cpp @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#include +#include #include #include diff --git a/ReactCommon/fabric/imagemanager/BUCK b/ReactCommon/react/renderer/imagemanager/BUCK similarity index 89% rename from ReactCommon/fabric/imagemanager/BUCK rename to ReactCommon/react/renderer/imagemanager/BUCK index 0e1749e9973541..167893665c2ba9 100644 --- a/ReactCommon/fabric/imagemanager/BUCK +++ b/ReactCommon/react/renderer/imagemanager/BUCK @@ -36,7 +36,7 @@ rn_xplat_cxx_library( ("", "*.h"), ("platform/cxx", "**/*.h"), ], - prefix = "react/imagemanager", + prefix = "react/renderer/imagemanager", ), fbandroid_headers = subdir_glob( [ @@ -66,7 +66,7 @@ rn_xplat_cxx_library( ("platform/ios", "RCTImageInstrumentationProxy.h"), ("platform/ios", "RCTImagePrimitivesConversions.h"), ], - prefix = "react/imagemanager", + prefix = "react/renderer/imagemanager", ), ios_frameworks = [ "$SDKROOT/System/Library/Frameworks/CoreGraphics.framework", @@ -102,10 +102,10 @@ rn_xplat_cxx_library( "//xplat/folly:memory", "//xplat/folly:molly", YOGA_CXX_TARGET, - react_native_xplat_target("fabric/core:core"), - react_native_xplat_target("fabric/mounting:mounting"), - react_native_xplat_target("fabric/debug:debug"), - react_native_xplat_target("fabric/graphics:graphics"), + react_native_xplat_target("react/renderer/core:core"), + react_native_xplat_target("react/renderer/mounting:mounting"), + react_native_xplat_target("react/renderer/debug:debug"), + react_native_xplat_target("react/renderer/graphics:graphics"), ], ) diff --git a/ReactCommon/fabric/imagemanager/ImageInstrumentation.h b/ReactCommon/react/renderer/imagemanager/ImageInstrumentation.h similarity index 94% rename from ReactCommon/fabric/imagemanager/ImageInstrumentation.h rename to ReactCommon/react/renderer/imagemanager/ImageInstrumentation.h index 577d18d97feb44..c1671cb6790376 100644 --- a/ReactCommon/fabric/imagemanager/ImageInstrumentation.h +++ b/ReactCommon/react/renderer/imagemanager/ImageInstrumentation.h @@ -7,7 +7,7 @@ #pragma once -#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/imagemanager/ImageManager.h b/ReactCommon/react/renderer/imagemanager/ImageManager.h similarity index 82% rename from ReactCommon/fabric/imagemanager/ImageManager.h rename to ReactCommon/react/renderer/imagemanager/ImageManager.h index 704451052b2a5f..a6023e8e3d9f39 100644 --- a/ReactCommon/fabric/imagemanager/ImageManager.h +++ b/ReactCommon/react/renderer/imagemanager/ImageManager.h @@ -9,9 +9,9 @@ #include -#include -#include -#include +#include +#include +#include #include namespace facebook { diff --git a/ReactCommon/fabric/imagemanager/ImageRequest.h b/ReactCommon/react/renderer/imagemanager/ImageRequest.h similarity index 90% rename from ReactCommon/fabric/imagemanager/ImageRequest.h rename to ReactCommon/react/renderer/imagemanager/ImageRequest.h index 76195165ce68b1..8c5dc8d5fe814c 100644 --- a/ReactCommon/fabric/imagemanager/ImageRequest.h +++ b/ReactCommon/react/renderer/imagemanager/ImageRequest.h @@ -7,11 +7,11 @@ #pragma once -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/imagemanager/ImageResponse.cpp b/ReactCommon/react/renderer/imagemanager/ImageResponse.cpp similarity index 100% rename from ReactCommon/fabric/imagemanager/ImageResponse.cpp rename to ReactCommon/react/renderer/imagemanager/ImageResponse.cpp diff --git a/ReactCommon/fabric/imagemanager/ImageResponse.h b/ReactCommon/react/renderer/imagemanager/ImageResponse.h similarity index 100% rename from ReactCommon/fabric/imagemanager/ImageResponse.h rename to ReactCommon/react/renderer/imagemanager/ImageResponse.h diff --git a/ReactCommon/fabric/imagemanager/ImageResponseObserver.h b/ReactCommon/react/renderer/imagemanager/ImageResponseObserver.h similarity index 92% rename from ReactCommon/fabric/imagemanager/ImageResponseObserver.h rename to ReactCommon/react/renderer/imagemanager/ImageResponseObserver.h index 6832e31341f843..edb94835c7b6cb 100644 --- a/ReactCommon/fabric/imagemanager/ImageResponseObserver.h +++ b/ReactCommon/react/renderer/imagemanager/ImageResponseObserver.h @@ -7,7 +7,7 @@ #pragma once -#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/imagemanager/ImageResponseObserverCoordinator.cpp b/ReactCommon/react/renderer/imagemanager/ImageResponseObserverCoordinator.cpp similarity index 100% rename from ReactCommon/fabric/imagemanager/ImageResponseObserverCoordinator.cpp rename to ReactCommon/react/renderer/imagemanager/ImageResponseObserverCoordinator.cpp diff --git a/ReactCommon/fabric/imagemanager/ImageResponseObserverCoordinator.h b/ReactCommon/react/renderer/imagemanager/ImageResponseObserverCoordinator.h similarity index 94% rename from ReactCommon/fabric/imagemanager/ImageResponseObserverCoordinator.h rename to ReactCommon/react/renderer/imagemanager/ImageResponseObserverCoordinator.h index ab8d04261e4900..f28e7e5805c37c 100644 --- a/ReactCommon/fabric/imagemanager/ImageResponseObserverCoordinator.h +++ b/ReactCommon/react/renderer/imagemanager/ImageResponseObserverCoordinator.h @@ -7,8 +7,8 @@ #pragma once -#include -#include +#include +#include #include #include diff --git a/ReactCommon/fabric/imagemanager/platform/cxx/ImageManager.cpp b/ReactCommon/react/renderer/imagemanager/platform/cxx/ImageManager.cpp similarity index 100% rename from ReactCommon/fabric/imagemanager/platform/cxx/ImageManager.cpp rename to ReactCommon/react/renderer/imagemanager/platform/cxx/ImageManager.cpp diff --git a/ReactCommon/fabric/imagemanager/platform/cxx/ImageRequest.cpp b/ReactCommon/react/renderer/imagemanager/platform/cxx/ImageRequest.cpp similarity index 100% rename from ReactCommon/fabric/imagemanager/platform/cxx/ImageRequest.cpp rename to ReactCommon/react/renderer/imagemanager/platform/cxx/ImageRequest.cpp diff --git a/ReactCommon/fabric/imagemanager/platform/ios/ImageManager.mm b/ReactCommon/react/renderer/imagemanager/platform/ios/ImageManager.mm similarity index 100% rename from ReactCommon/fabric/imagemanager/platform/ios/ImageManager.mm rename to ReactCommon/react/renderer/imagemanager/platform/ios/ImageManager.mm diff --git a/ReactCommon/fabric/imagemanager/platform/ios/ImageRequest.cpp b/ReactCommon/react/renderer/imagemanager/platform/ios/ImageRequest.cpp similarity index 100% rename from ReactCommon/fabric/imagemanager/platform/ios/ImageRequest.cpp rename to ReactCommon/react/renderer/imagemanager/platform/ios/ImageRequest.cpp diff --git a/ReactCommon/fabric/imagemanager/platform/ios/RCTImageInstrumentationProxy.h b/ReactCommon/react/renderer/imagemanager/platform/ios/RCTImageInstrumentationProxy.h similarity index 89% rename from ReactCommon/fabric/imagemanager/platform/ios/RCTImageInstrumentationProxy.h rename to ReactCommon/react/renderer/imagemanager/platform/ios/RCTImageInstrumentationProxy.h index 5d8f84f0f76b7b..95726a5ff0cccf 100644 --- a/ReactCommon/fabric/imagemanager/platform/ios/RCTImageInstrumentationProxy.h +++ b/ReactCommon/react/renderer/imagemanager/platform/ios/RCTImageInstrumentationProxy.h @@ -9,8 +9,8 @@ #include -#include -#include +#include +#include NS_ASSUME_NONNULL_BEGIN diff --git a/ReactCommon/fabric/imagemanager/platform/ios/RCTImageInstrumentationProxy.mm b/ReactCommon/react/renderer/imagemanager/platform/ios/RCTImageInstrumentationProxy.mm similarity index 100% rename from ReactCommon/fabric/imagemanager/platform/ios/RCTImageInstrumentationProxy.mm rename to ReactCommon/react/renderer/imagemanager/platform/ios/RCTImageInstrumentationProxy.mm diff --git a/ReactCommon/fabric/imagemanager/platform/ios/RCTImageManager.h b/ReactCommon/react/renderer/imagemanager/platform/ios/RCTImageManager.h similarity index 100% rename from ReactCommon/fabric/imagemanager/platform/ios/RCTImageManager.h rename to ReactCommon/react/renderer/imagemanager/platform/ios/RCTImageManager.h diff --git a/ReactCommon/fabric/imagemanager/platform/ios/RCTImageManager.mm b/ReactCommon/react/renderer/imagemanager/platform/ios/RCTImageManager.mm similarity index 96% rename from ReactCommon/fabric/imagemanager/platform/ios/RCTImageManager.mm rename to ReactCommon/react/renderer/imagemanager/platform/ios/RCTImageManager.mm index 9691162f65de56..9ad64c68fd28e2 100644 --- a/ReactCommon/fabric/imagemanager/platform/ios/RCTImageManager.mm +++ b/ReactCommon/react/renderer/imagemanager/platform/ios/RCTImageManager.mm @@ -7,14 +7,14 @@ #import "RCTImageManager.h" -#import +#import #import #import #import -#import -#import +#import +#import #import "RCTImageInstrumentationProxy.h" #import "RCTImagePrimitivesConversions.h" diff --git a/ReactCommon/fabric/imagemanager/platform/ios/RCTImageManagerProtocol.h b/ReactCommon/react/renderer/imagemanager/platform/ios/RCTImageManagerProtocol.h similarity index 81% rename from ReactCommon/fabric/imagemanager/platform/ios/RCTImageManagerProtocol.h rename to ReactCommon/react/renderer/imagemanager/platform/ios/RCTImageManagerProtocol.h index d69c2d3f34c1e2..a48d24ed313dee 100644 --- a/ReactCommon/fabric/imagemanager/platform/ios/RCTImageManagerProtocol.h +++ b/ReactCommon/react/renderer/imagemanager/platform/ios/RCTImageManagerProtocol.h @@ -6,8 +6,8 @@ */ #import -#import -#import +#import +#import @protocol RCTImageManagerProtocol diff --git a/ReactCommon/fabric/imagemanager/platform/ios/RCTImagePrimitivesConversions.h b/ReactCommon/react/renderer/imagemanager/platform/ios/RCTImagePrimitivesConversions.h similarity index 98% rename from ReactCommon/fabric/imagemanager/platform/ios/RCTImagePrimitivesConversions.h rename to ReactCommon/react/renderer/imagemanager/platform/ios/RCTImagePrimitivesConversions.h index db9d498dfe6710..f769d4d686abed 100644 --- a/ReactCommon/fabric/imagemanager/platform/ios/RCTImagePrimitivesConversions.h +++ b/ReactCommon/react/renderer/imagemanager/platform/ios/RCTImagePrimitivesConversions.h @@ -8,7 +8,7 @@ #import #import -#import +#import using namespace facebook::react; diff --git a/ReactCommon/fabric/imagemanager/platform/ios/RCTSyncImageManager.h b/ReactCommon/react/renderer/imagemanager/platform/ios/RCTSyncImageManager.h similarity index 100% rename from ReactCommon/fabric/imagemanager/platform/ios/RCTSyncImageManager.h rename to ReactCommon/react/renderer/imagemanager/platform/ios/RCTSyncImageManager.h diff --git a/ReactCommon/fabric/imagemanager/platform/ios/RCTSyncImageManager.mm b/ReactCommon/react/renderer/imagemanager/platform/ios/RCTSyncImageManager.mm similarity index 96% rename from ReactCommon/fabric/imagemanager/platform/ios/RCTSyncImageManager.mm rename to ReactCommon/react/renderer/imagemanager/platform/ios/RCTSyncImageManager.mm index a703977c68798b..6f8c54d492c72b 100644 --- a/ReactCommon/fabric/imagemanager/platform/ios/RCTSyncImageManager.mm +++ b/ReactCommon/react/renderer/imagemanager/platform/ios/RCTSyncImageManager.mm @@ -13,8 +13,8 @@ #import #import #import -#import -#import +#import +#import #import "RCTImagePrimitivesConversions.h" diff --git a/ReactCommon/fabric/imagemanager/primitives.h b/ReactCommon/react/renderer/imagemanager/primitives.h similarity index 94% rename from ReactCommon/fabric/imagemanager/primitives.h rename to ReactCommon/react/renderer/imagemanager/primitives.h index 76638f8943a590..dd95a542e46930 100644 --- a/ReactCommon/fabric/imagemanager/primitives.h +++ b/ReactCommon/react/renderer/imagemanager/primitives.h @@ -10,7 +10,7 @@ #include #include -#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/imagemanager/tests/ImageManagerTest.cpp b/ReactCommon/react/renderer/imagemanager/tests/ImageManagerTest.cpp similarity index 85% rename from ReactCommon/fabric/imagemanager/tests/ImageManagerTest.cpp rename to ReactCommon/react/renderer/imagemanager/tests/ImageManagerTest.cpp index 608c1d7da5f2dd..d9395d5647327b 100644 --- a/ReactCommon/fabric/imagemanager/tests/ImageManagerTest.cpp +++ b/ReactCommon/react/renderer/imagemanager/tests/ImageManagerTest.cpp @@ -9,7 +9,7 @@ #include -#include +#include using namespace facebook::react; diff --git a/ReactCommon/fabric/mapbuffer/BUCK b/ReactCommon/react/renderer/mapbuffer/BUCK similarity index 100% rename from ReactCommon/fabric/mapbuffer/BUCK rename to ReactCommon/react/renderer/mapbuffer/BUCK diff --git a/ReactCommon/fabric/mapbuffer/MapBuffer.cpp b/ReactCommon/react/renderer/mapbuffer/MapBuffer.cpp similarity index 100% rename from ReactCommon/fabric/mapbuffer/MapBuffer.cpp rename to ReactCommon/react/renderer/mapbuffer/MapBuffer.cpp diff --git a/ReactCommon/fabric/mapbuffer/MapBuffer.h b/ReactCommon/react/renderer/mapbuffer/MapBuffer.h similarity index 100% rename from ReactCommon/fabric/mapbuffer/MapBuffer.h rename to ReactCommon/react/renderer/mapbuffer/MapBuffer.h diff --git a/ReactCommon/fabric/mapbuffer/tests/MapBufferTest.cpp b/ReactCommon/react/renderer/mapbuffer/tests/MapBufferTest.cpp similarity index 100% rename from ReactCommon/fabric/mapbuffer/tests/MapBufferTest.cpp rename to ReactCommon/react/renderer/mapbuffer/tests/MapBufferTest.cpp diff --git a/ReactCommon/fabric/mounting/BUCK b/ReactCommon/react/renderer/mounting/BUCK similarity index 77% rename from ReactCommon/fabric/mounting/BUCK rename to ReactCommon/react/renderer/mounting/BUCK index 46531cf3e49ffa..f84c9bc4c084e7 100644 --- a/ReactCommon/fabric/mounting/BUCK +++ b/ReactCommon/react/renderer/mounting/BUCK @@ -30,7 +30,7 @@ rn_xplat_cxx_library( ("", "*.h"), ("stubs", "*.h"), ], - prefix = "react/mounting", + prefix = "react/renderer/mounting", ), compiler_flags = [ "-fexceptions", @@ -57,10 +57,10 @@ rn_xplat_cxx_library( "//xplat/folly:memory", "//xplat/folly:molly", react_native_xplat_target("better:better"), - react_native_xplat_target("fabric/components/root:root"), - react_native_xplat_target("fabric/components/view:view"), - react_native_xplat_target("fabric/core:core"), - react_native_xplat_target("fabric/debug:debug"), + react_native_xplat_target("react/renderer/components/root:root"), + react_native_xplat_target("react/renderer/components/view:view"), + react_native_xplat_target("react/renderer/core:core"), + react_native_xplat_target("react/renderer/debug:debug"), react_native_xplat_target("utils:utils"), ], ) @@ -82,9 +82,9 @@ fb_xplat_cxx_test( ":mounting", "//xplat/folly:molly", "//xplat/third-party/gmock:gtest", - react_native_xplat_target("fabric/element:element"), - react_native_xplat_target("fabric/components/root:root"), - react_native_xplat_target("fabric/components/view:view"), - react_native_xplat_target("fabric/components/scrollview:scrollview"), + react_native_xplat_target("react/renderer/element:element"), + react_native_xplat_target("react/renderer/components/root:root"), + react_native_xplat_target("react/renderer/components/view:view"), + react_native_xplat_target("react/renderer/components/scrollview:scrollview"), ], ) diff --git a/ReactCommon/fabric/mounting/Differentiator.cpp b/ReactCommon/react/renderer/mounting/Differentiator.cpp similarity index 99% rename from ReactCommon/fabric/mounting/Differentiator.cpp rename to ReactCommon/react/renderer/mounting/Differentiator.cpp index 62cfd94522f4eb..fce2a721d1ad02 100644 --- a/ReactCommon/fabric/mounting/Differentiator.cpp +++ b/ReactCommon/react/renderer/mounting/Differentiator.cpp @@ -9,8 +9,8 @@ #include #include -#include -#include +#include +#include #include #include "ShadowView.h" diff --git a/ReactCommon/fabric/mounting/Differentiator.h b/ReactCommon/react/renderer/mounting/Differentiator.h similarity index 89% rename from ReactCommon/fabric/mounting/Differentiator.h rename to ReactCommon/react/renderer/mounting/Differentiator.h index a7afd4f21c6b6f..3befbd72b061c1 100644 --- a/ReactCommon/fabric/mounting/Differentiator.h +++ b/ReactCommon/react/renderer/mounting/Differentiator.h @@ -7,8 +7,8 @@ #pragma once -#include -#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/mounting/MountingCoordinator.cpp b/ReactCommon/react/renderer/mounting/MountingCoordinator.cpp similarity index 98% rename from ReactCommon/fabric/mounting/MountingCoordinator.cpp rename to ReactCommon/react/renderer/mounting/MountingCoordinator.cpp index f4d5f3ab7b8473..05bfa4adbf53b9 100644 --- a/ReactCommon/fabric/mounting/MountingCoordinator.cpp +++ b/ReactCommon/react/renderer/mounting/MountingCoordinator.cpp @@ -14,7 +14,7 @@ #include -#include +#include namespace facebook { namespace react { @@ -39,7 +39,6 @@ void MountingCoordinator::push(ShadowTreeRevision &&revision) const { { std::lock_guard lock(mutex_); - assert(revision.getNumber() > baseRevision_.getNumber()); assert( !lastRevision_.has_value() || revision.getNumber() != lastRevision_->getNumber()); diff --git a/ReactCommon/fabric/mounting/MountingCoordinator.h b/ReactCommon/react/renderer/mounting/MountingCoordinator.h similarity index 92% rename from ReactCommon/fabric/mounting/MountingCoordinator.h rename to ReactCommon/react/renderer/mounting/MountingCoordinator.h index ed3ffb1a9d3fdc..88d2bf19d3f5cf 100644 --- a/ReactCommon/fabric/mounting/MountingCoordinator.h +++ b/ReactCommon/react/renderer/mounting/MountingCoordinator.h @@ -10,15 +10,15 @@ #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include "ShadowTreeRevision.h" #ifdef RN_SHADOW_TREE_INTROSPECTION -#include +#include #endif namespace facebook { diff --git a/ReactCommon/fabric/mounting/MountingOverrideDelegate.h b/ReactCommon/react/renderer/mounting/MountingOverrideDelegate.h similarity index 95% rename from ReactCommon/fabric/mounting/MountingOverrideDelegate.h rename to ReactCommon/react/renderer/mounting/MountingOverrideDelegate.h index 7f642078101e38..679ca97379a842 100644 --- a/ReactCommon/fabric/mounting/MountingOverrideDelegate.h +++ b/ReactCommon/react/renderer/mounting/MountingOverrideDelegate.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#include +#include #pragma once diff --git a/ReactCommon/fabric/mounting/MountingTelemetry.cpp b/ReactCommon/react/renderer/mounting/MountingTelemetry.cpp similarity index 100% rename from ReactCommon/fabric/mounting/MountingTelemetry.cpp rename to ReactCommon/react/renderer/mounting/MountingTelemetry.cpp diff --git a/ReactCommon/fabric/mounting/MountingTelemetry.h b/ReactCommon/react/renderer/mounting/MountingTelemetry.h similarity index 100% rename from ReactCommon/fabric/mounting/MountingTelemetry.h rename to ReactCommon/react/renderer/mounting/MountingTelemetry.h diff --git a/ReactCommon/fabric/mounting/MountingTransaction.cpp b/ReactCommon/react/renderer/mounting/MountingTransaction.cpp similarity index 100% rename from ReactCommon/fabric/mounting/MountingTransaction.cpp rename to ReactCommon/react/renderer/mounting/MountingTransaction.cpp diff --git a/ReactCommon/fabric/mounting/MountingTransaction.h b/ReactCommon/react/renderer/mounting/MountingTransaction.h similarity index 93% rename from ReactCommon/fabric/mounting/MountingTransaction.h rename to ReactCommon/react/renderer/mounting/MountingTransaction.h index f5e586162395d9..3f34b5e7835e6b 100644 --- a/ReactCommon/fabric/mounting/MountingTransaction.h +++ b/ReactCommon/react/renderer/mounting/MountingTransaction.h @@ -7,9 +7,9 @@ #pragma once -#include -#include -#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/mounting/MountingTransactionMetadata.cpp b/ReactCommon/react/renderer/mounting/MountingTransactionMetadata.cpp similarity index 100% rename from ReactCommon/fabric/mounting/MountingTransactionMetadata.cpp rename to ReactCommon/react/renderer/mounting/MountingTransactionMetadata.cpp diff --git a/ReactCommon/fabric/mounting/MountingTransactionMetadata.h b/ReactCommon/react/renderer/mounting/MountingTransactionMetadata.h similarity index 87% rename from ReactCommon/fabric/mounting/MountingTransactionMetadata.h rename to ReactCommon/react/renderer/mounting/MountingTransactionMetadata.h index 300fda9bb6e789..c5ca956c0de29f 100644 --- a/ReactCommon/fabric/mounting/MountingTransactionMetadata.h +++ b/ReactCommon/react/renderer/mounting/MountingTransactionMetadata.h @@ -7,8 +7,8 @@ #pragma once -#include -#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/mounting/ShadowTree.cpp b/ReactCommon/react/renderer/mounting/ShadowTree.cpp similarity index 96% rename from ReactCommon/fabric/mounting/ShadowTree.cpp rename to ReactCommon/react/renderer/mounting/ShadowTree.cpp index a834310e1db01a..4be53bf4252681 100644 --- a/ReactCommon/fabric/mounting/ShadowTree.cpp +++ b/ReactCommon/react/renderer/mounting/ShadowTree.cpp @@ -7,14 +7,14 @@ #include "ShadowTree.h" -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #include "ShadowTreeDelegate.h" #include "TreeStateReconciliation.h" diff --git a/ReactCommon/fabric/mounting/ShadowTree.h b/ReactCommon/react/renderer/mounting/ShadowTree.h similarity index 86% rename from ReactCommon/fabric/mounting/ShadowTree.h rename to ReactCommon/react/renderer/mounting/ShadowTree.h index 5090aeafd703df..6bbe1631cf7a0b 100644 --- a/ReactCommon/fabric/mounting/ShadowTree.h +++ b/ReactCommon/react/renderer/mounting/ShadowTree.h @@ -10,14 +10,14 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #include "MountingOverrideDelegate.h" namespace facebook { diff --git a/ReactCommon/fabric/mounting/ShadowTreeDelegate.h b/ReactCommon/react/renderer/mounting/ShadowTreeDelegate.h similarity index 92% rename from ReactCommon/fabric/mounting/ShadowTreeDelegate.h rename to ReactCommon/react/renderer/mounting/ShadowTreeDelegate.h index ae2a0645d7bc85..e7e5880e1de9cc 100644 --- a/ReactCommon/fabric/mounting/ShadowTreeDelegate.h +++ b/ReactCommon/react/renderer/mounting/ShadowTreeDelegate.h @@ -7,7 +7,7 @@ #pragma once -#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/mounting/ShadowTreeRegistry.cpp b/ReactCommon/react/renderer/mounting/ShadowTreeRegistry.cpp similarity index 100% rename from ReactCommon/fabric/mounting/ShadowTreeRegistry.cpp rename to ReactCommon/react/renderer/mounting/ShadowTreeRegistry.cpp diff --git a/ReactCommon/fabric/mounting/ShadowTreeRegistry.h b/ReactCommon/react/renderer/mounting/ShadowTreeRegistry.h similarity index 95% rename from ReactCommon/fabric/mounting/ShadowTreeRegistry.h rename to ReactCommon/react/renderer/mounting/ShadowTreeRegistry.h index 6ef6ae2e62c061..21bcc0fca0729e 100644 --- a/ReactCommon/fabric/mounting/ShadowTreeRegistry.h +++ b/ReactCommon/react/renderer/mounting/ShadowTreeRegistry.h @@ -10,8 +10,8 @@ #include #include -#include -#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/mounting/ShadowTreeRevision.cpp b/ReactCommon/react/renderer/mounting/ShadowTreeRevision.cpp similarity index 100% rename from ReactCommon/fabric/mounting/ShadowTreeRevision.cpp rename to ReactCommon/react/renderer/mounting/ShadowTreeRevision.cpp diff --git a/ReactCommon/fabric/mounting/ShadowTreeRevision.h b/ReactCommon/react/renderer/mounting/ShadowTreeRevision.h similarity index 86% rename from ReactCommon/fabric/mounting/ShadowTreeRevision.h rename to ReactCommon/react/renderer/mounting/ShadowTreeRevision.h index ba89dc784f8364..1fe84fb9fe3b76 100644 --- a/ReactCommon/fabric/mounting/ShadowTreeRevision.h +++ b/ReactCommon/react/renderer/mounting/ShadowTreeRevision.h @@ -9,10 +9,10 @@ #include -#include -#include -#include -#include +#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/mounting/ShadowView.cpp b/ReactCommon/react/renderer/mounting/ShadowView.cpp similarity index 97% rename from ReactCommon/fabric/mounting/ShadowView.cpp rename to ReactCommon/react/renderer/mounting/ShadowView.cpp index a5436df7dc35df..f717a28fe669f6 100644 --- a/ReactCommon/fabric/mounting/ShadowView.cpp +++ b/ReactCommon/react/renderer/mounting/ShadowView.cpp @@ -7,7 +7,7 @@ #include "ShadowView.h" -#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/mounting/ShadowView.h b/ReactCommon/react/renderer/mounting/ShadowView.h similarity index 90% rename from ReactCommon/fabric/mounting/ShadowView.h rename to ReactCommon/react/renderer/mounting/ShadowView.h index fc51f9e9b1b6d5..55027683bec0c6 100644 --- a/ReactCommon/fabric/mounting/ShadowView.h +++ b/ReactCommon/react/renderer/mounting/ShadowView.h @@ -9,11 +9,11 @@ #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/mounting/ShadowViewMutation.cpp b/ReactCommon/react/renderer/mounting/ShadowViewMutation.cpp similarity index 100% rename from ReactCommon/fabric/mounting/ShadowViewMutation.cpp rename to ReactCommon/react/renderer/mounting/ShadowViewMutation.cpp diff --git a/ReactCommon/fabric/mounting/ShadowViewMutation.h b/ReactCommon/react/renderer/mounting/ShadowViewMutation.h similarity index 97% rename from ReactCommon/fabric/mounting/ShadowViewMutation.h rename to ReactCommon/react/renderer/mounting/ShadowViewMutation.h index 8250a223984724..65b52beff39f27 100644 --- a/ReactCommon/fabric/mounting/ShadowViewMutation.h +++ b/ReactCommon/react/renderer/mounting/ShadowViewMutation.h @@ -9,7 +9,7 @@ #include -#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/mounting/SurfaceTelemetry.cpp b/ReactCommon/react/renderer/mounting/SurfaceTelemetry.cpp similarity index 100% rename from ReactCommon/fabric/mounting/SurfaceTelemetry.cpp rename to ReactCommon/react/renderer/mounting/SurfaceTelemetry.cpp diff --git a/ReactCommon/fabric/mounting/SurfaceTelemetry.h b/ReactCommon/react/renderer/mounting/SurfaceTelemetry.h similarity index 95% rename from ReactCommon/fabric/mounting/SurfaceTelemetry.h rename to ReactCommon/react/renderer/mounting/SurfaceTelemetry.h index 0151ceb8f9d6df..d10f7853a47527 100644 --- a/ReactCommon/fabric/mounting/SurfaceTelemetry.h +++ b/ReactCommon/react/renderer/mounting/SurfaceTelemetry.h @@ -7,7 +7,7 @@ #pragma once -#include +#include #include namespace facebook { diff --git a/ReactCommon/fabric/mounting/TelemetryController.cpp b/ReactCommon/react/renderer/mounting/TelemetryController.cpp similarity index 96% rename from ReactCommon/fabric/mounting/TelemetryController.cpp rename to ReactCommon/react/renderer/mounting/TelemetryController.cpp index 43c91b5eb85ec6..a39989cb69d5ef 100644 --- a/ReactCommon/fabric/mounting/TelemetryController.cpp +++ b/ReactCommon/react/renderer/mounting/TelemetryController.cpp @@ -7,7 +7,7 @@ #include "TelemetryController.h" -#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/mounting/TelemetryController.h b/ReactCommon/react/renderer/mounting/TelemetryController.h similarity index 88% rename from ReactCommon/fabric/mounting/TelemetryController.h rename to ReactCommon/react/renderer/mounting/TelemetryController.h index f5af79c0de0365..6d878d7d7b208a 100644 --- a/ReactCommon/fabric/mounting/TelemetryController.h +++ b/ReactCommon/react/renderer/mounting/TelemetryController.h @@ -10,9 +10,9 @@ #include #include -#include -#include -#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/mounting/TreeStateReconciliation.cpp b/ReactCommon/react/renderer/mounting/TreeStateReconciliation.cpp similarity index 100% rename from ReactCommon/fabric/mounting/TreeStateReconciliation.cpp rename to ReactCommon/react/renderer/mounting/TreeStateReconciliation.cpp diff --git a/ReactCommon/fabric/mounting/TreeStateReconciliation.h b/ReactCommon/react/renderer/mounting/TreeStateReconciliation.h similarity index 92% rename from ReactCommon/fabric/mounting/TreeStateReconciliation.h rename to ReactCommon/react/renderer/mounting/TreeStateReconciliation.h index 6775df1906d6a4..ff95b7e763d2c8 100644 --- a/ReactCommon/fabric/mounting/TreeStateReconciliation.h +++ b/ReactCommon/react/renderer/mounting/TreeStateReconciliation.h @@ -5,8 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -#include -#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/mounting/stubs/StubView.cpp b/ReactCommon/react/renderer/mounting/stubs/StubView.cpp similarity index 100% rename from ReactCommon/fabric/mounting/stubs/StubView.cpp rename to ReactCommon/react/renderer/mounting/stubs/StubView.cpp diff --git a/ReactCommon/fabric/mounting/stubs/StubView.h b/ReactCommon/react/renderer/mounting/stubs/StubView.h similarity index 86% rename from ReactCommon/fabric/mounting/stubs/StubView.h rename to ReactCommon/react/renderer/mounting/stubs/StubView.h index 7ee54645270a3b..8546baa157aee5 100644 --- a/ReactCommon/fabric/mounting/stubs/StubView.h +++ b/ReactCommon/react/renderer/mounting/stubs/StubView.h @@ -10,10 +10,10 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/mounting/stubs/StubViewTree.cpp b/ReactCommon/react/renderer/mounting/stubs/StubViewTree.cpp similarity index 100% rename from ReactCommon/fabric/mounting/stubs/StubViewTree.cpp rename to ReactCommon/react/renderer/mounting/stubs/StubViewTree.cpp diff --git a/ReactCommon/fabric/mounting/stubs/StubViewTree.h b/ReactCommon/react/renderer/mounting/stubs/StubViewTree.h similarity index 88% rename from ReactCommon/fabric/mounting/stubs/StubViewTree.h rename to ReactCommon/react/renderer/mounting/stubs/StubViewTree.h index 7a708e4b3918d2..6ffb00e63ce96a 100644 --- a/ReactCommon/fabric/mounting/stubs/StubViewTree.h +++ b/ReactCommon/react/renderer/mounting/stubs/StubViewTree.h @@ -10,8 +10,8 @@ #include #include -#include -#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/mounting/stubs/stubs.cpp b/ReactCommon/react/renderer/mounting/stubs/stubs.cpp similarity index 92% rename from ReactCommon/fabric/mounting/stubs/stubs.cpp rename to ReactCommon/react/renderer/mounting/stubs/stubs.cpp index d6ecc11b4af1ef..370989a21a8d7a 100644 --- a/ReactCommon/fabric/mounting/stubs/stubs.cpp +++ b/ReactCommon/react/renderer/mounting/stubs/stubs.cpp @@ -7,9 +7,9 @@ #include "stubs.h" -#include -#include -#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/mounting/stubs/stubs.h b/ReactCommon/react/renderer/mounting/stubs/stubs.h similarity index 90% rename from ReactCommon/fabric/mounting/stubs/stubs.h rename to ReactCommon/react/renderer/mounting/stubs/stubs.h index 46cda72c1f4e29..8a7b564c081073 100644 --- a/ReactCommon/fabric/mounting/stubs/stubs.h +++ b/ReactCommon/react/renderer/mounting/stubs/stubs.h @@ -7,7 +7,7 @@ #pragma once -#include +#include #include "StubView.h" #include "StubViewTree.h" diff --git a/ReactCommon/fabric/mounting/tests/Entropy.h b/ReactCommon/react/renderer/mounting/tests/Entropy.h similarity index 100% rename from ReactCommon/fabric/mounting/tests/Entropy.h rename to ReactCommon/react/renderer/mounting/tests/Entropy.h diff --git a/ReactCommon/fabric/mounting/tests/MountingTelemetryTest.cpp b/ReactCommon/react/renderer/mounting/tests/MountingTelemetryTest.cpp similarity index 98% rename from ReactCommon/fabric/mounting/tests/MountingTelemetryTest.cpp rename to ReactCommon/react/renderer/mounting/tests/MountingTelemetryTest.cpp index cf31109a38fa32..849efa8ac6f821 100644 --- a/ReactCommon/fabric/mounting/tests/MountingTelemetryTest.cpp +++ b/ReactCommon/react/renderer/mounting/tests/MountingTelemetryTest.cpp @@ -10,7 +10,7 @@ #include -#include +#include #include using namespace facebook::react; diff --git a/ReactCommon/fabric/mounting/tests/MountingTest.cpp b/ReactCommon/react/renderer/mounting/tests/MountingTest.cpp similarity index 98% rename from ReactCommon/fabric/mounting/tests/MountingTest.cpp rename to ReactCommon/react/renderer/mounting/tests/MountingTest.cpp index 517347986614dc..275daa6b60f3ed 100644 --- a/ReactCommon/fabric/mounting/tests/MountingTest.cpp +++ b/ReactCommon/react/renderer/mounting/tests/MountingTest.cpp @@ -7,10 +7,10 @@ #include -#include -#include -#include -#include +#include +#include +#include +#include #include "shadowTreeGeneration.h" diff --git a/ReactCommon/fabric/mounting/tests/ShadowTreeLifeCycleTest.cpp b/ReactCommon/react/renderer/mounting/tests/ShadowTreeLifeCycleTest.cpp similarity index 95% rename from ReactCommon/fabric/mounting/tests/ShadowTreeLifeCycleTest.cpp rename to ReactCommon/react/renderer/mounting/tests/ShadowTreeLifeCycleTest.cpp index c3aef70d4ab9c2..1def45c3cad4a3 100644 --- a/ReactCommon/fabric/mounting/tests/ShadowTreeLifeCycleTest.cpp +++ b/ReactCommon/react/renderer/mounting/tests/ShadowTreeLifeCycleTest.cpp @@ -8,10 +8,10 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include "Entropy.h" #include "shadowTreeGeneration.h" diff --git a/ReactCommon/fabric/mounting/tests/StateReconciliationTest.cpp b/ReactCommon/react/renderer/mounting/tests/StateReconciliationTest.cpp similarity index 91% rename from ReactCommon/fabric/mounting/tests/StateReconciliationTest.cpp rename to ReactCommon/react/renderer/mounting/tests/StateReconciliationTest.cpp index eb6129f5bf4dad..d32e1d69a5c42c 100644 --- a/ReactCommon/fabric/mounting/tests/StateReconciliationTest.cpp +++ b/ReactCommon/react/renderer/mounting/tests/StateReconciliationTest.cpp @@ -9,16 +9,16 @@ #include -#include -#include -#include -#include -#include -#include - -#include -#include -#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include using namespace facebook::react; diff --git a/ReactCommon/fabric/mounting/tests/shadowTreeGeneration.h b/ReactCommon/react/renderer/mounting/tests/shadowTreeGeneration.h similarity index 96% rename from ReactCommon/fabric/mounting/tests/shadowTreeGeneration.h rename to ReactCommon/react/renderer/mounting/tests/shadowTreeGeneration.h index 36673ff2497157..8a2c326d157efe 100644 --- a/ReactCommon/fabric/mounting/tests/shadowTreeGeneration.h +++ b/ReactCommon/react/renderer/mounting/tests/shadowTreeGeneration.h @@ -13,11 +13,11 @@ #include #include -#include -#include +#include +#include -#include -#include +#include +#include #include "Entropy.h" diff --git a/ReactCommon/fabric/scheduler/AsynchronousEventBeat.cpp b/ReactCommon/react/renderer/scheduler/AsynchronousEventBeat.cpp similarity index 100% rename from ReactCommon/fabric/scheduler/AsynchronousEventBeat.cpp rename to ReactCommon/react/renderer/scheduler/AsynchronousEventBeat.cpp diff --git a/ReactCommon/fabric/scheduler/AsynchronousEventBeat.h b/ReactCommon/react/renderer/scheduler/AsynchronousEventBeat.h similarity index 96% rename from ReactCommon/fabric/scheduler/AsynchronousEventBeat.h rename to ReactCommon/react/renderer/scheduler/AsynchronousEventBeat.h index 6e95c9b8f7918d..1acdcbb02d038c 100644 --- a/ReactCommon/fabric/scheduler/AsynchronousEventBeat.h +++ b/ReactCommon/react/renderer/scheduler/AsynchronousEventBeat.h @@ -6,7 +6,7 @@ */ #include -#include +#include #include namespace facebook { diff --git a/ReactCommon/fabric/scheduler/BUCK b/ReactCommon/react/renderer/scheduler/BUCK similarity index 74% rename from ReactCommon/fabric/scheduler/BUCK rename to ReactCommon/react/renderer/scheduler/BUCK index fc4a94488bdfc1..87f147704f5816 100644 --- a/ReactCommon/fabric/scheduler/BUCK +++ b/ReactCommon/react/renderer/scheduler/BUCK @@ -28,7 +28,7 @@ rn_xplat_cxx_library( [ ("", "*.h"), ], - prefix = "react/scheduler", + prefix = "react/renderer/scheduler", ), compiler_flags = [ "-fexceptions", @@ -55,14 +55,14 @@ rn_xplat_cxx_library( "//xplat/folly:molly", "//xplat/jsi:JSIDynamic", "//xplat/jsi:jsi", - react_native_xplat_target("fabric/core:core"), - react_native_xplat_target("fabric/mounting:mounting"), - react_native_xplat_target("fabric/uimanager:uimanager"), - react_native_xplat_target("fabric/templateprocessor:templateprocessor"), + react_native_xplat_target("react/renderer/core:core"), + react_native_xplat_target("react/renderer/mounting:mounting"), + react_native_xplat_target("react/renderer/uimanager:uimanager"), + react_native_xplat_target("react/renderer/templateprocessor:templateprocessor"), react_native_xplat_target("config:config"), - react_native_xplat_target("fabric/componentregistry:componentregistry"), - react_native_xplat_target("fabric/debug:debug"), - react_native_xplat_target("fabric/components/root:root"), + react_native_xplat_target("react/renderer/componentregistry:componentregistry"), + react_native_xplat_target("react/renderer/debug:debug"), + react_native_xplat_target("react/renderer/components/root:root"), react_native_xplat_target("utils:utils"), ], ) diff --git a/ReactCommon/fabric/scheduler/Scheduler.cpp b/ReactCommon/react/renderer/scheduler/Scheduler.cpp similarity index 95% rename from ReactCommon/fabric/scheduler/Scheduler.cpp rename to ReactCommon/react/renderer/scheduler/Scheduler.cpp index 14a4f77086cfcc..6b251264267cdf 100644 --- a/ReactCommon/fabric/scheduler/Scheduler.cpp +++ b/ReactCommon/react/renderer/scheduler/Scheduler.cpp @@ -10,17 +10,17 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #ifdef RN_SHADOW_TREE_INTROSPECTION -#include +#include #include #endif @@ -79,6 +79,7 @@ Scheduler::Scheduler( rootComponentDescriptor_ = std::make_unique( ComponentDescriptorParameters{eventDispatcher, nullptr, nullptr}); + uiManager->setBackgroundExecutor(schedulerToolbox.backgroundExecutor); uiManager->setDelegate(this); uiManager->setComponentDescriptorRegistry(componentDescriptorRegistry_); diff --git a/ReactCommon/fabric/scheduler/Scheduler.h b/ReactCommon/react/renderer/scheduler/Scheduler.h similarity index 88% rename from ReactCommon/fabric/scheduler/Scheduler.h rename to ReactCommon/react/renderer/scheduler/Scheduler.h index 2693b821939132..86496494d6d30d 100644 --- a/ReactCommon/fabric/scheduler/Scheduler.h +++ b/ReactCommon/react/renderer/scheduler/Scheduler.h @@ -11,17 +11,17 @@ #include #include -#include -#include #include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include namespace facebook { diff --git a/ReactCommon/fabric/scheduler/SchedulerDelegate.h b/ReactCommon/react/renderer/scheduler/SchedulerDelegate.h similarity index 90% rename from ReactCommon/fabric/scheduler/SchedulerDelegate.h rename to ReactCommon/react/renderer/scheduler/SchedulerDelegate.h index b0e43fe3e8641f..33be7dcb6e3d10 100644 --- a/ReactCommon/fabric/scheduler/SchedulerDelegate.h +++ b/ReactCommon/react/renderer/scheduler/SchedulerDelegate.h @@ -9,9 +9,9 @@ #include -#include -#include -#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/scheduler/SchedulerToolbox.cpp b/ReactCommon/react/renderer/scheduler/SchedulerToolbox.cpp similarity index 100% rename from ReactCommon/fabric/scheduler/SchedulerToolbox.cpp rename to ReactCommon/react/renderer/scheduler/SchedulerToolbox.cpp diff --git a/ReactCommon/fabric/scheduler/SchedulerToolbox.h b/ReactCommon/react/renderer/scheduler/SchedulerToolbox.h similarity index 68% rename from ReactCommon/fabric/scheduler/SchedulerToolbox.h rename to ReactCommon/react/renderer/scheduler/SchedulerToolbox.h index 0f56dbcccb410b..a98d450f37323a 100644 --- a/ReactCommon/fabric/scheduler/SchedulerToolbox.h +++ b/ReactCommon/react/renderer/scheduler/SchedulerToolbox.h @@ -8,8 +8,9 @@ #pragma once #include -#include -#include +#include +#include +#include #include #include @@ -49,6 +50,16 @@ struct SchedulerToolbox final { */ EventBeat::Factory asynchronousEventBeatFactory; EventBeat::Factory synchronousEventBeatFactory; + + /* + * General-purpose executor that is used to dispatch work on some utility + * queue (mostly) asynchronously to avoid unnecessary blocking the caller + * queue. + * The concrete implementation can use a serial or concurrent queue. + * Due to architectural constraints, the concrete implementation *must* call + * the call back synchronously if the executor is invoked on the main thread. + */ + BackgroundExecutor backgroundExecutor; }; } // namespace react diff --git a/ReactCommon/fabric/scheduler/SynchronousEventBeat.cpp b/ReactCommon/react/renderer/scheduler/SynchronousEventBeat.cpp similarity index 100% rename from ReactCommon/fabric/scheduler/SynchronousEventBeat.cpp rename to ReactCommon/react/renderer/scheduler/SynchronousEventBeat.cpp diff --git a/ReactCommon/fabric/scheduler/SynchronousEventBeat.h b/ReactCommon/react/renderer/scheduler/SynchronousEventBeat.h similarity index 96% rename from ReactCommon/fabric/scheduler/SynchronousEventBeat.h rename to ReactCommon/react/renderer/scheduler/SynchronousEventBeat.h index bf192e9078aff5..109a6ddf0b625d 100644 --- a/ReactCommon/fabric/scheduler/SynchronousEventBeat.h +++ b/ReactCommon/react/renderer/scheduler/SynchronousEventBeat.h @@ -8,7 +8,7 @@ #pragma once #include -#include +#include #include namespace facebook { diff --git a/ReactCommon/fabric/templateprocessor/BUCK b/ReactCommon/react/renderer/templateprocessor/BUCK similarity index 75% rename from ReactCommon/fabric/templateprocessor/BUCK rename to ReactCommon/react/renderer/templateprocessor/BUCK index ea5518b3818a5b..b4562085b1ef48 100644 --- a/ReactCommon/fabric/templateprocessor/BUCK +++ b/ReactCommon/react/renderer/templateprocessor/BUCK @@ -29,7 +29,7 @@ rn_xplat_cxx_library( [ ("", "*.h"), ], - prefix = "react/templateprocessor", + prefix = "react/renderer/templateprocessor", ), compiler_flags = [ "-fexceptions", @@ -57,10 +57,10 @@ rn_xplat_cxx_library( "//xplat/folly:molly", "//xplat/jsi:JSIDynamic", "//xplat/jsi:jsi", - react_native_xplat_target("fabric/core:core"), - react_native_xplat_target("fabric/uimanager:uimanager"), - react_native_xplat_target("fabric/componentregistry:componentregistry"), - react_native_xplat_target("fabric/debug:debug"), + react_native_xplat_target("react/renderer/core:core"), + react_native_xplat_target("react/renderer/uimanager:uimanager"), + react_native_xplat_target("react/renderer/componentregistry:componentregistry"), + react_native_xplat_target("react/renderer/debug:debug"), react_native_xplat_target("config:config"), react_native_xplat_target("utils:utils"), ], @@ -83,11 +83,11 @@ fb_xplat_cxx_test( "//xplat/folly:molly", "//xplat/third-party/gmock:gtest", react_native_xplat_target("config:config"), - react_native_xplat_target("fabric/components/activityindicator:activityindicator"), - react_native_xplat_target("fabric/components/image:image"), - react_native_xplat_target("fabric/components/root:root"), - react_native_xplat_target("fabric/components/scrollview:scrollview"), - react_native_xplat_target("fabric/components/view:view"), + react_native_xplat_target("react/renderer/components/activityindicator:activityindicator"), + react_native_xplat_target("react/renderer/components/image:image"), + react_native_xplat_target("react/renderer/components/root:root"), + react_native_xplat_target("react/renderer/components/scrollview:scrollview"), + react_native_xplat_target("react/renderer/components/view:view"), "//xplat/js/react-native-github:generated_components-rncore", ], ) diff --git a/ReactCommon/fabric/templateprocessor/UITemplateProcessor.cpp b/ReactCommon/react/renderer/templateprocessor/UITemplateProcessor.cpp similarity index 92% rename from ReactCommon/fabric/templateprocessor/UITemplateProcessor.cpp rename to ReactCommon/react/renderer/templateprocessor/UITemplateProcessor.cpp index 35854e589964f0..22d506efdcfda7 100644 --- a/ReactCommon/fabric/templateprocessor/UITemplateProcessor.cpp +++ b/ReactCommon/react/renderer/templateprocessor/UITemplateProcessor.cpp @@ -9,14 +9,14 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/templateprocessor/UITemplateProcessor.h b/ReactCommon/react/renderer/templateprocessor/UITemplateProcessor.h similarity index 90% rename from ReactCommon/fabric/templateprocessor/UITemplateProcessor.h rename to ReactCommon/react/renderer/templateprocessor/UITemplateProcessor.h index 4f9a892acf9397..384c572a6997e8 100644 --- a/ReactCommon/fabric/templateprocessor/UITemplateProcessor.h +++ b/ReactCommon/react/renderer/templateprocessor/UITemplateProcessor.h @@ -11,10 +11,10 @@ #include -#include #include -#include -#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/templateprocessor/tests/UITemplateProcessorTest.cpp b/ReactCommon/react/renderer/templateprocessor/tests/UITemplateProcessorTest.cpp similarity index 89% rename from ReactCommon/fabric/templateprocessor/tests/UITemplateProcessorTest.cpp rename to ReactCommon/react/renderer/templateprocessor/tests/UITemplateProcessorTest.cpp index 743b203a6b097b..5c7220f52a44bf 100644 --- a/ReactCommon/fabric/templateprocessor/tests/UITemplateProcessorTest.cpp +++ b/ReactCommon/react/renderer/templateprocessor/tests/UITemplateProcessorTest.cpp @@ -9,18 +9,18 @@ #include #include -#include -#include +#include +#include using namespace facebook::react; -#include -#include -#include -#include -#include -#include #include +#include +#include +#include +#include +#include +#include #include namespace facebook { diff --git a/ReactCommon/fabric/textlayoutmanager/BUCK b/ReactCommon/react/renderer/textlayoutmanager/BUCK similarity index 84% rename from ReactCommon/fabric/textlayoutmanager/BUCK rename to ReactCommon/react/renderer/textlayoutmanager/BUCK index 90db8d8d71ecae..747d108e18ee66 100644 --- a/ReactCommon/fabric/textlayoutmanager/BUCK +++ b/ReactCommon/react/renderer/textlayoutmanager/BUCK @@ -34,7 +34,7 @@ rn_xplat_cxx_library( [ ("", "*.h"), ], - prefix = "react/textlayoutmanager", + prefix = "react/renderer/textlayoutmanager", ), compiler_flags = [ "-fexceptions", @@ -46,7 +46,7 @@ rn_xplat_cxx_library( [ ("platform/cxx", "*.h"), ], - prefix = "react/textlayoutmanager", + prefix = "react/renderer/textlayoutmanager", ), cxx_headers = subdir_glob( [ @@ -67,7 +67,7 @@ rn_xplat_cxx_library( [ ("platform/android", "*.h"), ], - prefix = "react/textlayoutmanager", + prefix = "react/renderer/textlayoutmanager", ), fbandroid_headers = subdir_glob( [ @@ -89,7 +89,7 @@ rn_xplat_cxx_library( [ ("platform/ios", "*.h"), ], - prefix = "react/textlayoutmanager", + prefix = "react/renderer/textlayoutmanager", ), ios_frameworks = [ "$SDKROOT/System/Library/Frameworks/CoreGraphics.framework", @@ -123,13 +123,13 @@ rn_xplat_cxx_library( "//xplat/folly:memory", "//xplat/folly:molly", YOGA_CXX_TARGET, - react_native_xplat_target("fabric/attributedstring:attributedstring"), - react_native_xplat_target("fabric/core:core"), + react_native_xplat_target("react/renderer/attributedstring:attributedstring"), + react_native_xplat_target("react/renderer/core:core"), react_native_xplat_target("utils:utils"), - react_native_xplat_target("fabric/debug:debug"), - react_native_xplat_target("fabric/graphics:graphics"), - react_native_xplat_target("fabric/uimanager:uimanager"), - react_native_xplat_target("fabric/componentregistry:componentregistry"), + react_native_xplat_target("react/renderer/debug:debug"), + react_native_xplat_target("react/renderer/graphics:graphics"), + react_native_xplat_target("react/renderer/uimanager:uimanager"), + react_native_xplat_target("react/renderer/componentregistry:componentregistry"), ], ) diff --git a/ReactCommon/fabric/textlayoutmanager/TextMeasureCache.cpp b/ReactCommon/react/renderer/textlayoutmanager/TextMeasureCache.cpp similarity index 100% rename from ReactCommon/fabric/textlayoutmanager/TextMeasureCache.cpp rename to ReactCommon/react/renderer/textlayoutmanager/TextMeasureCache.cpp diff --git a/ReactCommon/fabric/textlayoutmanager/TextMeasureCache.h b/ReactCommon/react/renderer/textlayoutmanager/TextMeasureCache.h similarity index 96% rename from ReactCommon/fabric/textlayoutmanager/TextMeasureCache.h rename to ReactCommon/react/renderer/textlayoutmanager/TextMeasureCache.h index 71b1c07a3d06b6..460bcce9fd057c 100644 --- a/ReactCommon/fabric/textlayoutmanager/TextMeasureCache.h +++ b/ReactCommon/react/renderer/textlayoutmanager/TextMeasureCache.h @@ -7,9 +7,9 @@ #pragma once -#include -#include -#include +#include +#include +#include #include #include diff --git a/ReactCommon/fabric/textlayoutmanager/platform/android/TextLayoutManager.cpp b/ReactCommon/react/renderer/textlayoutmanager/platform/android/TextLayoutManager.cpp similarity index 97% rename from ReactCommon/fabric/textlayoutmanager/platform/android/TextLayoutManager.cpp rename to ReactCommon/react/renderer/textlayoutmanager/platform/android/TextLayoutManager.cpp index 52fda0f7cd841f..9d7bc047540f95 100644 --- a/ReactCommon/fabric/textlayoutmanager/platform/android/TextLayoutManager.cpp +++ b/ReactCommon/react/renderer/textlayoutmanager/platform/android/TextLayoutManager.cpp @@ -7,9 +7,9 @@ #include "TextLayoutManager.h" -#include -#include #include +#include +#include using namespace facebook::jni; diff --git a/ReactCommon/fabric/textlayoutmanager/platform/android/TextLayoutManager.h b/ReactCommon/react/renderer/textlayoutmanager/platform/android/TextLayoutManager.h similarity index 85% rename from ReactCommon/fabric/textlayoutmanager/platform/android/TextLayoutManager.h rename to ReactCommon/react/renderer/textlayoutmanager/platform/android/TextLayoutManager.h index c8939d3f0759d4..0136e7084baed7 100644 --- a/ReactCommon/fabric/textlayoutmanager/platform/android/TextLayoutManager.h +++ b/ReactCommon/react/renderer/textlayoutmanager/platform/android/TextLayoutManager.h @@ -7,10 +7,10 @@ #pragma once -#include -#include -#include -#include +#include +#include +#include +#include #include namespace facebook { diff --git a/ReactCommon/fabric/textlayoutmanager/platform/cxx/TextLayoutManager.cpp b/ReactCommon/react/renderer/textlayoutmanager/platform/cxx/TextLayoutManager.cpp similarity index 100% rename from ReactCommon/fabric/textlayoutmanager/platform/cxx/TextLayoutManager.cpp rename to ReactCommon/react/renderer/textlayoutmanager/platform/cxx/TextLayoutManager.cpp diff --git a/ReactCommon/fabric/textlayoutmanager/platform/cxx/TextLayoutManager.h b/ReactCommon/react/renderer/textlayoutmanager/platform/cxx/TextLayoutManager.h similarity index 80% rename from ReactCommon/fabric/textlayoutmanager/platform/cxx/TextLayoutManager.h rename to ReactCommon/react/renderer/textlayoutmanager/platform/cxx/TextLayoutManager.h index 57d301995b3918..7033cdeafe3b41 100644 --- a/ReactCommon/fabric/textlayoutmanager/platform/cxx/TextLayoutManager.h +++ b/ReactCommon/react/renderer/textlayoutmanager/platform/cxx/TextLayoutManager.h @@ -9,11 +9,11 @@ #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include namespace facebook { diff --git a/ReactCommon/fabric/textlayoutmanager/platform/ios/NSTextStorage+FontScaling.h b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/NSTextStorage+FontScaling.h similarity index 100% rename from ReactCommon/fabric/textlayoutmanager/platform/ios/NSTextStorage+FontScaling.h rename to ReactCommon/react/renderer/textlayoutmanager/platform/ios/NSTextStorage+FontScaling.h diff --git a/ReactCommon/fabric/textlayoutmanager/platform/ios/NSTextStorage+FontScaling.m b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/NSTextStorage+FontScaling.m similarity index 100% rename from ReactCommon/fabric/textlayoutmanager/platform/ios/NSTextStorage+FontScaling.m rename to ReactCommon/react/renderer/textlayoutmanager/platform/ios/NSTextStorage+FontScaling.m diff --git a/ReactCommon/fabric/textlayoutmanager/platform/ios/RCTAttributedTextUtils.h b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTAttributedTextUtils.h similarity index 87% rename from ReactCommon/fabric/textlayoutmanager/platform/ios/RCTAttributedTextUtils.h rename to ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTAttributedTextUtils.h index eda44cf6ff6d56..373e78daac3292 100644 --- a/ReactCommon/fabric/textlayoutmanager/platform/ios/RCTAttributedTextUtils.h +++ b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTAttributedTextUtils.h @@ -7,9 +7,9 @@ #import -#include -#include -#include +#include +#include +#include NS_ASSUME_NONNULL_BEGIN diff --git a/ReactCommon/fabric/textlayoutmanager/platform/ios/RCTAttributedTextUtils.mm b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTAttributedTextUtils.mm similarity index 98% rename from ReactCommon/fabric/textlayoutmanager/platform/ios/RCTAttributedTextUtils.mm rename to ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTAttributedTextUtils.mm index f9a6537abe2257..0f23297ad4afb9 100644 --- a/ReactCommon/fabric/textlayoutmanager/platform/ios/RCTAttributedTextUtils.mm +++ b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTAttributedTextUtils.mm @@ -7,10 +7,10 @@ #import "RCTAttributedTextUtils.h" -#include -#include -#include -#include +#include +#include +#include +#include #include using namespace facebook::react; diff --git a/ReactCommon/fabric/textlayoutmanager/platform/ios/RCTFontProperties.h b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTFontProperties.h similarity index 100% rename from ReactCommon/fabric/textlayoutmanager/platform/ios/RCTFontProperties.h rename to ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTFontProperties.h diff --git a/ReactCommon/fabric/textlayoutmanager/platform/ios/RCTFontUtils.h b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTFontUtils.h similarity index 86% rename from ReactCommon/fabric/textlayoutmanager/platform/ios/RCTFontUtils.h rename to ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTFontUtils.h index e8b40b10073f52..eafaa4e6f086db 100644 --- a/ReactCommon/fabric/textlayoutmanager/platform/ios/RCTFontUtils.h +++ b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTFontUtils.h @@ -7,7 +7,7 @@ #import -#import +#import NS_ASSUME_NONNULL_BEGIN diff --git a/ReactCommon/fabric/textlayoutmanager/platform/ios/RCTFontUtils.mm b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTFontUtils.mm similarity index 100% rename from ReactCommon/fabric/textlayoutmanager/platform/ios/RCTFontUtils.mm rename to ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTFontUtils.mm diff --git a/ReactCommon/fabric/textlayoutmanager/platform/ios/RCTTextLayoutManager.h b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTTextLayoutManager.h similarity index 88% rename from ReactCommon/fabric/textlayoutmanager/platform/ios/RCTTextLayoutManager.h rename to ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTTextLayoutManager.h index eb495776e8c1d3..805e0bab08cda4 100644 --- a/ReactCommon/fabric/textlayoutmanager/platform/ios/RCTTextLayoutManager.h +++ b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTTextLayoutManager.h @@ -7,11 +7,11 @@ #import -#import -#import -#import -#import -#import +#import +#import +#import +#import +#import NS_ASSUME_NONNULL_BEGIN diff --git a/ReactCommon/fabric/textlayoutmanager/platform/ios/RCTTextLayoutManager.mm b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTTextLayoutManager.mm similarity index 100% rename from ReactCommon/fabric/textlayoutmanager/platform/ios/RCTTextLayoutManager.mm rename to ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTTextLayoutManager.mm diff --git a/ReactCommon/fabric/textlayoutmanager/platform/ios/RCTTextPrimitivesConversions.h b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTTextPrimitivesConversions.h similarity index 96% rename from ReactCommon/fabric/textlayoutmanager/platform/ios/RCTTextPrimitivesConversions.h rename to ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTTextPrimitivesConversions.h index 1b69bbf2c7e9c4..fdfb6e2ce61c68 100644 --- a/ReactCommon/fabric/textlayoutmanager/platform/ios/RCTTextPrimitivesConversions.h +++ b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTTextPrimitivesConversions.h @@ -7,8 +7,8 @@ #import -#include -#include +#include +#include using namespace facebook::react; diff --git a/ReactCommon/fabric/textlayoutmanager/platform/ios/TextLayoutManager.h b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/TextLayoutManager.h similarity index 83% rename from ReactCommon/fabric/textlayoutmanager/platform/ios/TextLayoutManager.h rename to ReactCommon/react/renderer/textlayoutmanager/platform/ios/TextLayoutManager.h index 02a9ff7a9e6d3b..42b56603c11ff1 100644 --- a/ReactCommon/fabric/textlayoutmanager/platform/ios/TextLayoutManager.h +++ b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/TextLayoutManager.h @@ -9,10 +9,10 @@ #include -#include -#include -#include -#include +#include +#include +#include +#include #include namespace facebook { diff --git a/ReactCommon/fabric/textlayoutmanager/platform/ios/TextLayoutManager.mm b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/TextLayoutManager.mm similarity index 100% rename from ReactCommon/fabric/textlayoutmanager/platform/ios/TextLayoutManager.mm rename to ReactCommon/react/renderer/textlayoutmanager/platform/ios/TextLayoutManager.mm diff --git a/ReactCommon/fabric/textlayoutmanager/tests/TextLayoutManagerTest.cpp b/ReactCommon/react/renderer/textlayoutmanager/tests/TextLayoutManagerTest.cpp similarity index 83% rename from ReactCommon/fabric/textlayoutmanager/tests/TextLayoutManagerTest.cpp rename to ReactCommon/react/renderer/textlayoutmanager/tests/TextLayoutManagerTest.cpp index 7f99ab3a57bba1..ab4974c763144d 100644 --- a/ReactCommon/fabric/textlayoutmanager/tests/TextLayoutManagerTest.cpp +++ b/ReactCommon/react/renderer/textlayoutmanager/tests/TextLayoutManagerTest.cpp @@ -9,7 +9,7 @@ #include -#include +#include using namespace facebook::react; diff --git a/ReactCommon/fabric/uimanager/BUCK b/ReactCommon/react/renderer/uimanager/BUCK similarity index 73% rename from ReactCommon/fabric/uimanager/BUCK rename to ReactCommon/react/renderer/uimanager/BUCK index aa31fcae2af8c2..6cddfe741ab59d 100644 --- a/ReactCommon/fabric/uimanager/BUCK +++ b/ReactCommon/react/renderer/uimanager/BUCK @@ -29,7 +29,7 @@ rn_xplat_cxx_library( [ ("", "*.h"), ], - prefix = "react/uimanager", + prefix = "react/renderer/uimanager", ), compiler_flags = [ "-fexceptions", @@ -58,11 +58,11 @@ rn_xplat_cxx_library( "//xplat/jsi:JSIDynamic", "//xplat/jsi:jsi", react_native_xplat_target("config:config"), - react_native_xplat_target("fabric/components/view:view"), - react_native_xplat_target("fabric/mounting:mounting"), - react_native_xplat_target("fabric/core:core"), - react_native_xplat_target("fabric/componentregistry:componentregistry"), - react_native_xplat_target("fabric/debug:debug"), + react_native_xplat_target("react/renderer/components/view:view"), + react_native_xplat_target("react/renderer/mounting:mounting"), + react_native_xplat_target("react/renderer/core:core"), + react_native_xplat_target("react/renderer/componentregistry:componentregistry"), + react_native_xplat_target("react/renderer/debug:debug"), react_native_xplat_target("runtimeexecutor:runtimeexecutor"), ], ) @@ -84,11 +84,11 @@ fb_xplat_cxx_test( "//xplat/folly:molly", "//xplat/third-party/gmock:gtest", react_native_xplat_target("config:config"), - react_native_xplat_target("fabric/components/activityindicator:activityindicator"), - react_native_xplat_target("fabric/components/image:image"), - react_native_xplat_target("fabric/components/root:root"), - react_native_xplat_target("fabric/components/scrollview:scrollview"), - react_native_xplat_target("fabric/components/view:view"), + react_native_xplat_target("react/renderer/components/activityindicator:activityindicator"), + react_native_xplat_target("react/renderer/components/image:image"), + react_native_xplat_target("react/renderer/components/root:root"), + react_native_xplat_target("react/renderer/components/scrollview:scrollview"), + react_native_xplat_target("react/renderer/components/view:view"), "//xplat/js/react-native-github:generated_components-rncore", ], ) diff --git a/ReactCommon/fabric/uimanager/LayoutAnimationStatusDelegate.h b/ReactCommon/react/renderer/uimanager/LayoutAnimationStatusDelegate.h similarity index 100% rename from ReactCommon/fabric/uimanager/LayoutAnimationStatusDelegate.h rename to ReactCommon/react/renderer/uimanager/LayoutAnimationStatusDelegate.h diff --git a/ReactCommon/fabric/uimanager/UIManager.cpp b/ReactCommon/react/renderer/uimanager/UIManager.cpp similarity index 97% rename from ReactCommon/fabric/uimanager/UIManager.cpp rename to ReactCommon/react/renderer/uimanager/UIManager.cpp index f7172002c4c534..3444273d6c353f 100644 --- a/ReactCommon/fabric/uimanager/UIManager.cpp +++ b/ReactCommon/react/renderer/uimanager/UIManager.cpp @@ -7,9 +7,9 @@ #include "UIManager.h" -#include -#include -#include +#include +#include +#include #include @@ -290,6 +290,11 @@ UIManagerDelegate *UIManager::getDelegate() { return delegate_; } +void UIManager::setBackgroundExecutor( + BackgroundExecutor const &backgroundExecutor) { + backgroundExecutor_ = backgroundExecutor; +} + void UIManager::visitBinding( std::function callback) const { diff --git a/ReactCommon/fabric/uimanager/UIManager.h b/ReactCommon/react/renderer/uimanager/UIManager.h similarity index 86% rename from ReactCommon/fabric/uimanager/UIManager.h rename to ReactCommon/react/renderer/uimanager/UIManager.h index ab6fdbcca6a133..26081a1236fc3c 100644 --- a/ReactCommon/fabric/uimanager/UIManager.h +++ b/ReactCommon/react/renderer/uimanager/UIManager.h @@ -11,15 +11,16 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include namespace facebook { namespace react { @@ -41,6 +42,8 @@ class UIManager final : public ShadowTreeDelegate { void setDelegate(UIManagerDelegate *delegate); UIManagerDelegate *getDelegate(); + void setBackgroundExecutor(BackgroundExecutor const &backgroundExecutor); + /** * Sets and gets the UIManager's Animation APIs delegate. * The delegate is stored as a raw pointer, so the owner must null @@ -143,6 +146,7 @@ class UIManager final : public ShadowTreeDelegate { UIManagerAnimationDelegate *animationDelegate_{nullptr}; UIManagerBinding *uiManagerBinding_; ShadowTreeRegistry shadowTreeRegistry_{}; + BackgroundExecutor backgroundExecutor_{}; }; } // namespace react diff --git a/ReactCommon/fabric/uimanager/UIManagerAnimationDelegate.h b/ReactCommon/react/renderer/uimanager/UIManagerAnimationDelegate.h similarity index 85% rename from ReactCommon/fabric/uimanager/UIManagerAnimationDelegate.h rename to ReactCommon/react/renderer/uimanager/UIManagerAnimationDelegate.h index 9dcbef33e1228c..735a73fe513a9c 100644 --- a/ReactCommon/fabric/uimanager/UIManagerAnimationDelegate.h +++ b/ReactCommon/react/renderer/uimanager/UIManagerAnimationDelegate.h @@ -7,9 +7,9 @@ #pragma once -#include -#include -#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/uimanager/UIManagerBinding.cpp b/ReactCommon/react/renderer/uimanager/UIManagerBinding.cpp similarity index 92% rename from ReactCommon/fabric/uimanager/UIManagerBinding.cpp rename to ReactCommon/react/renderer/uimanager/UIManagerBinding.cpp index 92d20a915cd600..0cf68d55f93193 100644 --- a/ReactCommon/fabric/uimanager/UIManagerBinding.cpp +++ b/ReactCommon/react/renderer/uimanager/UIManagerBinding.cpp @@ -7,7 +7,7 @@ #include "UIManagerBinding.h" -#include +#include #include #include @@ -407,20 +407,52 @@ jsi::Value UIManagerBinding::get( } if (methodName == "completeRoot") { - return jsi::Function::createFromHostFunction( - runtime, - name, - 2, - [uiManager]( - jsi::Runtime &runtime, - const jsi::Value &thisValue, - const jsi::Value *arguments, - size_t count) -> jsi::Value { - uiManager->completeSurface( - surfaceIdFromValue(runtime, arguments[0]), - shadowNodeListFromValue(runtime, arguments[1])); - return jsi::Value::undefined(); - }); + if (uiManager->backgroundExecutor_) { + // Enhanced version of the method that uses `backgroundExecutor` and + // captures a shared pointer to `UIManager`. + return jsi::Function::createFromHostFunction( + runtime, + name, + 2, + [uiManager, sharedUIManager = uiManager_]( + jsi::Runtime &runtime, + jsi::Value const &thisValue, + jsi::Value const *arguments, + size_t count) -> jsi::Value { + auto surfaceId = surfaceIdFromValue(runtime, arguments[0]); + auto shadowNodeList = + shadowNodeListFromValue(runtime, arguments[1]); + + if (sharedUIManager->backgroundExecutor_) { + sharedUIManager->backgroundExecutor_( + [sharedUIManager, surfaceId, shadowNodeList] { + sharedUIManager->completeSurface(surfaceId, shadowNodeList); + }); + } else { + uiManager->completeSurface(surfaceId, shadowNodeList); + } + + return jsi::Value::undefined(); + }); + } else { + // Basic version of the method that does *not* use `backgroundExecutor` + // and does *not* capture a shared pointer to `UIManager`. + return jsi::Function::createFromHostFunction( + runtime, + name, + 2, + [uiManager]( + jsi::Runtime &runtime, + jsi::Value const &thisValue, + jsi::Value const *arguments, + size_t count) -> jsi::Value { + uiManager->completeSurface( + surfaceIdFromValue(runtime, arguments[0]), + shadowNodeListFromValue(runtime, arguments[1])); + + return jsi::Value::undefined(); + }); + } } if (methodName == "registerEventHandler") { diff --git a/ReactCommon/fabric/uimanager/UIManagerBinding.h b/ReactCommon/react/renderer/uimanager/UIManagerBinding.h similarity index 94% rename from ReactCommon/fabric/uimanager/UIManagerBinding.h rename to ReactCommon/react/renderer/uimanager/UIManagerBinding.h index 0ecf00c9dd9d62..d4e133f59d38d4 100644 --- a/ReactCommon/fabric/uimanager/UIManagerBinding.h +++ b/ReactCommon/react/renderer/uimanager/UIManagerBinding.h @@ -9,9 +9,9 @@ #include #include -#include -#include -#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/uimanager/UIManagerDelegate.h b/ReactCommon/react/renderer/uimanager/UIManagerDelegate.h similarity index 90% rename from ReactCommon/fabric/uimanager/UIManagerDelegate.h rename to ReactCommon/react/renderer/uimanager/UIManagerDelegate.h index 99fc0f413549cf..ad0c9e27f5b54a 100644 --- a/ReactCommon/fabric/uimanager/UIManagerDelegate.h +++ b/ReactCommon/react/renderer/uimanager/UIManagerDelegate.h @@ -7,9 +7,9 @@ #pragma once -#include -#include -#include +#include +#include +#include namespace facebook { namespace react { diff --git a/ReactCommon/fabric/uimanager/primitives.h b/ReactCommon/react/renderer/uimanager/primitives.h similarity index 93% rename from ReactCommon/fabric/uimanager/primitives.h rename to ReactCommon/react/renderer/uimanager/primitives.h index f02e8b7ffd66e6..cd9dde4a662c69 100644 --- a/ReactCommon/fabric/uimanager/primitives.h +++ b/ReactCommon/react/renderer/uimanager/primitives.h @@ -10,12 +10,15 @@ #include #include #include -#include -#include +#include +#include namespace facebook { namespace react { +using BackgroundExecutor = + std::function &&callback)>; + struct EventHandlerWrapper : public EventHandler { EventHandlerWrapper(jsi::Function eventHandler) : callback(std::move(eventHandler)) {} diff --git a/ReactCommon/fabric/uimanager/tests/FabricUIManagerTest.cpp b/ReactCommon/react/renderer/uimanager/tests/FabricUIManagerTest.cpp similarity index 86% rename from ReactCommon/fabric/uimanager/tests/FabricUIManagerTest.cpp rename to ReactCommon/react/renderer/uimanager/tests/FabricUIManagerTest.cpp index 474a8ba295d454..de35870cd304d1 100644 --- a/ReactCommon/fabric/uimanager/tests/FabricUIManagerTest.cpp +++ b/ReactCommon/react/renderer/uimanager/tests/FabricUIManagerTest.cpp @@ -8,7 +8,7 @@ #include #include -#include +#include using namespace facebook::react; diff --git a/ReactCommon/reactperflogger/reactperflogger/BridgeNativeModulePerfLogger.cpp b/ReactCommon/reactperflogger/reactperflogger/BridgeNativeModulePerfLogger.cpp index 70582331c799d8..9192889c1d482d 100644 --- a/ReactCommon/reactperflogger/reactperflogger/BridgeNativeModulePerfLogger.cpp +++ b/ReactCommon/reactperflogger/reactperflogger/BridgeNativeModulePerfLogger.cpp @@ -249,6 +249,13 @@ void asyncMethodCallEnd(const char *moduleName, const char *methodName) { } } +void asyncMethodCallFail(const char *moduleName, const char *methodName) { + NativeModulePerfLogger *logger = g_perfLogger.get(); + if (logger != nullptr) { + logger->asyncMethodCallFail(moduleName, methodName); + } +} + void asyncMethodCallBatchPreprocessStart() { NativeModulePerfLogger *logger = g_perfLogger.get(); if (logger != nullptr) { diff --git a/ReactCommon/reactperflogger/reactperflogger/BridgeNativeModulePerfLogger.h b/ReactCommon/reactperflogger/reactperflogger/BridgeNativeModulePerfLogger.h index e82257abf538f6..c2fa24550119fe 100644 --- a/ReactCommon/reactperflogger/reactperflogger/BridgeNativeModulePerfLogger.h +++ b/ReactCommon/reactperflogger/reactperflogger/BridgeNativeModulePerfLogger.h @@ -76,6 +76,7 @@ void asyncMethodCallArgConversionEnd( const char *methodName); void asyncMethodCallDispatch(const char *moduleName, const char *methodName); void asyncMethodCallEnd(const char *moduleName, const char *methodName); +void asyncMethodCallFail(const char *moduleName, const char *methodName); /** * Pre-processing async method call batch diff --git a/ReactCommon/reactperflogger/reactperflogger/NativeModulePerfLogger.h b/ReactCommon/reactperflogger/reactperflogger/NativeModulePerfLogger.h index f4e9591e0c439f..54def97671cd01 100644 --- a/ReactCommon/reactperflogger/reactperflogger/NativeModulePerfLogger.h +++ b/ReactCommon/reactperflogger/reactperflogger/NativeModulePerfLogger.h @@ -124,6 +124,9 @@ class NativeModulePerfLogger { virtual void asyncMethodCallEnd( const char *moduleName, const char *methodName) = 0; + virtual void asyncMethodCallFail( + const char *moduleName, + const char *methodName) = 0; /** * In the NativeModule system, we batch async NativeModule method calls. diff --git a/ReactCommon/turbomodule/core/BUCK b/ReactCommon/turbomodule/core/BUCK index 512c16ef811fe2..549ddef0a9e243 100644 --- a/ReactCommon/turbomodule/core/BUCK +++ b/ReactCommon/turbomodule/core/BUCK @@ -1,5 +1,5 @@ load("@fbsource//tools/build_defs/apple:flag_defs.bzl", "OBJC_ARC_PREPROCESSOR_FLAGS", "get_preprocessor_flags_for_build_mode", "get_static_library_ios_flags") -load("//tools/build_defs/oss:rn_defs.bzl", "ANDROID", "APPLE", "react_native_target", "react_native_xplat_target", "rn_xplat_cxx_library", "subdir_glob") +load("//tools/build_defs/oss:rn_defs.bzl", "ANDROID", "APPLE", "FBJNI_TARGET", "react_native_target", "react_native_xplat_target", "rn_xplat_cxx_library", "subdir_glob") rn_xplat_cxx_library( name = "core", @@ -22,6 +22,7 @@ rn_xplat_cxx_library( ], fbandroid_deps = [ react_native_target("jni/react/jni:jni"), + FBJNI_TARGET, ], fbandroid_exported_headers = subdir_glob( [ @@ -40,7 +41,6 @@ rn_xplat_cxx_library( ], fbobjc_inherited_buck_flags = get_static_library_ios_flags(), fbobjc_preprocessor_flags = OBJC_ARC_PREPROCESSOR_FLAGS + get_preprocessor_flags_for_build_mode(), - force_static = True, ios_deps = [ "//xplat/FBBaseLite:FBBaseLite", "//xplat/js/react-native-github:RCTCxxModule", diff --git a/ReactCommon/turbomodule/core/TurboModule.h b/ReactCommon/turbomodule/core/TurboModule.h index 0772986a76ab66..8bc8362730ccf0 100644 --- a/ReactCommon/turbomodule/core/TurboModule.h +++ b/ReactCommon/turbomodule/core/TurboModule.h @@ -64,8 +64,8 @@ class JSI_EXPORT TurboModule : public facebook::jsi::HostObject { * An app/platform-specific provider function to get an instance of a module * given a name. */ -using TurboModuleProviderFunctionType = - std::function(const std::string &name)>; +using TurboModuleProviderFunctionType = std::function(const std::string &name, const jsi::Value *schema)>; } // namespace react } // namespace facebook diff --git a/ReactCommon/turbomodule/core/TurboModuleBinding.cpp b/ReactCommon/turbomodule/core/TurboModuleBinding.cpp index b89e4061d4e37d..0b04ac69b10d66 100644 --- a/ReactCommon/turbomodule/core/TurboModuleBinding.cpp +++ b/ReactCommon/turbomodule/core/TurboModuleBinding.cpp @@ -50,11 +50,12 @@ TurboModuleBinding::~TurboModuleBinding() { } std::shared_ptr TurboModuleBinding::getModule( - const std::string &name) { + const std::string &name, + const jsi::Value *schema) { std::shared_ptr module = nullptr; { SystraceSection s("TurboModuleBinding::getModule", "module", name); - module = moduleProvider_(name); + module = moduleProvider_(name, schema); } return module; } @@ -64,12 +65,16 @@ jsi::Value TurboModuleBinding::jsProxy( const jsi::Value &thisVal, const jsi::Value *args, size_t count) { - if (count != 1) { + if (count < 1) { throw std::invalid_argument( - "TurboModuleBinding::jsProxy arg count must be 1"); + "__turboModuleProxy must be called with at least 1 argument"); } std::string moduleName = args[0].getString(runtime).utf8(runtime); - std::shared_ptr module = getModule(moduleName); + jsi::Value nullSchema = jsi::Value::undefined(); + + std::shared_ptr module = + (count >= 2 ? getModule(moduleName, &args[1]) + : getModule(moduleName, &nullSchema)); if (module == nullptr) { return jsi::Value::null(); diff --git a/ReactCommon/turbomodule/core/TurboModuleBinding.h b/ReactCommon/turbomodule/core/TurboModuleBinding.h index 96de89bed470e8..2546730959fc12 100644 --- a/ReactCommon/turbomodule/core/TurboModuleBinding.h +++ b/ReactCommon/turbomodule/core/TurboModuleBinding.h @@ -36,7 +36,9 @@ class TurboModuleBinding { /** * Get an TurboModule instance for the given module name. */ - std::shared_ptr getModule(const std::string &name); + std::shared_ptr getModule( + const std::string &name, + const jsi::Value *schema); private: /** diff --git a/ReactCommon/turbomodule/core/TurboModulePerfLogger.cpp b/ReactCommon/turbomodule/core/TurboModulePerfLogger.cpp index 5d145e1b869b39..f69701a26c0d85 100644 --- a/ReactCommon/turbomodule/core/TurboModulePerfLogger.cpp +++ b/ReactCommon/turbomodule/core/TurboModulePerfLogger.cpp @@ -249,6 +249,13 @@ void asyncMethodCallEnd(const char *moduleName, const char *methodName) { } } +void asyncMethodCallFail(const char *moduleName, const char *methodName) { + NativeModulePerfLogger *logger = g_perfLogger.get(); + if (logger != nullptr) { + logger->asyncMethodCallFail(moduleName, methodName); + } +} + void asyncMethodCallBatchPreprocessStart() { NativeModulePerfLogger *logger = g_perfLogger.get(); if (logger != nullptr) { diff --git a/ReactCommon/turbomodule/core/TurboModulePerfLogger.h b/ReactCommon/turbomodule/core/TurboModulePerfLogger.h index fe3a8ab30d4716..56abad502f5c92 100644 --- a/ReactCommon/turbomodule/core/TurboModulePerfLogger.h +++ b/ReactCommon/turbomodule/core/TurboModulePerfLogger.h @@ -76,6 +76,7 @@ void asyncMethodCallArgConversionEnd( const char *methodName); void asyncMethodCallDispatch(const char *moduleName, const char *methodName); void asyncMethodCallEnd(const char *moduleName, const char *methodName); +void asyncMethodCallFail(const char *moduleName, const char *methodName); /** * Pre-processing async method call batch diff --git a/ReactCommon/turbomodule/core/platform/android/JavaTurboModule.cpp b/ReactCommon/turbomodule/core/platform/android/JavaTurboModule.cpp index e79158ee7ccd2d..4b5d8d6e9538b6 100644 --- a/ReactCommon/turbomodule/core/platform/android/JavaTurboModule.cpp +++ b/ReactCommon/turbomodule/core/platform/android/JavaTurboModule.cpp @@ -13,6 +13,7 @@ #include #include +#include #include #include #include @@ -20,6 +21,8 @@ #include "JavaTurboModule.h" +namespace TMPL = facebook::react::TurboModulePerfLogger; + namespace facebook { namespace react { @@ -28,6 +31,11 @@ JavaTurboModule::JavaTurboModule(const InitParams ¶ms) instance_(jni::make_global(params.instance)), nativeInvoker_(params.nativeInvoker) {} +bool JavaTurboModule::isPromiseAsyncDispatchEnabled_ = false; +void JavaTurboModule::enablePromiseAsyncDispatch(bool enable) { + isPromiseAsyncDispatchEnabled_ = enable; +} + namespace { jni::local_ref createJavaCallbackFromJSIFunction( jsi::Function &&function, @@ -197,6 +205,11 @@ std::vector getMethodArgTypesFromSignature( return methodArgs; } +int32_t getUniqueId() { + static int32_t counter = 0; + return counter++; +} + } // namespace // fnjni already does this conversion, but since we are using plain JNI, this @@ -227,7 +240,8 @@ JNIArgs JavaTurboModule::convertJSIArgsToJNIArgs( auto makeGlobalIfNecessary = [&globalRefs, env, valueKind](jobject obj) -> jobject { - if (valueKind == VoidKind) { + if (valueKind == VoidKind || + (valueKind == PromiseKind && isPromiseAsyncDispatchEnabled_)) { jobject globalObj = env->NewGlobalRef(obj); globalRefs.push_back(globalObj); env->DeleteLocalRef(obj); @@ -388,10 +402,25 @@ jsi::Value convertFromJMapToValue(JNIEnv *env, jsi::Runtime &rt, jobject arg) { jsi::Value JavaTurboModule::invokeJavaMethod( jsi::Runtime &runtime, TurboModuleMethodValueKind valueKind, - const std::string &methodName, + const std::string &methodNameStr, const std::string &methodSignature, const jsi::Value *args, size_t argCount) { + const char *methodName = methodNameStr.c_str(); + const char *moduleName = name_.c_str(); + + bool isMethodSync = + !(valueKind == VoidKind || + (valueKind == PromiseKind && isPromiseAsyncDispatchEnabled_)); + + if (isMethodSync) { + TMPL::syncMethodCallStart(moduleName, methodName); + TMPL::syncMethodCallArgConversionStart(moduleName, methodName); + } else { + TMPL::asyncMethodCallStart(moduleName, methodName); + TMPL::asyncMethodCallArgConversionStart(moduleName, methodName); + } + JNIEnv *env = jni::Environment::current(); auto instance = instance_.get(); @@ -429,22 +458,44 @@ jsi::Value JavaTurboModule::invokeJavaMethod( jclass cls = env->GetObjectClass(instance); jmethodID methodID = - env->GetMethodID(cls, methodName.c_str(), methodSignature.c_str()); + env->GetMethodID(cls, methodName, methodSignature.c_str()); + + auto checkJNIErrorForMethodCall = + [methodName, moduleName, isMethodSync]() -> void { + try { + FACEBOOK_JNI_THROW_PENDING_EXCEPTION(); + } catch (...) { + if (isMethodSync) { + TMPL::syncMethodCallFail(moduleName, methodName); + } else { + TMPL::asyncMethodCallFail(moduleName, methodName); + } + throw; + } + }; // If the method signature doesn't match, show a redbox here instead of // crashing later. - FACEBOOK_JNI_THROW_PENDING_EXCEPTION(); + checkJNIErrorForMethodCall(); // TODO(T43933641): Refactor to remove this special-casing - if (methodName == "getConstants") { + if (methodNameStr == "getConstants") { + TMPL::syncMethodCallArgConversionEnd(moduleName, methodName); + TMPL::syncMethodCallExecutionStart(moduleName, methodName); + auto constantsMap = (jobject)env->CallObjectMethod(instance, methodID); - FACEBOOK_JNI_THROW_PENDING_EXCEPTION(); + checkJNIErrorForMethodCall(); - if (constantsMap == nullptr) { - return jsi::Value::undefined(); - } + TMPL::syncMethodCallExecutionEnd(moduleName, methodName); + TMPL::syncMethodCallReturnConversionStart(moduleName, methodName); - return convertFromJMapToValue(env, runtime, constantsMap); + jsi::Value returnValue = constantsMap == nullptr + ? jsi::Value::undefined() + : convertFromJMapToValue(env, runtime, constantsMap); + + TMPL::syncMethodCallReturnConversionEnd(moduleName, methodName); + TMPL::syncMethodCallEnd(moduleName, methodName); + return returnValue; } std::vector methodArgTypes = @@ -453,65 +504,62 @@ jsi::Value JavaTurboModule::invokeJavaMethod( JNIArgs jniArgs = convertJSIArgsToJNIArgs( env, runtime, - methodName, + methodNameStr, methodArgTypes, args, argCount, jsInvoker_, valueKind); + if (isMethodSync && valueKind != PromiseKind) { + TMPL::syncMethodCallArgConversionEnd(moduleName, methodName); + TMPL::syncMethodCallExecutionStart(moduleName, methodName); + } + auto &jargs = jniArgs.args_; auto &globalRefs = jniArgs.globalRefs_; switch (valueKind) { - case VoidKind: { - nativeInvoker_->invokeAsync( - [jargs, globalRefs, methodID, instance_ = instance_]() mutable - -> void { - /** - * TODO(ramanpreet): Why do we have to require the environment - * again? Why does JNI crash when we use the env from the upper - * scope? - */ - JNIEnv *env = jni::Environment::current(); - - env->CallVoidMethodA(instance_.get(), methodID, jargs.data()); - FACEBOOK_JNI_THROW_PENDING_EXCEPTION(); - - for (auto globalRef : globalRefs) { - env->DeleteGlobalRef(globalRef); - } - }); - - return jsi::Value::undefined(); - } case BooleanKind: { std::string returnType = methodSignature.substr(methodSignature.find_last_of(')') + 1); if (returnType == "Ljava/lang/Boolean;") { auto returnObject = (jobject)env->CallObjectMethodA(instance, methodID, jargs.data()); - FACEBOOK_JNI_THROW_PENDING_EXCEPTION(); - - if (returnObject == nullptr) { - return jsi::Value::null(); + checkJNIErrorForMethodCall(); + + TMPL::syncMethodCallExecutionEnd(moduleName, methodName); + TMPL::syncMethodCallReturnConversionStart(moduleName, methodName); + + jsi::Value returnValue = jsi::Value::null(); + if (returnObject != nullptr) { + jclass booleanClass = env->FindClass("java/lang/Boolean"); + jmethodID booleanValueMethod = + env->GetMethodID(booleanClass, "booleanValue", "()Z"); + bool returnBoolean = + (bool)env->CallBooleanMethod(returnObject, booleanValueMethod); + checkJNIErrorForMethodCall(); + returnValue = jsi::Value(returnBoolean); } - jclass booleanClass = env->FindClass("java/lang/Boolean"); - jmethodID booleanValueMethod = - env->GetMethodID(booleanClass, "booleanValue", "()Z"); - bool returnBoolean = - (bool)env->CallBooleanMethod(returnObject, booleanValueMethod); - FACEBOOK_JNI_THROW_PENDING_EXCEPTION(); - - return jsi::Value(returnBoolean); + TMPL::syncMethodCallReturnConversionEnd(moduleName, methodName); + TMPL::syncMethodCallEnd(moduleName, methodName); + return returnValue; } bool returnBoolean = (bool)env->CallBooleanMethodA(instance, methodID, jargs.data()); - FACEBOOK_JNI_THROW_PENDING_EXCEPTION(); + checkJNIErrorForMethodCall(); + + TMPL::syncMethodCallExecutionEnd(moduleName, methodName); + TMPL::syncMethodCallReturnConversionStart(moduleName, methodName); - return jsi::Value(returnBoolean); + jsi::Value returnValue = jsi::Value(returnBoolean); + + TMPL::syncMethodCallReturnConversionEnd(moduleName, methodName); + TMPL::syncMethodCallEnd(moduleName, methodName); + + return returnValue; } case NumberKind: { std::string returnType = @@ -519,64 +567,139 @@ jsi::Value JavaTurboModule::invokeJavaMethod( if (returnType == "Ljava/lang/Double;") { auto returnObject = (jobject)env->CallObjectMethodA(instance, methodID, jargs.data()); - FACEBOOK_JNI_THROW_PENDING_EXCEPTION(); - - if (returnObject == nullptr) { - return jsi::Value::null(); + checkJNIErrorForMethodCall(); + + TMPL::syncMethodCallExecutionEnd(moduleName, methodName); + TMPL::syncMethodCallReturnConversionStart(moduleName, methodName); + + jsi::Value returnValue = jsi::Value::null(); + if (returnObject != nullptr) { + jclass doubleClass = env->FindClass("java/lang/Double"); + jmethodID doubleValueMethod = + env->GetMethodID(doubleClass, "doubleValue", "()D"); + double returnDouble = + (double)env->CallDoubleMethod(returnObject, doubleValueMethod); + checkJNIErrorForMethodCall(); + returnValue = jsi::Value(returnDouble); } - jclass doubleClass = env->FindClass("java/lang/Double"); - jmethodID doubleValueMethod = - env->GetMethodID(doubleClass, "doubleValue", "()D"); - double returnDouble = - (double)env->CallDoubleMethod(returnObject, doubleValueMethod); - FACEBOOK_JNI_THROW_PENDING_EXCEPTION(); - - return jsi::Value(returnDouble); + TMPL::syncMethodCallReturnConversionEnd(moduleName, methodName); + TMPL::syncMethodCallEnd(moduleName, methodName); + return returnValue; } double returnDouble = (double)env->CallDoubleMethodA(instance, methodID, jargs.data()); - FACEBOOK_JNI_THROW_PENDING_EXCEPTION(); + checkJNIErrorForMethodCall(); - return jsi::Value(returnDouble); + TMPL::syncMethodCallExecutionEnd(moduleName, methodName); + TMPL::syncMethodCallReturnConversionStart(moduleName, methodName); + + jsi::Value returnValue = jsi::Value(returnDouble); + + TMPL::syncMethodCallReturnConversionEnd(moduleName, methodName); + TMPL::syncMethodCallEnd(moduleName, methodName); + return returnValue; } case StringKind: { auto returnString = (jstring)env->CallObjectMethodA(instance, methodID, jargs.data()); - FACEBOOK_JNI_THROW_PENDING_EXCEPTION(); - - if (returnString == nullptr) { - return jsi::Value::null(); + checkJNIErrorForMethodCall(); + + TMPL::syncMethodCallExecutionEnd(moduleName, methodName); + TMPL::syncMethodCallReturnConversionStart(moduleName, methodName); + + jsi::Value returnValue = jsi::Value::null(); + if (returnString != nullptr) { + const char *js = env->GetStringUTFChars(returnString, nullptr); + std::string result = js; + env->ReleaseStringUTFChars(returnString, js); + returnValue = + jsi::Value(runtime, jsi::String::createFromUtf8(runtime, result)); } - const char *js = env->GetStringUTFChars(returnString, nullptr); - std::string result = js; - env->ReleaseStringUTFChars(returnString, js); - return jsi::Value(runtime, jsi::String::createFromUtf8(runtime, result)); + + TMPL::syncMethodCallReturnConversionEnd(moduleName, methodName); + TMPL::syncMethodCallEnd(moduleName, methodName); + return returnValue; } case ObjectKind: { auto returnObject = (jobject)env->CallObjectMethodA(instance, methodID, jargs.data()); - FACEBOOK_JNI_THROW_PENDING_EXCEPTION(); + checkJNIErrorForMethodCall(); + + TMPL::syncMethodCallExecutionEnd(moduleName, methodName); + TMPL::syncMethodCallReturnConversionStart(moduleName, methodName); - if (returnObject == nullptr) { - return jsi::Value::null(); + jsi::Value returnValue = jsi::Value::null(); + if (returnObject != nullptr) { + auto jResult = jni::adopt_local(returnObject); + auto result = jni::static_ref_cast(jResult); + returnValue = + jsi::valueFromDynamic(runtime, result->cthis()->consume()); } - auto jResult = jni::adopt_local(returnObject); - auto result = jni::static_ref_cast(jResult); - return jsi::valueFromDynamic(runtime, result->cthis()->consume()); + + TMPL::syncMethodCallReturnConversionEnd(moduleName, methodName); + TMPL::syncMethodCallEnd(moduleName, methodName); + return returnValue; } case ArrayKind: { auto returnObject = (jobject)env->CallObjectMethodA(instance, methodID, jargs.data()); - FACEBOOK_JNI_THROW_PENDING_EXCEPTION(); + checkJNIErrorForMethodCall(); + + TMPL::syncMethodCallExecutionEnd(moduleName, methodName); + TMPL::syncMethodCallReturnConversionStart(moduleName, methodName); - if (returnObject == nullptr) { - return jsi::Value::null(); + jsi::Value returnValue = jsi::Value::null(); + if (returnObject != nullptr) { + auto jResult = jni::adopt_local(returnObject); + auto result = jni::static_ref_cast(jResult); + returnValue = + jsi::valueFromDynamic(runtime, result->cthis()->consume()); } - auto jResult = jni::adopt_local(returnObject); - auto result = jni::static_ref_cast(jResult); - return jsi::valueFromDynamic(runtime, result->cthis()->consume()); + + TMPL::syncMethodCallReturnConversionEnd(moduleName, methodName); + TMPL::syncMethodCallEnd(moduleName, methodName); + return returnValue; + } + case VoidKind: { + TMPL::asyncMethodCallArgConversionEnd(moduleName, methodName); + TMPL::asyncMethodCallDispatch(moduleName, methodName); + + nativeInvoker_->invokeAsync( + [jargs, + globalRefs, + methodID, + instance_ = instance_, + moduleNameStr = name_, + methodNameStr, + id = getUniqueId()]() mutable -> void { + /** + * TODO(ramanpreet): Why do we have to require the environment + * again? Why does JNI crash when we use the env from the upper + * scope? + */ + JNIEnv *env = jni::Environment::current(); + const char *moduleName = moduleNameStr.c_str(); + const char *methodName = methodNameStr.c_str(); + + TMPL::asyncMethodCallExecutionStart(moduleName, methodName, id); + env->CallVoidMethodA(instance_.get(), methodID, jargs.data()); + try { + FACEBOOK_JNI_THROW_PENDING_EXCEPTION(); + } catch (...) { + TMPL::asyncMethodCallExecutionFail(moduleName, methodName, id); + throw; + } + + for (auto globalRef : globalRefs) { + env->DeleteGlobalRef(globalRef); + } + TMPL::asyncMethodCallExecutionEnd(moduleName, methodName, id); + }); + + TMPL::asyncMethodCallEnd(moduleName, methodName); + return jsi::Value::undefined(); } case PromiseKind: { jsi::Function Promise = @@ -586,7 +709,15 @@ jsi::Value JavaTurboModule::invokeJavaMethod( runtime, jsi::PropNameID::forAscii(runtime, "fn"), 2, - [this, &jargs, argCount, instance, methodID, env]( + [this, + &jargs, + &globalRefs, + argCount, + instance_ = instance_, + methodID, + moduleNameStr = name_, + methodNameStr, + env]( jsi::Runtime &runtime, const jsi::Value &thisVal, const jsi::Value *promiseConstructorArgs, @@ -619,21 +750,82 @@ jsi::Value JavaTurboModule::invokeJavaMethod( jobject promise = env->NewObject( jPromiseImpl, jPromiseImplConstructor, resolve, reject); - jargs[argCount].l = promise; - env->CallVoidMethodA(instance, methodID, jargs.data()); + const char *moduleName = moduleNameStr.c_str(); + const char *methodName = methodNameStr.c_str(); + + if (isPromiseAsyncDispatchEnabled_) { + jobject globalPromise = env->NewGlobalRef(promise); + + globalRefs.push_back(globalPromise); + env->DeleteLocalRef(promise); + + jargs[argCount].l = globalPromise; + TMPL::asyncMethodCallArgConversionEnd(moduleName, methodName); + TMPL::asyncMethodCallDispatch(moduleName, methodName); + + nativeInvoker_->invokeAsync( + [jargs, + globalRefs, + methodID, + instance_ = instance_, + moduleNameStr, + methodNameStr, + id = getUniqueId()]() mutable -> void { + /** + * TODO(ramanpreet): Why do we have to require the + * environment again? Why does JNI crash when we use the env + * from the upper scope? + */ + JNIEnv *env = jni::Environment::current(); + const char *moduleName = moduleNameStr.c_str(); + const char *methodName = methodNameStr.c_str(); + + TMPL::asyncMethodCallExecutionStart( + moduleName, methodName, id); + env->CallVoidMethodA( + instance_.get(), methodID, jargs.data()); + try { + FACEBOOK_JNI_THROW_PENDING_EXCEPTION(); + } catch (...) { + TMPL::asyncMethodCallExecutionFail( + moduleName, methodName, id); + throw; + } + + for (auto globalRef : globalRefs) { + env->DeleteGlobalRef(globalRef); + } + TMPL::asyncMethodCallExecutionEnd( + moduleName, methodName, id); + }); + + } else { + jargs[argCount].l = promise; + TMPL::syncMethodCallArgConversionEnd(moduleName, methodName); + TMPL::syncMethodCallExecutionStart(moduleName, methodName); + env->CallVoidMethodA(instance_.get(), methodID, jargs.data()); + TMPL::syncMethodCallExecutionEnd(moduleName, methodName); + TMPL::syncMethodCallReturnConversionStart(moduleName, methodName); + } return jsi::Value::undefined(); }); jsi::Value promise = Promise.callAsConstructor(runtime, promiseConstructorArg); - FACEBOOK_JNI_THROW_PENDING_EXCEPTION(); + checkJNIErrorForMethodCall(); + if (isPromiseAsyncDispatchEnabled_) { + TMPL::asyncMethodCallEnd(moduleName, methodName); + } else { + TMPL::syncMethodCallReturnConversionEnd(moduleName, methodName); + TMPL::syncMethodCallEnd(moduleName, methodName); + } return promise; } default: throw std::runtime_error( - "Unable to find method module: " + methodName + "(" + + "Unable to find method module: " + methodNameStr + "(" + methodSignature + ")"); } } diff --git a/ReactCommon/turbomodule/core/platform/android/JavaTurboModule.h b/ReactCommon/turbomodule/core/platform/android/JavaTurboModule.h index 3a903e49558b76..642cacb194a85b 100644 --- a/ReactCommon/turbomodule/core/platform/android/JavaTurboModule.h +++ b/ReactCommon/turbomodule/core/platform/android/JavaTurboModule.h @@ -49,10 +49,17 @@ class JSI_EXPORT JavaTurboModule : public TurboModule { const jsi::Value *args, size_t argCount); + static void enablePromiseAsyncDispatch(bool enable); + private: jni::global_ref instance_; std::shared_ptr nativeInvoker_; + /** + * Experiments + */ + static bool isPromiseAsyncDispatchEnabled_; + JNIArgs convertJSIArgsToJNIArgs( JNIEnv *env, jsi::Runtime &rt, diff --git a/ReactCommon/turbomodule/core/platform/ios/RCTTurboModuleManager.mm b/ReactCommon/turbomodule/core/platform/ios/RCTTurboModuleManager.mm index f93dfa4f1aecad..0d89875a25bb56 100644 --- a/ReactCommon/turbomodule/core/platform/ios/RCTTurboModuleManager.mm +++ b/ReactCommon/turbomodule/core/platform/ios/RCTTurboModuleManager.mm @@ -656,7 +656,8 @@ - (void)installJSBindingWithRuntimeExecutor:(facebook::react::RuntimeExecutor)ru } __weak __typeof(self) weakSelf = self; - auto turboModuleProvider = [weakSelf](const std::string &name) -> std::shared_ptr { + auto turboModuleProvider = + [weakSelf](const std::string &name, const jsi::Value *schema) -> std::shared_ptr { if (!weakSelf) { return nullptr; } diff --git a/ReactCommon/yoga/yoga/YGEnums.cpp b/ReactCommon/yoga/yoga/YGEnums.cpp index 3c1301297b3c82..c01d3d94b3f190 100644 --- a/ReactCommon/yoga/yoga/YGEnums.cpp +++ b/ReactCommon/yoga/yoga/YGEnums.cpp @@ -179,6 +179,8 @@ const char* YGOverflowToString(const YGOverflow value) { const char* YGPositionTypeToString(const YGPositionType value) { switch (value) { + case YGPositionTypeStatic: + return "static"; case YGPositionTypeRelative: return "relative"; case YGPositionTypeAbsolute: diff --git a/ReactCommon/yoga/yoga/YGEnums.h b/ReactCommon/yoga/yoga/YGEnums.h index 4241281d76daa1..3dc458dcb31a08 100644 --- a/ReactCommon/yoga/yoga/YGEnums.h +++ b/ReactCommon/yoga/yoga/YGEnums.h @@ -128,7 +128,11 @@ YG_ENUM_SEQ_DECL( YGOverflowHidden, YGOverflowScroll) -YG_ENUM_SEQ_DECL(YGPositionType, YGPositionTypeRelative, YGPositionTypeAbsolute) +YG_ENUM_SEQ_DECL( + YGPositionType, + YGPositionTypeStatic, + YGPositionTypeRelative, + YGPositionTypeAbsolute) YG_ENUM_DECL( YGPrintOptions, diff --git a/architecture.gradle b/architecture.gradle new file mode 100644 index 00000000000000..ff3297f760f542 --- /dev/null +++ b/architecture.gradle @@ -0,0 +1,88 @@ +/* + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + + +def codegenDir = "$rootDir/packages/react-native-codegen"; +def codegenGenerateSchemaCli = "$codegenDir/lib/cli/combine/combine-js-to-schema-cli.js"; +def codegenGenerateNativeModuleSpecsCli = "$rootDir/scripts/generate-native-modules-specs-cli.js"; +def schemaFile = "schema.json"; + +// TODO: Consider building Gradle plugin instead. + +/** + * The config is derived from app-level `project.react`. + */ +ext.generateNativeArtifactsFromJavaScript = { Map config -> + def nodeExecutableAndArgs = config.nodeExecutableAndArgs ?: ["node"]; + def jsRootDir = config.jsRootDir ?: config.root; + + if (!config.enableCodegen) { + return; + } + + // 1. Create build dir + def generatedSrcDir = file("$buildDir/generated/source/codegen"); + + // 2. Produce schema from JS files. + task generateCodegenSchemaFromJavaScript(type: Exec) { + doFirst { + generatedSrcDir.deleteDir() + generatedSrcDir.mkdirs() + } + + def schemaOutputFile = file("$generatedSrcDir/$schemaFile"); + + inputs.files fileTree(dir: codegenDir) + inputs.files fileTree(dir: jsRootDir) + outputs.file(schemaOutputFile) + + def execCommands = ["yarn"] + nodeExecutableAndArgs + [ + codegenGenerateSchemaCli, + "$schemaOutputFile", + jsRootDir, + ]; + commandLine execCommands + + ext.schema = { + schemaOutputFile + } + } + + // 3. Generate Java code from schema + task generateCodegenArtifactsFromSchema(dependsOn: 'generateCodegenSchemaFromJavaScript', type: Exec) { + + def generatedSchema = tasks.generateCodegenSchemaFromJavaScript.schema(); + def javaPackageName = config.codegenJavaPackageName ?: "com.facebook.fbreact.specs.beta"; + def javaPackageDir = javaPackageName.replace(".", "/"); + def outputDir = file("$generatedSrcDir/java/$javaPackageDir"); + + inputs.files fileTree(dir: codegenDir) + inputs.files generatedSchema + outputs.dir(outputDir) + + def execCommands = ["yarn"] + nodeExecutableAndArgs + [ + codegenGenerateNativeModuleSpecsCli, + "android", + "$generatedSchema", + "$outputDir", + ]; + commandLine execCommands + } + + // 4. add deps + srcs + preBuild.dependsOn generateCodegenArtifactsFromSchema + + android { + sourceSets { + main { + java { + srcDirs += "$generatedSrcDir/java" + } + } + } + } +} diff --git a/flow-typed/npm/base64-js_v1.x.x.js b/flow-typed/npm/base64-js_v1.x.x.js new file mode 100644 index 00000000000000..8653866fdba324 --- /dev/null +++ b/flow-typed/npm/base64-js_v1.x.x.js @@ -0,0 +1,14 @@ +/** + * (c) Facebook, Inc. and its affiliates. Confidential and proprietary. + * + * @flow strict + * @format + */ + +declare module 'base64-js' { + declare module.exports: { + byteLength: string => number, + fromByteArray: (Uint8Array | Array) => string, + toByteArray: string => Uint8Array, + }; +} diff --git a/flow-typed/npm/pretty-format_v26.x.x.js b/flow-typed/npm/pretty-format_v26.x.x.js new file mode 100644 index 00000000000000..181d7909b34c8c --- /dev/null +++ b/flow-typed/npm/pretty-format_v26.x.x.js @@ -0,0 +1,51 @@ +/** + * (c) Facebook, Inc. and its affiliates. Confidential and proprietary. + * + * @flow strict + * @format + */ + +type PrettyFormatPlugin = + | { + test: (value: mixed) => boolean, + print: (value: mixed) => string, + } + | { + test: (value: mixed) => boolean, + serialize: (value: mixed) => string, + }; + +declare module 'pretty-format' { + declare module.exports: { + ( + value: mixed, + options?: ?{ + callToJSON?: ?boolean, + escapeRegex?: ?boolean, + escapeString?: ?boolean, + highlight?: ?boolean, + indent?: ?number, + maxDepth?: ?number, + min?: ?boolean, + plugins?: ?Array, + printFunctionName?: ?boolean, + theme?: ?{ + comment?: ?string, + prop?: ?string, + tag?: ?string, + value: ?string, + }, + }, + ): string, + + plugins: { + AsymmetricMatcher: PrettyFormatPlugin, + ConvertAnsi: PrettyFormatPlugin, + DOMCollection: PrettyFormatPlugin, + DOMElement: PrettyFormatPlugin, + Immutable: PrettyFormatPlugin, + ReactElement: PrettyFormatPlugin, + ReactTestComponent: PrettyFormatPlugin, + }, + }; +} diff --git a/flow-typed/npm/promise_v8.x.x.js b/flow-typed/npm/promise_v8.x.x.js new file mode 100644 index 00000000000000..580f98cdd6303e --- /dev/null +++ b/flow-typed/npm/promise_v8.x.x.js @@ -0,0 +1,32 @@ +/** + * (c) Facebook, Inc. and its affiliates. Confidential and proprietary. + * + * @flow strict + * @format + */ + +declare module 'promise/setimmediate/es6-extensions' { + declare module.exports: Class; +} + +declare module 'promise/setimmediate/done' { + declare module.exports: Class; +} + +declare module 'promise/setimmediate/finally' { + declare module.exports: Class; +} + +declare module 'promise/setimmediate/rejection-tracking' { + declare module.exports: { + enable: ( + options?: ?{ + whitelist?: ?Array, + allRejections?: ?boolean, + onUnhandled?: ?(number, mixed) => void, + onHandled?: ?(number, mixed) => void, + }, + ) => void, + disable: () => void, + }; +} diff --git a/flow-typed/npm/stacktrace-parser_v0.1.x.js b/flow-typed/npm/stacktrace-parser_v0.1.x.js new file mode 100644 index 00000000000000..9e99014453138f --- /dev/null +++ b/flow-typed/npm/stacktrace-parser_v0.1.x.js @@ -0,0 +1,19 @@ +/** + * (c) Facebook, Inc. and its affiliates. Confidential and proprietary. + * + * @flow strict + * @format + */ + +type StackFrame = { + file: string, + methodName: string, + lineNumber: number, + column: ?number, +}; + +declare module 'stacktrace-parser' { + declare module.exports: { + parse: string => Array, + }; +} diff --git a/jest-preset.js b/jest-preset.js index 6c9079d28115cb..37deb3991b4cde 100644 --- a/jest-preset.js +++ b/jest-preset.js @@ -21,7 +21,7 @@ module.exports = { ), }, transformIgnorePatterns: [ - 'node_modules/(?!(jest-)?react-native|@react-native-community)', + 'node_modules/(?!((jest-)?react-native|@react-native(-community)?)/)', ], setupFiles: [require.resolve('./jest/setup.js')], testEnvironment: 'node', diff --git a/jest.config.js b/jest.config.js index 0a5d16eac0200d..0d63c9fee19f46 100644 --- a/jest.config.js +++ b/jest.config.js @@ -3,55 +3,51 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. + * + * @format */ 'use strict'; module.exports = { - 'transform': { - '^.+\\.(bmp|gif|jpg|jpeg|mp4|png|psd|svg|webp)$': '/jest/assetFileTransformer.js', - '.*': './jest/preprocessor.js', - }, - 'setupFiles': [ - './jest/setup.js', - ], - 'timers': 'fake', - 'testRegex': '/__tests__/.*-test\\.js$', - 'testPathIgnorePatterns': [ - '/node_modules/', - '/template', - 'Libraries/Renderer', - 'RNTester/e2e', - ], - 'haste': { - 'defaultPlatform': 'ios', - 'platforms': [ - 'ios', - 'android', - 'macos', - ], - }, - 'unmockedModulePathPatterns': [ - 'node_modules/react/', - 'Libraries/Renderer', - 'promise', - 'source-map', - 'fastpath', - 'denodeify', - 'fbjs', - ], - 'testEnvironment': 'node', - 'moduleNameMapper': { - 'react-native-codegen/(.*)': '/packages/react-native-codegen/$1', - 'eslint/lib/rules/(.*)': '/node_modules/eslint/lib/rules/$1', - 'react-native(.*)': '$1', - }, - 'collectCoverageFrom': [ - 'Libraries/**/*.js', - ], - 'coveragePathIgnorePatterns': [ - '/__tests__/', - '/vendor/', - '/Libraries/react-native/', - ], + transform: { + '^.+\\.(bmp|gif|jpg|jpeg|mp4|png|psd|svg|webp)$': + '/jest/assetFileTransformer.js', + '.*': './jest/preprocessor.js', + }, + setupFiles: ['./jest/setup.js'], + timers: 'fake', + testRegex: '/__tests__/.*-test\\.js$', + testPathIgnorePatterns: [ + '/node_modules/', + '/template', + 'Libraries/Renderer', + 'RNTester/e2e', + ], + transformIgnorePatterns: ['node_modules/(?!@react-native/)'], + haste: { + defaultPlatform: 'ios', + platforms: ['ios', 'android', 'macos'], + }, + unmockedModulePathPatterns: [ + 'node_modules/react/', + 'Libraries/Renderer', + 'promise', + 'source-map', + 'fastpath', + 'denodeify', + 'fbjs', + ], + testEnvironment: 'node', + moduleNameMapper: { + 'react-native-codegen/(.*)': '/packages/react-native-codegen/$1', + 'eslint/lib/rules/(.*)': '/node_modules/eslint/lib/rules/$1', + '^react-native(.*)': '$1', + }, + collectCoverageFrom: ['Libraries/**/*.js'], + coveragePathIgnorePatterns: [ + '/__tests__/', + '/vendor/', + '/Libraries/react-native/', + ], }; diff --git a/jest/mockComponent.js b/jest/mockComponent.js index 28e222123961ba..42a30c8c6e68ac 100644 --- a/jest/mockComponent.js +++ b/jest/mockComponent.js @@ -16,17 +16,19 @@ module.exports = (moduleName, instanceMethods) => { const SuperClass = typeof RealComponent === 'function' ? RealComponent : React.Component; + const name = + RealComponent.displayName || + RealComponent.name || + (RealComponent.render // handle React.forwardRef + ? RealComponent.render.displayName || RealComponent.render.name + : 'Unknown'); + + const nameWithoutPrefix = name.replace(/^(RCT|RK)/, ''); + const Component = class extends SuperClass { static displayName = 'Component'; render() { - const name = - RealComponent.displayName || - RealComponent.name || - (RealComponent.render // handle React.forwardRef - ? RealComponent.render.displayName || RealComponent.render.name - : 'Unknown'); - const props = Object.assign({}, RealComponent.defaultProps); if (this.props) { @@ -42,14 +44,12 @@ module.exports = (moduleName, instanceMethods) => { }); } - return React.createElement( - name.replace(/^(RCT|RK)/, ''), - props, - this.props.children, - ); + return React.createElement(nameWithoutPrefix, props, this.props.children); } }; + Component.displayName = nameWithoutPrefix; + Object.keys(RealComponent).forEach(classStatic => { Component[classStatic] = RealComponent[classStatic]; }); diff --git a/jest/preprocessor.js b/jest/preprocessor.js index 5920c0a6f23c05..b08da26a396822 100644 --- a/jest/preprocessor.js +++ b/jest/preprocessor.js @@ -47,6 +47,7 @@ module.exports = { dev: true, enableBabelRuntime: false, experimentalImportSupport: false, + globalPrefix: '', hot: false, inlineRequires: true, minify: false, diff --git a/jest/setup.js b/jest/setup.js index d834e52a99fe0f..bc27b00e23abf0 100644 --- a/jest/setup.js +++ b/jest/setup.js @@ -12,8 +12,8 @@ const MockNativeMethods = jest.requireActual('./MockNativeMethods'); const mockComponent = jest.requireActual('./mockComponent'); -jest.requireActual('../Libraries/polyfills/Object.es7.js'); -jest.requireActual('../Libraries/polyfills/error-guard'); +jest.requireActual('@react-native/polyfills/Object.es7'); +jest.requireActual('@react-native/polyfills/error-guard'); global.__DEV__ = true; diff --git a/package.json b/package.json index 1fec8ec8fafc1a..d8ebf55bf30562 100644 --- a/package.json +++ b/package.json @@ -87,12 +87,15 @@ "postinstall": "node scripts/postInstall.js" }, "peerDependencies": { - "react": "16.13.1" + "react": "0.0.0-experimental-aae83a4b9" }, "dependencies": { "@react-native-community/cli": "^4.10.0", "@react-native-community/cli-platform-android": "^4.10.0", "@react-native-community/cli-platform-ios": "^4.10.0", + "@react-native/assets": "1.0.0", + "@react-native/polyfills": "1.0.0", + "@react-native/normalize-color": "1.0.0", "abort-controller": "^3.0.0", "anser": "^1.4.9", "base64-js": "^1.1.2", @@ -102,9 +105,9 @@ "hermes-engine": "~0.5.0", "invariant": "^2.2.4", "jsc-android": "^245459.0.0", - "metro-babel-register": "0.60.0", - "metro-react-native-babel-transformer": "0.60.0", - "metro-source-map": "0.60.0", + "metro-babel-register": "0.61.0", + "metro-react-native-babel-transformer": "0.61.0", + "metro-source-map": "0.61.0", "nullthrows": "^1.1.1", "pretty-format": "^26.0.1", "promise": "^8.0.3", @@ -113,7 +116,7 @@ "react-devtools-core": "^4.6.0", "react-refresh": "^0.4.0", "regenerator-runtime": "^0.13.2", - "scheduler": "0.19.1", + "scheduler": "0.0.0-experimental-aae83a4b9", "stacktrace-parser": "^0.1.3", "use-subscription": "^1.0.0", "whatwg-fetch": "^3.0.0" @@ -123,13 +126,15 @@ "@babel/generator": "^7.5.0", "@react-native-community/eslint-plugin": "file:packages/eslint-plugin-react-native-community", "@reactions/component": "^2.0.2", + "@typescript-eslint/eslint-plugin": "4.30.0", + "@typescript-eslint/parser": "4.30.0", "async": "^2.4.0", - "babel-eslint": "10.0.1", + "babel-eslint": "^10.1.0", "clang-format": "^1.2.4", "connect": "^3.6.5", "coveralls": "^3.0.2", "detox": "16.7.2", - "eslint": "5.1.0", + "eslint": "6.8.0", "eslint-config-fb-strict": "^24.9.0", "eslint-config-fbjs": "2.1.0", "eslint-config-prettier": "^6.0.0", @@ -143,7 +148,7 @@ "eslint-plugin-react-hooks": "^4.0.7", "eslint-plugin-react-native": "3.8.1", "eslint-plugin-relay": "1.7.1", - "flow-bin": "^0.129.0", + "flow-bin": "^0.130.0", "flow-remove-types": "1.2.3", "hermes-engine-darwin": "~0.5.0", "jest": "^26.0.1", @@ -151,11 +156,12 @@ "jscodeshift": "^0.9.0", "mkdirp": "^0.5.1", "prettier": "1.19.1", - "react": "16.13.1", - "react-test-renderer": "16.13.1", + "react": "0.0.0-experimental-aae83a4b9", "react-shallow-renderer": "16.13.1", + "react-test-renderer": "0.0.0-experimental-aae83a4b9", "shelljs": "^0.7.8", "signedsource": "^1.0.0", + "typescript": "4.4.2", "ws": "^6.1.4", "yargs": "^15.3.1" }, diff --git a/packages/assets/.npmignore b/packages/assets/.npmignore new file mode 100644 index 00000000000000..9b166b095d3fae --- /dev/null +++ b/packages/assets/.npmignore @@ -0,0 +1,3 @@ +**/__mocks__/** +**/__tests__/** +BUCK diff --git a/packages/assets/BUCK b/packages/assets/BUCK new file mode 100644 index 00000000000000..fa6f04f440ac24 --- /dev/null +++ b/packages/assets/BUCK @@ -0,0 +1,34 @@ +load("@fbsource//tools/build_defs:js_glob.bzl", "js_glob") +load("@fbsource//tools/build_defs/third_party:yarn_defs.bzl", "yarn_workspace") +load("@fbsource//xplat/js:JS_DEFS.bzl", "rn_library") + +rn_library( + name = "assets", + srcs = js_glob([ + "**/*", + "package.json", + ]), + labels = ["supermodule:xplat/default/public.react_native.core"], + skip_processors = True, + visibility = ["PUBLIC"], + worker = "//xplat/js:experimental-packager", +) + +yarn_workspace( + name = "yarn-workspace", + srcs = glob( + [ + "**/*.js", + "**/*.json", + ], + exclude = [ + "**/__fixtures__/**", + "**/__flowtests__/**", + "**/__mocks__/**", + "**/__tests__/**", + "**/node_modules/**", + "**/node_modules/.bin/**", + ], + ), + visibility = ["PUBLIC"], +) diff --git a/packages/assets/package.json b/packages/assets/package.json new file mode 100644 index 00000000000000..13064909c99bb9 --- /dev/null +++ b/packages/assets/package.json @@ -0,0 +1,10 @@ +{ + "name": "@react-native/assets", + "version": "1.0.0", + "description": "Asset support code for React Native.", + "repository": { + "type": "git", + "url": "git@github.com:facebook/react-native.git" + }, + "license": "MIT" +} diff --git a/Libraries/Image/assetPathUtils.js b/packages/assets/path-support.js similarity index 75% rename from Libraries/Image/assetPathUtils.js rename to packages/assets/path-support.js index 6281c959984d9c..d91943dbf1d92e 100644 --- a/Libraries/Image/assetPathUtils.js +++ b/packages/assets/path-support.js @@ -10,7 +10,7 @@ 'use strict'; -import type {PackagerAsset} from './AssetRegistry'; +import type {PackagerAsset} from './registry.js'; const androidScaleSuffix = { '0.75': 'ldpi', @@ -51,7 +51,7 @@ function getAndroidResourceFolderName( if (!drawableFileTypes.has(asset.type)) { return 'raw'; } - var suffix = getAndroidAssetSuffix(scale); + const suffix = getAndroidAssetSuffix(scale); if (!suffix) { throw new Error( "Don't know which android drawable suffix to use for scale: " + @@ -62,13 +62,11 @@ function getAndroidResourceFolderName( JSON.stringify(androidScaleSuffix, null, '\t'), ); } - const androidFolder = 'drawable-' + suffix; - return androidFolder; + return 'drawable-' + suffix; } function getAndroidResourceIdentifier(asset: PackagerAsset): string { - var folderPath = getBasePath(asset); - return (folderPath + '/' + asset.name) + return (getBasePath(asset) + '/' + asset.name) .toLowerCase() .replace(/\//g, '_') // Encode folder structure in file name .replace(/([^a-z0-9_])/g, '') // Remove illegal chars @@ -76,16 +74,12 @@ function getAndroidResourceIdentifier(asset: PackagerAsset): string { } function getBasePath(asset: PackagerAsset): string { - var basePath = asset.httpServerLocation; - if (basePath[0] === '/') { - basePath = basePath.substr(1); - } - return basePath; + const basePath = asset.httpServerLocation; + return basePath.startsWith('/') ? basePath.substr(1) : basePath; } module.exports = { - getAndroidAssetSuffix: getAndroidAssetSuffix, - getAndroidResourceFolderName: getAndroidResourceFolderName, - getAndroidResourceIdentifier: getAndroidResourceIdentifier, - getBasePath: getBasePath, + getAndroidResourceFolderName, + getAndroidResourceIdentifier, + getBasePath, }; diff --git a/packages/assets/registry.js b/packages/assets/registry.js new file mode 100644 index 00000000000000..088187ff3e70ab --- /dev/null +++ b/packages/assets/registry.js @@ -0,0 +1,38 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict + * @format + */ + +'use strict'; + +export type PackagerAsset = { + +__packager_asset: boolean, + +fileSystemLocation: string, + +httpServerLocation: string, + +width: ?number, + +height: ?number, + +scales: Array, + +hash: string, + +name: string, + +type: string, + ... +}; + +const assets: Array = []; + +function registerAsset(asset: PackagerAsset): number { + // `push` returns new array length, so the first asset will + // get id 1 (not 0) to make the value truthy + return assets.push(asset); +} + +function getAssetByID(assetId: number): PackagerAsset { + return assets[assetId - 1]; +} + +module.exports = {registerAsset, getAssetByID}; diff --git a/packages/babel-plugin-inline-view-configs/BUCK b/packages/babel-plugin-codegen/BUCK similarity index 100% rename from packages/babel-plugin-inline-view-configs/BUCK rename to packages/babel-plugin-codegen/BUCK diff --git a/packages/babel-plugin-inline-view-configs/__test_fixtures__/failures.js b/packages/babel-plugin-codegen/__test_fixtures__/failures.js similarity index 100% rename from packages/babel-plugin-inline-view-configs/__test_fixtures__/failures.js rename to packages/babel-plugin-codegen/__test_fixtures__/failures.js diff --git a/packages/babel-plugin-inline-view-configs/__test_fixtures__/fixtures.js b/packages/babel-plugin-codegen/__test_fixtures__/fixtures.js similarity index 100% rename from packages/babel-plugin-inline-view-configs/__test_fixtures__/fixtures.js rename to packages/babel-plugin-codegen/__test_fixtures__/fixtures.js diff --git a/packages/babel-plugin-inline-view-configs/__tests__/__snapshots__/index-test.js.snap b/packages/babel-plugin-codegen/__tests__/__snapshots__/index-test.js.snap similarity index 100% rename from packages/babel-plugin-inline-view-configs/__tests__/__snapshots__/index-test.js.snap rename to packages/babel-plugin-codegen/__tests__/__snapshots__/index-test.js.snap diff --git a/packages/babel-plugin-inline-view-configs/__tests__/index-test.js b/packages/babel-plugin-codegen/__tests__/index-test.js similarity index 100% rename from packages/babel-plugin-inline-view-configs/__tests__/index-test.js rename to packages/babel-plugin-codegen/__tests__/index-test.js diff --git a/packages/babel-plugin-inline-view-configs/index.js b/packages/babel-plugin-codegen/index.js similarity index 100% rename from packages/babel-plugin-inline-view-configs/index.js rename to packages/babel-plugin-codegen/index.js diff --git a/packages/babel-plugin-inline-view-configs/package.json b/packages/babel-plugin-codegen/package.json similarity index 67% rename from packages/babel-plugin-inline-view-configs/package.json rename to packages/babel-plugin-codegen/package.json index 76ccd2ae7c5412..dc635c5337b446 100644 --- a/packages/babel-plugin-inline-view-configs/package.json +++ b/packages/babel-plugin-codegen/package.json @@ -1,7 +1,7 @@ { "version": "0.0.5", - "name": "babel-plugin-inline-view-configs", - "description": "Babel plugin to inline view configs for React Native", + "name": "@react-native/babel-plugin-codegen", + "description": "Babel plugin to generate native module and view manager code for React Native.", "repository": { "type": "git", "url": "git@github.com:facebook/react-native.git" diff --git a/packages/eslint-plugin-react-native-community/__tests__/eslint-tester.js b/packages/eslint-plugin-react-native-community/__tests__/eslint-tester.js index 4218487f1dfd62..ea767a705b790f 100644 --- a/packages/eslint-plugin-react-native-community/__tests__/eslint-tester.js +++ b/packages/eslint-plugin-react-native-community/__tests__/eslint-tester.js @@ -12,7 +12,7 @@ const ESLintTester = require('eslint').RuleTester; ESLintTester.setDefaultConfig({ - parser: 'babel-eslint', + parser: require.resolve('babel-eslint'), parserOptions: { ecmaVersion: 6, sourceType: 'module', diff --git a/packages/normalize-color/.npmignore b/packages/normalize-color/.npmignore new file mode 100644 index 00000000000000..9b166b095d3fae --- /dev/null +++ b/packages/normalize-color/.npmignore @@ -0,0 +1,3 @@ +**/__mocks__/** +**/__tests__/** +BUCK diff --git a/packages/normalize-color/BUCK b/packages/normalize-color/BUCK new file mode 100644 index 00000000000000..50fab1d885b8ab --- /dev/null +++ b/packages/normalize-color/BUCK @@ -0,0 +1,34 @@ +load("@fbsource//tools/build_defs:js_glob.bzl", "js_glob") +load("@fbsource//tools/build_defs/third_party:yarn_defs.bzl", "yarn_workspace") +load("@fbsource//xplat/js:JS_DEFS.bzl", "rn_library") + +rn_library( + name = "normalize-color", + srcs = js_glob([ + "**/*", + "package.json", + ]), + labels = ["supermodule:xplat/default/public.react_native.core"], + skip_processors = True, + visibility = ["PUBLIC"], + worker = "//xplat/js:experimental-packager", +) + +yarn_workspace( + name = "yarn-workspace", + srcs = glob( + [ + "**/*.js", + "**/*.json", + ], + exclude = [ + "**/__fixtures__/**", + "**/__flowtests__/**", + "**/__mocks__/**", + "**/__tests__/**", + "**/node_modules/**", + "**/node_modules/.bin/**", + ], + ), + visibility = ["PUBLIC"], +) diff --git a/packages/normalize-color/__tests__/base-test.js b/packages/normalize-color/__tests__/base-test.js new file mode 100644 index 00000000000000..c37c9af5ff0a7f --- /dev/null +++ b/packages/normalize-color/__tests__/base-test.js @@ -0,0 +1,129 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + * @emails oncall+react_native + */ + +'use strict'; + +const normalizeColorBase = require('../base'); + +it('should accept only spec compliant colors', () => { + expect(normalizeColorBase('#abc')).not.toBe(null); + expect(normalizeColorBase('#abcd')).not.toBe(null); + expect(normalizeColorBase('#abcdef')).not.toBe(null); + expect(normalizeColorBase('#abcdef01')).not.toBe(null); + expect(normalizeColorBase('rgb(1,2,3)')).not.toBe(null); + expect(normalizeColorBase('rgb(1, 2, 3)')).not.toBe(null); + expect(normalizeColorBase('rgb( 1 , 2 , 3 )')).not.toBe(null); + expect(normalizeColorBase('rgb(-1, -2, -3)')).not.toBe(null); + expect(normalizeColorBase('rgba(0, 0, 0, 1)')).not.toBe(null); + expect(normalizeColorBase(0x01234567 + 0.5)).toBe(null); + expect(normalizeColorBase(-1)).toBe(null); + expect(normalizeColorBase(0xffffffff + 1)).toBe(null); +}); + +it('should temporarily accept floating point values for rgb', () => { + expect(normalizeColorBase('rgb(1.1, 2.1, 3.1)')).toBe(0x010203ff); + expect(normalizeColorBase('rgba(1.1, 2.1, 3.1, 1.0)')).toBe(0x010203ff); +}); + +it('should refuse non spec compliant colors', () => { + expect(normalizeColorBase('#00gg00')).toBe(null); + expect(normalizeColorBase('rgb(1, 2, 3,)')).toBe(null); + expect(normalizeColorBase('rgb(1, 2, 3')).toBe(null); + + // Used to be accepted by normalizeColorBase + expect(normalizeColorBase('abc')).toBe(null); + expect(normalizeColorBase(' #abc ')).toBe(null); + expect(normalizeColorBase('##abc')).toBe(null); + expect(normalizeColorBase('rgb 255 0 0')).toBe(null); + expect(normalizeColorBase('RGBA(0, 1, 2)')).toBe(null); + expect(normalizeColorBase('rgb (0, 1, 2)')).toBe(null); + expect(normalizeColorBase('hsv(0, 1, 2)')).toBe(null); + expect(normalizeColorBase({r: 10, g: 10, b: 10})).toBe(null); + expect(normalizeColorBase('hsl(1%, 2, 3)')).toBe(null); + expect(normalizeColorBase('rgb(1%, 2%, 3%)')).toBe(null); +}); + +it('should handle hex6 properly', () => { + expect(normalizeColorBase('#000000')).toBe(0x000000ff); + expect(normalizeColorBase('#ffffff')).toBe(0xffffffff); + expect(normalizeColorBase('#ff00ff')).toBe(0xff00ffff); + expect(normalizeColorBase('#abcdef')).toBe(0xabcdefff); + expect(normalizeColorBase('#012345')).toBe(0x012345ff); +}); + +it('should handle hex3 properly', () => { + expect(normalizeColorBase('#000')).toBe(0x000000ff); + expect(normalizeColorBase('#fff')).toBe(0xffffffff); + expect(normalizeColorBase('#f0f')).toBe(0xff00ffff); +}); + +it('should handle hex8 properly', () => { + expect(normalizeColorBase('#00000000')).toBe(0x00000000); + expect(normalizeColorBase('#ffffffff')).toBe(0xffffffff); + expect(normalizeColorBase('#ffff00ff')).toBe(0xffff00ff); + expect(normalizeColorBase('#abcdef01')).toBe(0xabcdef01); + expect(normalizeColorBase('#01234567')).toBe(0x01234567); +}); + +it('should handle rgb properly', () => { + expect(normalizeColorBase('rgb(0, 0, 0)')).toBe(0x000000ff); + expect(normalizeColorBase('rgb(-1, -2, -3)')).toBe(0x000000ff); + expect(normalizeColorBase('rgb(0, 0, 255)')).toBe(0x0000ffff); + expect(normalizeColorBase('rgb(100, 15, 69)')).toBe(0x640f45ff); + expect(normalizeColorBase('rgb(255, 255, 255)')).toBe(0xffffffff); + expect(normalizeColorBase('rgb(256, 256, 256)')).toBe(0xffffffff); +}); + +it('should handle rgba properly', () => { + expect(normalizeColorBase('rgba(0, 0, 0, 0.0)')).toBe(0x00000000); + expect(normalizeColorBase('rgba(0, 0, 0, 0)')).toBe(0x00000000); + expect(normalizeColorBase('rgba(0, 0, 0, -0.5)')).toBe(0x00000000); + expect(normalizeColorBase('rgba(0, 0, 0, 1.0)')).toBe(0x000000ff); + expect(normalizeColorBase('rgba(0, 0, 0, 1)')).toBe(0x000000ff); + expect(normalizeColorBase('rgba(0, 0, 0, 1.5)')).toBe(0x000000ff); + expect(normalizeColorBase('rgba(100, 15, 69, 0.5)')).toBe(0x640f4580); +}); + +it('should handle hsl properly', () => { + expect(normalizeColorBase('hsl(0, 0%, 0%)')).toBe(0x000000ff); + expect(normalizeColorBase('hsl(360, 100%, 100%)')).toBe(0xffffffff); + expect(normalizeColorBase('hsl(180, 50%, 50%)')).toBe(0x40bfbfff); + expect(normalizeColorBase('hsl(540, 50%, 50%)')).toBe(0x40bfbfff); + expect(normalizeColorBase('hsl(70, 25%, 75%)')).toBe(0xcacfafff); + expect(normalizeColorBase('hsl(70, 100%, 75%)')).toBe(0xeaff80ff); + expect(normalizeColorBase('hsl(70, 110%, 75%)')).toBe(0xeaff80ff); + expect(normalizeColorBase('hsl(70, 0%, 75%)')).toBe(0xbfbfbfff); + expect(normalizeColorBase('hsl(70, -10%, 75%)')).toBe(0xbfbfbfff); +}); + +it('should handle hsla properly', () => { + expect(normalizeColorBase('hsla(0, 0%, 0%, 0)')).toBe(0x00000000); + expect(normalizeColorBase('hsla(360, 100%, 100%, 1)')).toBe(0xffffffff); + expect(normalizeColorBase('hsla(360, 100%, 100%, 0)')).toBe(0xffffff00); + expect(normalizeColorBase('hsla(180, 50%, 50%, 0.2)')).toBe(0x40bfbf33); +}); + +it('should handle named colors properly', () => { + expect(normalizeColorBase('red')).toBe(0xff0000ff); + expect(normalizeColorBase('transparent')).toBe(0x00000000); + expect(normalizeColorBase('peachpuff')).toBe(0xffdab9ff); +}); + +it('should handle number colors properly', () => { + expect(normalizeColorBase(0x00000000)).toBe(0x00000000); + expect(normalizeColorBase(0xff0000ff)).toBe(0xff0000ff); + expect(normalizeColorBase(0xffffffff)).toBe(0xffffffff); + expect(normalizeColorBase(0x01234567)).toBe(0x01234567); +}); + +it("should return the same color when it's already normalized", () => { + const normalizedColor = normalizeColorBase('red') || 0; + expect(normalizeColorBase(normalizedColor)).toBe(normalizedColor); +}); diff --git a/packages/normalize-color/base.js b/packages/normalize-color/base.js new file mode 100644 index 00000000000000..295fd2c7c33b53 --- /dev/null +++ b/packages/normalize-color/base.js @@ -0,0 +1,377 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + * @flow + */ + +/* eslint no-bitwise: 0 */ + +'use strict'; + +function normalizeColorBase(color: ?string | number): null | number { + const matchers = getMatchers(); + let match; + + if (typeof color === 'number') { + if (color >>> 0 === color && color >= 0 && color <= 0xffffffff) { + return color; + } + return null; + } + + if (typeof color !== 'string') { + return null; + } + + // Ordered based on occurrences on Facebook codebase + if ((match = matchers.hex6.exec(color))) { + return parseInt(match[1] + 'ff', 16) >>> 0; + } + + if (names.hasOwnProperty(color)) { + return names[color]; + } + + if ((match = matchers.rgb.exec(color))) { + return ( + // b + ((parse255(match[1]) << 24) | // r + (parse255(match[2]) << 16) | // g + (parse255(match[3]) << 8) | + 0x000000ff) >>> // a + 0 + ); + } + + if ((match = matchers.rgba.exec(color))) { + return ( + // b + ((parse255(match[1]) << 24) | // r + (parse255(match[2]) << 16) | // g + (parse255(match[3]) << 8) | + parse1(match[4])) >>> // a + 0 + ); + } + + if ((match = matchers.hex3.exec(color))) { + return ( + parseInt( + match[1] + + match[1] + // r + match[2] + + match[2] + // g + match[3] + + match[3] + // b + 'ff', // a + 16, + ) >>> 0 + ); + } + + // https://drafts.csswg.org/css-color-4/#hex-notation + if ((match = matchers.hex8.exec(color))) { + return parseInt(match[1], 16) >>> 0; + } + + if ((match = matchers.hex4.exec(color))) { + return ( + parseInt( + match[1] + + match[1] + // r + match[2] + + match[2] + // g + match[3] + + match[3] + // b + match[4] + + match[4], // a + 16, + ) >>> 0 + ); + } + + if ((match = matchers.hsl.exec(color))) { + return ( + (hslToRgb( + parse360(match[1]), // h + parsePercentage(match[2]), // s + parsePercentage(match[3]), // l + ) | + 0x000000ff) >>> // a + 0 + ); + } + + if ((match = matchers.hsla.exec(color))) { + return ( + (hslToRgb( + parse360(match[1]), // h + parsePercentage(match[2]), // s + parsePercentage(match[3]), // l + ) | + parse1(match[4])) >>> // a + 0 + ); + } + + return null; +} + +function hue2rgb(p: number, q: number, t: number): number { + if (t < 0) { + t += 1; + } + if (t > 1) { + t -= 1; + } + if (t < 1 / 6) { + return p + (q - p) * 6 * t; + } + if (t < 1 / 2) { + return q; + } + if (t < 2 / 3) { + return p + (q - p) * (2 / 3 - t) * 6; + } + return p; +} + +function hslToRgb(h: number, s: number, l: number): number { + const q = l < 0.5 ? l * (1 + s) : l + s - l * s; + const p = 2 * l - q; + const r = hue2rgb(p, q, h + 1 / 3); + const g = hue2rgb(p, q, h); + const b = hue2rgb(p, q, h - 1 / 3); + + return ( + (Math.round(r * 255) << 24) | + (Math.round(g * 255) << 16) | + (Math.round(b * 255) << 8) + ); +} + +// var INTEGER = '[-+]?\\d+'; +const NUMBER = '[-+]?\\d*\\.?\\d+'; +const PERCENTAGE = NUMBER + '%'; + +function call(...args) { + return '\\(\\s*(' + args.join(')\\s*,\\s*(') + ')\\s*\\)'; +} + +let cachedMatchers; + +function getMatchers() { + if (cachedMatchers === undefined) { + cachedMatchers = { + rgb: new RegExp('rgb' + call(NUMBER, NUMBER, NUMBER)), + rgba: new RegExp('rgba' + call(NUMBER, NUMBER, NUMBER, NUMBER)), + hsl: new RegExp('hsl' + call(NUMBER, PERCENTAGE, PERCENTAGE)), + hsla: new RegExp('hsla' + call(NUMBER, PERCENTAGE, PERCENTAGE, NUMBER)), + hex3: /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, + hex4: /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, + hex6: /^#([0-9a-fA-F]{6})$/, + hex8: /^#([0-9a-fA-F]{8})$/, + }; + } + return cachedMatchers; +} + +function parse255(str: string): number { + const int = parseInt(str, 10); + if (int < 0) { + return 0; + } + if (int > 255) { + return 255; + } + return int; +} + +function parse360(str: string): number { + const int = parseFloat(str); + return (((int % 360) + 360) % 360) / 360; +} + +function parse1(str: string): number { + const num = parseFloat(str); + if (num < 0) { + return 0; + } + if (num > 1) { + return 255; + } + return Math.round(num * 255); +} + +function parsePercentage(str: string): number { + // parseFloat conveniently ignores the final % + const int = parseFloat(str); + if (int < 0) { + return 0; + } + if (int > 100) { + return 1; + } + return int / 100; +} + +const names = { + transparent: 0x00000000, + + // http://www.w3.org/TR/css3-color/#svg-color + aliceblue: 0xf0f8ffff, + antiquewhite: 0xfaebd7ff, + aqua: 0x00ffffff, + aquamarine: 0x7fffd4ff, + azure: 0xf0ffffff, + beige: 0xf5f5dcff, + bisque: 0xffe4c4ff, + black: 0x000000ff, + blanchedalmond: 0xffebcdff, + blue: 0x0000ffff, + blueviolet: 0x8a2be2ff, + brown: 0xa52a2aff, + burlywood: 0xdeb887ff, + burntsienna: 0xea7e5dff, + cadetblue: 0x5f9ea0ff, + chartreuse: 0x7fff00ff, + chocolate: 0xd2691eff, + coral: 0xff7f50ff, + cornflowerblue: 0x6495edff, + cornsilk: 0xfff8dcff, + crimson: 0xdc143cff, + cyan: 0x00ffffff, + darkblue: 0x00008bff, + darkcyan: 0x008b8bff, + darkgoldenrod: 0xb8860bff, + darkgray: 0xa9a9a9ff, + darkgreen: 0x006400ff, + darkgrey: 0xa9a9a9ff, + darkkhaki: 0xbdb76bff, + darkmagenta: 0x8b008bff, + darkolivegreen: 0x556b2fff, + darkorange: 0xff8c00ff, + darkorchid: 0x9932ccff, + darkred: 0x8b0000ff, + darksalmon: 0xe9967aff, + darkseagreen: 0x8fbc8fff, + darkslateblue: 0x483d8bff, + darkslategray: 0x2f4f4fff, + darkslategrey: 0x2f4f4fff, + darkturquoise: 0x00ced1ff, + darkviolet: 0x9400d3ff, + deeppink: 0xff1493ff, + deepskyblue: 0x00bfffff, + dimgray: 0x696969ff, + dimgrey: 0x696969ff, + dodgerblue: 0x1e90ffff, + firebrick: 0xb22222ff, + floralwhite: 0xfffaf0ff, + forestgreen: 0x228b22ff, + fuchsia: 0xff00ffff, + gainsboro: 0xdcdcdcff, + ghostwhite: 0xf8f8ffff, + gold: 0xffd700ff, + goldenrod: 0xdaa520ff, + gray: 0x808080ff, + green: 0x008000ff, + greenyellow: 0xadff2fff, + grey: 0x808080ff, + honeydew: 0xf0fff0ff, + hotpink: 0xff69b4ff, + indianred: 0xcd5c5cff, + indigo: 0x4b0082ff, + ivory: 0xfffff0ff, + khaki: 0xf0e68cff, + lavender: 0xe6e6faff, + lavenderblush: 0xfff0f5ff, + lawngreen: 0x7cfc00ff, + lemonchiffon: 0xfffacdff, + lightblue: 0xadd8e6ff, + lightcoral: 0xf08080ff, + lightcyan: 0xe0ffffff, + lightgoldenrodyellow: 0xfafad2ff, + lightgray: 0xd3d3d3ff, + lightgreen: 0x90ee90ff, + lightgrey: 0xd3d3d3ff, + lightpink: 0xffb6c1ff, + lightsalmon: 0xffa07aff, + lightseagreen: 0x20b2aaff, + lightskyblue: 0x87cefaff, + lightslategray: 0x778899ff, + lightslategrey: 0x778899ff, + lightsteelblue: 0xb0c4deff, + lightyellow: 0xffffe0ff, + lime: 0x00ff00ff, + limegreen: 0x32cd32ff, + linen: 0xfaf0e6ff, + magenta: 0xff00ffff, + maroon: 0x800000ff, + mediumaquamarine: 0x66cdaaff, + mediumblue: 0x0000cdff, + mediumorchid: 0xba55d3ff, + mediumpurple: 0x9370dbff, + mediumseagreen: 0x3cb371ff, + mediumslateblue: 0x7b68eeff, + mediumspringgreen: 0x00fa9aff, + mediumturquoise: 0x48d1ccff, + mediumvioletred: 0xc71585ff, + midnightblue: 0x191970ff, + mintcream: 0xf5fffaff, + mistyrose: 0xffe4e1ff, + moccasin: 0xffe4b5ff, + navajowhite: 0xffdeadff, + navy: 0x000080ff, + oldlace: 0xfdf5e6ff, + olive: 0x808000ff, + olivedrab: 0x6b8e23ff, + orange: 0xffa500ff, + orangered: 0xff4500ff, + orchid: 0xda70d6ff, + palegoldenrod: 0xeee8aaff, + palegreen: 0x98fb98ff, + paleturquoise: 0xafeeeeff, + palevioletred: 0xdb7093ff, + papayawhip: 0xffefd5ff, + peachpuff: 0xffdab9ff, + peru: 0xcd853fff, + pink: 0xffc0cbff, + plum: 0xdda0ddff, + powderblue: 0xb0e0e6ff, + purple: 0x800080ff, + rebeccapurple: 0x663399ff, + red: 0xff0000ff, + rosybrown: 0xbc8f8fff, + royalblue: 0x4169e1ff, + saddlebrown: 0x8b4513ff, + salmon: 0xfa8072ff, + sandybrown: 0xf4a460ff, + seagreen: 0x2e8b57ff, + seashell: 0xfff5eeff, + sienna: 0xa0522dff, + silver: 0xc0c0c0ff, + skyblue: 0x87ceebff, + slateblue: 0x6a5acdff, + slategray: 0x708090ff, + slategrey: 0x708090ff, + snow: 0xfffafaff, + springgreen: 0x00ff7fff, + steelblue: 0x4682b4ff, + tan: 0xd2b48cff, + teal: 0x008080ff, + thistle: 0xd8bfd8ff, + tomato: 0xff6347ff, + turquoise: 0x40e0d0ff, + violet: 0xee82eeff, + wheat: 0xf5deb3ff, + white: 0xffffffff, + whitesmoke: 0xf5f5f5ff, + yellow: 0xffff00ff, + yellowgreen: 0x9acd32ff, +}; + +module.exports = normalizeColorBase; diff --git a/packages/normalize-color/package.json b/packages/normalize-color/package.json new file mode 100644 index 00000000000000..a9fd8fcef1b23d --- /dev/null +++ b/packages/normalize-color/package.json @@ -0,0 +1,10 @@ +{ + "name": "@react-native/normalize-color", + "version": "1.0.0", + "description": "Color normalization code for React Native.", + "repository": { + "type": "git", + "url": "git@github.com:facebook/react-native.git" + }, + "license": "MIT" +} diff --git a/packages/polyfills/.npmignore b/packages/polyfills/.npmignore new file mode 100644 index 00000000000000..9b166b095d3fae --- /dev/null +++ b/packages/polyfills/.npmignore @@ -0,0 +1,3 @@ +**/__mocks__/** +**/__tests__/** +BUCK diff --git a/packages/polyfills/BUCK b/packages/polyfills/BUCK new file mode 100644 index 00000000000000..2d48cbf752c053 --- /dev/null +++ b/packages/polyfills/BUCK @@ -0,0 +1,20 @@ +load("@fbsource//tools/build_defs/third_party:yarn_defs.bzl", "yarn_workspace") + +yarn_workspace( + name = "yarn-workspace", + srcs = glob( + [ + "**/*.js", + "**/*.json", + ], + exclude = [ + "**/__fixtures__/**", + "**/__flowtests__/**", + "**/__mocks__/**", + "**/__tests__/**", + "**/node_modules/**", + "**/node_modules/.bin/**", + ], + ), + visibility = ["PUBLIC"], +) diff --git a/Libraries/polyfills/Object.es7.js b/packages/polyfills/Object.es7.js similarity index 100% rename from Libraries/polyfills/Object.es7.js rename to packages/polyfills/Object.es7.js diff --git a/Libraries/polyfills/__tests__/Object.es7-test.js b/packages/polyfills/__tests__/Object.es7-test.js similarity index 100% rename from Libraries/polyfills/__tests__/Object.es7-test.js rename to packages/polyfills/__tests__/Object.es7-test.js diff --git a/Libraries/polyfills/console.js b/packages/polyfills/console.js similarity index 100% rename from Libraries/polyfills/console.js rename to packages/polyfills/console.js diff --git a/Libraries/polyfills/error-guard.js b/packages/polyfills/error-guard.js similarity index 100% rename from Libraries/polyfills/error-guard.js rename to packages/polyfills/error-guard.js diff --git a/Libraries/ART/ARTSurfaceView.h b/packages/polyfills/index.js similarity index 52% rename from Libraries/ART/ARTSurfaceView.h rename to packages/polyfills/index.js index 355a27194620ca..b4dd4b63c6754c 100644 --- a/Libraries/ART/ARTSurfaceView.h +++ b/packages/polyfills/index.js @@ -1,14 +1,16 @@ -/* +/** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. + * + * @format */ -#import // TODO(macOS GH#774) - -#import "ARTContainer.h" - -@interface ARTSurfaceView : RCTUIView // TODO(macOS ISS#3536887) +'use strict'; -@end +module.exports = () => [ + require.resolve('./console.js'), + require.resolve('./error-guard.js'), + require.resolve('./Object.es7.js'), +]; diff --git a/packages/polyfills/package.json b/packages/polyfills/package.json new file mode 100644 index 00000000000000..ed96b9f671dea5 --- /dev/null +++ b/packages/polyfills/package.json @@ -0,0 +1,10 @@ +{ + "name": "@react-native/polyfills", + "version": "1.0.0", + "description": "Polyfills for React Native.", + "repository": { + "type": "git", + "url": "git@github.com:facebook/react-native.git" + }, + "license": "MIT" +} diff --git a/packages/react-native-codegen/DEFS.bzl b/packages/react-native-codegen/DEFS.bzl index b214f686a81034..4241832101c721 100644 --- a/packages/react-native-codegen/DEFS.bzl +++ b/packages/react-native-codegen/DEFS.bzl @@ -1,3 +1,4 @@ +load("@fbsource//tools/build_defs:buckconfig.bzl", "read_bool") load("@fbsource//tools/build_defs:fb_native_wrapper.bzl", "fb_native") load("@fbsource//tools/build_defs:platform_defs.bzl", "IOS", "MACOSX") load("@fbsource//tools/build_defs/apple:flag_defs.bzl", "get_preprocessor_flags_for_build_mode") @@ -184,78 +185,86 @@ def rn_codegen_components( ) # libs - rn_xplat_cxx_library( - name = "generated_components-{}".format(name), - srcs = [ - ":{}".format(generate_event_emitter_cpp_name), - ":{}".format(generate_props_cpp_name), - ":{}".format(generate_shadow_node_cpp_name), - ], - headers = [ - ":{}".format(generate_component_descriptor_h_name), - ":{}".format(generate_event_emitter_h_name), - ":{}".format(generate_props_h_name), - ":{}".format(generate_shadow_node_h_name), - ], - header_namespace = "react/components/{}".format(name), - exported_headers = { - "ComponentDescriptors.h": ":{}".format(generate_component_descriptor_h_name), - "EventEmitters.h": ":{}".format(generate_event_emitter_h_name), - "Props.h": ":{}".format(generate_props_h_name), - "RCTComponentViewHelpers.h": ":{}".format(generate_component_hobjcpp_name), - "ShadowNodes.h": ":{}".format(generate_shadow_node_h_name), - }, - compiler_flags = [ - "-fexceptions", - "-frtti", - "-std=c++14", - "-Wall", - ], - fbobjc_compiler_flags = get_apple_compiler_flags(), - fbobjc_preprocessor_flags = get_preprocessor_flags_for_build_mode() + get_apple_inspector_flags(), - ios_exported_headers = { - "ComponentViewHelpers.h": ":{}".format(generate_component_hobjcpp_name), - }, - ios_headers = [ - ":{}".format(generate_component_hobjcpp_name), - ], - labels = ["codegen_rule"], - platforms = (ANDROID, APPLE, CXX), - preprocessor_flags = [ - "-DLOG_TAG=\"ReactNative\"", - "-DWITH_FBSYSTRACE=1", - ], - tests = [":generated_tests-{}".format(name)], - visibility = ["PUBLIC"], - deps = [ - "//third-party/glog:glog", - "//xplat/fbsystrace:fbsystrace", - "//xplat/folly:headers_only", - "//xplat/folly:memory", - "//xplat/folly:molly", - YOGA_CXX_TARGET, - react_native_xplat_target("fabric/debug:debug"), - react_native_xplat_target("fabric/core:core"), - react_native_xplat_target("fabric/graphics:graphics"), - react_native_xplat_target("fabric/components/image:image"), - react_native_xplat_target("fabric/imagemanager:imagemanager"), - react_native_xplat_target("fabric/components/view:view"), - ], - ) + if is_running_buck_project(): + rn_xplat_cxx_library(name = "generated_components-{}".format(name), visibility = ["PUBLIC"]) + else: + rn_xplat_cxx_library( + name = "generated_components-{}".format(name), + srcs = [ + ":{}".format(generate_event_emitter_cpp_name), + ":{}".format(generate_props_cpp_name), + ":{}".format(generate_shadow_node_cpp_name), + ], + headers = [ + ":{}".format(generate_component_descriptor_h_name), + ":{}".format(generate_event_emitter_h_name), + ":{}".format(generate_props_h_name), + ":{}".format(generate_shadow_node_h_name), + ], + header_namespace = "react/renderer/components/{}".format(name), + exported_headers = { + "ComponentDescriptors.h": ":{}".format(generate_component_descriptor_h_name), + "EventEmitters.h": ":{}".format(generate_event_emitter_h_name), + "Props.h": ":{}".format(generate_props_h_name), + "RCTComponentViewHelpers.h": ":{}".format(generate_component_hobjcpp_name), + "ShadowNodes.h": ":{}".format(generate_shadow_node_h_name), + }, + compiler_flags = [ + "-fexceptions", + "-frtti", + "-std=c++14", + "-Wall", + ], + fbobjc_compiler_flags = get_apple_compiler_flags(), + fbobjc_preprocessor_flags = get_preprocessor_flags_for_build_mode() + get_apple_inspector_flags(), + ios_exported_headers = { + "ComponentViewHelpers.h": ":{}".format(generate_component_hobjcpp_name), + }, + ios_headers = [ + ":{}".format(generate_component_hobjcpp_name), + ], + labels = ["codegen_rule"], + platforms = (ANDROID, APPLE, CXX), + preprocessor_flags = [ + "-DLOG_TAG=\"ReactNative\"", + "-DWITH_FBSYSTRACE=1", + ], + tests = [":generated_tests-{}".format(name)], + visibility = ["PUBLIC"], + deps = [ + "//third-party/glog:glog", + "//xplat/fbsystrace:fbsystrace", + "//xplat/folly:headers_only", + "//xplat/folly:memory", + "//xplat/folly:molly", + YOGA_CXX_TARGET, + react_native_xplat_target("react/renderer/debug:debug"), + react_native_xplat_target("react/renderer/core:core"), + react_native_xplat_target("react/renderer/graphics:graphics"), + react_native_xplat_target("react/renderer/components/image:image"), + react_native_xplat_target("react/renderer/imagemanager:imagemanager"), + react_native_xplat_target("react/renderer/components/view:view"), + ], + ) - rn_android_library( - name = "generated_components_java-{}".format(name), - srcs = [ - ":{}".format(zip_generated_java_files), - ], - labels = ["codegen_rule"], - visibility = ["PUBLIC"], - deps = [ - react_native_dep("third-party/android/androidx:annotation"), - react_native_target("java/com/facebook/react/bridge:bridge"), - react_native_target("java/com/facebook/react/uimanager:uimanager"), - ], - ) + if is_running_buck_project(): + rn_android_library(name = "generated_components_java-{}".format(name)) + else: + rn_android_library( + name = "generated_components_java-{}".format(name), + srcs = [ + ":{}".format(zip_generated_java_files), + ], + labels = ["codegen_rule"], + visibility = ["PUBLIC"], + deps = [ + react_native_dep("third-party/android/androidx:annotation"), + react_native_target("java/com/facebook/react/bridge:bridge"), + react_native_target("java/com/facebook/react/common:common"), + react_native_target("java/com/facebook/react/turbomodule/core:core"), + react_native_target("java/com/facebook/react/uimanager:uimanager"), + ], + ) # Tests fb_xplat_cxx_test( @@ -308,35 +317,41 @@ def rn_codegen_cxx_modules( labels = ["codegen_rule"], ) - rn_xplat_cxx_library( - name = "generated_cxx_modules-{}".format(name), - srcs = [ - ":{}".format(generate_module_cpp_name), - ], - headers = [ - ":{}".format(generate_module_h_name), - ], - header_namespace = "react/modules/{}".format(name), - exported_headers = { - "NativeModules.cpp": ":{}".format(generate_module_cpp_name), - "NativeModules.h": ":{}".format(generate_module_h_name), - }, - compiler_flags = [ - "-fexceptions", - "-frtti", - "-std=c++14", - "-Wall", - ], - fbobjc_compiler_flags = get_apple_compiler_flags(), - fbobjc_preprocessor_flags = get_preprocessor_flags_for_build_mode() + get_apple_inspector_flags(), - labels = ["codegen_rule"], - platforms = (ANDROID, APPLE), - preprocessor_flags = [ - "-DLOG_TAG=\"ReactNative\"", - "-DWITH_FBSYSTRACE=1", - ], - visibility = ["PUBLIC"], - exported_deps = [ - react_native_xplat_target("turbomodule/core:core"), - ], - ) + if is_running_buck_project(): + rn_xplat_cxx_library(name = "generated_cxx_modules-{}".format(name)) + else: + rn_xplat_cxx_library( + name = "generated_cxx_modules-{}".format(name), + srcs = [ + ":{}".format(generate_module_cpp_name), + ], + headers = [ + ":{}".format(generate_module_h_name), + ], + header_namespace = "react/modules/{}".format(name), + exported_headers = { + "NativeModules.cpp": ":{}".format(generate_module_cpp_name), + "NativeModules.h": ":{}".format(generate_module_h_name), + }, + compiler_flags = [ + "-fexceptions", + "-frtti", + "-std=c++14", + "-Wall", + ], + fbobjc_compiler_flags = get_apple_compiler_flags(), + fbobjc_preprocessor_flags = get_preprocessor_flags_for_build_mode() + get_apple_inspector_flags(), + labels = ["codegen_rule"], + platforms = (ANDROID, APPLE), + preprocessor_flags = [ + "-DLOG_TAG=\"ReactNative\"", + "-DWITH_FBSYSTRACE=1", + ], + visibility = ["PUBLIC"], + exported_deps = [ + react_native_xplat_target("turbomodule/core:core"), + ], + ) + +def is_running_buck_project(): + return read_bool("fbandroid", "is_running_buck_project", False) diff --git a/packages/react-native-codegen/buck_tests/emptyFile.cpp b/packages/react-native-codegen/buck_tests/emptyFile.cpp index 2a994074b3ddb5..a68c679491ae74 100644 --- a/packages/react-native-codegen/buck_tests/emptyFile.cpp +++ b/packages/react-native-codegen/buck_tests/emptyFile.cpp @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import +#import // TODO: Import every prop and event to asset they're generated diff --git a/packages/react-native-codegen/buck_tests/emptyFile.mm b/packages/react-native-codegen/buck_tests/emptyFile.mm index 929a261b27c49a..a7713b5da4db42 100644 --- a/packages/react-native-codegen/buck_tests/emptyFile.mm +++ b/packages/react-native-codegen/buck_tests/emptyFile.mm @@ -5,8 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -#import -#import +#import +#import #import #import diff --git a/packages/react-native-codegen/src/CodegenSchema.js b/packages/react-native-codegen/src/CodegenSchema.js index 5ae6d4a24732fb..ffd3a1a4666173 100644 --- a/packages/react-native-codegen/src/CodegenSchema.js +++ b/packages/react-native-codegen/src/CodegenSchema.js @@ -55,11 +55,6 @@ export type StringTypeAnnotation = $ReadOnly<{| type: 'StringTypeAnnotation', |}>; -export type TypeAliasTypeAnnotation = $ReadOnly<{| - type: 'TypeAliasTypeAnnotation', - name: string, -|}>; - export type EventObjectPropertyType = | $ReadOnly<{| type: 'BooleanTypeAnnotation', @@ -200,109 +195,6 @@ export type PropTypeShape = $ReadOnly<{| typeAnnotation: PropTypeTypeAnnotation, |}>; -export type PrimitiveTypeAnnotationType = - | 'StringTypeAnnotation' - | 'NumberTypeAnnotation' - | 'Int32TypeAnnotation' - | 'DoubleTypeAnnotation' - | 'FloatTypeAnnotation' - | 'BooleanTypeAnnotation' - | 'GenericObjectTypeAnnotation'; - -export type PrimitiveTypeAnnotation = $ReadOnly<{| - type: PrimitiveTypeAnnotationType, -|}>; - -export type ReservedFunctionValueTypeName = 'RootTag'; // Union with more custom types. - -export type FunctionTypeAnnotationParamTypeAnnotation = - | $ReadOnly<{| - type: - | 'AnyTypeAnnotation' - | 'FunctionTypeAnnotation' - | PrimitiveTypeAnnotationType, - |}> - | $ReadOnly<{| - type: 'ReservedFunctionValueTypeAnnotation', - name: ReservedFunctionValueTypeName, - |}> - | $ReadOnly<{| - type: 'ArrayTypeAnnotation', - elementType: - | ?FunctionTypeAnnotationParamTypeAnnotation - | ?TypeAliasTypeAnnotation, - |}> - | $ReadOnly<{| - type: 'ObjectTypeAnnotation', - properties: ?$ReadOnlyArray, - |}>; - -export type FunctionTypeAnnotationReturnArrayElementType = - | FunctionTypeAnnotationParamTypeAnnotation - | TypeAliasTypeAnnotation; - -export type ObjectParamTypeAnnotation = $ReadOnly<{| - optional: boolean, - name: string, - typeAnnotation?: - | FunctionTypeAnnotationParamTypeAnnotation - | TypeAliasTypeAnnotation, // TODO (T67898313): Workaround for NativeLinking's use of union type, typeAnnotations should not be optional -|}>; - -export type FunctionTypeAnnotationReturn = - | $ReadOnly<{| - nullable: boolean, - type: - | 'GenericPromiseTypeAnnotation' - | 'VoidTypeAnnotation' - | PrimitiveTypeAnnotationType, - |}> - | $ReadOnly<{| - nullable: boolean, - type: 'ReservedFunctionValueTypeAnnotation', - name: ReservedFunctionValueTypeName, - |}> - | $ReadOnly<{| - nullable: boolean, - type: 'ArrayTypeAnnotation', - elementType: ?FunctionTypeAnnotationReturnArrayElementType, - |}> - | $ReadOnly<{| - nullable: boolean, - type: 'ObjectTypeAnnotation', - properties: ?$ReadOnlyArray, - |}>; - -export type FunctionTypeAnnotationParam = $ReadOnly<{| - nullable: boolean, - name: string, - typeAnnotation: - | FunctionTypeAnnotationParamTypeAnnotation - | TypeAliasTypeAnnotation, -|}>; - -export type FunctionTypeAnnotation = $ReadOnly<{| - type: 'FunctionTypeAnnotation', - params: $ReadOnlyArray, - returnTypeAnnotation: FunctionTypeAnnotationReturn, - optional: boolean, -|}>; - -export type NativeModuleMethodTypeShape = $ReadOnly<{| - name: string, - typeAnnotation: FunctionTypeAnnotation, -|}>; - -export type ObjectTypeAliasTypeShape = $ReadOnly<{| - type: 'ObjectTypeAnnotation', - properties: $ReadOnlyArray, -|}>; - -export type NativeModuleShape = $ReadOnly<{| - aliases: $ReadOnly<{[aliasName: string]: ObjectTypeAliasTypeShape, ...}>, - properties: $ReadOnlyArray, -|}>; - export type EventTypeShape = $ReadOnly<{| name: string, bubblingType: 'direct' | 'bubble', @@ -363,3 +255,115 @@ export type SchemaType = $ReadOnly<{| ..., }>, |}>; + +/** + * NativeModule Types + */ +export type NativeModuleShape = $ReadOnly<{| + // We only support aliases to Objects + aliases: $ReadOnly<{[aliasName: string]: ObjectTypeAliasTypeShape, ...}>, + properties: $ReadOnlyArray, +|}>; + +export type ObjectTypeAliasTypeShape = $ReadOnly<{| + type: 'ObjectTypeAnnotation', + properties: $ReadOnlyArray, +|}>; + +export type NativeModuleMethodTypeShape = $ReadOnly<{| + name: string, + typeAnnotation: FunctionTypeAnnotation, +|}>; + +export type FunctionTypeAnnotation = $ReadOnly<{| + type: 'FunctionTypeAnnotation', + params: $ReadOnlyArray, + returnTypeAnnotation: FunctionTypeAnnotationReturn, + optional: boolean, +|}>; + +export type FunctionTypeAnnotationReturn = + | $ReadOnly<{| + nullable: boolean, + type: + | 'GenericPromiseTypeAnnotation' + | 'VoidTypeAnnotation' + | PrimitiveTypeAnnotationType, + |}> + | $ReadOnly<{| + nullable: boolean, + type: 'ReservedFunctionValueTypeAnnotation', + name: ReservedFunctionValueTypeName, + |}> + | $ReadOnly<{| + nullable: boolean, + type: 'ArrayTypeAnnotation', + elementType: ?FunctionTypeAnnotationReturnArrayElementType, + |}> + | $ReadOnly<{| + nullable: boolean, + type: 'ObjectTypeAnnotation', + properties: ?$ReadOnlyArray, + |}>; + +export type FunctionTypeAnnotationReturnArrayElementType = + | FunctionTypeAnnotationParamTypeAnnotation // TODO: What does FunctionTypeAnnotationParamTypeAnnotation have to do with function returns? + | TypeAliasTypeAnnotation; + +export type TypeAliasTypeAnnotation = $ReadOnly<{| + type: 'TypeAliasTypeAnnotation', + name: string, +|}>; + +export type FunctionTypeAnnotationParam = $ReadOnly<{| + nullable: boolean, + name: string, + typeAnnotation: + | FunctionTypeAnnotationParamTypeAnnotation + | TypeAliasTypeAnnotation, +|}>; + +export type FunctionTypeAnnotationParamTypeAnnotation = + | $ReadOnly<{| + type: + | 'AnyTypeAnnotation' + | 'FunctionTypeAnnotation' + | PrimitiveTypeAnnotationType, + |}> + | $ReadOnly<{| + type: 'ReservedFunctionValueTypeAnnotation', + name: ReservedFunctionValueTypeName, + |}> + | $ReadOnly<{| + type: 'ArrayTypeAnnotation', + elementType: + | ?FunctionTypeAnnotationParamTypeAnnotation + | ?TypeAliasTypeAnnotation, + |}> + | $ReadOnly<{| + type: 'ObjectTypeAnnotation', + properties: ?$ReadOnlyArray, + |}>; + +export type PrimitiveTypeAnnotationType = + | 'StringTypeAnnotation' + | 'NumberTypeAnnotation' + | 'Int32TypeAnnotation' + | 'DoubleTypeAnnotation' + | 'FloatTypeAnnotation' + | 'BooleanTypeAnnotation' + | 'GenericObjectTypeAnnotation'; + +export type PrimitiveTypeAnnotation = $ReadOnly<{| + type: PrimitiveTypeAnnotationType, +|}>; + +export type ReservedFunctionValueTypeName = 'RootTag'; // Union with more custom types. + +export type ObjectParamTypeAnnotation = $ReadOnly<{| + optional: boolean, + name: string, + typeAnnotation?: + | FunctionTypeAnnotationParamTypeAnnotation + | TypeAliasTypeAnnotation, // TODO (T67898313): Workaround for NativeLinking's use of union type, typeAnnotations should not be optional +|}>; diff --git a/packages/react-native-codegen/src/cli/combine/combine-js-to-schema-cli.js b/packages/react-native-codegen/src/cli/combine/combine-js-to-schema-cli.js index 2f9543683604a1..7de7a602b34319 100644 --- a/packages/react-native-codegen/src/cli/combine/combine-js-to-schema-cli.js +++ b/packages/react-native-codegen/src/cli/combine/combine-js-to-schema-cli.js @@ -13,10 +13,31 @@ const combine = require('./combine-js-to-schema'); const fs = require('fs'); +// $FlowFixMe[untyped-import] glob is untyped +const glob = require('glob'); +const path = require('path'); const [outfile, ...fileList] = process.argv.slice(2); -const formattedSchema = JSON.stringify(combine(fileList), null, 2); +const allFiles = []; +fileList.forEach(file => { + if (fs.lstatSync(file).isDirectory()) { + const dirFiles = glob + .sync(`${file}/**/*.js`, { + nodir: true, + }) + .filter( + f => + /^(Native.+|.+NativeComponent)/.test(path.basename(f)) && + !f.includes('__tests'), + ); + allFiles.push(...dirFiles); + } else { + allFiles.push(file); + } +}); + +const formattedSchema = JSON.stringify(combine(allFiles), null, 2); if (outfile != null) { fs.writeFileSync(outfile, formattedSchema); } else { diff --git a/packages/react-native-codegen/src/generators/RNCodegen.js b/packages/react-native-codegen/src/generators/RNCodegen.js index 0de0f2ec1d10ae..ce6221db60e3ee 100644 --- a/packages/react-native-codegen/src/generators/RNCodegen.js +++ b/packages/react-native-codegen/src/generators/RNCodegen.js @@ -26,6 +26,7 @@ const generatePropsH = require('./components/GeneratePropsH.js'); const generateModuleH = require('./modules/GenerateModuleH.js'); const generateModuleCpp = require('./modules/GenerateModuleCpp.js'); const generateModuleHObjCpp = require('./modules/GenerateModuleHObjCpp.js'); +const generateModuleJavaSpec = require('./modules/GenerateModuleJavaSpec.js'); const generateModuleMm = require('./modules/GenerateModuleMm.js'); const generatePropsJavaInterface = require('./components/GeneratePropsJavaInterface.js'); const generatePropsJavaDelegate = require('./components/GeneratePropsJavaDelegate.js'); @@ -60,12 +61,7 @@ type Config = $ReadOnly<{| const GENERATORS = { descriptors: [generateComponentDescriptorH.generate], - events: [ - generateEventEmitterCpp.generate, - generateEventEmitterH.generate, - generateModuleHObjCpp.generate, - generateModuleMm.generate, - ], + events: [generateEventEmitterCpp.generate, generateEventEmitterH.generate], props: [ generateComponentHObjCpp.generate, generatePropsCpp.generate, @@ -73,7 +69,14 @@ const GENERATORS = { generatePropsJavaInterface.generate, generatePropsJavaDelegate.generate, ], - modules: [generateModuleCpp.generate, generateModuleH.generate], + modules: [ + generateModuleCpp.generate, + generateModuleH.generate, + generateModuleHObjCpp.generate, + generateModuleMm.generate, + // TODO: Java output and the C++ output need to be separated. + generateModuleJavaSpec.generate, + ], tests: [generateTests.generate], 'shadow-nodes': [ generateShadowNodeCpp.generate, diff --git a/packages/react-native-codegen/src/generators/components/CppHelpers.js b/packages/react-native-codegen/src/generators/components/CppHelpers.js index 75b259ab84f912..f6e7077a416942 100644 --- a/packages/react-native-codegen/src/generators/components/CppHelpers.js +++ b/packages/react-native-codegen/src/generators/components/CppHelpers.js @@ -67,7 +67,7 @@ function getImports(properties: $ReadOnlyArray): Set { case 'EdgeInsetsPrimitive': return; case 'ImageSourcePrimitive': - imports.add('#include '); + imports.add('#include '); return; default: (name: empty); diff --git a/packages/react-native-codegen/src/generators/components/GenerateComponentDescriptorH.js b/packages/react-native-codegen/src/generators/components/GenerateComponentDescriptorH.js index 2bd7a7817d2fcc..9fb720b0156e7d 100644 --- a/packages/react-native-codegen/src/generators/components/GenerateComponentDescriptorH.js +++ b/packages/react-native-codegen/src/generators/components/GenerateComponentDescriptorH.js @@ -25,8 +25,8 @@ const template = ` #pragma once -#include -#include +#include +#include namespace facebook { namespace react { diff --git a/packages/react-native-codegen/src/generators/components/GenerateEventEmitterCpp.js b/packages/react-native-codegen/src/generators/components/GenerateEventEmitterCpp.js index 052315baaf46ed..ecf717e7d6da95 100644 --- a/packages/react-native-codegen/src/generators/components/GenerateEventEmitterCpp.js +++ b/packages/react-native-codegen/src/generators/components/GenerateEventEmitterCpp.js @@ -34,7 +34,7 @@ const template = ` * LICENSE file in the root directory of this source tree. */ -#include +#include namespace facebook { namespace react { diff --git a/packages/react-native-codegen/src/generators/components/GenerateEventEmitterH.js b/packages/react-native-codegen/src/generators/components/GenerateEventEmitterH.js index 6c90069677f1ce..6d687cbb81f39e 100644 --- a/packages/react-native-codegen/src/generators/components/GenerateEventEmitterH.js +++ b/packages/react-native-codegen/src/generators/components/GenerateEventEmitterH.js @@ -43,7 +43,7 @@ const template = ` */ #pragma once -#include +#include namespace facebook { namespace react { diff --git a/packages/react-native-codegen/src/generators/components/GeneratePropsCpp.js b/packages/react-native-codegen/src/generators/components/GeneratePropsCpp.js index b6b03eb7d36979..287a51d3c11368 100644 --- a/packages/react-native-codegen/src/generators/components/GeneratePropsCpp.js +++ b/packages/react-native-codegen/src/generators/components/GeneratePropsCpp.js @@ -24,7 +24,7 @@ const template = ` * LICENSE file in the root directory of this source tree. */ -#include +#include ::_IMPORTS_:: namespace facebook { @@ -87,7 +87,7 @@ module.exports = { ): FilesOutput { const fileName = 'Props.cpp'; const allImports: Set = new Set([ - '#include ', + '#include ', ]); const componentProps = Object.keys(schema.modules) diff --git a/packages/react-native-codegen/src/generators/components/GeneratePropsH.js b/packages/react-native-codegen/src/generators/components/GeneratePropsH.js index a7ff3f9d77cda8..8e2b724a2bd57c 100644 --- a/packages/react-native-codegen/src/generators/components/GeneratePropsH.js +++ b/packages/react-native-codegen/src/generators/components/GeneratePropsH.js @@ -467,7 +467,9 @@ function getExtendsImports( case 'ReactNativeBuiltInType': switch (extendProps.knownTypeName) { case 'ReactNativeCoreViewProps': - imports.add('#include '); + imports.add( + '#include ', + ); return; default: (extendProps.knownTypeName: empty); @@ -490,16 +492,16 @@ function getLocalImports( function addImportsForNativeName(name) { switch (name) { case 'ColorPrimitive': - imports.add('#include '); + imports.add('#include '); return; case 'ImageSourcePrimitive': - imports.add('#include '); + imports.add('#include '); return; case 'PointPrimitive': - imports.add('#include '); + imports.add('#include '); return; case 'EdgeInsetsPrimitive': - imports.add('#include '); + imports.add('#include '); return; default: (name: empty); @@ -540,7 +542,7 @@ function getLocalImports( } if (typeAnnotation.type === 'ObjectTypeAnnotation') { - imports.add('#include '); + imports.add('#include '); const objectImports = getImports(typeAnnotation.properties); const localImports = getLocalImports(typeAnnotation.properties); objectImports.forEach(imports.add, imports); diff --git a/packages/react-native-codegen/src/generators/components/GenerateShadowNodeCpp.js b/packages/react-native-codegen/src/generators/components/GenerateShadowNodeCpp.js index 8784849619f5e6..4968da1f466b72 100644 --- a/packages/react-native-codegen/src/generators/components/GenerateShadowNodeCpp.js +++ b/packages/react-native-codegen/src/generators/components/GenerateShadowNodeCpp.js @@ -23,7 +23,7 @@ const template = ` * LICENSE file in the root directory of this source tree. */ -#include +#include namespace facebook { namespace react { diff --git a/packages/react-native-codegen/src/generators/components/GenerateShadowNodeH.js b/packages/react-native-codegen/src/generators/components/GenerateShadowNodeH.js index 84c22bc3190219..a020896ff9d4af 100644 --- a/packages/react-native-codegen/src/generators/components/GenerateShadowNodeH.js +++ b/packages/react-native-codegen/src/generators/components/GenerateShadowNodeH.js @@ -25,8 +25,8 @@ const template = ` #pragma once -::_IMPORTS_::#include -#include +::_IMPORTS_::#include +#include namespace facebook { namespace react { @@ -94,7 +94,7 @@ module.exports = { .filter(Boolean) .join('\n\n'); - const eventEmitterImport = `#include \n`; + const eventEmitterImport = `#include \n`; const replacedTemplate = template .replace(/::_COMPONENT_CLASSES_::/g, moduleResults) diff --git a/packages/react-native-codegen/src/generators/components/GenerateTests.js b/packages/react-native-codegen/src/generators/components/GenerateTests.js index 25c0cfa59a9b61..75ea5ae8fda467 100644 --- a/packages/react-native-codegen/src/generators/components/GenerateTests.js +++ b/packages/react-native-codegen/src/generators/components/GenerateTests.js @@ -32,7 +32,7 @@ const fileTemplate = ` */ #include -#include +#include ::_IMPORTS_:: using namespace facebook::react; @@ -140,9 +140,9 @@ module.exports = { ): FilesOutput { const fileName = 'Tests.cpp'; const allImports = new Set([ - '#include ', - '#include ', - '#include ', + '#include ', + '#include ', + '#include ', ]); const componentTests = Object.keys(schema.modules) diff --git a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateComponentDescriptorH-test.js.snap b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateComponentDescriptorH-test.js.snap index e23ae48953f9ea..c75e3cd513c8fc 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateComponentDescriptorH-test.js.snap +++ b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateComponentDescriptorH-test.js.snap @@ -12,8 +12,8 @@ Map { #pragma once -#include -#include +#include +#include namespace facebook { namespace react { @@ -38,8 +38,8 @@ Map { #pragma once -#include -#include +#include +#include namespace facebook { namespace react { @@ -64,8 +64,8 @@ Map { #pragma once -#include -#include +#include +#include namespace facebook { namespace react { @@ -90,8 +90,8 @@ Map { #pragma once -#include -#include +#include +#include namespace facebook { namespace react { @@ -116,8 +116,8 @@ Map { #pragma once -#include -#include +#include +#include namespace facebook { namespace react { @@ -142,8 +142,8 @@ Map { #pragma once -#include -#include +#include +#include namespace facebook { namespace react { @@ -168,8 +168,8 @@ Map { #pragma once -#include -#include +#include +#include namespace facebook { namespace react { @@ -194,8 +194,8 @@ Map { #pragma once -#include -#include +#include +#include namespace facebook { namespace react { @@ -220,8 +220,8 @@ Map { #pragma once -#include -#include +#include +#include namespace facebook { namespace react { @@ -246,8 +246,8 @@ Map { #pragma once -#include -#include +#include +#include namespace facebook { namespace react { @@ -272,8 +272,8 @@ Map { #pragma once -#include -#include +#include +#include namespace facebook { namespace react { @@ -298,8 +298,8 @@ Map { #pragma once -#include -#include +#include +#include namespace facebook { namespace react { @@ -324,8 +324,8 @@ Map { #pragma once -#include -#include +#include +#include namespace facebook { namespace react { @@ -350,8 +350,8 @@ Map { #pragma once -#include -#include +#include +#include namespace facebook { namespace react { @@ -376,8 +376,8 @@ Map { #pragma once -#include -#include +#include +#include namespace facebook { namespace react { @@ -402,8 +402,8 @@ Map { #pragma once -#include -#include +#include +#include namespace facebook { namespace react { @@ -428,8 +428,8 @@ Map { #pragma once -#include -#include +#include +#include namespace facebook { namespace react { @@ -454,8 +454,8 @@ Map { #pragma once -#include -#include +#include +#include namespace facebook { namespace react { @@ -480,8 +480,8 @@ Map { #pragma once -#include -#include +#include +#include namespace facebook { namespace react { @@ -506,8 +506,8 @@ Map { #pragma once -#include -#include +#include +#include namespace facebook { namespace react { @@ -532,8 +532,8 @@ Map { #pragma once -#include -#include +#include +#include namespace facebook { namespace react { @@ -558,8 +558,8 @@ Map { #pragma once -#include -#include +#include +#include namespace facebook { namespace react { @@ -584,8 +584,8 @@ Map { #pragma once -#include -#include +#include +#include namespace facebook { namespace react { @@ -610,8 +610,8 @@ Map { #pragma once -#include -#include +#include +#include namespace facebook { namespace react { @@ -636,8 +636,8 @@ Map { #pragma once -#include -#include +#include +#include namespace facebook { namespace react { @@ -663,8 +663,8 @@ Map { #pragma once -#include -#include +#include +#include namespace facebook { namespace react { diff --git a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateEventEmitterCpp-test.js.snap b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateEventEmitterCpp-test.js.snap index c70dc86ce28188..a8c65fe6224b38 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateEventEmitterCpp-test.js.snap +++ b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateEventEmitterCpp-test.js.snap @@ -10,7 +10,7 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include +#include namespace facebook { namespace react { @@ -33,7 +33,7 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include +#include namespace facebook { namespace react { @@ -56,7 +56,7 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include +#include namespace facebook { namespace react { @@ -79,7 +79,7 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include +#include namespace facebook { namespace react { @@ -102,7 +102,7 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include +#include namespace facebook { namespace react { @@ -125,7 +125,7 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include +#include namespace facebook { namespace react { @@ -148,7 +148,7 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include +#include namespace facebook { namespace react { @@ -171,7 +171,7 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include +#include namespace facebook { namespace react { @@ -212,7 +212,7 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include +#include namespace facebook { namespace react { @@ -261,7 +261,7 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include +#include namespace facebook { namespace react { @@ -297,7 +297,7 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include +#include namespace facebook { namespace react { @@ -320,7 +320,7 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include +#include namespace facebook { namespace react { @@ -343,7 +343,7 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include +#include namespace facebook { namespace react { @@ -366,7 +366,7 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include +#include namespace facebook { namespace react { @@ -389,7 +389,7 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include +#include namespace facebook { namespace react { @@ -412,7 +412,7 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include +#include namespace facebook { namespace react { @@ -435,7 +435,7 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include +#include namespace facebook { namespace react { @@ -458,7 +458,7 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include +#include namespace facebook { namespace react { @@ -487,7 +487,7 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include +#include namespace facebook { namespace react { @@ -510,7 +510,7 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include +#include namespace facebook { namespace react { @@ -533,7 +533,7 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include +#include namespace facebook { namespace react { @@ -556,7 +556,7 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include +#include namespace facebook { namespace react { @@ -579,7 +579,7 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include +#include namespace facebook { namespace react { @@ -602,7 +602,7 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include +#include namespace facebook { namespace react { @@ -625,7 +625,7 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include +#include namespace facebook { namespace react { @@ -649,7 +649,7 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include +#include namespace facebook { namespace react { diff --git a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateEventEmitterH-test.js.snap b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateEventEmitterH-test.js.snap index 229c08c3f15b42..18c1ccc473fbb3 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateEventEmitterH-test.js.snap +++ b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateEventEmitterH-test.js.snap @@ -11,7 +11,7 @@ Map { */ #pragma once -#include +#include namespace facebook { namespace react { @@ -35,7 +35,7 @@ Map { */ #pragma once -#include +#include namespace facebook { namespace react { @@ -59,7 +59,7 @@ Map { */ #pragma once -#include +#include namespace facebook { namespace react { @@ -83,7 +83,7 @@ Map { */ #pragma once -#include +#include namespace facebook { namespace react { @@ -107,7 +107,7 @@ Map { */ #pragma once -#include +#include namespace facebook { namespace react { @@ -131,7 +131,7 @@ Map { */ #pragma once -#include +#include namespace facebook { namespace react { @@ -155,7 +155,7 @@ Map { */ #pragma once -#include +#include namespace facebook { namespace react { @@ -179,7 +179,7 @@ Map { */ #pragma once -#include +#include namespace facebook { namespace react { @@ -222,7 +222,7 @@ Map { */ #pragma once -#include +#include namespace facebook { namespace react { @@ -284,7 +284,7 @@ Map { */ #pragma once -#include +#include namespace facebook { namespace react { @@ -323,7 +323,7 @@ Map { */ #pragma once -#include +#include namespace facebook { namespace react { @@ -347,7 +347,7 @@ Map { */ #pragma once -#include +#include namespace facebook { namespace react { @@ -371,7 +371,7 @@ Map { */ #pragma once -#include +#include namespace facebook { namespace react { @@ -395,7 +395,7 @@ Map { */ #pragma once -#include +#include namespace facebook { namespace react { @@ -419,7 +419,7 @@ Map { */ #pragma once -#include +#include namespace facebook { namespace react { @@ -443,7 +443,7 @@ Map { */ #pragma once -#include +#include namespace facebook { namespace react { @@ -467,7 +467,7 @@ Map { */ #pragma once -#include +#include namespace facebook { namespace react { @@ -491,7 +491,7 @@ Map { */ #pragma once -#include +#include namespace facebook { namespace react { @@ -524,7 +524,7 @@ Map { */ #pragma once -#include +#include namespace facebook { namespace react { @@ -548,7 +548,7 @@ Map { */ #pragma once -#include +#include namespace facebook { namespace react { @@ -572,7 +572,7 @@ Map { */ #pragma once -#include +#include namespace facebook { namespace react { @@ -596,7 +596,7 @@ Map { */ #pragma once -#include +#include namespace facebook { namespace react { @@ -620,7 +620,7 @@ Map { */ #pragma once -#include +#include namespace facebook { namespace react { @@ -644,7 +644,7 @@ Map { */ #pragma once -#include +#include namespace facebook { namespace react { @@ -668,7 +668,7 @@ Map { */ #pragma once -#include +#include namespace facebook { namespace react { @@ -692,7 +692,7 @@ Map { */ #pragma once -#include +#include namespace facebook { namespace react { diff --git a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsCpp-test.js.snap b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsCpp-test.js.snap index 27ce7d45df9925..84911ff29e33b8 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsCpp-test.js.snap +++ b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsCpp-test.js.snap @@ -10,9 +10,9 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include -#include -#include +#include +#include +#include namespace facebook { namespace react { @@ -50,8 +50,8 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include -#include +#include +#include namespace facebook { namespace react { @@ -79,8 +79,8 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include -#include +#include +#include namespace facebook { namespace react { @@ -108,8 +108,8 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include -#include +#include +#include namespace facebook { namespace react { @@ -137,8 +137,8 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include -#include +#include +#include namespace facebook { namespace react { @@ -166,8 +166,8 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include -#include +#include +#include namespace facebook { namespace react { @@ -195,8 +195,8 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include -#include +#include +#include namespace facebook { namespace react { @@ -229,8 +229,8 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include -#include +#include +#include namespace facebook { namespace react { @@ -258,8 +258,8 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include -#include +#include +#include namespace facebook { namespace react { @@ -287,8 +287,8 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include -#include +#include +#include namespace facebook { namespace react { @@ -316,8 +316,8 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include -#include +#include +#include namespace facebook { namespace react { @@ -345,8 +345,8 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include -#include +#include +#include namespace facebook { namespace react { @@ -369,8 +369,8 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include -#include +#include +#include namespace facebook { namespace react { @@ -403,9 +403,9 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include -#include -#include +#include +#include +#include namespace facebook { namespace react { @@ -433,8 +433,8 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include -#include +#include +#include namespace facebook { namespace react { @@ -462,8 +462,8 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include -#include +#include +#include namespace facebook { namespace react { @@ -491,8 +491,8 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include -#include +#include +#include namespace facebook { namespace react { @@ -522,8 +522,8 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include -#include +#include +#include namespace facebook { namespace react { @@ -551,9 +551,9 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include -#include -#include +#include +#include +#include namespace facebook { namespace react { @@ -584,8 +584,8 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include -#include +#include +#include namespace facebook { namespace react { @@ -613,9 +613,9 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include -#include -#include +#include +#include +#include namespace facebook { namespace react { @@ -643,8 +643,8 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include -#include +#include +#include namespace facebook { namespace react { @@ -672,8 +672,8 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include -#include +#include +#include namespace facebook { namespace react { @@ -701,8 +701,8 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include -#include +#include +#include namespace facebook { namespace react { @@ -731,8 +731,8 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include -#include +#include +#include namespace facebook { namespace react { @@ -766,8 +766,8 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include -#include +#include +#include namespace facebook { namespace react { diff --git a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsH-test.js.snap b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsH-test.js.snap index 3071e0e70ed107..9129a7df326ba7 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsH-test.js.snap +++ b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsH-test.js.snap @@ -12,10 +12,10 @@ Map { #pragma once #include -#include -#include -#include -#include +#include +#include +#include +#include #include namespace facebook { @@ -224,11 +224,11 @@ Map { */ #pragma once -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include namespace facebook { @@ -297,7 +297,7 @@ Map { */ #pragma once -#include +#include namespace facebook { namespace react { @@ -329,8 +329,8 @@ Map { */ #pragma once -#include -#include +#include +#include namespace facebook { namespace react { @@ -362,7 +362,7 @@ Map { */ #pragma once -#include +#include namespace facebook { namespace react { @@ -394,7 +394,7 @@ Map { */ #pragma once -#include +#include namespace facebook { namespace react { @@ -426,7 +426,7 @@ Map { */ #pragma once -#include +#include namespace facebook { namespace react { @@ -463,7 +463,7 @@ Map { */ #pragma once -#include +#include namespace facebook { namespace react { @@ -495,7 +495,7 @@ Map { */ #pragma once -#include +#include namespace facebook { namespace react { @@ -527,7 +527,7 @@ Map { */ #pragma once -#include +#include namespace facebook { namespace react { @@ -559,7 +559,7 @@ Map { */ #pragma once -#include +#include namespace facebook { namespace react { @@ -615,7 +615,7 @@ Map { */ #pragma once -#include +#include namespace facebook { namespace react { @@ -652,8 +652,8 @@ Map { */ #pragma once -#include -#include +#include +#include namespace facebook { namespace react { @@ -685,8 +685,8 @@ Map { */ #pragma once -#include -#include +#include +#include namespace facebook { namespace react { @@ -718,7 +718,7 @@ Map { */ #pragma once -#include +#include namespace facebook { namespace react { @@ -777,7 +777,7 @@ Map { */ #pragma once -#include +#include namespace facebook { namespace react { @@ -811,7 +811,7 @@ Map { */ #pragma once -#include +#include namespace facebook { namespace react { @@ -843,10 +843,10 @@ Map { */ #pragma once -#include -#include -#include -#include +#include +#include +#include +#include namespace facebook { namespace react { @@ -881,7 +881,7 @@ Map { */ #pragma once -#include +#include namespace facebook { namespace react { @@ -913,12 +913,12 @@ Map { */ #pragma once -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include namespace facebook { @@ -1165,8 +1165,8 @@ Map { */ #pragma once -#include -#include +#include +#include namespace facebook { namespace react { @@ -1198,7 +1198,7 @@ Map { */ #pragma once -#include +#include namespace facebook { namespace react { @@ -1248,7 +1248,7 @@ Map { */ #pragma once -#include +#include namespace facebook { namespace react { @@ -1281,7 +1281,7 @@ Map { */ #pragma once -#include +#include namespace facebook { namespace react { @@ -1323,7 +1323,7 @@ Map { */ #pragma once -#include +#include namespace facebook { namespace react { diff --git a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateShadowNodeCpp-test.js.snap b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateShadowNodeCpp-test.js.snap index 22043570482540..94ce4a3e64a435 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateShadowNodeCpp-test.js.snap +++ b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateShadowNodeCpp-test.js.snap @@ -10,7 +10,7 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include +#include namespace facebook { namespace react { @@ -33,7 +33,7 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include +#include namespace facebook { namespace react { @@ -56,7 +56,7 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include +#include namespace facebook { namespace react { @@ -79,7 +79,7 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include +#include namespace facebook { namespace react { @@ -102,7 +102,7 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include +#include namespace facebook { namespace react { @@ -125,7 +125,7 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include +#include namespace facebook { namespace react { @@ -148,7 +148,7 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include +#include namespace facebook { namespace react { @@ -171,7 +171,7 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include +#include namespace facebook { namespace react { @@ -194,7 +194,7 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include +#include namespace facebook { namespace react { @@ -217,7 +217,7 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include +#include namespace facebook { namespace react { @@ -240,7 +240,7 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include +#include namespace facebook { namespace react { @@ -263,7 +263,7 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include +#include namespace facebook { namespace react { @@ -286,7 +286,7 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include +#include namespace facebook { namespace react { @@ -309,7 +309,7 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include +#include namespace facebook { namespace react { @@ -332,7 +332,7 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include +#include namespace facebook { namespace react { @@ -355,7 +355,7 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include +#include namespace facebook { namespace react { @@ -378,7 +378,7 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include +#include namespace facebook { namespace react { @@ -401,7 +401,7 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include +#include namespace facebook { namespace react { @@ -424,7 +424,7 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include +#include namespace facebook { namespace react { @@ -447,7 +447,7 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include +#include namespace facebook { namespace react { @@ -470,7 +470,7 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include +#include namespace facebook { namespace react { @@ -493,7 +493,7 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include +#include namespace facebook { namespace react { @@ -516,7 +516,7 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include +#include namespace facebook { namespace react { @@ -539,7 +539,7 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include +#include namespace facebook { namespace react { @@ -562,7 +562,7 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include +#include namespace facebook { namespace react { @@ -586,7 +586,7 @@ Map { * LICENSE file in the root directory of this source tree. */ -#include +#include namespace facebook { namespace react { diff --git a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateShadowNodeH-test.js.snap b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateShadowNodeH-test.js.snap index 5327702796da7c..ff15cf0d55a5b5 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateShadowNodeH-test.js.snap +++ b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateShadowNodeH-test.js.snap @@ -12,8 +12,8 @@ Map { #pragma once -#include -#include +#include +#include namespace facebook { namespace react { @@ -45,8 +45,8 @@ Map { #pragma once -#include -#include +#include +#include namespace facebook { namespace react { @@ -78,8 +78,8 @@ Map { #pragma once -#include -#include +#include +#include namespace facebook { namespace react { @@ -111,8 +111,8 @@ Map { #pragma once -#include -#include +#include +#include namespace facebook { namespace react { @@ -144,8 +144,8 @@ Map { #pragma once -#include -#include +#include +#include namespace facebook { namespace react { @@ -177,8 +177,8 @@ Map { #pragma once -#include -#include +#include +#include namespace facebook { namespace react { @@ -210,8 +210,8 @@ Map { #pragma once -#include -#include +#include +#include namespace facebook { namespace react { @@ -243,9 +243,9 @@ Map { #pragma once -#include -#include -#include +#include +#include +#include namespace facebook { namespace react { @@ -278,9 +278,9 @@ Map { #pragma once -#include -#include -#include +#include +#include +#include namespace facebook { namespace react { @@ -313,8 +313,8 @@ Map { #pragma once -#include -#include +#include +#include namespace facebook { namespace react { @@ -339,8 +339,8 @@ Map { #pragma once -#include -#include +#include +#include namespace facebook { namespace react { @@ -372,8 +372,8 @@ Map { #pragma once -#include -#include +#include +#include namespace facebook { namespace react { @@ -405,8 +405,8 @@ Map { #pragma once -#include -#include +#include +#include namespace facebook { namespace react { @@ -438,8 +438,8 @@ Map { #pragma once -#include -#include +#include +#include namespace facebook { namespace react { @@ -471,8 +471,8 @@ Map { #pragma once -#include -#include +#include +#include namespace facebook { namespace react { @@ -504,8 +504,8 @@ Map { #pragma once -#include -#include +#include +#include namespace facebook { namespace react { @@ -537,8 +537,8 @@ Map { #pragma once -#include -#include +#include +#include namespace facebook { namespace react { @@ -570,8 +570,8 @@ Map { #pragma once -#include -#include +#include +#include namespace facebook { namespace react { @@ -596,8 +596,8 @@ Map { #pragma once -#include -#include +#include +#include namespace facebook { namespace react { @@ -629,8 +629,8 @@ Map { #pragma once -#include -#include +#include +#include namespace facebook { namespace react { @@ -662,8 +662,8 @@ Map { #pragma once -#include -#include +#include +#include namespace facebook { namespace react { @@ -695,8 +695,8 @@ Map { #pragma once -#include -#include +#include +#include namespace facebook { namespace react { @@ -728,8 +728,8 @@ Map { #pragma once -#include -#include +#include +#include namespace facebook { namespace react { @@ -761,8 +761,8 @@ Map { #pragma once -#include -#include +#include +#include namespace facebook { namespace react { @@ -794,8 +794,8 @@ Map { #pragma once -#include -#include +#include +#include namespace facebook { namespace react { @@ -836,8 +836,8 @@ Map { #pragma once -#include -#include +#include +#include namespace facebook { namespace react { diff --git a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateTests-test.js.snap b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateTests-test.js.snap index 8f73a0c825023a..d08b35e6fa0b75 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateTests-test.js.snap +++ b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateTests-test.js.snap @@ -10,11 +10,11 @@ Map { */ #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include using namespace facebook::react; @@ -39,10 +39,10 @@ Map { */ #include -#include -#include -#include -#include +#include +#include +#include +#include using namespace facebook::react; @@ -67,10 +67,10 @@ Map { */ #include -#include -#include -#include -#include +#include +#include +#include +#include using namespace facebook::react; @@ -104,10 +104,10 @@ Map { */ #include -#include -#include -#include -#include +#include +#include +#include +#include using namespace facebook::react; @@ -141,10 +141,10 @@ Map { */ #include -#include -#include -#include -#include +#include +#include +#include +#include using namespace facebook::react; @@ -169,10 +169,10 @@ Map { */ #include -#include -#include -#include -#include +#include +#include +#include +#include using namespace facebook::react; @@ -206,10 +206,10 @@ Map { */ #include -#include -#include -#include -#include +#include +#include +#include +#include using namespace facebook::react; @@ -234,10 +234,10 @@ Map { */ #include -#include -#include -#include -#include +#include +#include +#include +#include using namespace facebook::react; @@ -271,10 +271,10 @@ Map { */ #include -#include -#include -#include -#include +#include +#include +#include +#include using namespace facebook::react; @@ -308,10 +308,10 @@ Map { */ #include -#include -#include -#include -#include +#include +#include +#include +#include using namespace facebook::react; @@ -336,10 +336,10 @@ Map { */ #include -#include -#include -#include -#include +#include +#include +#include +#include using namespace facebook::react; @@ -364,10 +364,10 @@ Map { */ #include -#include -#include -#include -#include +#include +#include +#include +#include using namespace facebook::react; @@ -392,10 +392,10 @@ Map { */ #include -#include -#include -#include -#include +#include +#include +#include +#include using namespace facebook::react; @@ -474,11 +474,11 @@ Map { */ #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include using namespace facebook::react; @@ -512,10 +512,10 @@ Map { */ #include -#include -#include -#include -#include +#include +#include +#include +#include using namespace facebook::react; @@ -540,10 +540,10 @@ Map { */ #include -#include -#include -#include -#include +#include +#include +#include +#include using namespace facebook::react; @@ -568,10 +568,10 @@ Map { */ #include -#include -#include -#include -#include +#include +#include +#include +#include using namespace facebook::react; @@ -596,10 +596,10 @@ Map { */ #include -#include -#include -#include -#include +#include +#include +#include +#include using namespace facebook::react; @@ -633,11 +633,11 @@ Map { */ #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include using namespace facebook::react; @@ -698,10 +698,10 @@ Map { */ #include -#include -#include -#include -#include +#include +#include +#include +#include using namespace facebook::react; @@ -726,11 +726,11 @@ Map { */ #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include using namespace facebook::react; @@ -755,10 +755,10 @@ Map { */ #include -#include -#include -#include -#include +#include +#include +#include +#include using namespace facebook::react; @@ -792,10 +792,10 @@ Map { */ #include -#include -#include -#include -#include +#include +#include +#include +#include using namespace facebook::react; @@ -847,10 +847,10 @@ Map { */ #include -#include -#include -#include -#include +#include +#include +#include +#include using namespace facebook::react; @@ -893,10 +893,10 @@ Map { */ #include -#include -#include -#include -#include +#include +#include +#include +#include using namespace facebook::react; @@ -948,10 +948,10 @@ Map { */ #include -#include -#include -#include -#include +#include +#include +#include +#include using namespace facebook::react; diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleCpp.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleCpp.js index 365fd30a552f80..6f61945cd9df9b 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleCpp.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleCpp.js @@ -11,7 +11,7 @@ 'use strict'; import type {SchemaType} from '../../CodegenSchema'; -const {getTypeAliasTypeAnnotation} = require('./ObjCppUtils/Utils'); +const {getTypeAliasTypeAnnotation} = require('./Utils'); type FilesOutput = Map; const propertyHeaderTemplate = diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleH.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleH.js index fb41d160b5b336..0594f626ce9d66 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleH.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleH.js @@ -18,7 +18,7 @@ import type { ObjectTypeAliasTypeShape, } from '../../CodegenSchema'; -const {getTypeAliasTypeAnnotation} = require('./ObjCppUtils/Utils'); +const {getTypeAliasTypeAnnotation} = require('./Utils'); type FilesOutput = Map; @@ -32,8 +32,7 @@ public: };`; -const template = ` -/** +const template = `/** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleHObjCpp.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleHObjCpp.js index 41ebb294c0d436..c9f173df868e37 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleHObjCpp.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleHObjCpp.js @@ -24,7 +24,7 @@ const { getNamespacedStructName, } = require('./ObjCppUtils/GenerateStructs'); -const {getTypeAliasTypeAnnotation} = require('./ObjCppUtils/Utils'); +const {getTypeAliasTypeAnnotation} = require('./Utils'); type FilesOutput = Map; diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleJavaSpec.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleJavaSpec.js new file mode 100644 index 00000000000000..5054146e4ffc56 --- /dev/null +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleJavaSpec.js @@ -0,0 +1,332 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict + * @format + */ + +'use strict'; + +import type { + FunctionTypeAnnotationParam, + FunctionTypeAnnotationReturn, + NativeModuleMethodTypeShape, + ObjectTypeAliasTypeShape, + SchemaType, +} from '../../CodegenSchema'; +const {getTypeAliasTypeAnnotation} = require('./Utils'); + +type FilesOutput = Map; + +const moduleTemplate = `/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the LICENSE file in the root + * directory of this source tree. + * + * ${'@'}generated by codegen project: GenerateModuleJavaSpec.js + * + * @nolint + */ + +package ::_PACKAGENAME_::; + +::_IMPORTS_:: + +public abstract class ::_CLASSNAME_:: extends ReactContextBaseJavaModule implements ReactModuleWithSpec, TurboModule { + public ::_CLASSNAME_::(ReactApplicationContext reactContext) { + super(reactContext); + } + +::_METHODS_:: +} +`; + +function translateFunctionParamToJavaType( + param: FunctionTypeAnnotationParam, + createErrorMessage: (typeName: string) => string, + aliases: $ReadOnly<{[aliasName: string]: ObjectTypeAliasTypeShape, ...}>, + imports: Set, +): string { + const {nullable, typeAnnotation} = param; + + function wrapIntoNullableIfNeeded(generatedType: string) { + if (nullable) { + imports.add('javax.annotation.Nullable'); + return `@Nullable ${generatedType}`; + } + return generatedType; + } + + const realTypeAnnotation = + typeAnnotation.type === 'TypeAliasTypeAnnotation' + ? getTypeAliasTypeAnnotation(typeAnnotation.name, aliases) + : typeAnnotation; + switch (realTypeAnnotation.type) { + case 'ReservedFunctionValueTypeAnnotation': + switch (realTypeAnnotation.name) { + case 'RootTag': + return nullable ? 'Double' : 'double'; + default: + (realTypeAnnotation.name: empty); + throw new Error(createErrorMessage(realTypeAnnotation.name)); + } + case 'StringTypeAnnotation': + return wrapIntoNullableIfNeeded('String'); + case 'NumberTypeAnnotation': + case 'FloatTypeAnnotation': + case 'Int32TypeAnnotation': + return nullable ? 'Double' : 'double'; + case 'BooleanTypeAnnotation': + return nullable ? 'Boolean' : 'boolean'; + case 'ObjectTypeAnnotation': + imports.add('com.facebook.react.bridge.ReadableMap'); + if (typeAnnotation.type === 'TypeAliasTypeAnnotation') { + // No class alias for args, so it still falls under ReadableMap. + return 'ReadableMap'; + } + return 'ReadableMap'; + case 'GenericObjectTypeAnnotation': + // Treat this the same as ObjectTypeAnnotation for now. + imports.add('com.facebook.react.bridge.ReadableMap'); + return 'ReadableMap'; + case 'ArrayTypeAnnotation': + imports.add('com.facebook.react.bridge.ReadableArray'); + return 'ReadableArray'; + case 'FunctionTypeAnnotation': + imports.add('com.facebook.react.bridge.Callback'); + return 'Callback'; + default: + throw new Error(createErrorMessage(realTypeAnnotation.type)); + } +} + +function translateFunctionReturnTypeToJavaType( + returnTypeAnnotation: FunctionTypeAnnotationReturn, + createErrorMessage: (typeName: string) => string, + imports: Set, +): string { + const {nullable} = returnTypeAnnotation; + + function wrapIntoNullableIfNeeded(generatedType: string) { + if (nullable) { + imports.add('javax.annotation.Nullable'); + return `@Nullable ${generatedType}`; + } + return generatedType; + } + + // TODO: Support aliased return type. This doesn't exist in React Native Android yet. + switch (returnTypeAnnotation.type) { + case 'ReservedFunctionValueTypeAnnotation': + switch (returnTypeAnnotation.name) { + case 'RootTag': + return nullable ? 'Double' : 'double'; + default: + (returnTypeAnnotation.name: empty); + throw new Error(createErrorMessage(returnTypeAnnotation.name)); + } + case 'VoidTypeAnnotation': + case 'GenericPromiseTypeAnnotation': + return 'void'; + case 'StringTypeAnnotation': + return wrapIntoNullableIfNeeded('String'); + case 'NumberTypeAnnotation': + case 'FloatTypeAnnotation': + case 'Int32TypeAnnotation': + return nullable ? 'Double' : 'double'; + case 'BooleanTypeAnnotation': + return nullable ? 'Boolean' : 'boolean'; + case 'ObjectTypeAnnotation': + imports.add('com.facebook.react.bridge.WritableMap'); + return 'WritableMap'; + case 'GenericObjectTypeAnnotation': + imports.add('com.facebook.react.bridge.WritableMap'); + return 'WritableMap'; + case 'ArrayTypeAnnotation': + imports.add('com.facebook.react.bridge.WritableArray'); + return 'WritableArray'; + default: + throw new Error(createErrorMessage(returnTypeAnnotation.type)); + } +} + +// Build special-cased runtime check for getConstants(). +function buildGetConstantsMethod( + method: NativeModuleMethodTypeShape, + imports: Set, +): string { + if ( + method.typeAnnotation.returnTypeAnnotation.type === 'ObjectTypeAnnotation' + ) { + const requiredProps = []; + const optionalProps = []; + const rawProperties = + method.typeAnnotation.returnTypeAnnotation.properties || []; + rawProperties.forEach(p => { + if (p.optional) { + optionalProps.push(p.name); + } else { + requiredProps.push(p.name); + } + }); + if (requiredProps.length === 0 && optionalProps.length === 0) { + // Nothing to validate during runtime. + return ''; + } + + imports.add('com.facebook.react.common.build.ReactBuildConfig'); + imports.add('java.util.Arrays'); + imports.add('java.util.HashSet'); + imports.add('java.util.Map'); + imports.add('java.util.Set'); + imports.add('javax.annotation.Nullable'); + + const requiredPropsFragment = + requiredProps.length > 0 + ? `Arrays.asList( + ${requiredProps + .sort() + .map(p => `"${p}"`) + .join(',\n ')} + )` + : ''; + const optionalPropsFragment = + optionalProps.length > 0 + ? `Arrays.asList( + ${optionalProps + .sort() + .map(p => `"${p}"`) + .join(',\n ')} + )` + : ''; + + return ` protected abstract Map getTypedExportedConstants(); + + @Override + public final @Nullable Map getConstants() { + Map constants = getTypedExportedConstants(); + if (ReactBuildConfig.DEBUG || ReactBuildConfig.IS_INTERNAL_BUILD) { + Set obligatoryFlowConstants = new HashSet<>(${requiredPropsFragment}); + Set optionalFlowConstants = new HashSet<>(${optionalPropsFragment}); + Set undeclaredConstants = new HashSet<>(constants.keySet()); + undeclaredConstants.removeAll(obligatoryFlowConstants); + undeclaredConstants.removeAll(optionalFlowConstants); + if (!undeclaredConstants.isEmpty()) { + throw new IllegalStateException(String.format("Native Module Flow doesn't declare constants: %s", undeclaredConstants)); + } + undeclaredConstants = obligatoryFlowConstants; + undeclaredConstants.removeAll(constants.keySet()); + if (!undeclaredConstants.isEmpty()) { + throw new IllegalStateException(String.format("Native Module doesn't fill in constants: %s", undeclaredConstants)); + } + } + return constants; + }`; + } + + return ''; +} + +module.exports = { + generate( + libraryName: string, + schema: SchemaType, + moduleSpecName: string, + ): FilesOutput { + const files = new Map(); + // TODO: Allow package configuration. + const packageName = 'com.facebook.fbreact.specs.beta'; + const nativeModules = Object.keys(schema.modules) + .map(moduleName => { + const modules = schema.modules[moduleName].nativeModules; + if (modules == null) { + return null; + } + + return modules; + }) + .filter(Boolean) + .reduce((acc, components) => Object.assign(acc, components), {}); + + Object.keys(nativeModules).forEach(name => { + const {aliases, properties} = nativeModules[name]; + const className = `Native${name}Spec`; + + const imports: Set = new Set([ + // Always required. + 'com.facebook.react.bridge.ReactApplicationContext', + 'com.facebook.react.bridge.ReactContextBaseJavaModule', + 'com.facebook.react.bridge.ReactMethod', + 'com.facebook.react.bridge.ReactModuleWithSpec', + 'com.facebook.react.turbomodule.core.interfaces.TurboModule', + ]); + + const methods = properties.map(method => { + if (method.name === 'getConstants') { + return buildGetConstantsMethod(method, imports); + } + + // Handle return type + const translatedReturnType = translateFunctionReturnTypeToJavaType( + method.typeAnnotation.returnTypeAnnotation, + typeName => + `Unsupported return type for method ${method.name}. Found: ${typeName}`, + imports, + ); + const returningPromise = + method.typeAnnotation.returnTypeAnnotation.type === + 'GenericPromiseTypeAnnotation'; + const isSyncMethod = + method.typeAnnotation.returnTypeAnnotation.type !== + 'VoidTypeAnnotation' && !returningPromise; + + // Handle method args + const traversedArgs = method.typeAnnotation.params.map(param => { + const translatedParam = translateFunctionParamToJavaType( + param, + typeName => + `Unsupported type for param "${param.name}" in ${method.name}. Found: ${typeName}`, + aliases, + imports, + ); + return `${translatedParam} ${param.name}`; + }); + + if (returningPromise) { + // Promise return type requires an extra arg at the end. + imports.add('com.facebook.react.bridge.Promise'); + traversedArgs.push('Promise promise'); + } + + const methodJavaAnnotation = `@ReactMethod${ + isSyncMethod ? '(isBlockingSynchronousMethod = true)' : '' + }`; + return ` ${methodJavaAnnotation} + public abstract ${translatedReturnType} ${method.name}(${traversedArgs.join( + ', ', + )});`; + }); + + files.set( + `${className}.java`, + moduleTemplate + .replace( + /::_IMPORTS_::/g, + Array.from(imports) + .sort() + .map(p => `import ${p};`) + .join('\n'), + ) + .replace(/::_PACKAGENAME_::/g, packageName) + .replace(/::_CLASSNAME_::/g, className) + .replace(/::_METHODS_::/g, methods.filter(m => !!m).join('\n\n')), + ); + }); + + return files; + }, +}; diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleMm.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleMm.js index 251c242a7c39c2..8b60d07e127429 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleMm.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleMm.js @@ -13,10 +13,8 @@ import type {SchemaType, NativeModuleShape} from '../../CodegenSchema'; const {capitalizeFirstLetter} = require('./ObjCppUtils/GenerateStructs'); -const { - flatObjects, - getTypeAliasTypeAnnotation, -} = require('./ObjCppUtils/Utils'); +const {flatObjects} = require('./ObjCppUtils/Utils'); +const {getTypeAliasTypeAnnotation} = require('./Utils'); type FilesOutput = Map; diff --git a/packages/react-native-codegen/src/generators/modules/ObjCppUtils/GenerateStructs.js b/packages/react-native-codegen/src/generators/modules/ObjCppUtils/GenerateStructs.js index e860a663270140..c9e1d817a296d1 100644 --- a/packages/react-native-codegen/src/generators/modules/ObjCppUtils/GenerateStructs.js +++ b/packages/react-native-codegen/src/generators/modules/ObjCppUtils/GenerateStructs.js @@ -18,8 +18,8 @@ const { flatObjects, capitalizeFirstLetter, getSafePropertyName, - getTypeAliasTypeAnnotation, } = require('./Utils'); +const {getTypeAliasTypeAnnotation} = require('../Utils'); const {generateStructsForConstants} = require('./GenerateStructsForConstants'); const template = ` diff --git a/packages/react-native-codegen/src/generators/modules/ObjCppUtils/GenerateStructsForConstants.js b/packages/react-native-codegen/src/generators/modules/ObjCppUtils/GenerateStructsForConstants.js index 614f2fe4a42c48..0433152f7f627d 100644 --- a/packages/react-native-codegen/src/generators/modules/ObjCppUtils/GenerateStructsForConstants.js +++ b/packages/react-native-codegen/src/generators/modules/ObjCppUtils/GenerateStructsForConstants.js @@ -14,11 +14,8 @@ import type { ObjectParamTypeAnnotation, ObjectTypeAliasTypeShape, } from '../../../CodegenSchema'; -const { - flatObjects, - capitalizeFirstLetter, - getTypeAliasTypeAnnotation, -} = require('./Utils'); +const {flatObjects, capitalizeFirstLetter} = require('./Utils'); +const {getTypeAliasTypeAnnotation} = require('../Utils'); const structTemplate = ` namespace JS { diff --git a/packages/react-native-codegen/src/generators/modules/ObjCppUtils/Utils.js b/packages/react-native-codegen/src/generators/modules/ObjCppUtils/Utils.js index 8c921c075c6082..fd4dca38468dad 100644 --- a/packages/react-native-codegen/src/generators/modules/ObjCppUtils/Utils.js +++ b/packages/react-native-codegen/src/generators/modules/ObjCppUtils/Utils.js @@ -14,6 +14,7 @@ import type { ObjectParamTypeAnnotation, ObjectTypeAliasTypeShape, } from '../../../CodegenSchema'; +const {getTypeAliasTypeAnnotation} = require('../Utils'); function capitalizeFirstLetter(string: string): string { return string.charAt(0).toUpperCase() + string.slice(1); @@ -104,35 +105,8 @@ function getSafePropertyName(property: ObjectParamTypeAnnotation): string { return property.name; } -function getTypeAliasTypeAnnotation( - name: string, - aliases: $ReadOnly<{[aliasName: string]: ObjectTypeAliasTypeShape, ...}>, -): $ReadOnly { - const typeAnnotation = aliases[name]; - if (!typeAnnotation) { - throw Error(`No type annotation found for "${name}" in schema`); - } - if (typeAnnotation.type === 'ObjectTypeAnnotation') { - if (typeAnnotation.properties) { - return typeAnnotation; - } - - throw new Error( - `Unsupported type for "${name}". Please provide properties.`, - ); - } - if (typeAnnotation.type === 'TypeAliasTypeAnnotation') { - return getTypeAliasTypeAnnotation(typeAnnotation.name, aliases); - } - - throw Error( - `Unsupported type annotation in alias "${name}", found: ${typeAnnotation.type}`, - ); -} - module.exports = { flatObjects, capitalizeFirstLetter, getSafePropertyName, - getTypeAliasTypeAnnotation, }; diff --git a/packages/react-native-codegen/src/generators/modules/Utils.js b/packages/react-native-codegen/src/generators/modules/Utils.js new file mode 100644 index 00000000000000..ee20099e68d909 --- /dev/null +++ b/packages/react-native-codegen/src/generators/modules/Utils.js @@ -0,0 +1,43 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict + * @format + */ + +'use strict'; + +import type {ObjectTypeAliasTypeShape} from '../../CodegenSchema'; + +function getTypeAliasTypeAnnotation( + name: string, + aliases: $ReadOnly<{[aliasName: string]: ObjectTypeAliasTypeShape, ...}>, +): $ReadOnly { + const typeAnnotation = aliases[name]; + if (!typeAnnotation) { + throw Error(`No type annotation found for "${name}" in schema`); + } + if (typeAnnotation.type === 'ObjectTypeAnnotation') { + if (typeAnnotation.properties) { + return typeAnnotation; + } + + throw new Error( + `Unsupported type for "${name}". Please provide properties.`, + ); + } + if (typeAnnotation.type === 'TypeAliasTypeAnnotation') { + return getTypeAliasTypeAnnotation(typeAnnotation.name, aliases); + } + + throw Error( + `Unsupported type annotation in alias "${name}", found: ${typeAnnotation.type}`, + ); +} + +module.exports = { + getTypeAliasTypeAnnotation, +}; diff --git a/packages/react-native-codegen/src/generators/modules/__tests__/GenerateModuleH-test.js b/packages/react-native-codegen/src/generators/modules/__tests__/GenerateModuleH-test.js index 918184b9ff50f7..658221b56298f4 100644 --- a/packages/react-native-codegen/src/generators/modules/__tests__/GenerateModuleH-test.js +++ b/packages/react-native-codegen/src/generators/modules/__tests__/GenerateModuleH-test.js @@ -14,7 +14,7 @@ const fixtures = require('../__test_fixtures__/fixtures.js'); const generator = require('../GenerateModuleH.js'); -describe('GenerateModuleCpp', () => { +describe('GenerateModuleH', () => { Object.keys(fixtures) .sort() .forEach(fixtureName => { diff --git a/packages/react-native-codegen/src/generators/modules/__tests__/GenerateModuleJavaSpec-test.js b/packages/react-native-codegen/src/generators/modules/__tests__/GenerateModuleJavaSpec-test.js new file mode 100644 index 00000000000000..5ccb87d2d4b672 --- /dev/null +++ b/packages/react-native-codegen/src/generators/modules/__tests__/GenerateModuleJavaSpec-test.js @@ -0,0 +1,29 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @emails oncall+react_native + * @flow strict-local + * @format + */ + +'use strict'; + +const fixtures = require('../__test_fixtures__/fixtures.js'); +const generator = require('../GenerateModuleJavaSpec.js'); + +describe('GenerateModuleJavaSpec', () => { + Object.keys(fixtures) + .sort() + .forEach(fixtureName => { + const fixture = fixtures[fixtureName]; + + it(`can generate fixture ${fixtureName}`, () => { + expect( + generator.generate(fixtureName, fixture, 'SampleSpec'), + ).toMatchSnapshot(); + }); + }); +}); diff --git a/packages/react-native-codegen/src/generators/modules/__tests__/GenerateModuleMm-test.js b/packages/react-native-codegen/src/generators/modules/__tests__/GenerateModuleMm-test.js index d6a59847b4a40d..5bfd8c79e07682 100644 --- a/packages/react-native-codegen/src/generators/modules/__tests__/GenerateModuleMm-test.js +++ b/packages/react-native-codegen/src/generators/modules/__tests__/GenerateModuleMm-test.js @@ -14,7 +14,7 @@ const fixtures = require('../__test_fixtures__/fixtures.js'); const generator = require('../GenerateModuleMm.js'); -describe('GenerateModuleHObjCpp', () => { +describe('GenerateModuleMm', () => { Object.keys(fixtures) .sort() .forEach(fixtureName => { diff --git a/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleH-test.js.snap b/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleH-test.js.snap index bda31d0a36e4da..09fb053c8bfac7 100644 --- a/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleH-test.js.snap +++ b/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleH-test.js.snap @@ -1,9 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`GenerateModuleCpp can generate fixture COMPLEX_OBJECTS 1`] = ` +exports[`GenerateModuleH can generate fixture COMPLEX_OBJECTS 1`] = ` Map { - "NativeModules.h" => " -/** + "NativeModules.h" => "/** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the @@ -35,10 +34,9 @@ virtual void getArrays(jsi::Runtime &rt, const jsi::Object &options) = 0; } `; -exports[`GenerateModuleCpp can generate fixture EMPTY_NATIVE_MODULES 1`] = ` +exports[`GenerateModuleH can generate fixture EMPTY_NATIVE_MODULES 1`] = ` Map { - "NativeModules.h" => " -/** + "NativeModules.h" => "/** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the @@ -67,10 +65,9 @@ public: } `; -exports[`GenerateModuleCpp can generate fixture NATIVE_MODULES_WITH_TYPE_ALIASES 1`] = ` +exports[`GenerateModuleH can generate fixture NATIVE_MODULES_WITH_TYPE_ALIASES 1`] = ` Map { - "NativeModules.h" => " -/** + "NativeModules.h" => "/** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the @@ -100,10 +97,9 @@ virtual void cropImage(jsi::Runtime &rt, const jsi::Object &cropData) = 0; } `; -exports[`GenerateModuleCpp can generate fixture REAL_MODULE_EXAMPLE 1`] = ` +exports[`GenerateModuleH can generate fixture REAL_MODULE_EXAMPLE 1`] = ` Map { - "NativeModules.h" => " -/** + "NativeModules.h" => "/** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the @@ -157,10 +153,9 @@ virtual void dismissRedbox(jsi::Runtime &rt) = 0; } `; -exports[`GenerateModuleCpp can generate fixture SIMPLE_NATIVE_MODULES 1`] = ` +exports[`GenerateModuleH can generate fixture SIMPLE_NATIVE_MODULES 1`] = ` Map { - "NativeModules.h" => " -/** + "NativeModules.h" => "/** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the @@ -199,10 +194,9 @@ virtual jsi::Value getValueWithPromise(jsi::Runtime &rt, bool error) = 0; } `; -exports[`GenerateModuleCpp can generate fixture TWO_MODULES_DIFFERENT_FILES 1`] = ` +exports[`GenerateModuleH can generate fixture TWO_MODULES_DIFFERENT_FILES 1`] = ` Map { - "NativeModules.h" => " -/** + "NativeModules.h" => "/** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the @@ -241,10 +235,9 @@ virtual void voidFunc(jsi::Runtime &rt) = 0; } `; -exports[`GenerateModuleCpp can generate fixture TWO_MODULES_SAME_FILE 1`] = ` +exports[`GenerateModuleH can generate fixture TWO_MODULES_SAME_FILE 1`] = ` Map { - "NativeModules.h" => " -/** + "NativeModules.h" => "/** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the diff --git a/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleJavaSpec-test.js.snap b/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleJavaSpec-test.js.snap new file mode 100644 index 00000000000000..13eeb45cc922e6 --- /dev/null +++ b/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleJavaSpec-test.js.snap @@ -0,0 +1,448 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`GenerateModuleJavaSpec can generate fixture COMPLEX_OBJECTS 1`] = ` +Map { + "NativeSampleTurboModuleSpec.java" => "/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the LICENSE file in the root + * directory of this source tree. + * + * @generated by codegen project: GenerateModuleJavaSpec.js + * + * @nolint + */ + +package com.facebook.fbreact.specs.beta; + +import com.facebook.react.bridge.Callback; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactContextBaseJavaModule; +import com.facebook.react.bridge.ReactMethod; +import com.facebook.react.bridge.ReactModuleWithSpec; +import com.facebook.react.bridge.ReadableArray; +import com.facebook.react.bridge.ReadableMap; +import com.facebook.react.bridge.WritableMap; +import com.facebook.react.turbomodule.core.interfaces.TurboModule; + +public abstract class NativeSampleTurboModuleSpec extends ReactContextBaseJavaModule implements ReactModuleWithSpec, TurboModule { + public NativeSampleTurboModuleSpec(ReactApplicationContext reactContext) { + super(reactContext); + } + + @ReactMethod(isBlockingSynchronousMethod = true) + public abstract WritableMap difficult(ReadableMap A); + + @ReactMethod + public abstract void optionals(ReadableMap A); + + @ReactMethod + public abstract void optionalMethod(ReadableMap options, Callback callback, ReadableArray extras); + + @ReactMethod + public abstract void getArrays(ReadableMap options); +} +", +} +`; + +exports[`GenerateModuleJavaSpec can generate fixture EMPTY_NATIVE_MODULES 1`] = ` +Map { + "NativeSampleTurboModuleSpec.java" => "/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the LICENSE file in the root + * directory of this source tree. + * + * @generated by codegen project: GenerateModuleJavaSpec.js + * + * @nolint + */ + +package com.facebook.fbreact.specs.beta; + +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactContextBaseJavaModule; +import com.facebook.react.bridge.ReactMethod; +import com.facebook.react.bridge.ReactModuleWithSpec; +import com.facebook.react.turbomodule.core.interfaces.TurboModule; + +public abstract class NativeSampleTurboModuleSpec extends ReactContextBaseJavaModule implements ReactModuleWithSpec, TurboModule { + public NativeSampleTurboModuleSpec(ReactApplicationContext reactContext) { + super(reactContext); + } + + +} +", +} +`; + +exports[`GenerateModuleJavaSpec can generate fixture NATIVE_MODULES_WITH_TYPE_ALIASES 1`] = ` +Map { + "NativeAliasTurboModuleSpec.java" => "/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the LICENSE file in the root + * directory of this source tree. + * + * @generated by codegen project: GenerateModuleJavaSpec.js + * + * @nolint + */ + +package com.facebook.fbreact.specs.beta; + +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactContextBaseJavaModule; +import com.facebook.react.bridge.ReactMethod; +import com.facebook.react.bridge.ReactModuleWithSpec; +import com.facebook.react.bridge.ReadableMap; +import com.facebook.react.turbomodule.core.interfaces.TurboModule; + +public abstract class NativeAliasTurboModuleSpec extends ReactContextBaseJavaModule implements ReactModuleWithSpec, TurboModule { + public NativeAliasTurboModuleSpec(ReactApplicationContext reactContext) { + super(reactContext); + } + + @ReactMethod + public abstract void cropImage(ReadableMap cropData); +} +", +} +`; + +exports[`GenerateModuleJavaSpec can generate fixture REAL_MODULE_EXAMPLE 1`] = ` +Map { + "NativeCameraRollManagerSpec.java" => "/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the LICENSE file in the root + * directory of this source tree. + * + * @generated by codegen project: GenerateModuleJavaSpec.js + * + * @nolint + */ + +package com.facebook.fbreact.specs.beta; + +import com.facebook.react.bridge.Promise; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactContextBaseJavaModule; +import com.facebook.react.bridge.ReactMethod; +import com.facebook.react.bridge.ReactModuleWithSpec; +import com.facebook.react.bridge.ReadableArray; +import com.facebook.react.bridge.ReadableMap; +import com.facebook.react.turbomodule.core.interfaces.TurboModule; + +public abstract class NativeCameraRollManagerSpec extends ReactContextBaseJavaModule implements ReactModuleWithSpec, TurboModule { + public NativeCameraRollManagerSpec(ReactApplicationContext reactContext) { + super(reactContext); + } + + @ReactMethod + public abstract void getPhotos(ReadableMap params, Promise promise); + + @ReactMethod + public abstract void saveToCameraRoll(String uri, String type, Promise promise); + + @ReactMethod + public abstract void deletePhotos(ReadableArray assets, Promise promise); +} +", + "NativeImagePickerIOSSpec.java" => "/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the LICENSE file in the root + * directory of this source tree. + * + * @generated by codegen project: GenerateModuleJavaSpec.js + * + * @nolint + */ + +package com.facebook.fbreact.specs.beta; + +import com.facebook.react.bridge.Callback; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactContextBaseJavaModule; +import com.facebook.react.bridge.ReactMethod; +import com.facebook.react.bridge.ReactModuleWithSpec; +import com.facebook.react.bridge.ReadableMap; +import com.facebook.react.turbomodule.core.interfaces.TurboModule; + +public abstract class NativeImagePickerIOSSpec extends ReactContextBaseJavaModule implements ReactModuleWithSpec, TurboModule { + public NativeImagePickerIOSSpec(ReactApplicationContext reactContext) { + super(reactContext); + } + + @ReactMethod + public abstract void openCameraDialog(ReadableMap config, Callback successCallback, Callback cancelCallback); +} +", + "NativeExceptionsManagerSpec.java" => "/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the LICENSE file in the root + * directory of this source tree. + * + * @generated by codegen project: GenerateModuleJavaSpec.js + * + * @nolint + */ + +package com.facebook.fbreact.specs.beta; + +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactContextBaseJavaModule; +import com.facebook.react.bridge.ReactMethod; +import com.facebook.react.bridge.ReactModuleWithSpec; +import com.facebook.react.bridge.ReadableArray; +import com.facebook.react.bridge.ReadableMap; +import com.facebook.react.turbomodule.core.interfaces.TurboModule; + +public abstract class NativeExceptionsManagerSpec extends ReactContextBaseJavaModule implements ReactModuleWithSpec, TurboModule { + public NativeExceptionsManagerSpec(ReactApplicationContext reactContext) { + super(reactContext); + } + + @ReactMethod + public abstract void reportFatalException(String message, ReadableArray stack, double exceptionId); + + @ReactMethod + public abstract void reportSoftException(String message, ReadableArray stack, double exceptionId); + + @ReactMethod + public abstract void reportException(ReadableMap data); + + @ReactMethod + public abstract void updateExceptionMessage(String message, ReadableArray stack, double exceptionId); + + @ReactMethod + public abstract void dismissRedbox(); +} +", +} +`; + +exports[`GenerateModuleJavaSpec can generate fixture SIMPLE_NATIVE_MODULES 1`] = ` +Map { + "NativeSampleTurboModuleSpec.java" => "/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the LICENSE file in the root + * directory of this source tree. + * + * @generated by codegen project: GenerateModuleJavaSpec.js + * + * @nolint + */ + +package com.facebook.fbreact.specs.beta; + +import com.facebook.react.bridge.Callback; +import com.facebook.react.bridge.Promise; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactContextBaseJavaModule; +import com.facebook.react.bridge.ReactMethod; +import com.facebook.react.bridge.ReactModuleWithSpec; +import com.facebook.react.bridge.ReadableArray; +import com.facebook.react.bridge.ReadableMap; +import com.facebook.react.bridge.WritableArray; +import com.facebook.react.bridge.WritableMap; +import com.facebook.react.common.build.ReactBuildConfig; +import com.facebook.react.turbomodule.core.interfaces.TurboModule; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import javax.annotation.Nullable; + +public abstract class NativeSampleTurboModuleSpec extends ReactContextBaseJavaModule implements ReactModuleWithSpec, TurboModule { + public NativeSampleTurboModuleSpec(ReactApplicationContext reactContext) { + super(reactContext); + } + + protected abstract Map getTypedExportedConstants(); + + @Override + public final @Nullable Map getConstants() { + Map constants = getTypedExportedConstants(); + if (ReactBuildConfig.DEBUG || ReactBuildConfig.IS_INTERNAL_BUILD) { + Set obligatoryFlowConstants = new HashSet<>(Arrays.asList( + \\"const1\\", + \\"const2\\", + \\"const3\\" + )); + Set optionalFlowConstants = new HashSet<>(); + Set undeclaredConstants = new HashSet<>(constants.keySet()); + undeclaredConstants.removeAll(obligatoryFlowConstants); + undeclaredConstants.removeAll(optionalFlowConstants); + if (!undeclaredConstants.isEmpty()) { + throw new IllegalStateException(String.format(\\"Native Module Flow doesn't declare constants: %s\\", undeclaredConstants)); + } + undeclaredConstants = obligatoryFlowConstants; + undeclaredConstants.removeAll(constants.keySet()); + if (!undeclaredConstants.isEmpty()) { + throw new IllegalStateException(String.format(\\"Native Module doesn't fill in constants: %s\\", undeclaredConstants)); + } + } + return constants; + } + + @ReactMethod + public abstract void voidFunc(); + + @ReactMethod(isBlockingSynchronousMethod = true) + public abstract boolean getBool(boolean arg); + + @ReactMethod(isBlockingSynchronousMethod = true) + public abstract double getNumber(double arg); + + @ReactMethod(isBlockingSynchronousMethod = true) + public abstract String getString(String arg); + + @ReactMethod(isBlockingSynchronousMethod = true) + public abstract WritableArray getArray(ReadableArray arg); + + @ReactMethod(isBlockingSynchronousMethod = true) + public abstract WritableMap getObject(ReadableMap arg); + + @ReactMethod(isBlockingSynchronousMethod = true) + public abstract double getRootTag(double arg); + + @ReactMethod(isBlockingSynchronousMethod = true) + public abstract WritableMap getValue(double x, String y, ReadableMap z); + + @ReactMethod + public abstract void getValueWithCallback(Callback callback); + + @ReactMethod + public abstract void getValueWithPromise(boolean error, Promise promise); +} +", +} +`; + +exports[`GenerateModuleJavaSpec can generate fixture TWO_MODULES_DIFFERENT_FILES 1`] = ` +Map { + "NativeSampleTurboModuleSpec.java" => "/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the LICENSE file in the root + * directory of this source tree. + * + * @generated by codegen project: GenerateModuleJavaSpec.js + * + * @nolint + */ + +package com.facebook.fbreact.specs.beta; + +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactContextBaseJavaModule; +import com.facebook.react.bridge.ReactMethod; +import com.facebook.react.bridge.ReactModuleWithSpec; +import com.facebook.react.turbomodule.core.interfaces.TurboModule; + +public abstract class NativeSampleTurboModuleSpec extends ReactContextBaseJavaModule implements ReactModuleWithSpec, TurboModule { + public NativeSampleTurboModuleSpec(ReactApplicationContext reactContext) { + super(reactContext); + } + + @ReactMethod + public abstract void voidFunc(); +} +", + "NativeSample2TurboModuleSpec.java" => "/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the LICENSE file in the root + * directory of this source tree. + * + * @generated by codegen project: GenerateModuleJavaSpec.js + * + * @nolint + */ + +package com.facebook.fbreact.specs.beta; + +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactContextBaseJavaModule; +import com.facebook.react.bridge.ReactMethod; +import com.facebook.react.bridge.ReactModuleWithSpec; +import com.facebook.react.turbomodule.core.interfaces.TurboModule; + +public abstract class NativeSample2TurboModuleSpec extends ReactContextBaseJavaModule implements ReactModuleWithSpec, TurboModule { + public NativeSample2TurboModuleSpec(ReactApplicationContext reactContext) { + super(reactContext); + } + + @ReactMethod + public abstract void voidFunc(); +} +", +} +`; + +exports[`GenerateModuleJavaSpec can generate fixture TWO_MODULES_SAME_FILE 1`] = ` +Map { + "NativeSampleTurboModuleSpec.java" => "/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the LICENSE file in the root + * directory of this source tree. + * + * @generated by codegen project: GenerateModuleJavaSpec.js + * + * @nolint + */ + +package com.facebook.fbreact.specs.beta; + +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactContextBaseJavaModule; +import com.facebook.react.bridge.ReactMethod; +import com.facebook.react.bridge.ReactModuleWithSpec; +import com.facebook.react.turbomodule.core.interfaces.TurboModule; + +public abstract class NativeSampleTurboModuleSpec extends ReactContextBaseJavaModule implements ReactModuleWithSpec, TurboModule { + public NativeSampleTurboModuleSpec(ReactApplicationContext reactContext) { + super(reactContext); + } + + @ReactMethod + public abstract void voidFunc(); +} +", + "NativeSample2TurboModuleSpec.java" => "/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the LICENSE file in the root + * directory of this source tree. + * + * @generated by codegen project: GenerateModuleJavaSpec.js + * + * @nolint + */ + +package com.facebook.fbreact.specs.beta; + +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactContextBaseJavaModule; +import com.facebook.react.bridge.ReactMethod; +import com.facebook.react.bridge.ReactModuleWithSpec; +import com.facebook.react.turbomodule.core.interfaces.TurboModule; + +public abstract class NativeSample2TurboModuleSpec extends ReactContextBaseJavaModule implements ReactModuleWithSpec, TurboModule { + public NativeSample2TurboModuleSpec(ReactApplicationContext reactContext) { + super(reactContext); + } + + @ReactMethod + public abstract void voidFunc(); +} +", +} +`; diff --git a/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleMm-test.js.snap b/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleMm-test.js.snap index 6192444e427682..192e19235d1cf1 100644 --- a/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleMm-test.js.snap +++ b/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleMm-test.js.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`GenerateModuleHObjCpp can generate fixture COMPLEX_OBJECTS 1`] = ` +exports[`GenerateModuleMm can generate fixture COMPLEX_OBJECTS 1`] = ` Map { "SampleSpec-generated.mm" => " /** @@ -102,7 +102,7 @@ namespace facebook { } `; -exports[`GenerateModuleHObjCpp can generate fixture EMPTY_NATIVE_MODULES 1`] = ` +exports[`GenerateModuleMm can generate fixture EMPTY_NATIVE_MODULES 1`] = ` Map { "SampleSpec-generated.mm" => " /** @@ -132,7 +132,7 @@ namespace facebook { } `; -exports[`GenerateModuleHObjCpp can generate fixture NATIVE_MODULES_WITH_TYPE_ALIASES 1`] = ` +exports[`GenerateModuleMm can generate fixture NATIVE_MODULES_WITH_TYPE_ALIASES 1`] = ` Map { "SampleSpec-generated.mm" => " /** @@ -200,7 +200,7 @@ namespace facebook { } `; -exports[`GenerateModuleHObjCpp can generate fixture REAL_MODULE_EXAMPLE 1`] = ` +exports[`GenerateModuleMm can generate fixture REAL_MODULE_EXAMPLE 1`] = ` Map { "SampleSpec-generated.mm" => " /** @@ -374,7 +374,7 @@ namespace facebook { } `; -exports[`GenerateModuleHObjCpp can generate fixture SIMPLE_NATIVE_MODULES 1`] = ` +exports[`GenerateModuleMm can generate fixture SIMPLE_NATIVE_MODULES 1`] = ` Map { "SampleSpec-generated.mm" => " /** @@ -468,7 +468,7 @@ namespace facebook { } `; -exports[`GenerateModuleHObjCpp can generate fixture TWO_MODULES_DIFFERENT_FILES 1`] = ` +exports[`GenerateModuleMm can generate fixture TWO_MODULES_DIFFERENT_FILES 1`] = ` Map { "SampleSpec-generated.mm" => " /** @@ -515,7 +515,7 @@ namespace facebook { } `; -exports[`GenerateModuleHObjCpp can generate fixture TWO_MODULES_SAME_FILE 1`] = ` +exports[`GenerateModuleMm can generate fixture TWO_MODULES_SAME_FILE 1`] = ` Map { "SampleSpec-generated.mm" => " /** diff --git a/packages/react-native-codegen/src/parsers/flow/modules/schema.js b/packages/react-native-codegen/src/parsers/flow/modules/schema.js index 68b1d61c98b97d..c1e4c80cfd5fed 100644 --- a/packages/react-native-codegen/src/parsers/flow/modules/schema.js +++ b/packages/react-native-codegen/src/parsers/flow/modules/schema.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format - * @flow strict-local + * @flow strict */ 'use strict'; diff --git a/react.gradle b/react.gradle index 6441d93f70ecdd..3f7ddbadc37d84 100644 --- a/react.gradle +++ b/react.gradle @@ -30,7 +30,7 @@ def detectCliPath(config) { } def cliPath = ["node", "-e", "console.log(require('react-native/cli').bin);"].execute([], projectDir).text.trim() - + if (cliPath) { return cliPath } else if (new File("${projectDir}/../../node_modules/react-native/cli.js").exists()) { @@ -126,7 +126,7 @@ afterEvaluate { } else { execCommand.addAll([*nodeExecutableAndArgs, cliPath]) } - + def enableHermes = enableHermesForVariant(variant) def currentBundleTask = tasks.create( @@ -349,3 +349,6 @@ afterEvaluate { } } } + +apply(from: "$rootDir/architecture.gradle"); +generateNativeArtifactsFromJavaScript(project.react); diff --git a/rn-get-polyfills.js b/rn-get-polyfills.js index a0041d6ef17410..0bd50234aea1d9 100644 --- a/rn-get-polyfills.js +++ b/rn-get-polyfills.js @@ -9,8 +9,4 @@ 'use strict'; -module.exports = () => [ - require.resolve('./Libraries/polyfills/console.js'), - require.resolve('./Libraries/polyfills/error-guard.js'), - require.resolve('./Libraries/polyfills/Object.es7.js'), -]; +module.exports = require('@react-native/polyfills'); diff --git a/scripts/generate-native-modules-specs-cli.js b/scripts/generate-native-modules-specs-cli.js index 2b72610e21b6c4..fe0871bb368fca 100644 --- a/scripts/generate-native-modules-specs-cli.js +++ b/scripts/generate-native-modules-specs-cli.js @@ -15,7 +15,7 @@ const mkdirp = require('mkdirp'); const os = require('os'); const path = require('path'); -function generateSpec(schemaPath, outputDirectory) { +function generateSpec(platform, schemaPath, outputDirectory) { const libraryName = 'FBReactNativeSpec'; const moduleSpecName = 'FBReactNativeSpec'; const schemaText = fs.readFileSync(schemaPath, 'utf-8'); @@ -38,14 +38,7 @@ function generateSpec(schemaPath, outputDirectory) { RNCodegen.generate( {libraryName, schema, outputDirectory: tempOutputDirectory, moduleSpecName}, { - generators: [ - 'descriptors', - 'events', - 'props', - 'tests', - 'shadow-nodes', - 'modules', - ], + generators: ['modules'], }, ); @@ -60,19 +53,35 @@ function generateSpec(schemaPath, outputDirectory) { } mkdirp.sync(outputDirectory); - const fileNames = [`${moduleSpecName}.h`, `${moduleSpecName}-generated.mm`]; - fileNames.forEach(fileName => { - const newOutput = `${tempOutputDirectory}/${fileName}`; - const prevOutput = `${outputDirectory}/${fileName}`; - fs.copyFileSync(newOutput, prevOutput); - }); + if (platform === 'ios') { + const fileNames = [`${moduleSpecName}.h`, `${moduleSpecName}-generated.mm`]; + fileNames.forEach(fileName => { + const newOutput = `${tempOutputDirectory}/${fileName}`; + const prevOutput = `${outputDirectory}/${fileName}`; + fs.copyFileSync(newOutput, prevOutput); + }); + } else if (platform === 'android') { + // Copy all .java files for now. + // TODO: Build sufficient support for producing Java package directories based + // on preferred package name. + const files = fs.readdirSync(tempOutputDirectory); + files + .filter(f => f.endsWith('.java')) + .forEach(f => { + fs.copyFileSync( + `${tempOutputDirectory}/${f}`, + `${outputDirectory}/${f}`, + ); + }); + } } function main() { const args = process.argv.slice(2); - const schemaPath = args[0]; - const outputDir = args[1]; - generateSpec(schemaPath, outputDir); + const platform = args[0]; + const schemaPath = args[1]; + const outputDir = args[2]; + generateSpec(platform, schemaPath, outputDir); } main(); diff --git a/scripts/generate-native-modules-specs.sh b/scripts/generate-native-modules-specs.sh index fc567f9f388158..c65f85aa8190c8 100755 --- a/scripts/generate-native-modules-specs.sh +++ b/scripts/generate-native-modules-specs.sh @@ -47,8 +47,8 @@ step_gen_schema () { } step_gen_specs () { - describe "Generating native code from schema" - "$YARN_BINARY" --silent node scripts/generate-native-modules-specs-cli.js "$SCHEMA_FILE" "$OUTPUT_DIR" + describe "Generating native code from schema (iOS)" + "$YARN_BINARY" --silent node scripts/generate-native-modules-specs-cli.js ios "$SCHEMA_FILE" "$OUTPUT_DIR" } step_build_codegen diff --git a/scripts/run-ci-e2e-tests.js b/scripts/run-ci-e2e-tests.js index de988e39012fcc..c535a0b477b7d4 100644 --- a/scripts/run-ci-e2e-tests.js +++ b/scripts/run-ci-e2e-tests.js @@ -89,7 +89,7 @@ try { const METRO_CONFIG = path.join(ROOT, 'metro.config.js'); const RN_GET_POLYFILLS = path.join(ROOT, 'rn-get-polyfills.js'); - const RN_POLYFILLS_PATH = 'Libraries/polyfills/'; + const RN_POLYFILLS_PATH = 'packages/polyfills/'; exec(`mkdir -p ${RN_POLYFILLS_PATH}`); cp(METRO_CONFIG, '.'); diff --git a/scripts/versiontemplates/ReactNativeVersion.js.template b/scripts/versiontemplates/ReactNativeVersion.js.template index 9e05c12fd81042..72bfcfef110580 100644 --- a/scripts/versiontemplates/ReactNativeVersion.js.template +++ b/scripts/versiontemplates/ReactNativeVersion.js.template @@ -6,7 +6,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow + * @flow strict */ exports.version = { diff --git a/template/_flowconfig b/template/_flowconfig index 8595b44b162e33..c0abe5fd60b246 100644 --- a/template/_flowconfig +++ b/template/_flowconfig @@ -33,6 +33,8 @@ emoji=true esproposal.optional_chaining=enable esproposal.nullish_coalescing=enable +exact_by_default=true + module.file_ext=.js module.file_ext=.json module.file_ext=.ios.js @@ -69,4 +71,4 @@ untyped-import untyped-type-import [version] -^0.129.0 +^0.130.0 diff --git a/template/android/build.gradle b/template/android/build.gradle index 8a15ee84738e3f..4f2aa7c5a581e0 100644 --- a/template/android/build.gradle +++ b/template/android/build.gradle @@ -3,7 +3,7 @@ buildscript { ext { buildToolsVersion = "29.0.3" - minSdkVersion = 16 + minSdkVersion = 19 compileSdkVersion = 29 targetSdkVersion = 29 } diff --git a/template/package.json b/template/package.json index 4604bb182a7d24..537a87e6772eba 100644 --- a/template/package.json +++ b/template/package.json @@ -10,7 +10,7 @@ "lint": "eslint ." }, "dependencies": { - "react": "16.13.1", + "react": "0.0.0-experimental-aae83a4b9", "react-native": "0.63.3" }, "devDependencies": { @@ -20,8 +20,8 @@ "babel-jest": "^25.1.0", "eslint": "^6.5.1", "jest": "^25.1.0", - "metro-react-native-babel-preset": "^0.60.0", - "react-test-renderer": "16.13.1" + "metro-react-native-babel-preset": "^0.61.0", + "react-test-renderer": "0.0.0-experimental-aae83a4b9 " }, "jest": { "preset": "react-native" diff --git a/yarn.lock b/yarn.lock index 98979cb37b0703..a856c2bcc55a4f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9,6 +9,13 @@ dependencies: "@babel/highlight" "^7.8.3" +"@babel/code-frame@^7.14.5": + version "7.14.5" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.14.5.tgz#23b08d740e83f49c5e59945fbf1b43e80bbf4edb" + integrity sha512-9pzDqyc6OLDaqe+zbACgFkb6fKMNG6CObKpnYXChRsvYGyEdc7CA2BaqeOM+vOtCS5ndmJicPJhKAwYRI6UfFw== + dependencies: + "@babel/highlight" "^7.14.5" + "@babel/core@^7.0.0", "@babel/core@^7.1.0", "@babel/core@^7.1.6", "@babel/core@^7.4.5", "@babel/core@^7.7.5": version "7.10.0" resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.10.0.tgz#a6fe5db77ebfb61e0da6c5c36aaf14aab07b2b44" @@ -41,6 +48,15 @@ lodash "^4.17.13" source-map "^0.5.0" +"@babel/generator@^7.15.0": + version "7.15.0" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.15.0.tgz#a7d0c172e0d814974bad5aa77ace543b97917f15" + integrity sha512-eKl4XdMrbpYvuB505KTta4AV9g+wWzmVBW69tX0H2NwKVKd2YJbKgyK6M8j/rgLbmHOYJn6rUklV677nOyJrEQ== + dependencies: + "@babel/types" "^7.15.0" + jsesc "^2.5.1" + source-map "^0.5.0" + "@babel/helper-annotate-as-pure@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.8.3.tgz#60bc0bc657f63a0924ff9a4b4a0b24a13cf4deee" @@ -111,6 +127,15 @@ "@babel/traverse" "^7.8.3" "@babel/types" "^7.8.3" +"@babel/helper-function-name@^7.14.5": + version "7.14.5" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.14.5.tgz#89e2c474972f15d8e233b52ee8c480e2cfcd50c4" + integrity sha512-Gjna0AsXWfFvrAuX+VKcN/aNNWonizBj39yGwUzVDVTlMYJMK2Wp6xdpy72mfArFq5uK+NOuexfzZlzI1z9+AQ== + dependencies: + "@babel/helper-get-function-arity" "^7.14.5" + "@babel/template" "^7.14.5" + "@babel/types" "^7.14.5" + "@babel/helper-function-name@^7.8.3", "@babel/helper-function-name@^7.9.5": version "7.9.5" resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.9.5.tgz#2b53820d35275120e1874a82e5aabe1376920a5c" @@ -120,6 +145,13 @@ "@babel/template" "^7.8.3" "@babel/types" "^7.9.5" +"@babel/helper-get-function-arity@^7.14.5": + version "7.14.5" + resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.14.5.tgz#25fbfa579b0937eee1f3b805ece4ce398c431815" + integrity sha512-I1Db4Shst5lewOM4V+ZKJzQ0JGGaZ6VY1jYvMghRjqs6DWgxLCIyFt30GlnKkfUeFLpJt2vzbMVEXVSXlIFYUg== + dependencies: + "@babel/types" "^7.14.5" + "@babel/helper-get-function-arity@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.8.3.tgz#b894b947bd004381ce63ea1db9f08547e920abd5" @@ -127,6 +159,13 @@ dependencies: "@babel/types" "^7.8.3" +"@babel/helper-hoist-variables@^7.14.5": + version "7.14.5" + resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.14.5.tgz#e0dd27c33a78e577d7c8884916a3e7ef1f7c7f8d" + integrity sha512-R1PXiz31Uc0Vxy4OEOm07x0oSjKAdPPCh3tPivn/Eo8cvz6gveAeuyUUPB21Hoiif0uoPQSSdhIPS3352nvdyQ== + dependencies: + "@babel/types" "^7.14.5" + "@babel/helper-member-expression-to-functions@^7.10.0": version "7.10.0" resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.10.0.tgz#e8cf57470bfd1247f2b41aa621a527e952efa6f1" @@ -202,6 +241,13 @@ "@babel/template" "^7.8.3" "@babel/types" "^7.8.3" +"@babel/helper-split-export-declaration@^7.14.5": + version "7.14.5" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.14.5.tgz#22b23a54ef51c2b7605d851930c1976dd0bc693a" + integrity sha512-hprxVPu6e5Kdp2puZUmvOGjaLv9TCe58E/Fl6hRq4YiVQxIcNvuq6uTM2r1mT/oPskuS9CgR+I94sqAYv0NGKA== + dependencies: + "@babel/types" "^7.14.5" + "@babel/helper-split-export-declaration@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.8.3.tgz#31a9f30070f91368a7182cf05f831781065fc7a9" @@ -209,6 +255,11 @@ dependencies: "@babel/types" "^7.8.3" +"@babel/helper-validator-identifier@^7.14.5", "@babel/helper-validator-identifier@^7.14.9": + version "7.14.9" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.14.9.tgz#6654d171b2024f6d8ee151bf2509699919131d48" + integrity sha512-pQYxPY0UP6IHISRitNe8bsijHex4TWZXi2HwKVsjPiltzlhse2znVcm9Ace510VT1kxIHjGJCZZQBX2gJDbo0g== + "@babel/helper-validator-identifier@^7.9.0", "@babel/helper-validator-identifier@^7.9.5": version "7.9.5" resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.9.5.tgz#90977a8e6fbf6b431a7dc31752eee233bf052d80" @@ -233,6 +284,15 @@ "@babel/traverse" "^7.10.0" "@babel/types" "^7.10.0" +"@babel/highlight@^7.14.5": + version "7.14.5" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.14.5.tgz#6861a52f03966405001f6aa534a01a24d99e8cd9" + integrity sha512-qf9u2WFWVV0MppaL877j2dBtQIDgmidgjGk5VIMw3OadXvYaXn66U1BFlH2t4+t3i+8PhedppRv+i40ABzd+gg== + dependencies: + "@babel/helper-validator-identifier" "^7.14.5" + chalk "^2.0.0" + js-tokens "^4.0.0" + "@babel/highlight@^7.8.3": version "7.9.0" resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.9.0.tgz#4e9b45ccb82b79607271b2979ad82c7b68163079" @@ -247,6 +307,11 @@ resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.10.0.tgz#8eca3e71a73dd562c5222376b08253436bb4995b" integrity sha512-fnDUl1Uy2gThM4IFVW4ISNHqr3cJrCsRkSCasFgx0XDO9JcttDS5ytyBc4Cu4X1+fjoo3IVvFbRD6TeFlHJlEQ== +"@babel/parser@^7.14.5", "@babel/parser@^7.15.0", "@babel/parser@^7.7.0": + version "7.15.3" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.15.3.tgz#3416d9bea748052cfcb63dbcc27368105b1ed862" + integrity sha512-O0L6v/HvqbdJawj0iBEfVQMc3/6WP+AeOsovsIgBFyJaG+W2w7eqvZB7puddATmWuARlm1SX7DwxJ/JJUnDpEA== + "@babel/plugin-check-constants@^7.0.0-beta.38": version "7.0.0-beta.38" resolved "https://registry.yarnpkg.com/@babel/plugin-check-constants/-/plugin-check-constants-7.0.0-beta.38.tgz#bbda6306d45a4f097ccb416c0b52d6503f6502cf" @@ -697,6 +762,15 @@ "@babel/parser" "^7.10.0" "@babel/types" "^7.10.0" +"@babel/template@^7.14.5": + version "7.14.5" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.14.5.tgz#a9bc9d8b33354ff6e55a9c60d1109200a68974f4" + integrity sha512-6Z3Po85sfxRGachLULUhOmvAaOo7xCvqGQtxINai2mEGPFm6pQ4z5QInFnUrRpfoSV60BnjyF5F3c+15fxFV1g== + dependencies: + "@babel/code-frame" "^7.14.5" + "@babel/parser" "^7.14.5" + "@babel/types" "^7.14.5" + "@babel/traverse@^7.0.0", "@babel/traverse@^7.1.0", "@babel/traverse@^7.10.0", "@babel/traverse@^7.7.4", "@babel/traverse@^7.8.3": version "7.10.0" resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.10.0.tgz#290935529881baf619398d94fd453838bef36740" @@ -712,6 +786,21 @@ globals "^11.1.0" lodash "^4.17.13" +"@babel/traverse@^7.7.0": + version "7.15.0" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.15.0.tgz#4cca838fd1b2a03283c1f38e141f639d60b3fc98" + integrity sha512-392d8BN0C9eVxVWd8H6x9WfipgVH5IaIoLp23334Sc1vbKKWINnvwRpb4us0xtPaCumlwbTtIYNA0Dv/32sVFw== + dependencies: + "@babel/code-frame" "^7.14.5" + "@babel/generator" "^7.15.0" + "@babel/helper-function-name" "^7.14.5" + "@babel/helper-hoist-variables" "^7.14.5" + "@babel/helper-split-export-declaration" "^7.14.5" + "@babel/parser" "^7.15.0" + "@babel/types" "^7.15.0" + debug "^4.1.0" + globals "^11.1.0" + "@babel/types@^7.0.0", "@babel/types@^7.10.0", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.8.3", "@babel/types@^7.9.0", "@babel/types@^7.9.5": version "7.10.0" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.10.0.tgz#d47d92249e42393a5723aad5319035ae411e3e38" @@ -721,6 +810,14 @@ lodash "^4.17.13" to-fast-properties "^2.0.0" +"@babel/types@^7.14.5", "@babel/types@^7.15.0", "@babel/types@^7.7.0": + version "7.15.0" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.15.0.tgz#61af11f2286c4e9c69ca8deb5f4375a73c72dcbd" + integrity sha512-OBvfqnllOIdX4ojTHpwZbpvz4j3EWyjkZEdmjH0/cgsd6QOdSgU8rLSk6ard/pcW7rlmjdVSX/AWOaORR1uNOQ== + dependencies: + "@babel/helper-validator-identifier" "^7.14.9" + to-fast-properties "^2.0.0" + "@bcoe/v8-coverage@^0.2.3": version "0.2.3" resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" @@ -1017,6 +1114,27 @@ "@types/yargs" "^15.0.0" chalk "^4.0.0" +"@nodelib/fs.scandir@2.1.5": + version "2.1.5" + resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" + integrity sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g== + dependencies: + "@nodelib/fs.stat" "2.0.5" + run-parallel "^1.1.9" + +"@nodelib/fs.stat@2.0.5", "@nodelib/fs.stat@^2.0.2": + version "2.0.5" + resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz#5bd262af94e9d25bd1e71b05deed44876a222e8b" + integrity sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A== + +"@nodelib/fs.walk@^1.2.3": + version "1.2.8" + resolved "https://registry.yarnpkg.com/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz#e95737e8bb6746ddedf69c556953494f196fe69a" + integrity sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg== + dependencies: + "@nodelib/fs.scandir" "2.1.5" + fastq "^1.6.0" + "@react-native-community/cli-debugger-ui@^4.9.0": version "4.9.0" resolved "https://registry.yarnpkg.com/@react-native-community/cli-debugger-ui/-/cli-debugger-ui-4.9.0.tgz#4177764ba69243c97aa26829d59d9501acb2bd71" @@ -1127,6 +1245,21 @@ "@react-native-community/eslint-plugin@file:packages/eslint-plugin-react-native-community": version "1.1.0" +"@react-native/assets@1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@react-native/assets/-/assets-1.0.0.tgz#c6f9bf63d274bafc8e970628de24986b30a55c8e" + integrity sha512-KrwSpS1tKI70wuKl68DwJZYEvXktDHdZMG0k2AXD/rJVSlB23/X2CB2cutVR0HwNMJIal9HOUOBB2rVfa6UGtQ== + +"@react-native/normalize-color@1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@react-native/normalize-color/-/normalize-color-1.0.0.tgz#c52a99d4fe01049102d47dc45d40cbde4f720ab6" + integrity sha512-xUNRvNmCl3UGCPbbHvfyFMnpvLPoOjDCcp5bT9m2k+TF/ZBklEQwhPZlkrxRx2NhgFh1X3a5uL7mJ7ZR+8G7Qg== + +"@react-native/polyfills@1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@react-native/polyfills/-/polyfills-1.0.0.tgz#05bb0031533598f9458cf65a502b8df0eecae780" + integrity sha512-0jbp4RxjYopTsIdLl+/Fy2TiwVYHy4mgeu07DG4b/LyM0OS/+lPP5c9sbnt/AMlnF6qz2JRZpPpGw1eMNS6A4w== + "@reactions/component@^2.0.2": version "2.0.2" resolved "https://registry.yarnpkg.com/@reactions/component/-/component-2.0.2.tgz#40f8c1c2c37baabe57a0c944edb9310dc1ec6642" @@ -1215,6 +1348,11 @@ "@types/istanbul-lib-coverage" "*" "@types/istanbul-lib-report" "*" +"@types/json-schema@^7.0.7": + version "7.0.9" + resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.9.tgz#97edc9037ea0c38585320b28964dde3b39e4660d" + integrity sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ== + "@types/node@*": version "13.13.4" resolved "https://registry.yarnpkg.com/@types/node/-/node-13.13.4.tgz#1581d6c16e3d4803eb079c87d4ac893ee7501c2c" @@ -1254,6 +1392,75 @@ dependencies: "@types/yargs-parser" "*" +"@typescript-eslint/eslint-plugin@4.30.0": + version "4.30.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.30.0.tgz#4a0c1ae96b953f4e67435e20248d812bfa55e4fb" + integrity sha512-NgAnqk55RQ/SD+tZFD9aPwNSeHmDHHe5rtUyhIq0ZeCWZEvo4DK9rYz7v9HDuQZFvn320Ot+AikaCKMFKLlD0g== + dependencies: + "@typescript-eslint/experimental-utils" "4.30.0" + "@typescript-eslint/scope-manager" "4.30.0" + debug "^4.3.1" + functional-red-black-tree "^1.0.1" + regexpp "^3.1.0" + semver "^7.3.5" + tsutils "^3.21.0" + +"@typescript-eslint/experimental-utils@4.30.0": + version "4.30.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-4.30.0.tgz#9e49704fef568432ae16fc0d6685c13d67db0fd5" + integrity sha512-K8RNIX9GnBsv5v4TjtwkKtqMSzYpjqAQg/oSphtxf3xxdt6T0owqnpojztjjTcatSteH3hLj3t/kklKx87NPqw== + dependencies: + "@types/json-schema" "^7.0.7" + "@typescript-eslint/scope-manager" "4.30.0" + "@typescript-eslint/types" "4.30.0" + "@typescript-eslint/typescript-estree" "4.30.0" + eslint-scope "^5.1.1" + eslint-utils "^3.0.0" + +"@typescript-eslint/parser@4.30.0": + version "4.30.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-4.30.0.tgz#6abd720f66bd790f3e0e80c3be77180c8fcb192d" + integrity sha512-HJ0XuluSZSxeboLU7Q2VQ6eLlCwXPBOGnA7CqgBnz2Db3JRQYyBDJgQnop6TZ+rsbSx5gEdWhw4rE4mDa1FnZg== + dependencies: + "@typescript-eslint/scope-manager" "4.30.0" + "@typescript-eslint/types" "4.30.0" + "@typescript-eslint/typescript-estree" "4.30.0" + debug "^4.3.1" + +"@typescript-eslint/scope-manager@4.30.0": + version "4.30.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-4.30.0.tgz#1a3ffbb385b1a06be85cd5165a22324f069a85ee" + integrity sha512-VJ/jAXovxNh7rIXCQbYhkyV2Y3Ac/0cVHP/FruTJSAUUm4Oacmn/nkN5zfWmWFEanN4ggP0vJSHOeajtHq3f8A== + dependencies: + "@typescript-eslint/types" "4.30.0" + "@typescript-eslint/visitor-keys" "4.30.0" + +"@typescript-eslint/types@4.30.0": + version "4.30.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.30.0.tgz#fb9d9b0358426f18687fba82eb0b0f869780204f" + integrity sha512-YKldqbNU9K4WpTNwBqtAerQKLLW/X2A/j4yw92e3ZJYLx+BpKLeheyzoPfzIXHfM8BXfoleTdiYwpsvVPvHrDw== + +"@typescript-eslint/typescript-estree@4.30.0": + version "4.30.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.30.0.tgz#ae57833da72a753f4846cd3053758c771670c2ac" + integrity sha512-6WN7UFYvykr/U0Qgy4kz48iGPWILvYL34xXJxvDQeiRE018B7POspNRVtAZscWntEPZpFCx4hcz/XBT+erenfg== + dependencies: + "@typescript-eslint/types" "4.30.0" + "@typescript-eslint/visitor-keys" "4.30.0" + debug "^4.3.1" + globby "^11.0.3" + is-glob "^4.0.1" + semver "^7.3.5" + tsutils "^3.21.0" + +"@typescript-eslint/visitor-keys@4.30.0": + version "4.30.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.30.0.tgz#a47c6272fc71b0c627d1691f68eaecf4ad71445e" + integrity sha512-pNaaxDt/Ol/+JZwzP7MqWc8PJQTUhZwoee/PVlQ+iYoYhagccvoHnC9e4l+C/krQYYkENxznhVSDwClIbZVxRw== + dependencies: + "@typescript-eslint/types" "4.30.0" + eslint-visitor-keys "^2.0.0" + abab@^2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.3.tgz#623e2075e02eb2d3f2475e49f99c91846467907a" @@ -1292,31 +1499,21 @@ acorn-globals@^6.0.0: acorn "^7.1.1" acorn-walk "^7.1.1" -acorn-jsx@^5.0.0: - version "5.0.1" - resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.0.1.tgz#32a064fd925429216a09b141102bfdd185fae40e" - integrity sha512-HJ7CfNHrfJLlNTzIEUTj43LNWGkqpRLxm3YjAlcD0ACydk9XynzYsCBHxut+iqt+1aBXkx9UP/w/ZqMr13XIzg== +acorn-jsx@^5.2.0: + version "5.3.2" + resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" + integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== acorn-walk@^7.1.1: version "7.1.1" resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-7.1.1.tgz#345f0dffad5c735e7373d2fec9a1023e6a44b83e" integrity sha512-wdlPY2tm/9XBr7QkKlq0WQVgiuGTX6YWPyRyBviSoScBuLfTVQhvwg6wJ369GJ/1nPfTLMfnrFIfjqVg6d+jQQ== -acorn@^6.0.2: - version "6.4.2" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.4.2.tgz#35866fd710528e92de10cf06016498e47e39e1e6" - integrity sha512-XtGIhXwF8YM8bJhGxG5kXgjkEuNGLTkoYqVE+KMR+aspr4KGYmKYg7yUe3KghyQ9yheNwLnjmzh/7+gfDBmHCQ== - acorn@^7.1.1: version "7.1.1" resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.1.1.tgz#e35668de0b402f359de515c5482a1ab9f89a69bf" integrity sha512-add7dgA5ppRPxCFJoAGfMDi7PIBXq1RtGo7BhbLaxwrXPOmw8gq48Y9ozT01hUKy9byMjlR20EJhu5zlkErEkg== -ajv-keywords@^3.0.0: - version "3.4.0" - resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.4.0.tgz#4b831e7b531415a7cc518cd404e73f6193c6349d" - integrity sha512-aUjdRFISbuFOl0EIZc+9e4FfZp0bDZgAdOOf30bJmw8VM9v84SHyVyxDfbWxpGYbdZD/9XoKxfHVNmxPkhwyGw== - ajv@^5.3.0: version "5.5.2" resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.5.2.tgz#73b5eeca3fab653e3d3f9422b341ad42205dc965" @@ -1327,7 +1524,7 @@ ajv@^5.3.0: fast-json-stable-stringify "^2.0.0" json-schema-traverse "^0.3.0" -ajv@^6.0.1, ajv@^6.5.0: +ajv@^6.10.0, ajv@^6.10.2: version "6.12.6" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== @@ -1426,11 +1623,6 @@ ansi-regex@^5.0.0: resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.0.tgz#388539f55179bf39339c81af30a654d69f87cb75" integrity sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg== -ansi-styles@^2.2.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" - integrity sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4= - ansi-styles@^3.2.0, ansi-styles@^3.2.1: version "3.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" @@ -1551,6 +1743,11 @@ array-slice@^0.2.3: resolved "https://registry.yarnpkg.com/array-slice/-/array-slice-0.2.3.tgz#dd3cfb80ed7973a75117cdac69b0b99ec86186f5" integrity sha1-3Tz7gO15c6dRF82sabC5nshhhvU= +array-union@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d" + integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw== + array-unique@^0.3.2: version "0.3.2" resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428" @@ -1637,31 +1834,22 @@ axobject-query@^2.0.2: dependencies: ast-types-flow "0.0.7" -babel-code-frame@^6.26.0: - version "6.26.0" - resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b" - integrity sha1-Y/1D99weO7fONZR9uP42mj9Yx0s= - dependencies: - chalk "^1.1.3" - esutils "^2.0.2" - js-tokens "^3.0.2" - babel-core@^7.0.0-bridge.0: version "7.0.0-bridge.0" resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-7.0.0-bridge.0.tgz#95a492ddd90f9b4e9a4a1da14eb335b87b634ece" integrity sha512-poPX9mZH/5CSanm50Q+1toVci6pv5KSRv/5TWCwtzQS5XEwn40BcCrgIeMFWP9CKKIniKXNxoIOnOq4VVlGXhg== -babel-eslint@10.0.1: - version "10.0.1" - resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-10.0.1.tgz#919681dc099614cd7d31d45c8908695092a1faed" - integrity sha512-z7OT1iNV+TjOwHNLLyJk+HN+YVWX+CLE6fPD2SymJZOZQBs+QIexFjhm4keGTm8MW9xr4EC9Q0PbaLB24V5GoQ== +babel-eslint@^10.1.0: + version "10.1.0" + resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-10.1.0.tgz#6968e568a910b78fb3779cdd8b6ac2f479943232" + integrity sha512-ifWaTHQ0ce+448CYop8AdrQiBsGrnC+bMgfyKFdi6EsPLTAWG+QfyDeM6OH+FmWnKvEq5NnBMLvlBUPKQZoDSg== dependencies: "@babel/code-frame" "^7.0.0" - "@babel/parser" "^7.0.0" - "@babel/traverse" "^7.0.0" - "@babel/types" "^7.0.0" - eslint-scope "3.7.1" + "@babel/parser" "^7.7.0" + "@babel/traverse" "^7.7.0" + "@babel/types" "^7.7.0" eslint-visitor-keys "^1.0.0" + resolve "^1.12.0" babel-jest@^26.0.1: version "26.0.1" @@ -1950,14 +2138,6 @@ cache-base@^1.0.1: union-value "^1.0.0" unset-value "^1.0.0" -call-bind@^1.0.0, call-bind@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.2.tgz#b1d4e89e688119c3c9a903ad30abb2f6a919be3c" - integrity sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA== - dependencies: - function-bind "^1.1.1" - get-intrinsic "^1.0.2" - caller-callsite@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/caller-callsite/-/caller-callsite-2.0.0.tgz#847e0fce0a223750a9a027c54b33731ad3154134" @@ -1965,13 +2145,6 @@ caller-callsite@^2.0.0: dependencies: callsites "^2.0.0" -caller-path@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/caller-path/-/caller-path-0.1.0.tgz#94085ef63581ecd3daa92444a8fe94e82577751f" - integrity sha1-lAhe9jWB7NPaqSREqP6U6CV3dR8= - dependencies: - callsites "^0.2.0" - caller-path@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/caller-path/-/caller-path-2.0.0.tgz#468f83044e369ab2010fac5f06ceee15bb2cb1f4" @@ -1979,11 +2152,6 @@ caller-path@^2.0.0: dependencies: caller-callsite "^2.0.0" -callsites@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/callsites/-/callsites-0.2.0.tgz#afab96262910a7f33c19a5775825c69f34e350ca" - integrity sha1-r6uWJikQp/M8GaV3WCXGnzTjUMo= - callsites@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/callsites/-/callsites-2.0.0.tgz#06eb84f00eea413da86affefacbffb36093b3c50" @@ -2021,17 +2189,6 @@ caseless@~0.12.0: resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" integrity sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw= -chalk@^1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" - integrity sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg= - dependencies: - ansi-styles "^2.2.1" - escape-string-regexp "^1.0.2" - has-ansi "^2.0.0" - strip-ansi "^3.0.0" - supports-color "^2.0.0" - chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.4.1: version "2.4.1" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.1.tgz#18c49ab16a037b6eb0152cc83e3471338215b66e" @@ -2066,6 +2223,14 @@ chalk@^4.0.0: ansi-styles "^4.1.0" supports-color "^7.1.0" +chalk@^4.1.0: + version "4.1.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" + integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" + char-regex@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/char-regex/-/char-regex-1.0.2.tgz#d744358226217f981ed58f479b1d6bcc29545dcf" @@ -2076,6 +2241,11 @@ chardet@^0.4.0: resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.4.2.tgz#b5473b33dc97c424e5d98dc87d55d4d8a29c8bf2" integrity sha1-tUc7M9yXxCTl2Y3IfVXU2KKci/I= +chardet@^0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e" + integrity sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA== + child-process-promise@^2.2.0: version "2.2.1" resolved "https://registry.yarnpkg.com/child-process-promise/-/child-process-promise-2.2.1.tgz#4730a11ef610fad450b8f223c79d31d7bdad8074" @@ -2095,11 +2265,6 @@ ci-info@^2.0.0: resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-2.0.0.tgz#67a9e964be31a51e15e5010d58e6f12834002f46" integrity sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ== -circular-json@^0.3.1: - version "0.3.3" - resolved "https://registry.yarnpkg.com/circular-json/-/circular-json-0.3.3.tgz#815c99ea84f6809529d2f45791bdf82711352d66" - integrity sha512-UZK3NBx2Mca+b5LsG7bY183pHWt5Y1xts4P3Pz7ENTwGVnJOUWbRb3ocjvX7hx9tq/yTAdclXm9sZ38gNuem4A== - clang-format@^1.2.4: version "1.2.4" resolved "https://registry.yarnpkg.com/clang-format/-/clang-format-1.2.4.tgz#4bb4b0a98180428deb093cf20982e9fc1af20b6c" @@ -2126,6 +2291,13 @@ cli-cursor@^2.1.0: dependencies: restore-cursor "^2.0.0" +cli-cursor@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-3.1.0.tgz#264305a7ae490d1d03bf0c9ba7c925d1753af307" + integrity sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw== + dependencies: + restore-cursor "^3.1.0" + cli-spinners@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-2.1.0.tgz#22c34b4d51f573240885b201efda4e4ec9fff3c7" @@ -2136,6 +2308,11 @@ cli-width@^2.0.0: resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.0.tgz#ff19ede8a9a5e579324147b0c11f0fbcbabed639" integrity sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk= +cli-width@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-3.0.0.tgz#a2f48437a2caa9a22436e794bf071ec9e61cedf6" + integrity sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw== + cliui@^4.0.0: version "4.1.0" resolved "https://registry.yarnpkg.com/cliui/-/cliui-4.1.0.tgz#348422dbe82d800b3022eef4f6ac10bf2e4d1b49" @@ -2459,12 +2636,12 @@ debug@2.6.9, debug@^2.1.2, debug@^2.2.0, debug@^2.3.3: dependencies: ms "2.0.0" -debug@^3.1.0: - version "3.2.7" - resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.7.tgz#72580b7e9145fb39b6676f9c5e5fb100b934179a" - integrity sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ== +debug@^4.0.1, debug@^4.3.1: + version "4.3.2" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.2.tgz#f0a49c18ac8779e31d4a0c6029dfb76873c7428b" + integrity sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw== dependencies: - ms "^2.1.1" + ms "2.1.2" debug@^4.1.0: version "4.1.0" @@ -2522,7 +2699,7 @@ defaults@^1.0.3: dependencies: clone "^1.0.2" -define-properties@^1.1.2, define-properties@^1.1.3: +define-properties@^1.1.2: version "1.1.3" resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.3.tgz#cf88da6cbee26fe6db7094f61d870cbd84cee9f1" integrity sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ== @@ -2619,6 +2796,13 @@ diff-sequences@^26.0.0: resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-26.0.0.tgz#0760059a5c287637b842bd7085311db7060e88a6" integrity sha512-JC/eHYEC3aSS0vZGjuoc4vHA0yAQTzhQQldXMeMF+JlxLGJlCO38Gma82NV9gk1jGFz8mDzUMeaKXvjRRdJ2dg== +dir-glob@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f" + integrity sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA== + dependencies: + path-type "^4.0.0" + doctrine@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.1.0.tgz#5cd01fc101621b42c4cd7f5d1a66243716d3f39d" @@ -2626,6 +2810,13 @@ doctrine@^2.1.0: dependencies: esutils "^2.0.2" +doctrine@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-3.0.0.tgz#addebead72a6574db783639dc87a121773973961" + integrity sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w== + dependencies: + esutils "^2.0.2" + domexception@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/domexception/-/domexception-2.0.1.tgz#fb44aefba793e1574b0af6aed2801d057529f304" @@ -2702,29 +2893,6 @@ errorhandler@^1.5.0: accepts "~1.3.7" escape-html "~1.0.3" -es-abstract@^1.10.0: - version "1.18.5" - resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.18.5.tgz#9b10de7d4c206a3581fd5b2124233e04db49ae19" - integrity sha512-DDggyJLoS91CkJjgauM5c0yZMjiD1uK3KcaCeAmffGwZ+ODWzOkPN4QwRbsK5DOFf06fywmyLci3ZD8jLGhVYA== - dependencies: - call-bind "^1.0.2" - es-to-primitive "^1.2.1" - function-bind "^1.1.1" - get-intrinsic "^1.1.1" - has "^1.0.3" - has-symbols "^1.0.2" - internal-slot "^1.0.3" - is-callable "^1.2.3" - is-negative-zero "^2.0.1" - is-regex "^1.1.3" - is-string "^1.0.6" - object-inspect "^1.11.0" - object-keys "^1.1.1" - object.assign "^4.1.2" - string.prototype.trimend "^1.0.4" - string.prototype.trimstart "^1.0.4" - unbox-primitive "^1.0.1" - es-abstract@^1.11.0: version "1.13.0" resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.13.0.tgz#ac86145fdd5099d8dd49558ccba2eaf9b88e24e9" @@ -2757,21 +2925,12 @@ es-to-primitive@^1.1.1, es-to-primitive@^1.2.0: is-date-object "^1.0.1" is-symbol "^1.0.2" -es-to-primitive@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.2.1.tgz#e55cd4c9cdc188bcefb03b366c736323fc5c898a" - integrity sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA== - dependencies: - is-callable "^1.1.4" - is-date-object "^1.0.1" - is-symbol "^1.0.2" - escape-html@~1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" integrity sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg= -escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: +escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= @@ -2908,29 +3067,28 @@ eslint-rule-composer@^0.3.0: resolved "https://registry.yarnpkg.com/eslint-rule-composer/-/eslint-rule-composer-0.3.0.tgz#79320c927b0c5c0d3d3d2b76c8b4a488f25bbaf9" integrity sha512-bt+Sh8CtDmn2OajxvNO+BX7Wn4CIWMpTRm3MaiKPCQcnnlm0CS2mhui6QaoeQugs+3Kj2ESKEEGJUdVafwhiCg== -eslint-scope@3.7.1: - version "3.7.1" - resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-3.7.1.tgz#3d63c3edfda02e06e01a452ad88caacc7cdcb6e8" - integrity sha1-PWPD7f2gLgbgGkUq2IyqzHzctug= - dependencies: - esrecurse "^4.1.0" - estraverse "^4.1.1" - -eslint-scope@^4.0.0: - version "4.0.3" - resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-4.0.3.tgz#ca03833310f6889a3264781aa82e63eb9cfe7848" - integrity sha512-p7VutNr1O/QrxysMo3E45FjYDTeXBy0iTltPFNSqKAIfjDSXC+4dj+qfyuD8bfAXrW/y6lW3O76VaYNPKfpKrg== +eslint-scope@^5.0.0, eslint-scope@^5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c" + integrity sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw== dependencies: - esrecurse "^4.1.0" + esrecurse "^4.3.0" estraverse "^4.1.1" -eslint-utils@^1.3.1: +eslint-utils@^1.4.3: version "1.4.3" resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.4.3.tgz#74fec7c54d0776b6f67e0251040b5806564e981f" integrity sha512-fbBN5W2xdY45KulGXmLHZ3c3FHfVYmKg0IrAKGOkT/464PQsx2UeIzfz1RmEci+KLm1bBaAzZAh8+/E+XAeZ8Q== dependencies: eslint-visitor-keys "^1.1.0" +eslint-utils@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-3.0.0.tgz#8aebaface7345bb33559db0a1f13a1d2d48c3672" + integrity sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA== + dependencies: + eslint-visitor-keys "^2.0.0" + eslint-visitor-keys@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d" @@ -2941,59 +3099,62 @@ eslint-visitor-keys@^1.1.0: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.1.0.tgz#e2a82cea84ff246ad6fb57f9bde5b46621459ec2" integrity sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A== -eslint@5.1.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-5.1.0.tgz#2ed611f1ce163c0fb99e1e0cda5af8f662dff645" - integrity sha512-DyH6JsoA1KzA5+OSWFjg56DFJT+sDLO0yokaPZ9qY0UEmYrPA1gEX/G1MnVkmRDsksG4H1foIVz2ZXXM3hHYvw== +eslint-visitor-keys@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz#f65328259305927392c938ed44eb0a5c9b2bd303" + integrity sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw== + +eslint@6.8.0: + version "6.8.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-6.8.0.tgz#62262d6729739f9275723824302fb227c8c93ffb" + integrity sha512-K+Iayyo2LtyYhDSYwz5D5QdWw0hCacNzyq1Y821Xna2xSJj7cijoLLYmLxTQgcgZ9mC61nryMy9S7GRbYpI5Ig== dependencies: - ajv "^6.5.0" - babel-code-frame "^6.26.0" + "@babel/code-frame" "^7.0.0" + ajv "^6.10.0" chalk "^2.1.0" cross-spawn "^6.0.5" - debug "^3.1.0" - doctrine "^2.1.0" - eslint-scope "^4.0.0" - eslint-utils "^1.3.1" - eslint-visitor-keys "^1.0.0" - espree "^4.0.0" + debug "^4.0.1" + doctrine "^3.0.0" + eslint-scope "^5.0.0" + eslint-utils "^1.4.3" + eslint-visitor-keys "^1.1.0" + espree "^6.1.2" esquery "^1.0.1" esutils "^2.0.2" - file-entry-cache "^2.0.0" + file-entry-cache "^5.0.1" functional-red-black-tree "^1.0.1" - glob "^7.1.2" - globals "^11.7.0" - ignore "^3.3.3" + glob-parent "^5.0.0" + globals "^12.1.0" + ignore "^4.0.6" + import-fresh "^3.0.0" imurmurhash "^0.1.4" - inquirer "^5.2.0" - is-resolvable "^1.1.0" - js-yaml "^3.11.0" + inquirer "^7.0.0" + is-glob "^4.0.0" + js-yaml "^3.13.1" json-stable-stringify-without-jsonify "^1.0.1" levn "^0.3.0" - lodash "^4.17.5" + lodash "^4.17.14" minimatch "^3.0.4" mkdirp "^0.5.1" natural-compare "^1.4.0" - optionator "^0.8.2" - path-is-inside "^1.0.2" - pluralize "^7.0.0" + optionator "^0.8.3" progress "^2.0.0" - regexpp "^1.1.0" - require-uncached "^1.0.3" - semver "^5.5.0" - string.prototype.matchall "^2.0.0" - strip-ansi "^4.0.0" - strip-json-comments "^2.0.1" - table "^4.0.3" + regexpp "^2.0.1" + semver "^6.1.2" + strip-ansi "^5.2.0" + strip-json-comments "^3.0.1" + table "^5.2.3" text-table "^0.2.0" + v8-compile-cache "^2.0.3" -espree@^4.0.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/espree/-/espree-4.1.0.tgz#728d5451e0fd156c04384a7ad89ed51ff54eb25f" - integrity sha512-I5BycZW6FCVIub93TeVY1s7vjhP9CY6cXCznIRfiig7nRviKZYdRnj/sHEWC6A7WE9RDWOFq9+7OsWSYz8qv2w== +espree@^6.1.2: + version "6.2.1" + resolved "https://registry.yarnpkg.com/espree/-/espree-6.2.1.tgz#77fc72e1fd744a2052c20f38a5b575832e82734a" + integrity sha512-ysCxRQY3WaXJz9tdbWOwuWr5Y/XrPTGX9Kiz3yoUXwW0VZ4w30HTkQLaGx/+ttFjF8i+ACbArnB4ce68a9m5hw== dependencies: - acorn "^6.0.2" - acorn-jsx "^5.0.0" - eslint-visitor-keys "^1.0.0" + acorn "^7.1.1" + acorn-jsx "^5.2.0" + eslint-visitor-keys "^1.1.0" esprima@^4.0.0, esprima@^4.0.1, esprima@~4.0.0: version "4.0.1" @@ -3007,18 +3168,23 @@ esquery@^1.0.1: dependencies: estraverse "^4.0.0" -esrecurse@^4.1.0: - version "4.2.1" - resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.2.1.tgz#007a3b9fdbc2b3bb87e4879ea19c92fdbd3942cf" - integrity sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ== +esrecurse@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.3.0.tgz#7ad7964d679abb28bee72cec63758b1c5d2c9921" + integrity sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag== dependencies: - estraverse "^4.1.0" + estraverse "^5.2.0" -estraverse@^4.0.0, estraverse@^4.1.0, estraverse@^4.1.1, estraverse@^4.2.0: +estraverse@^4.0.0, estraverse@^4.1.1, estraverse@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13" integrity sha1-De4/7TH81GlhjOc0IJn8GvoL2xM= +estraverse@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.2.0.tgz#307df42547e6cc7324d3cf03c155d5cdb8c53880" + integrity sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ== + esutils@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" @@ -3136,7 +3302,7 @@ extend@~3.0.2: resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa" integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g== -external-editor@^2.0.4, external-editor@^2.1.0: +external-editor@^2.0.4: version "2.2.0" resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-2.2.0.tgz#045511cfd8d133f3846673d1047c154e214ad3d5" integrity sha512-bSn6gvGxKt+b7+6TKEv1ZycHleA7aHhRHyAqJyp5pbUFuYYNIzpZnQDk7AsYckyWdEnTeAnay0aCy2aV6iTk9A== @@ -3145,6 +3311,15 @@ external-editor@^2.0.4, external-editor@^2.1.0: iconv-lite "^0.4.17" tmp "^0.0.33" +external-editor@^3.0.3: + version "3.1.0" + resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-3.1.0.tgz#cb03f740befae03ea4d283caed2741a83f335495" + integrity sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew== + dependencies: + chardet "^0.7.0" + iconv-lite "^0.4.24" + tmp "^0.0.33" + extglob@^2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/extglob/-/extglob-2.0.4.tgz#ad00fe4dc612a9232e8718711dc5cb5ab0285543" @@ -3188,6 +3363,17 @@ fast-diff@^1.1.1: resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.2.0.tgz#73ee11982d86caaf7959828d519cfe927fac5f03" integrity sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w== +fast-glob@^3.1.1: + version "3.2.7" + resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.7.tgz#fd6cb7a2d7e9aa7a7846111e85a196d6b2f766a1" + integrity sha512-rYGMRwip6lUMvYD3BTScMwT1HtAs2d71SMv66Vrxs0IekGZEjhM0pcMfjQPnknBt2zeCwQMEupiN02ZP4DiT1Q== + dependencies: + "@nodelib/fs.stat" "^2.0.2" + "@nodelib/fs.walk" "^1.2.3" + glob-parent "^5.1.2" + merge2 "^1.3.0" + micromatch "^4.0.4" + fast-json-stable-stringify@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2" @@ -3198,6 +3384,13 @@ fast-levenshtein@~2.0.4, fast-levenshtein@~2.0.6: resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= +fastq@^1.6.0: + version "1.12.0" + resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.12.0.tgz#ed7b6ab5d62393fb2cc591c853652a5c318bf794" + integrity sha512-VNX0QkHK3RsXVKr9KrlUv/FoTa0NdbYoHHl7uXHv2rzyHSlxjdNAKug2twd9luJxpcyNeAgf5iPPMutJO67Dfg== + dependencies: + reusify "^1.0.4" + fb-watchman@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/fb-watchman/-/fb-watchman-2.0.0.tgz#54e9abf7dfa2f26cd9b1636c588c1afc05de5d58" @@ -3247,13 +3440,19 @@ figures@^2.0.0: dependencies: escape-string-regexp "^1.0.5" -file-entry-cache@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-2.0.0.tgz#c392990c3e684783d838b8c84a45d8a048458361" - integrity sha1-w5KZDD5oR4PYOLjISkXYoEhFg2E= +figures@^3.0.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/figures/-/figures-3.2.0.tgz#625c18bd293c604dc4a8ddb2febf0c88341746af" + integrity sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg== dependencies: - flat-cache "^1.2.1" - object-assign "^4.0.1" + escape-string-regexp "^1.0.5" + +file-entry-cache@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-5.0.1.tgz#ca0f6efa6dd3d561333fb14515065c2fafdf439c" + integrity sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g== + dependencies: + flat-cache "^2.0.1" fill-range@^4.0.0: version "4.0.0" @@ -3309,20 +3508,24 @@ find-up@^4.0.0, find-up@^4.1.0: locate-path "^5.0.0" path-exists "^4.0.0" -flat-cache@^1.2.1: - version "1.3.4" - resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-1.3.4.tgz#2c2ef77525cc2929007dfffa1dd314aa9c9dee6f" - integrity sha512-VwyB3Lkgacfik2vhqR4uv2rvebqmDvFu4jlN/C1RzWoJEo8I7z4Q404oiqYCkq41mni8EzQnm95emU9seckwtg== +flat-cache@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-2.0.1.tgz#5d296d6f04bda44a4630a301413bdbc2ec085ec0" + integrity sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA== dependencies: - circular-json "^0.3.1" - graceful-fs "^4.1.2" - rimraf "~2.6.2" - write "^0.2.1" + flatted "^2.0.0" + rimraf "2.6.3" + write "1.0.3" + +flatted@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.2.tgz#4575b21e2bcee7434aa9be662f4b7b5f9c2b5138" + integrity sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA== -flow-bin@^0.129.0: - version "0.129.0" - resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.129.0.tgz#50294d6e335dd97d095c27b096ea0b94c2415d55" - integrity sha512-WLXOj09oCK6nODVKM5uxvAzBpxXeI304E60tELMeQd/TJsyfbykNCZ+e4xml9eUOyoac9nDL3YrJpPZMzq0tMA== +flow-bin@^0.130.0: + version "0.130.0" + resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.130.0.tgz#e25eaf891af96da371ff6a9fa99d709f24ce9252" + integrity sha512-1TSLwCPXvKPwiae7Fh+dpipCzwlHQ1UcBHfCpQImz+hsxYIUWkLWJWEm34bY6I7dSM4ekSiVeP02BhzVJGwtpw== flow-parser@0.*: version "0.89.0" @@ -3459,15 +3662,6 @@ get-caller-file@^2.0.1: resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== -get-intrinsic@^1.0.2, get-intrinsic@^1.1.0, get-intrinsic@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.1.1.tgz#15f59f376f855c446963948f0d24cd3637b4abc6" - integrity sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q== - dependencies: - function-bind "^1.1.1" - has "^1.0.3" - has-symbols "^1.0.1" - get-port@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/get-port/-/get-port-2.1.0.tgz#8783f9dcebd1eea495a334e1a6a251e78887ab1a" @@ -3506,6 +3700,13 @@ getpass@^0.1.1: dependencies: assert-plus "^1.0.0" +glob-parent@^5.0.0, glob-parent@^5.1.2: + version "5.1.2" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" + integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== + dependencies: + is-glob "^4.0.1" + glob@^6.0.1: version "6.0.4" resolved "https://registry.yarnpkg.com/glob/-/glob-6.0.4.tgz#0f08860f6a155127b2fadd4f9ce24b1aab6e4d22" @@ -3541,11 +3742,30 @@ glob@^7.1.4: once "^1.3.0" path-is-absolute "^1.0.0" -globals@^11.1.0, globals@^11.7.0: +globals@^11.1.0: version "11.8.0" resolved "https://registry.yarnpkg.com/globals/-/globals-11.8.0.tgz#c1ef45ee9bed6badf0663c5cb90e8d1adec1321d" integrity sha512-io6LkyPVuzCHBSQV9fmOwxZkUk6nIaGmxheLDgmuFv89j0fm2aqDbIXKAGfzCMHqz3HLF2Zf8WSG6VqMh2qFmA== +globals@^12.1.0: + version "12.4.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-12.4.0.tgz#a18813576a41b00a24a97e7f815918c2e19925f8" + integrity sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg== + dependencies: + type-fest "^0.8.1" + +globby@^11.0.3: + version "11.0.4" + resolved "https://registry.yarnpkg.com/globby/-/globby-11.0.4.tgz#2cbaff77c2f2a62e71e9b2813a67b97a3a3001a5" + integrity sha512-9O4MVG9ioZJ08ffbcyVYyLOJLk5JQ688pJ4eMGLpdWLHq/Wr1D9BlriLQyL0E+jbkuePVZXYFj47QM/v093wHg== + dependencies: + array-union "^2.1.0" + dir-glob "^3.0.1" + fast-glob "^3.1.1" + ignore "^5.1.4" + merge2 "^1.3.0" + slash "^3.0.0" + graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.3, graceful-fs@^4.1.6, graceful-fs@^4.1.9: version "4.1.11" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" @@ -3602,18 +3822,6 @@ har-validator@~5.1.3: ajv "^6.5.5" har-schema "^2.0.0" -has-ansi@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" - integrity sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE= - dependencies: - ansi-regex "^2.0.0" - -has-bigints@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/has-bigints/-/has-bigints-1.0.1.tgz#64fe6acb020673e3b78db035a5af69aa9d07b113" - integrity sha512-LSBS2LjbNBTf6287JEbEzvJgftkF5qFkmCo9hDRpAzKhUOlJ+hx8dd4USs00SgsUNwc4617J9ki5YtEClM2ffA== - has-flag@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" @@ -3629,18 +3837,6 @@ has-symbols@^1.0.0: resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.0.tgz#ba1a8f1af2a0fc39650f5c850367704122063b44" integrity sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q= -has-symbols@^1.0.1, has-symbols@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.2.tgz#165d3070c00309752a1236a479331e3ac56f1423" - integrity sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw== - -has-tostringtag@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/has-tostringtag/-/has-tostringtag-1.0.0.tgz#7e133818a7d394734f941e73c3d3f9291e658b25" - integrity sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ== - dependencies: - has-symbols "^1.0.2" - has-unicode@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9" @@ -3735,7 +3931,7 @@ human-signals@^1.1.1: resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-1.1.1.tgz#c5b1cd14f50aeae09ab6c59fe63ba3395fe4dfa3" integrity sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw== -iconv-lite@0.4.24, iconv-lite@^0.4.17, iconv-lite@^0.4.4, iconv-lite@~0.4.13: +iconv-lite@0.4.24, iconv-lite@^0.4.17, iconv-lite@^0.4.24, iconv-lite@^0.4.4, iconv-lite@~0.4.13: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== @@ -3749,16 +3945,21 @@ ignore-walk@^3.0.1: dependencies: minimatch "^3.0.4" -ignore@^3.3.3: - version "3.3.10" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.10.tgz#0a97fb876986e8081c631160f8f9f389157f0043" - integrity sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug== +ignore@^4.0.6: + version "4.0.6" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" + integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg== ignore@^5.0.5: version "5.0.5" resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.0.5.tgz#c663c548d6ce186fb33616a8ccb5d46e56bdbbf9" integrity sha512-kOC8IUb8HSDMVcYrDVezCxpJkzSQWTAzf3olpKM6o9rM5zpojx23O0Fl8Wr4+qJ6ZbPEHqf1fdwev/DS7v7pmA== +ignore@^5.1.4: + version "5.1.8" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.8.tgz#f150a8b50a34289b33e22f5889abd4d8016f0e57" + integrity sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw== + image-size@^0.6.0: version "0.6.3" resolved "https://registry.yarnpkg.com/image-size/-/image-size-0.6.3.tgz#e7e5c65bb534bd7cdcedd6cb5166272a85f75fb2" @@ -3772,6 +3973,14 @@ import-fresh@^2.0.0: caller-path "^2.0.0" resolve-from "^3.0.0" +import-fresh@^3.0.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.3.0.tgz#37162c25fcb9ebaa2e6e53d5b4d88ce17d9e0c2b" + integrity sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw== + dependencies: + parent-module "^1.0.0" + resolve-from "^4.0.0" + import-local@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/import-local/-/import-local-3.0.2.tgz#a8cfd0431d1de4a2199703d003e3e62364fa6db6" @@ -3823,34 +4032,25 @@ inquirer@^3.0.6: strip-ansi "^4.0.0" through "^2.3.6" -inquirer@^5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-5.2.0.tgz#db350c2b73daca77ff1243962e9f22f099685726" - integrity sha512-E9BmnJbAKLPGonz0HeWHtbKf+EeSP93paWO3ZYoUpq/aowXvYGjjCSuashhXPpzbArIjBbji39THkxTz9ZeEUQ== +inquirer@^7.0.0: + version "7.3.3" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-7.3.3.tgz#04d176b2af04afc157a83fd7c100e98ee0aad003" + integrity sha512-JG3eIAj5V9CwcGvuOmoo6LB9kbAYT8HXffUl6memuszlwDC/qvFAJw49XJ5NROSFNPxp3iQg1GqkFhaY/CR0IA== dependencies: - ansi-escapes "^3.0.0" - chalk "^2.0.0" - cli-cursor "^2.1.0" - cli-width "^2.0.0" - external-editor "^2.1.0" - figures "^2.0.0" - lodash "^4.3.0" - mute-stream "0.0.7" - run-async "^2.2.0" - rxjs "^5.5.2" - string-width "^2.1.0" - strip-ansi "^4.0.0" + ansi-escapes "^4.2.1" + chalk "^4.1.0" + cli-cursor "^3.1.0" + cli-width "^3.0.0" + external-editor "^3.0.3" + figures "^3.0.0" + lodash "^4.17.19" + mute-stream "0.0.8" + run-async "^2.4.0" + rxjs "^6.6.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" through "^2.3.6" -internal-slot@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/internal-slot/-/internal-slot-1.0.3.tgz#7347e307deeea2faac2ac6205d4bc7d34967f59c" - integrity sha512-O0DB1JC/sPyZl7cIo78n5dR7eUSwwpYPiXRhTzNxZVAMUuB8vlnRFyLxdrVToks6XPLVnFfbzaVd5WLjhgg+vA== - dependencies: - get-intrinsic "^1.1.0" - has "^1.0.3" - side-channel "^1.0.4" - interpret@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.1.0.tgz#7ed1b1410c6a0e0f78cf95d3b8440c63f78b8614" @@ -3892,21 +4092,6 @@ is-arrayish@^0.2.1: resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" integrity sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0= -is-bigint@^1.0.1: - version "1.0.4" - resolved "https://registry.yarnpkg.com/is-bigint/-/is-bigint-1.0.4.tgz#08147a1875bc2b32005d41ccd8291dffc6691df3" - integrity sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg== - dependencies: - has-bigints "^1.0.1" - -is-boolean-object@^1.1.0: - version "1.1.2" - resolved "https://registry.yarnpkg.com/is-boolean-object/-/is-boolean-object-1.1.2.tgz#5c6dc200246dd9321ae4b885a114bb1f75f63719" - integrity sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA== - dependencies: - call-bind "^1.0.2" - has-tostringtag "^1.0.0" - is-buffer@^1.1.5: version "1.1.6" resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" @@ -3917,11 +4102,6 @@ is-callable@^1.1.3, is-callable@^1.1.4: resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.4.tgz#1e1adf219e1eeb684d691f9d6a05ff0d30a24d75" integrity sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA== -is-callable@^1.2.3: - version "1.2.4" - resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.4.tgz#47301d58dd0259407865547853df6d61fe471945" - integrity sha512-nsuwtxZfMX67Oryl9LCQ+upnC0Z0BgpwntpS89m1H/TLF0zNfzfLMV/9Wa/6MZsj0acpEjAO0KF1xT6ZdLl95w== - is-ci@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-2.0.0.tgz#6bc6334181810e04b5c22b3d589fdca55026404c" @@ -3929,6 +4109,13 @@ is-ci@^2.0.0: dependencies: ci-info "^2.0.0" +is-core-module@^2.2.0: + version "2.6.0" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.6.0.tgz#d7553b2526fe59b92ba3e40c8df757ec8a709e19" + integrity sha512-wShG8vs60jKfPWpF2KZRaAtvt3a20OAn7+IJ6hLPECpSABLcKtFKTTI4ZtH5QcBruBHlq+WsdHWyz0BCZW7svQ== + dependencies: + has "^1.0.3" + is-data-descriptor@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz#0b5ee648388e2c860282e793f1856fec3f301b56" @@ -3983,6 +4170,11 @@ is-extendable@^1.0.1: dependencies: is-plain-object "^2.0.4" +is-extglob@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" + integrity sha1-qIwCU1eR8C7TfHahueqXc8gz+MI= + is-fullwidth-code-point@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" @@ -4005,17 +4197,12 @@ is-generator-fn@^2.0.0: resolved "https://registry.yarnpkg.com/is-generator-fn/-/is-generator-fn-2.0.0.tgz#038c31b774709641bda678b1f06a4e3227c10b3e" integrity sha512-elzyIdM7iKoFHzcrndIqjYomImhxrFRnGP3galODoII4TB9gI7mZ+FnlLQmmjf27SxHS2gKEeyhX5/+YRS6H9g== -is-negative-zero@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/is-negative-zero/-/is-negative-zero-2.0.1.tgz#3de746c18dda2319241a53675908d8f766f11c24" - integrity sha512-2z6JzQvZRa9A2Y7xC6dQQm4FSTSTNWjKIYYTt4246eMTJmIo0Q+ZyOsU66X8lxK1AbB92dFeglPLrhwpeRKO6w== - -is-number-object@^1.0.4: - version "1.0.6" - resolved "https://registry.yarnpkg.com/is-number-object/-/is-number-object-1.0.6.tgz#6a7aaf838c7f0686a50b4553f7e54a96494e89f0" - integrity sha512-bEVOqiRcvo3zO1+G2lVMy+gkkEm9Yh7cDMRusKKu5ZJKPUYSJwICTKZrNKHA2EbSP0Tu0+6B/emsYNHZyn6K8g== +is-glob@^4.0.0, is-glob@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.1.tgz#7567dbe9f2f5e2467bc77ab83c4a29482407a5dc" + integrity sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg== dependencies: - has-tostringtag "^1.0.0" + is-extglob "^2.1.1" is-number@^3.0.0: version "3.0.0" @@ -4053,19 +4240,6 @@ is-regex@^1.0.4: dependencies: has "^1.0.1" -is-regex@^1.1.3: - version "1.1.4" - resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.1.4.tgz#eef5663cd59fa4c0ae339505323df6854bb15958" - integrity sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg== - dependencies: - call-bind "^1.0.2" - has-tostringtag "^1.0.0" - -is-resolvable@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/is-resolvable/-/is-resolvable-1.1.0.tgz#fb18f87ce1feb925169c9a407c19318a3206ed88" - integrity sha512-qgDYXFSR5WvEfuS5dMj6oTMEbrrSaM0CrFk2Yiq/gXnBvD9pMa2jGXxyhGLfvhZpuMZe18CJpFxAt3CRs42NMg== - is-stream@^1.0.1, is-stream@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" @@ -4076,13 +4250,6 @@ is-stream@^2.0.0: resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.0.tgz#bde9c32680d6fae04129d6ac9d921ce7815f78e3" integrity sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw== -is-string@^1.0.5, is-string@^1.0.6: - version "1.0.7" - resolved "https://registry.yarnpkg.com/is-string/-/is-string-1.0.7.tgz#0dd12bf2006f255bb58f695110eff7491eebc0fd" - integrity sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg== - dependencies: - has-tostringtag "^1.0.0" - is-symbol@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.2.tgz#a055f6ae57192caee329e7a860118b497a950f38" @@ -4090,13 +4257,6 @@ is-symbol@^1.0.2: dependencies: has-symbols "^1.0.0" -is-symbol@^1.0.3: - version "1.0.4" - resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.4.tgz#a6dac93b635b063ca6872236de88910a57af139c" - integrity sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg== - dependencies: - has-symbols "^1.0.2" - is-typedarray@^1.0.0, is-typedarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" @@ -4687,11 +4847,6 @@ jetifier@^1.6.2: resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== -js-tokens@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" - integrity sha1-mGbfOVECEw449/mWvOtlRDIJwls= - js-yaml@^3.11.0, js-yaml@^3.9.0: version "3.12.0" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.12.0.tgz#eaed656ec8344f10f527c6bfa1b6e2244de167d1" @@ -4966,7 +5121,7 @@ lodash.throttle@^4.1.1: resolved "https://registry.yarnpkg.com/lodash.throttle/-/lodash.throttle-4.1.1.tgz#c23e91b710242ac70c37f1e1cda9274cc39bf2f4" integrity sha1-wj6RtxAkKscMN/HhzaknTMOb8vQ= -lodash@4.x.x, lodash@^4.17.10, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.3.0: +lodash@4.x.x, lodash@^4.17.10, lodash@^4.17.5, lodash@^4.3.0: version "4.17.11" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d" integrity sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg== @@ -4976,6 +5131,11 @@ lodash@^4.17.13, lodash@^4.17.15: resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== +lodash@^4.17.14, lodash@^4.17.19: + version "4.17.21" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" + integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== + log-driver@^1.2.7: version "1.2.7" resolved "https://registry.yarnpkg.com/log-driver/-/log-driver-1.2.7.tgz#63b95021f0702fedfa2c9bb0a24e7797d71871d8" @@ -5012,6 +5172,13 @@ lru-cache@^4.0.1: pseudomap "^1.0.2" yallist "^2.1.2" +lru-cache@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" + integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA== + dependencies: + yallist "^4.0.0" + make-dir@^2.0.0, make-dir@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-2.1.0.tgz#5f0310e18b8be898cc07009295a30ae41e91e6f5" @@ -5074,6 +5241,11 @@ merge-stream@^2.0.0: resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== +merge2@^1.3.0: + version "1.4.1" + resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" + integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== + metro-babel-register@0.58.0: version "0.58.0" resolved "https://registry.yarnpkg.com/metro-babel-register/-/metro-babel-register-0.58.0.tgz#5c44786d49a044048df56cf476a2263491d4f53a" @@ -5092,10 +5264,10 @@ metro-babel-register@0.58.0: core-js "^2.2.2" escape-string-regexp "^1.0.5" -metro-babel-register@0.60.0: - version "0.60.0" - resolved "https://registry.yarnpkg.com/metro-babel-register/-/metro-babel-register-0.60.0.tgz#5ece59e0d05c0015d3ad6094932e7679c68a0273" - integrity sha512-zUmx9srlkX0dThdpRN/jWcOGG89mIaLT9+BMrFn2Pb1kqwnThfu2vm+eRIQPbFGrceVCXjL5OSXlBlhguo5bog== +metro-babel-register@0.61.0: + version "0.61.0" + resolved "https://registry.yarnpkg.com/metro-babel-register/-/metro-babel-register-0.61.0.tgz#028641905c7752d0af4b70797cb31fecc4139fdc" + integrity sha512-tul79iDRAj4VAfFU5cgnMOqKOQ5/5R+yIYW+z3tmku/TKtxMsmO7qlCtst8DtWeH6h3YeUHU55W2//nRrjKnRw== dependencies: "@babel/core" "^7.0.0" "@babel/plugin-proposal-class-properties" "^7.0.0" @@ -5114,13 +5286,13 @@ metro-babel-transformer@0.58.0: "@babel/core" "^7.0.0" metro-source-map "0.58.0" -metro-babel-transformer@0.60.0: - version "0.60.0" - resolved "https://registry.yarnpkg.com/metro-babel-transformer/-/metro-babel-transformer-0.60.0.tgz#92e0b2309372b3b1335cb94dd1348f841d1d198e" - integrity sha512-7liSVU+Ighta38l12BrIlhUtphxdZddTMrJrnUSbNM9J3fMsWUVZogpnH8reioiEiu4D4mwTHEukIbiFJyGdHg== +metro-babel-transformer@0.61.0: + version "0.61.0" + resolved "https://registry.yarnpkg.com/metro-babel-transformer/-/metro-babel-transformer-0.61.0.tgz#5088841059c638fde9c4f66c4403f9fdb832b21b" + integrity sha512-G9aETweSs7gfREhBDqMXzVdutiwydS4VJzI3gWNjrHuJ8F+k1H6tojVTsIldfmv3Xb18z1swbpbUd7UlEXirrg== dependencies: "@babel/core" "^7.0.0" - metro-source-map "0.60.0" + metro-source-map "0.61.0" metro-cache@0.58.0: version "0.58.0" @@ -5213,11 +5385,12 @@ metro-react-native-babel-preset@0.58.0: "@babel/template" "^7.0.0" react-refresh "^0.4.0" -metro-react-native-babel-preset@0.60.0: - version "0.60.0" - resolved "https://registry.yarnpkg.com/metro-react-native-babel-preset/-/metro-react-native-babel-preset-0.60.0.tgz#9aaaeca10a04c117ea84fb18e54c44ddcaad2ab8" - integrity sha512-eByxCh52XWyMwh4eduzLz0HkraOX7X/tJBsOXvxhUaj8UEolxMYQWD1DO7rJbFiKfZbxRPortltDYzjJI4MpdQ== +metro-react-native-babel-preset@0.61.0: + version "0.61.0" + resolved "https://registry.yarnpkg.com/metro-react-native-babel-preset/-/metro-react-native-babel-preset-0.61.0.tgz#4276f6a300daba5f43d6b35f30a8354f8aa093a1" + integrity sha512-k0j2K70YadKFFayFOtw9sbaB38LdkkJLluwqHvyl9CRAa3m7cWQ6pZbakCPrp3OWyo7dJWbP70ybOvjoDv2jwQ== dependencies: + "@babel/core" "^7.0.0" "@babel/plugin-proposal-class-properties" "^7.0.0" "@babel/plugin-proposal-export-default-from" "^7.0.0" "@babel/plugin-proposal-nullish-coalescing-operator" "^7.0.0" @@ -5257,16 +5430,16 @@ metro-react-native-babel-preset@0.60.0: "@babel/template" "^7.0.0" react-refresh "^0.4.0" -metro-react-native-babel-transformer@0.60.0: - version "0.60.0" - resolved "https://registry.yarnpkg.com/metro-react-native-babel-transformer/-/metro-react-native-babel-transformer-0.60.0.tgz#669b44b02aca8692b346e1cfd80a57c68fb53edd" - integrity sha512-ky5AGt97tOQnr5YQ9CPKTjlekP+uprFN0FlNW3LH54LpE3q9o++IerBKvq1KJZgYLvpiSAiqsia+IH1LAP8hrA== +metro-react-native-babel-transformer@0.61.0: + version "0.61.0" + resolved "https://registry.yarnpkg.com/metro-react-native-babel-transformer/-/metro-react-native-babel-transformer-0.61.0.tgz#6aa773e56334eb2903eb5bc9725fec374d98e57e" + integrity sha512-qLaf64pim9uF75ahdJ/FvLoBONO/WbM3aXR/uL27y0ohFzdZshuoPgwtvAihkVCyGY+9GErVPB0QuH0hMJF6vA== dependencies: "@babel/core" "^7.0.0" babel-preset-fbjs "^3.3.0" - metro-babel-transformer "0.60.0" - metro-react-native-babel-preset "0.60.0" - metro-source-map "0.60.0" + metro-babel-transformer "0.61.0" + metro-react-native-babel-preset "0.61.0" + metro-source-map "0.61.0" metro-react-native-babel-transformer@^0.58.0: version "0.58.0" @@ -5299,16 +5472,16 @@ metro-source-map@0.58.0: source-map "^0.5.6" vlq "^1.0.0" -metro-source-map@0.60.0: - version "0.60.0" - resolved "https://registry.yarnpkg.com/metro-source-map/-/metro-source-map-0.60.0.tgz#a7abfed408bc07006aecac1f4a845edf5257272c" - integrity sha512-zq7gP4SwZ0dtM3J9kBMVd+FVS2v6/4hmR21cTOAXk7Mi7KnSnb1onuQaTwi4m6fdlr19N9A7Ad2VU0q+uVlFyA== +metro-source-map@0.61.0: + version "0.61.0" + resolved "https://registry.yarnpkg.com/metro-source-map/-/metro-source-map-0.61.0.tgz#32635d94a84ffa1ef5e43c969cae998f748192a9" + integrity sha512-2iCs8WDUl/cW55E5gLVH6cr2a8Yie6fNqn3cjsgmTtKFMCyBEdicVMHSPCScGCxGkX6KzjpL2PVK+d3T9Z1fOg== dependencies: "@babel/traverse" "^7.0.0" "@babel/types" "^7.0.0" invariant "^2.2.4" - metro-symbolicate "0.60.0" - ob1 "0.60.0" + metro-symbolicate "0.61.0" + ob1 "0.61.0" source-map "^0.5.6" vlq "^1.0.0" @@ -5323,13 +5496,13 @@ metro-symbolicate@0.58.0: through2 "^2.0.1" vlq "^1.0.0" -metro-symbolicate@0.60.0: - version "0.60.0" - resolved "https://registry.yarnpkg.com/metro-symbolicate/-/metro-symbolicate-0.60.0.tgz#11e962d3b5cc0a7c7389a44979772cbce168ddb8" - integrity sha512-H9g6CflHY0k+dpuxvmRIFs1FyGbxs/IhBlfBks0c3L9wr+1mJT63K5pjlhoonKB0c///wMTP+kUuSMRRox2qhQ== +metro-symbolicate@0.61.0: + version "0.61.0" + resolved "https://registry.yarnpkg.com/metro-symbolicate/-/metro-symbolicate-0.61.0.tgz#ba5dc4d7689672b412cb360a758996166f38cf08" + integrity sha512-BytId1VGTp/m/hvSKiqO3/vmeQFkrAG4nKcXK1Kh9RMrTaUs2ry7HtS2dgQZHiPl0rro6Vpv7g5Xsgm6UlJ0oA== dependencies: invariant "^2.2.4" - metro-source-map "0.60.0" + metro-source-map "0.61.0" source-map "^0.5.6" through2 "^2.0.1" vlq "^1.0.0" @@ -5423,6 +5596,14 @@ micromatch@^4.0.2: braces "^3.0.1" picomatch "^2.0.5" +micromatch@^4.0.4: + version "4.0.4" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.4.tgz#896d519dfe9db25fce94ceb7a500919bf881ebf9" + integrity sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg== + dependencies: + braces "^3.0.1" + picomatch "^2.2.3" + mime-db@1.44.0, "mime-db@>= 1.43.0 < 2": version "1.44.0" resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.44.0.tgz#fa11c5eb0aca1334b4233cb4d52f10c5a6272f92" @@ -5541,6 +5722,11 @@ ms@2.0.0: resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g= +ms@2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" + integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== + ms@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.1.tgz#30a5864eb3ebb0a66f2ebe6d727af06a09d86e0a" @@ -5551,6 +5737,11 @@ mute-stream@0.0.7: resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" integrity sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s= +mute-stream@0.0.8: + version "0.0.8" + resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d" + integrity sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA== + mv@~2: version "2.1.1" resolved "https://registry.yarnpkg.com/mv/-/mv-2.1.1.tgz#ae6ce0d6f6d5e0a4f7d893798d03c1ea9559b6a2" @@ -5781,10 +5972,10 @@ ob1@0.58.0: resolved "https://registry.yarnpkg.com/ob1/-/ob1-0.58.0.tgz#484a1e9a63a8b79d9ea6f3a83b2a42110faac973" integrity sha512-uZP44cbowAfHafP1k4skpWItk5iHCoRevMfrnUvYCfyNNPPJd3rfDCyj0exklWi2gDXvjlj2ObsfiqP/bs/J7Q== -ob1@0.60.0: - version "0.60.0" - resolved "https://registry.yarnpkg.com/ob1/-/ob1-0.60.0.tgz#0f79e7c60dcd666819413e836d8f473ea83cfc7a" - integrity sha512-hi8vHBZiYIIoQMzwieQGv+VnPMFNaDciSyZhQNTXl54NB0MYOviQoeEbVqD6dcTHPE8nuJMbIZ0lIRiksAMB0A== +ob1@0.61.0: + version "0.61.0" + resolved "https://registry.yarnpkg.com/ob1/-/ob1-0.61.0.tgz#ff5a20cd51e0586f6c4aefcf9aeabac7d35b1f1e" + integrity sha512-cKgz8Y14j/+PziEkuvpNgEY5RMkeFUANKsEGjXS/tzI5XSSTT5277CqZt3FEn9MRCEe6FhuhizbA+NKnMlMScA== object-assign@^4.0.1, object-assign@^4.1.0, object-assign@^4.1.1: version "4.1.1" @@ -5800,12 +5991,7 @@ object-copy@^0.1.0: define-property "^0.2.5" kind-of "^3.0.3" -object-inspect@^1.11.0, object-inspect@^1.9.0: - version "1.11.0" - resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.11.0.tgz#9dceb146cedd4148a0d9e51ab88d34cf509922b1" - integrity sha512-jp7ikS6Sd3GxQfZJPyH3cjcbJF6GZPClgdV+EFygjFLQ5FmW/dRUnTd9PQ9k0JhoNDabWFbpF1yCdSWCC6gexg== - -object-keys@^1.0.11, object-keys@^1.1.1: +object-keys@^1.0.11: version "1.1.1" resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA== @@ -5832,16 +6018,6 @@ object.assign@^4.1.0: has-symbols "^1.0.0" object-keys "^1.0.11" -object.assign@^4.1.2: - version "4.1.2" - resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.2.tgz#0ed54a342eceb37b38ff76eb831a0e788cb63940" - integrity sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ== - dependencies: - call-bind "^1.0.0" - define-properties "^1.1.3" - has-symbols "^1.0.1" - object-keys "^1.1.1" - object.fromentries@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/object.fromentries/-/object.fromentries-2.0.0.tgz#49a543d92151f8277b3ac9600f1e930b189d30ab" @@ -5911,7 +6087,7 @@ optionator@^0.8.1: type-check "~0.3.2" wordwrap "~1.0.0" -optionator@^0.8.2: +optionator@^0.8.3: version "0.8.3" resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.3.tgz#84fa1d036fe9d3c7e21d99884b601167ec8fb495" integrity sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA== @@ -6020,6 +6196,13 @@ p-try@^2.0.0: resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.0.0.tgz#85080bb87c64688fa47996fe8f7dfbe8211760b1" integrity sha512-hMp0onDKIajHfIkdRk3P4CdCmErkYAxxDtP3Wx/4nZ3aGlau2VKh3mZpcuFkH27WQkL/3WBCPOktzA9ZOAnMQQ== +parent-module@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2" + integrity sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g== + dependencies: + callsites "^3.0.0" + parse-json@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-4.0.0.tgz#be35f5425be1f7f6c747184f98a788cb99477ee0" @@ -6068,11 +6251,6 @@ path-is-absolute@^1.0.0: resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= -path-is-inside@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53" - integrity sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM= - path-key@^2.0.0, path-key@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" @@ -6088,6 +6266,11 @@ path-parse@^1.0.6: resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c" integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw== +path-type@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" + integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== + performance-now@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" @@ -6098,6 +6281,11 @@ picomatch@^2.0.4, picomatch@^2.0.5: resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.2.2.tgz#21f333e9b6b8eaff02468f5146ea406d345f4dad" integrity sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg== +picomatch@^2.2.3: + version "2.3.0" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.0.tgz#f1f061de8f6a4bf022892e2d128234fb98302972" + integrity sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw== + pify@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/pify/-/pify-4.0.1.tgz#4b2cd25c50d598735c50292224fd8c6df41e3231" @@ -6163,11 +6351,6 @@ plugin-error@^0.1.2: arr-union "^2.0.1" extend-shallow "^1.1.2" -pluralize@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-7.0.0.tgz#298b89df8b93b0221dbf421ad2b1b1ea23fc6777" - integrity sha512-ARhBOdzS3e41FbkW/XWrTEtukqqLoK5+Z/4UeDaLuSW+39JPeFgs4gCGqsrJHVZX0fUrx//4OF0K1CUGwlIFow== - posix-character-classes@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab" @@ -6343,6 +6526,11 @@ qs@~6.5.2: resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA== +queue-microtask@^1.2.2: + version "1.2.3" + resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243" + integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A== + range-parser@~1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.0.tgz#f49be6b487894ddc40dcc94a322f611092e00d5e" @@ -6366,6 +6554,11 @@ react-devtools-core@^4.6.0: shell-quote "^1.6.1" ws "^7" +react-is@0.0.0-experimental-aae83a4b9: + version "0.0.0-experimental-aae83a4b9" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-0.0.0-experimental-aae83a4b9.tgz#9dde6f4ac1da013398bf990706af2d4f59774d2b" + integrity sha512-0AZ4lHKqoXzYZ5RhNtj7ODYhQ6fXLDRn9lRapoVxYd2rgfe6LLrrf7ob5lweuo/krb7heBGINZ479FdQIvNLfg== + react-is@^16.12.0: version "16.12.0" resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.12.0.tgz#2cc0fe0fba742d97fd527c42a13bec4eeb06241c" @@ -6376,17 +6569,12 @@ react-is@^16.8.1, react-is@^16.8.4: resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.8.4.tgz#90f336a68c3a29a096a3d648ab80e87ec61482a2" integrity sha512-PVadd+WaUDOAciICm/J1waJaSvgq+4rHE/K70j0PFqKhkTBsPv/82UGQJNXAngz1fOQLLxI6z1sEDmJDQhCTAA== -react-is@^16.8.6: - version "16.10.2" - resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.10.2.tgz#984120fd4d16800e9a738208ab1fba422d23b5ab" - integrity sha512-INBT1QEgtcCCgvccr5/86CfD71fw9EPmDxgiJX4I2Ddr6ZsV6iFXsuby+qWJPtmNuMY0zByTsG4468P7nHuNWA== - react-refresh@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/react-refresh/-/react-refresh-0.4.0.tgz#d421f9bd65e0e4b9822a399f14ac56bda9c92292" integrity sha512-bacjSio8GOtzNZKZZM6EWqbhlbb6pr28JWJWFTLwEBKvPIBRo6/Ob68D2EWZA2VyTdQxAh+TRnCYOPNKsQiXTA== -react-shallow-renderer@16.13.1: +react-shallow-renderer@16.13.1, react-shallow-renderer@^16.13.1: version "16.13.1" resolved "https://registry.yarnpkg.com/react-shallow-renderer/-/react-shallow-renderer-16.13.1.tgz#4cfd6dc0f05a8d4d261ff7a80e9b88f15491a00a" integrity sha512-hLmExm5/ZnjodLgm/4oxYw4i7fL6LLPhbO9mF/4tmaZUurtLrp2aSeDHZmRk0SVCHXPz0VaEbb3Dqi5J7odz7Q== @@ -6394,24 +6582,23 @@ react-shallow-renderer@16.13.1: object-assign "^4.1.1" react-is "^16.12.0" -react-test-renderer@16.13.1: - version "16.13.1" - resolved "https://registry.yarnpkg.com/react-test-renderer/-/react-test-renderer-16.13.1.tgz#de25ea358d9012606de51e012d9742e7f0deabc1" - integrity sha512-Sn2VRyOK2YJJldOqoh8Tn/lWQ+ZiKhyZTPtaO0Q6yNj+QDbmRkVFap6pZPy3YQk8DScRDfyqm/KxKYP9gCMRiQ== +react-test-renderer@0.0.0-experimental-aae83a4b9: + version "0.0.0-experimental-aae83a4b9" + resolved "https://registry.yarnpkg.com/react-test-renderer/-/react-test-renderer-0.0.0-experimental-aae83a4b9.tgz#494dc7b72fe7ab6d469cd43032e686aa15f767f8" + integrity sha512-Wbj7W/YQhJZpC5FbJmOgtEUNIFKfXmWvAHlJn9wc636pUHTMDYs/180qJlUwtrfW2WLb1xEpPKZQ9RnfT7gVxg== dependencies: object-assign "^4.1.1" - prop-types "^15.6.2" - react-is "^16.8.6" - scheduler "^0.19.1" + react-is "0.0.0-experimental-aae83a4b9" + react-shallow-renderer "^16.13.1" + scheduler "0.0.0-experimental-aae83a4b9" -react@16.13.1: - version "16.13.1" - resolved "https://registry.yarnpkg.com/react/-/react-16.13.1.tgz#2e818822f1a9743122c063d6410d85c1e3afe48e" - integrity sha512-YMZQQq32xHLX0bz5Mnibv1/LHb3Sqzngu7xstSM+vrkE5Kzr9xE0yMByK5kMoTK30YVJE61WfbxIFFvfeDKT1w== +react@0.0.0-experimental-aae83a4b9: + version "0.0.0-experimental-aae83a4b9" + resolved "https://registry.yarnpkg.com/react/-/react-0.0.0-experimental-aae83a4b9.tgz#9b2063ddb2dc9a3d347e7a0a4233462c78800ba0" + integrity sha512-PuabEUXkXk9E4FrB3FoHY6GwvkqBpN7Od2V91TQgwJcgfErMIXQQm1n9GxzQBJ/RfgkTBCoaV4zEC/B8cNJWjw== dependencies: loose-envify "^1.1.0" object-assign "^4.1.1" - prop-types "^15.6.2" read-pkg-up@^7.0.1: version "7.0.1" @@ -6500,18 +6687,15 @@ regex-not@^1.0.0, regex-not@^1.0.2: extend-shallow "^3.0.2" safe-regex "^1.1.0" -regexp.prototype.flags@^1.2.0: - version "1.3.1" - resolved "https://registry.yarnpkg.com/regexp.prototype.flags/-/regexp.prototype.flags-1.3.1.tgz#7ef352ae8d159e758c0eadca6f8fcb4eef07be26" - integrity sha512-JiBdRBq91WlY7uRJ0ds7R+dU02i6LKi8r3BuQhNXn+kmeLN+EfHhfjqMRis1zJxnlu88hq/4dx0P2OP3APRTOA== - dependencies: - call-bind "^1.0.2" - define-properties "^1.1.3" +regexpp@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-2.0.1.tgz#8d19d31cf632482b589049f8281f93dbcba4d07f" + integrity sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw== -regexpp@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-1.1.0.tgz#0e3516dd0b7904f413d2d4193dce4618c3a689ab" - integrity sha512-LOPw8FpgdQF9etWMaAfG/WRthIdXJGYp4mJ2Jgn/2lpkbod9jPn0t9UqN7AxBOKNfzRbYyVfgc7Vk4t/MpnXgw== +regexpp@^3.1.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.2.0.tgz#0425a2768d8f23bad70ca4b90461fa2f1213e1b2" + integrity sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg== regexpu-core@^4.7.0: version "4.7.0" @@ -6630,14 +6814,6 @@ require-main-filename@^2.0.0: resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b" integrity sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg== -require-uncached@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/require-uncached/-/require-uncached-1.0.3.tgz#4e0d56d6c9662fd31e43011c4b95aa49955421d3" - integrity sha1-Tg1W1slmL9MeQwEcS5WqSZVUIdM= - dependencies: - caller-path "^0.1.0" - resolve-from "^1.0.0" - resolve-cwd@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-3.0.0.tgz#0f0075f1bb2544766cf73ba6a6e2adfebcb13f2d" @@ -6645,16 +6821,16 @@ resolve-cwd@^3.0.0: dependencies: resolve-from "^5.0.0" -resolve-from@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226" - integrity sha1-Jsv+k10a7uq7Kbw/5a6wHpPUQiY= - resolve-from@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-3.0.0.tgz#b22c7af7d9d6881bc8b6e653335eebcb0a188748" integrity sha1-six699nWiBvItuZTM17rywoYh0g= +resolve-from@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" + integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== + resolve-from@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-5.0.0.tgz#c35225843df8f776df21c57557bc087e9dfdfc69" @@ -6672,6 +6848,14 @@ resolve@^1.1.6, resolve@^1.10.0, resolve@^1.3.2, resolve@^1.5.0, resolve@^1.8.1, dependencies: path-parse "^1.0.6" +resolve@^1.12.0: + version "1.20.0" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.20.0.tgz#629a013fb3f70755d6f0b7935cc1c2c5378b1975" + integrity sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A== + dependencies: + is-core-module "^2.2.0" + path-parse "^1.0.6" + resolve@^1.17.0: version "1.17.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.17.0.tgz#b25941b54968231cc2d1bb76a79cb7f2c0bf8444" @@ -6687,6 +6871,14 @@ restore-cursor@^2.0.0: onetime "^2.0.0" signal-exit "^3.0.2" +restore-cursor@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-3.1.0.tgz#39f67c54b3a7a58cea5236d95cf0034239631f7e" + integrity sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA== + dependencies: + onetime "^5.1.0" + signal-exit "^3.0.2" + ret@~0.1.10: version "0.1.15" resolved "https://registry.yarnpkg.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc" @@ -6697,6 +6889,18 @@ retry@^0.10.1: resolved "https://registry.yarnpkg.com/retry/-/retry-0.10.1.tgz#e76388d217992c252750241d3d3956fed98d8ff4" integrity sha1-52OI0heZLCUnUCQdPTlW/tmNj/Q= +reusify@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" + integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== + +rimraf@2.6.3: + version "2.6.3" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.3.tgz#b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab" + integrity sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA== + dependencies: + glob "^7.1.3" + rimraf@^2.5.4, rimraf@^2.6.1: version "2.6.2" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.2.tgz#2ed8150d24a16ea8651e6d6ef0f47c4158ce7a36" @@ -6723,13 +6927,6 @@ rimraf@~2.4.0: dependencies: glob "^6.0.1" -rimraf@~2.6.2: - version "2.6.3" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.3.tgz#b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab" - integrity sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA== - dependencies: - glob "^7.1.3" - rsvp@^3.3.3: version "3.6.2" resolved "https://registry.yarnpkg.com/rsvp/-/rsvp-3.6.2.tgz#2e96491599a96cde1b515d5674a8f7a91452926a" @@ -6742,6 +6939,18 @@ run-async@^2.2.0: dependencies: is-promise "^2.1.0" +run-async@^2.4.0: + version "2.4.1" + resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.4.1.tgz#8440eccf99ea3e70bd409d49aab88e10c189a455" + integrity sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ== + +run-parallel@^1.1.9: + version "1.2.0" + resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee" + integrity sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA== + dependencies: + queue-microtask "^1.2.2" + rx-lite-aggregates@^4.0.8: version "4.0.8" resolved "https://registry.yarnpkg.com/rx-lite-aggregates/-/rx-lite-aggregates-4.0.8.tgz#753b87a89a11c95467c4ac1626c4efc4e05c67be" @@ -6754,13 +6963,20 @@ rx-lite@*, rx-lite@^4.0.8: resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-4.0.8.tgz#0b1e11af8bc44836f04a6407e92da42467b79444" integrity sha1-Cx4Rr4vESDbwSmQH6S2kJGe3lEQ= -rxjs@^5.4.3, rxjs@^5.5.2: +rxjs@^5.4.3: version "5.5.12" resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-5.5.12.tgz#6fa61b8a77c3d793dbaf270bee2f43f652d741cc" integrity sha512-xx2itnL5sBbqeeiVgNPVuQQ1nC8Jp2WfNJhXWHmElW9YmrpS9UVnNzhP3EH3HFqexO5Tlp8GhYY+WEcqcVMvGw== dependencies: symbol-observable "1.0.1" +rxjs@^6.6.0: + version "6.6.7" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.6.7.tgz#90ac018acabf491bf65044235d5863c4dab804c9" + integrity sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ== + dependencies: + tslib "^1.9.0" + safe-buffer@5.1.2, safe-buffer@^5.0.1, safe-buffer@^5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1: version "5.1.2" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" @@ -6817,10 +7033,10 @@ saxes@^5.0.0: dependencies: xmlchars "^2.2.0" -scheduler@0.19.1, scheduler@^0.19.1: - version "0.19.1" - resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.19.1.tgz#4f3e2ed2c1a7d65681f4c854fa8c5a1ccb40f196" - integrity sha512-n/zwRWRYSUj0/3g/otKDRPMh6qv2SYMWNq85IEa8iZyAv8od9zDYpGSnpBEjNgcMNq6Scbu5KfIPxNF72R/2EA== +scheduler@0.0.0-experimental-aae83a4b9: + version "0.0.0-experimental-aae83a4b9" + resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.0.0-experimental-aae83a4b9.tgz#da2d706425a55ff1538d26f634171bc333a38b3b" + integrity sha512-z0Z0TqehF/6dZbOtRcdvJBX5qUWhNs4sLddxe8VtCThTnBhK+vv5Hv6R/LP5UcE+ROk8988uTYlQExzofI7yZA== dependencies: loose-envify "^1.1.0" object-assign "^4.1.1" @@ -6835,7 +7051,7 @@ semver@^5.1.0, semver@^5.3.0, semver@^5.4.1, semver@^5.5.0, semver@^5.5.1: resolved "https://registry.yarnpkg.com/semver/-/semver-5.6.0.tgz#7e74256fbaa49c75aa7c7a205cc22799cac80004" integrity sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg== -semver@^6.0.0, semver@^6.3.0: +semver@^6.0.0, semver@^6.1.2, semver@^6.3.0: version "6.3.0" resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== @@ -6845,6 +7061,13 @@ semver@^7.2.1, semver@^7.3.2: resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.2.tgz#604962b052b81ed0786aae84389ffba70ffd3938" integrity sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ== +semver@^7.3.5: + version "7.3.5" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.5.tgz#0b621c879348d8998e4b0e4be94b3f12e6018ef7" + integrity sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ== + dependencies: + lru-cache "^6.0.0" + send@0.16.2: version "0.16.2" resolved "https://registry.yarnpkg.com/send/-/send-0.16.2.tgz#6ecca1e0f8c156d141597559848df64730a6bbc1" @@ -6969,15 +7192,6 @@ shellwords@^0.1.1: resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b" integrity sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww== -side-channel@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.4.tgz#efce5c8fdc104ee751b25c58d4290011fa5ea2cf" - integrity sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw== - dependencies: - call-bind "^1.0.0" - get-intrinsic "^1.0.2" - object-inspect "^1.9.0" - signal-exit@^3.0.0, signal-exit@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" @@ -7012,14 +7226,7 @@ slash@^3.0.0: resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== -slice-ansi@1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-1.0.0.tgz#044f1a49d8842ff307aad6b505ed178bd950134d" - integrity sha512-POqxBK6Lb3q6s047D/XsDVNPnF9Dl8JSaqe9h9lURl0OdNqy/ujDrOiIHtsqXMGbWWTIomRzAMaTyawAU//Reg== - dependencies: - is-fullwidth-code-point "^2.0.0" - -slice-ansi@^2.0.0: +slice-ansi@^2.0.0, slice-ansi@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-2.1.0.tgz#cacd7693461a637a5788d92a7dd4fba068e81636" integrity sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ== @@ -7256,33 +7463,6 @@ string-width@^4.1.0, string-width@^4.2.0: is-fullwidth-code-point "^3.0.0" strip-ansi "^6.0.0" -string.prototype.matchall@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/string.prototype.matchall/-/string.prototype.matchall-2.0.0.tgz#2af8fe3d2d6dc53ca2a59bd376b089c3c152b3c8" - integrity sha512-WoZ+B2ypng1dp4iFLF2kmZlwwlE19gmjgKuhL1FJfDgCREWb3ye3SDVHSzLH6bxfnvYmkCxbzkmWcQZHA4P//Q== - dependencies: - define-properties "^1.1.2" - es-abstract "^1.10.0" - function-bind "^1.1.1" - has-symbols "^1.0.0" - regexp.prototype.flags "^1.2.0" - -string.prototype.trimend@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/string.prototype.trimend/-/string.prototype.trimend-1.0.4.tgz#e75ae90c2942c63504686c18b287b4a0b1a45f80" - integrity sha512-y9xCjw1P23Awk8EvTpcyL2NIr1j7wJ39f+k6lvRnSMz+mz9CGz9NYPelDk42kOz6+ql8xjfK8oYzy3jAP5QU5A== - dependencies: - call-bind "^1.0.2" - define-properties "^1.1.3" - -string.prototype.trimstart@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/string.prototype.trimstart/-/string.prototype.trimstart-1.0.4.tgz#b36399af4ab2999b4c9c648bd7a3fb2bb26feeed" - integrity sha512-jh6e984OBfvxS50tdY2nRZnoC5/mLFKOREQfw8t5yytkoUsJRNxvI/E39qu1sD0OtWI3OC0XgKSmcWwziwYuZw== - dependencies: - call-bind "^1.0.2" - define-properties "^1.1.3" - string_decoder@~1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" @@ -7340,7 +7520,12 @@ strip-final-newline@^2.0.0: resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad" integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA== -strip-json-comments@^2.0.1, strip-json-comments@~2.0.1: +strip-json-comments@^3.0.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" + integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== + +strip-json-comments@~2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo= @@ -7350,11 +7535,6 @@ sudo-prompt@^9.0.0: resolved "https://registry.yarnpkg.com/sudo-prompt/-/sudo-prompt-9.1.1.tgz#73853d729770392caec029e2470db9c221754db0" integrity sha512-es33J1g2HjMpyAhz8lOR+ICmXXAqTuKbuXuUWLhOLew20oN9oUCgCJx615U/v7aioZg7IX5lIh9x34vwneu4pA== -supports-color@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" - integrity sha1-U10EXOa2Nj+kARcIRimZXp3zJMc= - supports-color@^5.3.0: version "5.5.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" @@ -7394,17 +7574,15 @@ symbol-tree@^3.2.4: resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2" integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw== -table@^4.0.3: - version "4.0.3" - resolved "https://registry.yarnpkg.com/table/-/table-4.0.3.tgz#00b5e2b602f1794b9acaf9ca908a76386a7813bc" - integrity sha512-S7rnFITmBH1EnyKcvxBh1LjYeQMmnZtCXSEbHcH6S0NoKit24ZuFO/T1vDcLdYsLQkM188PVVhQmzKIuThNkKg== +table@^5.2.3: + version "5.4.6" + resolved "https://registry.yarnpkg.com/table/-/table-5.4.6.tgz#1292d19500ce3f86053b05f0e8e7e4a3bb21079e" + integrity sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug== dependencies: - ajv "^6.0.1" - ajv-keywords "^3.0.0" - chalk "^2.1.0" - lodash "^4.17.4" - slice-ansi "1.0.0" - string-width "^2.1.1" + ajv "^6.10.2" + lodash "^4.17.14" + slice-ansi "^2.1.0" + string-width "^3.0.0" tail@^2.0.0: version "2.0.2" @@ -7598,6 +7776,18 @@ truncate-utf8-bytes@^1.0.0: dependencies: utf8-byte-length "^1.0.1" +tslib@^1.8.1, tslib@^1.9.0: + version "1.14.1" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" + integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== + +tsutils@^3.21.0: + version "3.21.0" + resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.21.0.tgz#b48717d394cea6c1e096983eed58e9d61715b623" + integrity sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA== + dependencies: + tslib "^1.8.1" + tunnel-agent@^0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" @@ -7649,6 +7839,11 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= +typescript@4.4.2: + version "4.4.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.4.2.tgz#6d618640d430e3569a1dfb44f7d7e600ced3ee86" + integrity sha512-gzP+t5W4hdy4c+68bfcv0t400HVJMMd2+H9B7gae1nQlBzCqvrXX+6GL/b3GAgyTH966pzrZ70/fRjwAtZksSQ== + ua-parser-js@^0.7.18: version "0.7.18" resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.18.tgz#a7bfd92f56edfb117083b69e31d2aa8882d4b1ed" @@ -7672,16 +7867,6 @@ ultron@~1.1.0: resolved "https://registry.yarnpkg.com/ultron/-/ultron-1.1.1.tgz#9fe1536a10a664a65266a1e3ccf85fd36302bc9c" integrity sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og== -unbox-primitive@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/unbox-primitive/-/unbox-primitive-1.0.1.tgz#085e215625ec3162574dc8859abee78a59b14471" - integrity sha512-tZU/3NqK3dA5gpE1KtyiJUrEB0lxnGkMFHptJ7q6ewdZ8s12QrODwNbhIJStmJkd1QDXa1NRA8aF2A1zk/Ypyw== - dependencies: - function-bind "^1.1.1" - has-bigints "^1.0.1" - has-symbols "^1.0.2" - which-boxed-primitive "^1.0.2" - unicode-canonical-property-names-ecmascript@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz#2619800c4c825800efdd8343af7dd9933cbe2818" @@ -7785,6 +7970,11 @@ uuid@^7.0.3: resolved "https://registry.yarnpkg.com/uuid/-/uuid-7.0.3.tgz#c5c9f2c8cf25dc0a372c4df1441c41f5bd0c680b" integrity sha512-DPSke0pXhTZgoF/d+WSt2QaKMCFSfx7QegxEWT+JOuHF5aWrKEn0G+ztjuJg/gG8/ItK+rbPCD/yNv8yyih6Cg== +v8-compile-cache@^2.0.3: + version "2.3.0" + resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz#2de19618c66dc247dcfb6f99338035d8245a2cee" + integrity sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA== + v8-to-istanbul@^4.1.3: version "4.1.3" resolved "https://registry.yarnpkg.com/v8-to-istanbul/-/v8-to-istanbul-4.1.3.tgz#22fe35709a64955f49a08a7c7c959f6520ad6f20" @@ -7890,17 +8080,6 @@ whatwg-url@^8.0.0: tr46 "^2.0.0" webidl-conversions "^5.0.0" -which-boxed-primitive@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz#13757bc89b209b049fe5d86430e21cf40a89a8e6" - integrity sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg== - dependencies: - is-bigint "^1.0.1" - is-boolean-object "^1.1.0" - is-number-object "^1.0.4" - is-string "^1.0.5" - is-symbol "^1.0.3" - which-module@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" @@ -7996,10 +8175,10 @@ write-file-atomic@^3.0.0: signal-exit "^3.0.2" typedarray-to-buffer "^3.1.5" -write@^0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/write/-/write-0.2.1.tgz#5fc03828e264cea3fe91455476f7a3c566cb0757" - integrity sha1-X8A4KOJkzqP+kUVUdvejxWbLB1c= +write@1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/write/-/write-1.0.3.tgz#0800e14523b923a387e415123c865616aae0f5c3" + integrity sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig== dependencies: mkdirp "^0.5.1" @@ -8104,6 +8283,11 @@ yallist@^3.0.0, yallist@^3.0.2: resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.0.2.tgz#8452b4bb7e83c7c188d8041c1a837c773d6d8bb9" integrity sha1-hFK0u36Dx8GI2AQcGoN8dz1ti7k= +yallist@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" + integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== + yargs-parser@^13.0.0: version "13.0.0" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-13.0.0.tgz#3fc44f3e76a8bdb1cc3602e860108602e5ccde8b"