mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Compare commits
110
Commits
@@ -3,9 +3,23 @@
|
||||
LastUpgradeVersion = "0700"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
parallelizeBuildables = "NO"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "83CBBA2D1A601D0E00E9B192"
|
||||
BuildableName = "libReact.a"
|
||||
BlueprintName = "React"
|
||||
ReferencedContainer = "container:../../React/React.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
@@ -23,10 +37,10 @@
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
buildConfiguration = "Debug">
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
@@ -42,11 +56,11 @@
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Debug"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
@@ -65,10 +79,10 @@
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Release"
|
||||
debugDocumentVersioning = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
|
||||
@@ -299,7 +299,7 @@ var SearchScreen = React.createClass({
|
||||
onEndReached={this.onEndReached}
|
||||
automaticallyAdjustContentInsets={false}
|
||||
keyboardDismissMode="on-drag"
|
||||
keyboardShouldPersistTaps={true}
|
||||
keyboardShouldPersistTaps="handled"
|
||||
showsVerticalScrollIndicator={false}
|
||||
/>;
|
||||
|
||||
|
||||
@@ -3,9 +3,23 @@
|
||||
LastUpgradeVersion = "0700"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
parallelizeBuildables = "NO"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "83CBBA2D1A601D0E00E9B192"
|
||||
BuildableName = "libReact.a"
|
||||
BlueprintName = "React"
|
||||
ReferencedContainer = "container:../../React/React.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
@@ -23,10 +37,10 @@
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
buildConfiguration = "Debug">
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
@@ -42,11 +56,11 @@
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Debug"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
@@ -65,10 +79,10 @@
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Release"
|
||||
debugDocumentVersioning = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
|
||||
@@ -95,7 +95,6 @@
|
||||
2DD323E11DA2DDBF000FE1B8 /* legacy_image@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3D2AFAF41D646CF80089D1A3 /* legacy_image@2x.png */; };
|
||||
2DD323E21DA2DDBF000FE1B8 /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB61A68108700A75B9A /* Info.plist */; };
|
||||
2DD323E31DA2DE3F000FE1B8 /* libRCTAnimation-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2DD323B51DA2DD8B000FE1B8 /* libRCTAnimation-tvOS.a */; };
|
||||
2DD323E41DA2DE3F000FE1B8 /* libRCTImage-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2DD323BB1DA2DD8B000FE1B8 /* libRCTImage-tvOS.a */; };
|
||||
2DD323E51DA2DE3F000FE1B8 /* libRCTLinking-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2DD323BF1DA2DD8B000FE1B8 /* libRCTLinking-tvOS.a */; };
|
||||
2DD323E61DA2DE3F000FE1B8 /* libRCTNetwork-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2DD323C31DA2DD8B000FE1B8 /* libRCTNetwork-tvOS.a */; };
|
||||
2DD323E71DA2DE3F000FE1B8 /* libRCTSettings-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2DD323C81DA2DD8B000FE1B8 /* libRCTSettings-tvOS.a */; };
|
||||
@@ -109,6 +108,7 @@
|
||||
3D13F84A1D6F6AFD00E69E0E /* OtherImages.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3D13F8451D6F6AF200E69E0E /* OtherImages.xcassets */; };
|
||||
3D299BAF1D33EBFA00FA1057 /* RCTLoggingTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D299BAE1D33EBFA00FA1057 /* RCTLoggingTests.m */; };
|
||||
3D2AFAF51D646CF80089D1A3 /* legacy_image@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3D2AFAF41D646CF80089D1A3 /* legacy_image@2x.png */; };
|
||||
3D302F221DF8285100D6DDAE /* libRCTImage-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2DD323BB1DA2DD8B000FE1B8 /* libRCTImage-tvOS.a */; };
|
||||
3D56F9F11D6F6E9B00F53A06 /* UIExplorerBundle.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 3D13F83E1D6F6AE000E69E0E /* UIExplorerBundle.bundle */; };
|
||||
3DB99D0C1BA0340600302749 /* UIExplorerIntegrationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3DB99D0B1BA0340600302749 /* UIExplorerIntegrationTests.m */; };
|
||||
3DD981D61D33C6FB007DC7BE /* TestBundle.js in Resources */ = {isa = PBXBuildFile; fileRef = 3DD981D51D33C6FB007DC7BE /* TestBundle.js */; };
|
||||
@@ -337,14 +337,14 @@
|
||||
containerPortal = 14AADEFF1AC3DB95002390C9 /* React.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = 3D3C059A1DE3340900C268FA;
|
||||
remoteInfo = CSSLayout;
|
||||
remoteInfo = yoga;
|
||||
};
|
||||
3D3C08821DE3424E00C268FA /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 14AADEFF1AC3DB95002390C9 /* React.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = 3D3C06751DE3340C00C268FA;
|
||||
remoteInfo = "CSSLayout-tvOS";
|
||||
remoteInfo = "yoga-tvOS";
|
||||
};
|
||||
58005BED1ABA80530062E044 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
@@ -513,15 +513,15 @@
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
2DD323EA1DA2DE3F000FE1B8 /* libReact-tvOS.a in Frameworks */,
|
||||
2DD323E31DA2DE3F000FE1B8 /* libRCTAnimation-tvOS.a in Frameworks */,
|
||||
2DD323E41DA2DE3F000FE1B8 /* libRCTImage-tvOS.a in Frameworks */,
|
||||
3D302F221DF8285100D6DDAE /* libRCTImage-tvOS.a in Frameworks */,
|
||||
2DD323E51DA2DE3F000FE1B8 /* libRCTLinking-tvOS.a in Frameworks */,
|
||||
2DD323E61DA2DE3F000FE1B8 /* libRCTNetwork-tvOS.a in Frameworks */,
|
||||
3D05746D1DE6008900184BB4 /* libRCTPushNotification-tvOS.a in Frameworks */,
|
||||
2DD323E71DA2DE3F000FE1B8 /* libRCTSettings-tvOS.a in Frameworks */,
|
||||
2DD323E81DA2DE3F000FE1B8 /* libRCTText-tvOS.a in Frameworks */,
|
||||
2DD323E91DA2DE3F000FE1B8 /* libRCTWebSocket-tvOS.a in Frameworks */,
|
||||
2DD323EA1DA2DE3F000FE1B8 /* libReact-tvOS.a in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -726,8 +726,8 @@
|
||||
children = (
|
||||
14AADF041AC3DB95002390C9 /* libReact.a */,
|
||||
2DD323D91DA2DD8B000FE1B8 /* libReact-tvOS.a */,
|
||||
3D3C08811DE3424E00C268FA /* libCSSLayout.a */,
|
||||
3D3C08831DE3424E00C268FA /* libCSSLayout-tvOS.a */,
|
||||
3D3C08811DE3424E00C268FA /* libyoga.a */,
|
||||
3D3C08831DE3424E00C268FA /* libyoga-tvOS.a */,
|
||||
3D05748C1DE6008900184BB4 /* libcxxreact.a */,
|
||||
3D05748E1DE6008900184BB4 /* libcxxreact-tvOS.a */,
|
||||
3D0574901DE6008900184BB4 /* libjschelpers.a */,
|
||||
@@ -1290,17 +1290,17 @@
|
||||
remoteRef = 3D0574911DE6008900184BB4 /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
3D3C08811DE3424E00C268FA /* libCSSLayout.a */ = {
|
||||
3D3C08811DE3424E00C268FA /* libyoga.a */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = archive.ar;
|
||||
path = libCSSLayout.a;
|
||||
path = libyoga.a;
|
||||
remoteRef = 3D3C08801DE3424E00C268FA /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
3D3C08831DE3424E00C268FA /* libCSSLayout-tvOS.a */ = {
|
||||
3D3C08831DE3424E00C268FA /* libyoga-tvOS.a */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = archive.ar;
|
||||
path = "libCSSLayout-tvOS.a";
|
||||
path = "libyoga-tvOS.a";
|
||||
remoteRef = 3D3C08821DE3424E00C268FA /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
@@ -1627,6 +1627,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
DEVELOPMENT_TEAM = V9WTTPBFK9;
|
||||
INFOPLIST_FILE = "$(SRCROOT)/UIExplorer/Info.plist";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited)";
|
||||
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
||||
@@ -1892,7 +1893,6 @@
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_LABEL = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
@@ -1952,7 +1952,6 @@
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_LABEL = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
OTHER_LDFLAGS = (
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "2D2A28121D9B038B00D4039D"
|
||||
BuildableName = "libReact-tvOS.a"
|
||||
BuildableName = "libReact.a"
|
||||
BlueprintName = "React-tvOS"
|
||||
ReferencedContainer = "container:../../React/React.xcodeproj">
|
||||
</BuildableReference>
|
||||
|
||||
@@ -28,10 +28,10 @@
|
||||
{
|
||||
[super setUp];
|
||||
|
||||
self.parentView = [self _shadowViewWithConfig:^(CSSNodeRef node) {
|
||||
CSSNodeStyleSetFlexDirection(node, CSSFlexDirectionColumn);
|
||||
CSSNodeStyleSetWidth(node, 440);
|
||||
CSSNodeStyleSetHeight(node, 440);
|
||||
self.parentView = [self _shadowViewWithConfig:^(YGNodeRef node) {
|
||||
YGNodeStyleSetFlexDirection(node, YGFlexDirectionColumn);
|
||||
YGNodeStyleSetWidth(node, 440);
|
||||
YGNodeStyleSetHeight(node, 440);
|
||||
}];
|
||||
self.parentView.reactTag = @1; // must be valid rootView tag
|
||||
}
|
||||
@@ -50,43 +50,43 @@
|
||||
//
|
||||
- (void)testApplyingLayoutRecursivelyToShadowView
|
||||
{
|
||||
RCTShadowView *leftView = [self _shadowViewWithConfig:^(CSSNodeRef node) {
|
||||
CSSNodeStyleSetFlex(node, 1);
|
||||
RCTShadowView *leftView = [self _shadowViewWithConfig:^(YGNodeRef node) {
|
||||
YGNodeStyleSetFlex(node, 1);
|
||||
}];
|
||||
|
||||
RCTShadowView *centerView = [self _shadowViewWithConfig:^(CSSNodeRef node) {
|
||||
CSSNodeStyleSetFlex(node, 2);
|
||||
CSSNodeStyleSetMargin(node, CSSEdgeLeft, 10);
|
||||
CSSNodeStyleSetMargin(node, CSSEdgeRight, 10);
|
||||
RCTShadowView *centerView = [self _shadowViewWithConfig:^(YGNodeRef node) {
|
||||
YGNodeStyleSetFlex(node, 2);
|
||||
YGNodeStyleSetMargin(node, YGEdgeLeft, 10);
|
||||
YGNodeStyleSetMargin(node, YGEdgeRight, 10);
|
||||
}];
|
||||
|
||||
RCTShadowView *rightView = [self _shadowViewWithConfig:^(CSSNodeRef node) {
|
||||
CSSNodeStyleSetFlex(node, 1);
|
||||
RCTShadowView *rightView = [self _shadowViewWithConfig:^(YGNodeRef node) {
|
||||
YGNodeStyleSetFlex(node, 1);
|
||||
}];
|
||||
|
||||
RCTShadowView *mainView = [self _shadowViewWithConfig:^(CSSNodeRef node) {
|
||||
CSSNodeStyleSetFlexDirection(node, CSSFlexDirectionRow);
|
||||
CSSNodeStyleSetFlex(node, 2);
|
||||
CSSNodeStyleSetMargin(node, CSSEdgeTop, 10);
|
||||
CSSNodeStyleSetMargin(node, CSSEdgeBottom, 10);
|
||||
RCTShadowView *mainView = [self _shadowViewWithConfig:^(YGNodeRef node) {
|
||||
YGNodeStyleSetFlexDirection(node, YGFlexDirectionRow);
|
||||
YGNodeStyleSetFlex(node, 2);
|
||||
YGNodeStyleSetMargin(node, YGEdgeTop, 10);
|
||||
YGNodeStyleSetMargin(node, YGEdgeBottom, 10);
|
||||
}];
|
||||
|
||||
[mainView insertReactSubview:leftView atIndex:0];
|
||||
[mainView insertReactSubview:centerView atIndex:1];
|
||||
[mainView insertReactSubview:rightView atIndex:2];
|
||||
|
||||
RCTShadowView *headerView = [self _shadowViewWithConfig:^(CSSNodeRef node) {
|
||||
CSSNodeStyleSetFlex(node, 1);
|
||||
RCTShadowView *headerView = [self _shadowViewWithConfig:^(YGNodeRef node) {
|
||||
YGNodeStyleSetFlex(node, 1);
|
||||
}];
|
||||
|
||||
RCTShadowView *footerView = [self _shadowViewWithConfig:^(CSSNodeRef node) {
|
||||
CSSNodeStyleSetFlex(node, 1);
|
||||
RCTShadowView *footerView = [self _shadowViewWithConfig:^(YGNodeRef node) {
|
||||
YGNodeStyleSetFlex(node, 1);
|
||||
}];
|
||||
|
||||
CSSNodeStyleSetPadding(self.parentView.cssNode, CSSEdgeLeft, 10);
|
||||
CSSNodeStyleSetPadding(self.parentView.cssNode, CSSEdgeTop, 10);
|
||||
CSSNodeStyleSetPadding(self.parentView.cssNode, CSSEdgeRight, 10);
|
||||
CSSNodeStyleSetPadding(self.parentView.cssNode, CSSEdgeBottom, 10);
|
||||
YGNodeStyleSetPadding(self.parentView.cssNode, YGEdgeLeft, 10);
|
||||
YGNodeStyleSetPadding(self.parentView.cssNode, YGEdgeTop, 10);
|
||||
YGNodeStyleSetPadding(self.parentView.cssNode, YGEdgeRight, 10);
|
||||
YGNodeStyleSetPadding(self.parentView.cssNode, YGEdgeBottom, 10);
|
||||
|
||||
[self.parentView insertReactSubview:headerView atIndex:0];
|
||||
[self.parentView insertReactSubview:mainView atIndex:1];
|
||||
@@ -108,18 +108,18 @@
|
||||
|
||||
- (void)testAncestorCheck
|
||||
{
|
||||
RCTShadowView *centerView = [self _shadowViewWithConfig:^(CSSNodeRef node) {
|
||||
CSSNodeStyleSetFlex(node, 1);
|
||||
RCTShadowView *centerView = [self _shadowViewWithConfig:^(YGNodeRef node) {
|
||||
YGNodeStyleSetFlex(node, 1);
|
||||
}];
|
||||
|
||||
RCTShadowView *mainView = [self _shadowViewWithConfig:^(CSSNodeRef node) {
|
||||
CSSNodeStyleSetFlex(node, 1);
|
||||
RCTShadowView *mainView = [self _shadowViewWithConfig:^(YGNodeRef node) {
|
||||
YGNodeStyleSetFlex(node, 1);
|
||||
}];
|
||||
|
||||
[mainView insertReactSubview:centerView atIndex:0];
|
||||
|
||||
RCTShadowView *footerView = [self _shadowViewWithConfig:^(CSSNodeRef node) {
|
||||
CSSNodeStyleSetFlex(node, 1);
|
||||
RCTShadowView *footerView = [self _shadowViewWithConfig:^(YGNodeRef node) {
|
||||
YGNodeStyleSetFlex(node, 1);
|
||||
}];
|
||||
|
||||
[self.parentView insertReactSubview:mainView atIndex:0];
|
||||
@@ -131,10 +131,10 @@
|
||||
|
||||
- (void)testAssignsSuggestedWidthDimension
|
||||
{
|
||||
[self _withShadowViewWithStyle:^(CSSNodeRef node) {
|
||||
CSSNodeStyleSetPosition(node, CSSEdgeLeft, 0);
|
||||
CSSNodeStyleSetPosition(node, CSSEdgeTop, 0);
|
||||
CSSNodeStyleSetHeight(node, 10);
|
||||
[self _withShadowViewWithStyle:^(YGNodeRef node) {
|
||||
YGNodeStyleSetPosition(node, YGEdgeLeft, 0);
|
||||
YGNodeStyleSetPosition(node, YGEdgeTop, 0);
|
||||
YGNodeStyleSetHeight(node, 10);
|
||||
}
|
||||
assertRelativeLayout:CGRectMake(0, 0, 3, 10)
|
||||
withIntrinsicContentSize:CGSizeMake(3, UIViewNoIntrinsicMetric)];
|
||||
@@ -142,10 +142,10 @@
|
||||
|
||||
- (void)testAssignsSuggestedHeightDimension
|
||||
{
|
||||
[self _withShadowViewWithStyle:^(CSSNodeRef node) {
|
||||
CSSNodeStyleSetPosition(node, CSSEdgeLeft, 0);
|
||||
CSSNodeStyleSetPosition(node, CSSEdgeTop, 0);
|
||||
CSSNodeStyleSetWidth(node, 10);
|
||||
[self _withShadowViewWithStyle:^(YGNodeRef node) {
|
||||
YGNodeStyleSetPosition(node, YGEdgeLeft, 0);
|
||||
YGNodeStyleSetPosition(node, YGEdgeTop, 0);
|
||||
YGNodeStyleSetWidth(node, 10);
|
||||
}
|
||||
assertRelativeLayout:CGRectMake(0, 0, 10, 4)
|
||||
withIntrinsicContentSize:CGSizeMake(UIViewNoIntrinsicMetric, 4)];
|
||||
@@ -153,11 +153,11 @@
|
||||
|
||||
- (void)testDoesNotOverrideDimensionStyleWithSuggestedDimensions
|
||||
{
|
||||
[self _withShadowViewWithStyle:^(CSSNodeRef node) {
|
||||
CSSNodeStyleSetPosition(node, CSSEdgeLeft, 0);
|
||||
CSSNodeStyleSetPosition(node, CSSEdgeTop, 0);
|
||||
CSSNodeStyleSetWidth(node, 10);
|
||||
CSSNodeStyleSetHeight(node, 10);
|
||||
[self _withShadowViewWithStyle:^(YGNodeRef node) {
|
||||
YGNodeStyleSetPosition(node, YGEdgeLeft, 0);
|
||||
YGNodeStyleSetPosition(node, YGEdgeTop, 0);
|
||||
YGNodeStyleSetWidth(node, 10);
|
||||
YGNodeStyleSetHeight(node, 10);
|
||||
}
|
||||
assertRelativeLayout:CGRectMake(0, 0, 10, 10)
|
||||
withIntrinsicContentSize:CGSizeMake(3, 4)];
|
||||
@@ -165,16 +165,16 @@
|
||||
|
||||
- (void)testDoesNotAssignSuggestedDimensionsWhenStyledWithFlexAttribute
|
||||
{
|
||||
float parentWidth = CSSNodeStyleGetWidth(self.parentView.cssNode);
|
||||
float parentHeight = CSSNodeStyleGetHeight(self.parentView.cssNode);
|
||||
[self _withShadowViewWithStyle:^(CSSNodeRef node) {
|
||||
CSSNodeStyleSetFlex(node, 1);
|
||||
float parentWidth = YGNodeStyleGetWidth(self.parentView.cssNode);
|
||||
float parentHeight = YGNodeStyleGetHeight(self.parentView.cssNode);
|
||||
[self _withShadowViewWithStyle:^(YGNodeRef node) {
|
||||
YGNodeStyleSetFlex(node, 1);
|
||||
}
|
||||
assertRelativeLayout:CGRectMake(0, 0, parentWidth, parentHeight)
|
||||
withIntrinsicContentSize:CGSizeMake(3, 4)];
|
||||
}
|
||||
|
||||
- (void)_withShadowViewWithStyle:(void(^)(CSSNodeRef node))configBlock
|
||||
- (void)_withShadowViewWithStyle:(void(^)(YGNodeRef node))configBlock
|
||||
assertRelativeLayout:(CGRect)expectedRect
|
||||
withIntrinsicContentSize:(CGSize)contentSize
|
||||
{
|
||||
@@ -189,7 +189,7 @@
|
||||
NSStringFromCGRect(actualRect));
|
||||
}
|
||||
|
||||
- (RCTRootShadowView *)_shadowViewWithConfig:(void(^)(CSSNodeRef node))configBlock
|
||||
- (RCTRootShadowView *)_shadowViewWithConfig:(void(^)(YGNodeRef node))configBlock
|
||||
{
|
||||
RCTRootShadowView *shadowView = [RCTRootShadowView new];
|
||||
configBlock(shadowView.cssNode);
|
||||
|
||||
@@ -411,6 +411,23 @@ class TextExample extends React.Component {
|
||||
This very long text should be truncated with dots in the beginning.
|
||||
</Text>
|
||||
</UIExplorerBlock>
|
||||
<UIExplorerBlock title="Include Font Padding">
|
||||
<View style={{flexDirection: 'row', justifyContent: 'space-around', marginBottom: 10}}>
|
||||
<View style={{alignItems: 'center'}}>
|
||||
<Text style={styles.includeFontPaddingText}>
|
||||
Ey
|
||||
</Text>
|
||||
<Text>Default</Text>
|
||||
</View>
|
||||
<View style={{alignItems: 'center'}}>
|
||||
<Text style={[styles.includeFontPaddingText, {includeFontPadding: false, marginLeft: 10}]}>
|
||||
Ey
|
||||
</Text>
|
||||
<Text>includeFontPadding: false</Text>
|
||||
</View>
|
||||
</View>
|
||||
<Text>By default Android will put extra space above text to allow for upper-case accents or other ascenders. With some fonts, this can make text look slightly misaligned when centered vertically.</Text>
|
||||
</UIExplorerBlock>
|
||||
</UIExplorerPage>
|
||||
);
|
||||
}
|
||||
@@ -421,6 +438,14 @@ var styles = StyleSheet.create({
|
||||
left: 5,
|
||||
backgroundColor: 'rgba(100, 100, 100, 0.3)'
|
||||
},
|
||||
includeFontPaddingText: {
|
||||
fontSize: 120,
|
||||
fontFamily: 'sans-serif',
|
||||
backgroundColor: '#EEEEEE',
|
||||
color: '#000000',
|
||||
textAlignVertical: 'center',
|
||||
alignSelf: 'center',
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = TextExample;
|
||||
|
||||
@@ -82,7 +82,7 @@ class UIExplorerExampleList extends React.Component {
|
||||
renderRow={this._renderExampleRow.bind(this)}
|
||||
renderSectionHeader={this._renderSectionHeader}
|
||||
enableEmptySections={true}
|
||||
keyboardShouldPersistTaps={true}
|
||||
keyboardShouldPersistTaps="handled"
|
||||
automaticallyAdjustContentInsets={false}
|
||||
keyboardDismissMode="on-drag"
|
||||
/>
|
||||
|
||||
@@ -35,13 +35,11 @@ var UIExplorerTitle = require('./UIExplorerTitle');
|
||||
|
||||
class UIExplorerPage extends React.Component {
|
||||
props: {
|
||||
keyboardShouldPersistTaps?: boolean,
|
||||
noScroll?: boolean,
|
||||
noSpacer?: boolean,
|
||||
};
|
||||
|
||||
static propTypes = {
|
||||
keyboardShouldPersistTaps: React.PropTypes.bool,
|
||||
noScroll: React.PropTypes.bool,
|
||||
noSpacer: React.PropTypes.bool,
|
||||
};
|
||||
@@ -55,7 +53,7 @@ class UIExplorerPage extends React.Component {
|
||||
ContentWrapper = (ScrollView: ReactClass<any>);
|
||||
// $FlowFixMe found when converting React.createClass to ES6
|
||||
wrapperProps.automaticallyAdjustContentInsets = !this.props.title;
|
||||
wrapperProps.keyboardShouldPersistTaps = true;
|
||||
wrapperProps.keyboardShouldPersistTaps = 'handled';
|
||||
wrapperProps.keyboardDismissMode = 'interactive';
|
||||
}
|
||||
var title = this.props.title ?
|
||||
|
||||
@@ -275,15 +275,11 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
||||
"$(SRCROOT)/../../React/**",
|
||||
);
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
SKIP_INSTALL = YES;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -314,14 +310,10 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
||||
"$(SRCROOT)/../../React/**",
|
||||
);
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
SKIP_INSTALL = YES;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Release;
|
||||
@@ -331,7 +323,6 @@
|
||||
buildSettings = {
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -340,7 +331,6 @@
|
||||
buildSettings = {
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#import "UIView+React.h"
|
||||
#import <React/UIView+React.h>
|
||||
|
||||
/**
|
||||
* ART nodes are implemented as empty UIViews but this is just an implementation detail to fit
|
||||
|
||||
@@ -9,8 +9,9 @@
|
||||
|
||||
#import "ARTSurfaceView.h"
|
||||
|
||||
#import <React/RCTLog.h>
|
||||
|
||||
#import "ARTNode.h"
|
||||
#import "RCTLog.h"
|
||||
|
||||
@implementation ARTSurfaceView
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#import "ARTBrush.h"
|
||||
|
||||
#import "RCTDefines.h"
|
||||
#import <React/RCTDefines.h>
|
||||
|
||||
@implementation ARTBrush
|
||||
|
||||
|
||||
@@ -9,8 +9,9 @@
|
||||
|
||||
#import "ARTLinearGradient.h"
|
||||
|
||||
#import <React/RCTLog.h>
|
||||
|
||||
#import "RCTConvert+ART.h"
|
||||
#import "RCTLog.h"
|
||||
|
||||
@implementation ARTLinearGradient
|
||||
{
|
||||
|
||||
@@ -9,8 +9,9 @@
|
||||
|
||||
#import "ARTPattern.h"
|
||||
|
||||
#import <React/RCTLog.h>
|
||||
|
||||
#import "RCTConvert+ART.h"
|
||||
#import "RCTLog.h"
|
||||
|
||||
@implementation ARTPattern
|
||||
{
|
||||
|
||||
@@ -9,8 +9,9 @@
|
||||
|
||||
#import "ARTRadialGradient.h"
|
||||
|
||||
#import <React/RCTLog.h>
|
||||
|
||||
#import "RCTConvert+ART.h"
|
||||
#import "RCTLog.h"
|
||||
|
||||
@implementation ARTRadialGradient
|
||||
{
|
||||
|
||||
@@ -9,8 +9,9 @@
|
||||
|
||||
#import "ARTSolidColor.h"
|
||||
|
||||
#import <React/RCTLog.h>
|
||||
|
||||
#import "RCTConvert+ART.h"
|
||||
#import "RCTLog.h"
|
||||
|
||||
@implementation ARTSolidColor
|
||||
{
|
||||
|
||||
@@ -9,10 +9,11 @@
|
||||
|
||||
#import <QuartzCore/QuartzCore.h>
|
||||
|
||||
#import <React/RCTConvert.h>
|
||||
|
||||
#import "ARTBrush.h"
|
||||
#import "ARTCGFloatArray.h"
|
||||
#import "ARTTextFrame.h"
|
||||
#import "RCTConvert.h"
|
||||
|
||||
@interface RCTConvert (ART)
|
||||
|
||||
|
||||
@@ -9,12 +9,13 @@
|
||||
|
||||
#import "RCTConvert+ART.h"
|
||||
|
||||
#import <React/RCTFont.h>
|
||||
#import <React/RCTLog.h>
|
||||
|
||||
#import "ARTLinearGradient.h"
|
||||
#import "ARTPattern.h"
|
||||
#import "ARTRadialGradient.h"
|
||||
#import "ARTSolidColor.h"
|
||||
#import "RCTLog.h"
|
||||
#import "RCTFont.h"
|
||||
|
||||
@implementation RCTConvert (ART)
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ var ReactNativeViewAttributes = require('ReactNativeViewAttributes');
|
||||
|
||||
var createReactNativeComponentClass = require('createReactNativeComponentClass');
|
||||
var merge = require('merge');
|
||||
var invariant = require('fbjs/lib/invariant');
|
||||
|
||||
// Diff Helpers
|
||||
|
||||
@@ -137,6 +138,14 @@ function childrenAsString(children) {
|
||||
// Surface - Root node of all ART
|
||||
|
||||
class Surface extends React.Component {
|
||||
static childContextTypes = {
|
||||
isInSurface: React.PropTypes.bool,
|
||||
};
|
||||
|
||||
getChildContext() {
|
||||
return { isInSurface: true };
|
||||
}
|
||||
|
||||
render() {
|
||||
var props = this.props;
|
||||
var w = extractNumber(props.width, 0);
|
||||
@@ -203,8 +212,16 @@ function extractOpacity(props) {
|
||||
// ReactART.
|
||||
|
||||
class Group extends React.Component {
|
||||
static contextTypes = {
|
||||
isInSurface: React.PropTypes.bool.isRequired,
|
||||
};
|
||||
|
||||
render() {
|
||||
var props = this.props;
|
||||
invariant(
|
||||
this.context.isInSurface,
|
||||
'ART: <Group /> must be a child of a <Surface />'
|
||||
);
|
||||
return (
|
||||
<NativeGroup
|
||||
opacity={extractOpacity(props)}
|
||||
|
||||
@@ -7,8 +7,9 @@
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#import "ARTNode.h"
|
||||
#import "RCTViewManager.h"
|
||||
#import <React/RCTViewManager.h>
|
||||
|
||||
@class ARTNode;
|
||||
|
||||
@interface ARTNodeManager : RCTViewManager
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#import "RCTViewManager.h"
|
||||
#import <React/RCTViewManager.h>
|
||||
|
||||
@interface ARTSurfaceViewManager : RCTViewManager
|
||||
|
||||
|
||||
@@ -132,11 +132,11 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
SKIP_INSTALL = YES;
|
||||
WARNING_CFLAGS = (
|
||||
"-Wextra",
|
||||
"-Wall",
|
||||
@@ -173,10 +173,10 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
SKIP_INSTALL = YES;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
WARNING_CFLAGS = (
|
||||
"-Wextra",
|
||||
@@ -193,7 +193,6 @@
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = RCTActionSheet;
|
||||
RUN_CLANG_STATIC_ANALYZER = YES;
|
||||
SKIP_INSTALL = YES;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -205,7 +204,6 @@
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = RCTActionSheet;
|
||||
RUN_CLANG_STATIC_ANALYZER = NO;
|
||||
SKIP_INSTALL = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
||||
@@ -156,11 +156,11 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
SKIP_INSTALL = YES;
|
||||
WARNING_CFLAGS = (
|
||||
"-Werror",
|
||||
"-Wall",
|
||||
@@ -197,10 +197,10 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
SKIP_INSTALL = YES;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
WARNING_CFLAGS = (
|
||||
"-Werror",
|
||||
@@ -216,7 +216,6 @@
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
RUN_CLANG_STATIC_ANALYZER = YES;
|
||||
SKIP_INSTALL = YES;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -226,7 +225,6 @@
|
||||
CLANG_STATIC_ANALYZER_MODE = deep;
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
||||
@@ -42,7 +42,8 @@ function shouldUseNativeDriver(config: AnimationConfig | EventConfig): boolean {
|
||||
'Animated: `useNativeDriver` is not supported because the native ' +
|
||||
'animated module is missing. Falling back to JS-based animation. To ' +
|
||||
'resolve this, add `RCTAnimation` module to this app, or remove ' +
|
||||
'`useNativeDriver`.'
|
||||
'`useNativeDriver`. ' +
|
||||
'More info: https://github.com/facebook/react-native/issues/11094#issuecomment-263240420'
|
||||
);
|
||||
warnedMissingNativeAnimated = true;
|
||||
}
|
||||
|
||||
@@ -174,11 +174,11 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include/**";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
SKIP_INSTALL = YES;
|
||||
WARNING_CFLAGS = (
|
||||
"-Werror",
|
||||
"-Wall",
|
||||
@@ -215,10 +215,10 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include/**";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
SKIP_INSTALL = YES;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
WARNING_CFLAGS = (
|
||||
"-Werror",
|
||||
@@ -238,7 +238,6 @@
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = RCTCameraRoll;
|
||||
RUN_CLANG_STATIC_ANALYZER = YES;
|
||||
SKIP_INSTALL = YES;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -253,7 +252,6 @@
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = RCTCameraRoll;
|
||||
RUN_CLANG_STATIC_ANALYZER = NO;
|
||||
SKIP_INSTALL = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
||||
@@ -54,8 +54,7 @@ export type AnnotationDragState = $Enum<{
|
||||
|
||||
/**
|
||||
* **IMPORTANT: This component is now DEPRECATED and will be removed
|
||||
* in January 2017 (React Native version 0.42). This component only supports
|
||||
* iOS.**
|
||||
* in React Native version 0.42. This component only supports iOS.**
|
||||
*
|
||||
* **Please use
|
||||
* [react-native-maps](https://github.com/airbnb/react-native-maps) by Airbnb
|
||||
@@ -86,6 +85,19 @@ export type AnnotationDragState = $Enum<{
|
||||
|
||||
const MapView = React.createClass({
|
||||
|
||||
componentWillMount: function() {
|
||||
console.warn(
|
||||
'MapView is now deprecated and will be removed from React Native in version 0.42. ' +
|
||||
'Please use the react-native-maps module which is more feature complete ' +
|
||||
'and works on Android too: https://github.com/airbnb/react-native-maps\n' +
|
||||
'It is actively maintained and used extensively.\n\n' +
|
||||
'Once MapView is removed from React Native in v0.42, we will release the ' +
|
||||
'code as deprecated-react-native-ios-mapview. You will be able to ' +
|
||||
'continue using that and migrate to react-native-maps your own pace later.\n\n' +
|
||||
'For more info, check out https://github.com/facebook/react-native/pull/10500'
|
||||
);
|
||||
},
|
||||
|
||||
mixins: [NativeMethodsMixin],
|
||||
|
||||
propTypes: {
|
||||
|
||||
@@ -18,6 +18,7 @@ var StyleSheet = require('StyleSheet');
|
||||
var StyleSheetPropType = require('StyleSheetPropType');
|
||||
var TextStylePropTypes = require('TextStylePropTypes');
|
||||
var View = require('View');
|
||||
var processColor = require('processColor');
|
||||
|
||||
var itemStylePropType = StyleSheetPropType(TextStylePropTypes);
|
||||
var requireNativeComponent = require('requireNativeComponent');
|
||||
@@ -48,7 +49,11 @@ var PickerIOS = React.createClass({
|
||||
if (child.props.value === props.selectedValue) {
|
||||
selectedIndex = index;
|
||||
}
|
||||
items.push({value: child.props.value, label: child.props.label});
|
||||
items.push({
|
||||
value: child.props.value,
|
||||
label: child.props.label,
|
||||
textColor: processColor(child.props.color),
|
||||
});
|
||||
});
|
||||
return {selectedIndex, items};
|
||||
},
|
||||
@@ -95,6 +100,7 @@ PickerIOS.Item = class extends React.Component {
|
||||
static propTypes = {
|
||||
value: React.PropTypes.any, // string or integer basically
|
||||
label: React.PropTypes.string,
|
||||
color: React.PropTypes.string,
|
||||
};
|
||||
|
||||
render() {
|
||||
|
||||
@@ -18,6 +18,7 @@ var ReactNative = require('ReactNative');
|
||||
var Subscribable = require('Subscribable');
|
||||
var TextInputState = require('TextInputState');
|
||||
var UIManager = require('UIManager');
|
||||
var warning = require('fbjs/lib/warning');
|
||||
|
||||
var { getInstanceFromNode } = require('ReactNativeComponentTree');
|
||||
var { ScrollViewManager } = require('NativeModules');
|
||||
@@ -134,7 +135,7 @@ var ScrollResponderMixin = {
|
||||
// - Determine if the scroll view has been scrolled and therefore should
|
||||
// refuse to give up its responder lock.
|
||||
// - Determine if releasing should dismiss the keyboard when we are in
|
||||
// tap-to-dismiss mode (!this.props.keyboardShouldPersistTaps).
|
||||
// tap-to-dismiss mode (this.props.keyboardShouldPersistTaps !== 'always').
|
||||
observedScrollSinceBecomingResponder: false,
|
||||
becameResponderWhileAnimating: false,
|
||||
};
|
||||
@@ -172,7 +173,14 @@ var ScrollResponderMixin = {
|
||||
* true.
|
||||
*
|
||||
*/
|
||||
scrollResponderHandleStartShouldSetResponder: function(): boolean {
|
||||
scrollResponderHandleStartShouldSetResponder: function(e: Event): boolean {
|
||||
var currentlyFocusedTextInput = TextInputState.currentlyFocusedField();
|
||||
|
||||
if (this.props.keyboardShouldPersistTaps === 'handled' &&
|
||||
currentlyFocusedTextInput != null &&
|
||||
e.target !== currentlyFocusedTextInput) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
@@ -190,7 +198,10 @@ var ScrollResponderMixin = {
|
||||
scrollResponderHandleStartShouldSetResponderCapture: function(e: Event): boolean {
|
||||
// First see if we want to eat taps while the keyboard is up
|
||||
var currentlyFocusedTextInput = TextInputState.currentlyFocusedField();
|
||||
if (!this.props.keyboardShouldPersistTaps &&
|
||||
var {keyboardShouldPersistTaps} = this.props;
|
||||
var keyboardNeverPersistTaps = !keyboardShouldPersistTaps ||
|
||||
keyboardShouldPersistTaps === 'never';
|
||||
if (keyboardNeverPersistTaps &&
|
||||
currentlyFocusedTextInput != null &&
|
||||
!isTagInstanceOfTextInput(e.target)) {
|
||||
return true;
|
||||
@@ -250,7 +261,8 @@ var ScrollResponderMixin = {
|
||||
// By default scroll views will unfocus a textField
|
||||
// if another touch occurs outside of it
|
||||
var currentlyFocusedTextInput = TextInputState.currentlyFocusedField();
|
||||
if (!this.props.keyboardShouldPersistTaps &&
|
||||
if (this.props.keyboardShouldPersistTaps !== true &&
|
||||
this.props.keyboardShouldPersistTaps !== 'always' &&
|
||||
currentlyFocusedTextInput != null &&
|
||||
e.target !== currentlyFocusedTextInput &&
|
||||
!this.state.observedScrollSinceBecomingResponder &&
|
||||
@@ -481,6 +493,13 @@ var ScrollResponderMixin = {
|
||||
* The `keyboardWillShow` is called before input focus.
|
||||
*/
|
||||
componentWillMount: function() {
|
||||
var {keyboardShouldPersistTaps} = this.props;
|
||||
warning(
|
||||
typeof keyboardShouldPersistTaps !== 'boolean',
|
||||
`'keyboardShouldPersistTaps={${keyboardShouldPersistTaps}}' is deprecated. `
|
||||
+ `Use 'keyboardShouldPersistTaps="${keyboardShouldPersistTaps ? "always" : "never"}"' instead`
|
||||
);
|
||||
|
||||
this.keyboardWillOpenTo = null;
|
||||
this.additionalScrollOffset = 0;
|
||||
this.addListenerOn(Keyboard, 'keyboardWillShow', this.scrollResponderKeyboardWillShow);
|
||||
|
||||
@@ -44,6 +44,21 @@ const requireNativeComponent = require('requireNativeComponent');
|
||||
*
|
||||
* Doesn't yet support other contained responders from blocking this scroll
|
||||
* view from becoming the responder.
|
||||
*
|
||||
*
|
||||
* `<ScrollView>` vs `<ListView>` - which one to use?
|
||||
* ScrollView simply renders all its react child components at once. That
|
||||
* makes it very easy to understand and use.
|
||||
* On the other hand, this has a performance downside. Imagine you have a very
|
||||
* long list of items you want to display, worth of couple of your ScrollView’s
|
||||
* heights. Creating JS components and native views upfront for all its items,
|
||||
* which may not even be shown, will contribute to slow rendering of your
|
||||
* screen and increased memory usage.
|
||||
*
|
||||
* This is where ListView comes into play. ListView renders items lazily,
|
||||
* just when they are about to appear. This laziness comes at cost of a more
|
||||
* complicated API, which is worth it unless you are rendering a small fixed
|
||||
* set of items.
|
||||
*/
|
||||
const ScrollView = React.createClass({
|
||||
propTypes: {
|
||||
@@ -177,12 +192,18 @@ const ScrollView = React.createClass({
|
||||
'on-drag',
|
||||
]),
|
||||
/**
|
||||
* When false, tapping outside of the focused text input when the keyboard
|
||||
* is up dismisses the keyboard. When true, the keyboard will not dismiss
|
||||
* automatically, and the scroll view will not catch taps, but children of
|
||||
* the scroll view can catch taps. The default value is false.
|
||||
* Determines when the keyboard should stay visible after a tap.
|
||||
*
|
||||
* - 'never' (the default), tapping outside of the focused text input when the keyboard
|
||||
* is up dismisses the keyboard. When this happens, children won't receive the tap.
|
||||
* - 'always', the keyboard will not dismiss automatically, and the scroll view will not
|
||||
* catch taps, but children of the scroll view can catch taps.
|
||||
* - 'handled', the keyboard will not dismiss automatically when the tap was handled by
|
||||
* a children, (or captured by an ancestor).
|
||||
* - false, deprecated, use 'never' instead
|
||||
* - true, deprecated, use 'always' instead
|
||||
*/
|
||||
keyboardShouldPersistTaps: PropTypes.bool,
|
||||
keyboardShouldPersistTaps: PropTypes.oneOf(['always', 'never', 'handled', false, true]),
|
||||
/**
|
||||
* The maximum allowed zoom scale. The default value is 1.0.
|
||||
* @platform ios
|
||||
|
||||
@@ -109,7 +109,7 @@ require('RCTLog');
|
||||
|
||||
// Set up error handler
|
||||
if (!global.__fbDisableExceptionsManager) {
|
||||
function handleError(e, isFatal) {
|
||||
const handleError = (e, isFatal) => {
|
||||
try {
|
||||
ExceptionsManager.handleException(e, isFatal);
|
||||
} catch (ee) {
|
||||
@@ -118,7 +118,7 @@ if (!global.__fbDisableExceptionsManager) {
|
||||
/* eslint-enable no-console-disallow */
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const ErrorUtils = require('ErrorUtils');
|
||||
ErrorUtils.setGlobalHandler(handleError);
|
||||
@@ -200,7 +200,6 @@ if (__DEV__) {
|
||||
}
|
||||
|
||||
require('RCTDebugComponentOwnership');
|
||||
require('react-transform-hmr');
|
||||
}
|
||||
|
||||
// Set up inspector
|
||||
|
||||
@@ -131,7 +131,7 @@ class NavigationCardStack extends React.Component<DefaultProps, Props, void> {
|
||||
/**
|
||||
* Custom style applied to the card.
|
||||
*/
|
||||
cardStyle: View.propTypes.style,
|
||||
cardStyle: PropTypes.any,
|
||||
|
||||
/**
|
||||
* Direction of the cards movement. Value could be `horizontal` or
|
||||
|
||||
@@ -178,7 +178,7 @@ class SwipeableListView extends React.Component {
|
||||
_renderRow = (rowData: Object, sectionID: string, rowID: string): React.Element<any> => {
|
||||
const slideoutView = this.props.renderQuickActions(rowData, sectionID, rowID);
|
||||
|
||||
// If renderRowSlideout is unspecified or returns falsey, don't allow swipe
|
||||
// If renderQuickActions is unspecified or returns falsey, don't allow swipe
|
||||
if (!slideoutView) {
|
||||
return this.props.renderRow(rowData, sectionID, rowID);
|
||||
}
|
||||
|
||||
@@ -132,11 +132,11 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
SKIP_INSTALL = YES;
|
||||
WARNING_CFLAGS = (
|
||||
"-Werror",
|
||||
"-Wall",
|
||||
@@ -173,10 +173,10 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
SKIP_INSTALL = YES;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
WARNING_CFLAGS = (
|
||||
"-Werror",
|
||||
@@ -191,9 +191,8 @@
|
||||
CLANG_STATIC_ANALYZER_MODE = deep;
|
||||
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = RCTGeolocation;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
RUN_CLANG_STATIC_ANALYZER = YES;
|
||||
SKIP_INSTALL = YES;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -203,8 +202,7 @@
|
||||
CLANG_STATIC_ANALYZER_MODE = deep;
|
||||
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = RCTGeolocation;
|
||||
SKIP_INSTALL = YES;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
||||
@@ -27,13 +27,15 @@
|
||||
2D3B5F241D9B0D1300451313 /* RCTImageUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 134B00A11B54232B00EC8DFB /* RCTImageUtils.m */; };
|
||||
35123E6B1B59C99D00EBAD80 /* RCTImageStoreManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 35123E6A1B59C99D00EBAD80 /* RCTImageStoreManager.m */; };
|
||||
354631681B69857700AA0B86 /* RCTImageEditingManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 354631671B69857700AA0B86 /* RCTImageEditingManager.m */; };
|
||||
3D302E181DF8228100D6DDAE /* RCTImageUtils.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 134B00A01B54232B00EC8DFB /* RCTImageUtils.h */; };
|
||||
3D302F211DF8269200D6DDAE /* RCTImageUtils.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 134B00A01B54232B00EC8DFB /* RCTImageUtils.h */; };
|
||||
3DED3A8A1DE6F79800336DD7 /* RCTGIFImageDecoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 1304D5B01AA8C50D0002E2BE /* RCTGIFImageDecoder.h */; };
|
||||
3DED3A8B1DE6F79800336DD7 /* RCTImageBlurUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = EEF314701C9B0DD30049118E /* RCTImageBlurUtils.h */; };
|
||||
3DED3A8C1DE6F79800336DD7 /* RCTImageCache.h in Headers */ = {isa = PBXBuildFile; fileRef = CCD34C251D4B8FE900268922 /* RCTImageCache.h */; };
|
||||
3DED3A8D1DE6F79800336DD7 /* RCTImageEditingManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 354631661B69857700AA0B86 /* RCTImageEditingManager.h */; };
|
||||
3DED3A8E1DE6F79800336DD7 /* RCTImageLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D5FA63C1DE4B44A0058FD77 /* RCTImageLoader.h */; };
|
||||
3DED3A8F1DE6F79800336DD7 /* RCTImageStoreManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D5FA63D1DE4B44A0058FD77 /* RCTImageStoreManager.h */; };
|
||||
3DED3A901DE6F79800336DD7 /* RCTImageUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 134B00A01B54232B00EC8DFB /* RCTImageUtils.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
3DED3A901DE6F79800336DD7 /* RCTImageUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 134B00A01B54232B00EC8DFB /* RCTImageUtils.h */; };
|
||||
3DED3A911DE6F79800336DD7 /* RCTImageView.h in Headers */ = {isa = PBXBuildFile; fileRef = 1304D5A71AA8C4A30002E2BE /* RCTImageView.h */; };
|
||||
3DED3A921DE6F79800336DD7 /* RCTImageViewManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 1304D5A91AA8C4A30002E2BE /* RCTImageViewManager.h */; };
|
||||
3DED3A931DE6F79800336DD7 /* RCTLocalAssetImageLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 13EF7F7D1BC825B1003F47DD /* RCTLocalAssetImageLoader.h */; };
|
||||
@@ -44,7 +46,7 @@
|
||||
3DED3A991DE6F7A400336DD7 /* RCTImageEditingManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 354631661B69857700AA0B86 /* RCTImageEditingManager.h */; };
|
||||
3DED3A9A1DE6F7A400336DD7 /* RCTImageLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D5FA63C1DE4B44A0058FD77 /* RCTImageLoader.h */; };
|
||||
3DED3A9B1DE6F7A400336DD7 /* RCTImageStoreManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D5FA63D1DE4B44A0058FD77 /* RCTImageStoreManager.h */; };
|
||||
3DED3A9C1DE6F7A400336DD7 /* RCTImageUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 134B00A01B54232B00EC8DFB /* RCTImageUtils.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
3DED3A9C1DE6F7A400336DD7 /* RCTImageUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 134B00A01B54232B00EC8DFB /* RCTImageUtils.h */; };
|
||||
3DED3A9D1DE6F7A400336DD7 /* RCTImageView.h in Headers */ = {isa = PBXBuildFile; fileRef = 1304D5A71AA8C4A30002E2BE /* RCTImageView.h */; };
|
||||
3DED3A9E1DE6F7A400336DD7 /* RCTImageViewManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 1304D5A91AA8C4A30002E2BE /* RCTImageViewManager.h */; };
|
||||
3DED3A9F1DE6F7A400336DD7 /* RCTLocalAssetImageLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 13EF7F7D1BC825B1003F47DD /* RCTLocalAssetImageLoader.h */; };
|
||||
@@ -53,6 +55,31 @@
|
||||
EEF314721C9B0DD30049118E /* RCTImageBlurUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = EEF314711C9B0DD30049118E /* RCTImageBlurUtils.m */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
3D302E171DF8225500D6DDAE /* Copy Headers */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = include/RCTImage;
|
||||
dstSubfolderSpec = 16;
|
||||
files = (
|
||||
3D302E181DF8228100D6DDAE /* RCTImageUtils.h in Copy Headers */,
|
||||
);
|
||||
name = "Copy Headers";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
3D302F201DF8268700D6DDAE /* Copy Headers */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = include/RCTImage;
|
||||
dstSubfolderSpec = 16;
|
||||
files = (
|
||||
3D302F211DF8269200D6DDAE /* RCTImageUtils.h in Copy Headers */,
|
||||
);
|
||||
name = "Copy Headers";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
1304D5A71AA8C4A30002E2BE /* RCTImageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTImageView.h; sourceTree = "<group>"; };
|
||||
1304D5A81AA8C4A30002E2BE /* RCTImageView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTImageView.m; sourceTree = "<group>"; };
|
||||
@@ -139,12 +166,12 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
3DED3A8A1DE6F79800336DD7 /* RCTGIFImageDecoder.h in Headers */,
|
||||
3DED3A901DE6F79800336DD7 /* RCTImageUtils.h in Headers */,
|
||||
3DED3A8B1DE6F79800336DD7 /* RCTImageBlurUtils.h in Headers */,
|
||||
3DED3A8C1DE6F79800336DD7 /* RCTImageCache.h in Headers */,
|
||||
3DED3A8D1DE6F79800336DD7 /* RCTImageEditingManager.h in Headers */,
|
||||
3DED3A8E1DE6F79800336DD7 /* RCTImageLoader.h in Headers */,
|
||||
3DED3A8F1DE6F79800336DD7 /* RCTImageStoreManager.h in Headers */,
|
||||
3DED3A901DE6F79800336DD7 /* RCTImageUtils.h in Headers */,
|
||||
3DED3A911DE6F79800336DD7 /* RCTImageView.h in Headers */,
|
||||
3DED3A921DE6F79800336DD7 /* RCTImageViewManager.h in Headers */,
|
||||
3DED3A931DE6F79800336DD7 /* RCTLocalAssetImageLoader.h in Headers */,
|
||||
@@ -178,6 +205,7 @@
|
||||
buildConfigurationList = 2D2A28421D9B042B00D4039D /* Build configuration list for PBXNativeTarget "RCTImage-tvOS" */;
|
||||
buildPhases = (
|
||||
3DED3A951DE6F79D00336DD7 /* Headers */,
|
||||
3D302F201DF8268700D6DDAE /* Copy Headers */,
|
||||
2D2A28361D9B042B00D4039D /* Sources */,
|
||||
);
|
||||
buildRules = (
|
||||
@@ -194,6 +222,7 @@
|
||||
buildConfigurationList = 58B511711A9E6B3D00147676 /* Build configuration list for PBXNativeTarget "RCTImage" */;
|
||||
buildPhases = (
|
||||
3DED3A891DE6F78800336DD7 /* Headers */,
|
||||
3D302E171DF8225500D6DDAE /* Copy Headers */,
|
||||
58B511591A9E6B3D00147676 /* Sources */,
|
||||
);
|
||||
buildRules = (
|
||||
@@ -295,7 +324,6 @@
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/RCTImage;
|
||||
SDKROOT = appletvos;
|
||||
SKIP_INSTALL = YES;
|
||||
TVOS_DEPLOYMENT_TARGET = 9.2;
|
||||
};
|
||||
name = Debug;
|
||||
@@ -314,7 +342,6 @@
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/RCTImage;
|
||||
SDKROOT = appletvos;
|
||||
SKIP_INSTALL = YES;
|
||||
TVOS_DEPLOYMENT_TARGET = 9.2;
|
||||
};
|
||||
name = Release;
|
||||
@@ -358,11 +385,11 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
SKIP_INSTALL = YES;
|
||||
WARNING_CFLAGS = (
|
||||
"-Werror",
|
||||
"-Wall",
|
||||
@@ -402,10 +429,10 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
SKIP_INSTALL = YES;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
WARNING_CFLAGS = (
|
||||
"-Werror",
|
||||
@@ -426,7 +453,6 @@
|
||||
PRODUCT_NAME = RCTImage;
|
||||
PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/RCTImage;
|
||||
RUN_CLANG_STATIC_ANALYZER = YES;
|
||||
SKIP_INSTALL = YES;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -442,7 +468,6 @@
|
||||
PRODUCT_NAME = RCTImage;
|
||||
PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/RCTImage;
|
||||
RUN_CLANG_STATIC_ANALYZER = NO;
|
||||
SKIP_INSTALL = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
||||
@@ -236,10 +236,14 @@ static UIImage *RCTResizeImageIfNeeded(UIImage *image,
|
||||
{
|
||||
dispatch_async(_URLRequestQueue, ^{
|
||||
// Remove completed tasks
|
||||
NSMutableArray *tasksToRemove = nil;
|
||||
for (RCTNetworkTask *task in self->_pendingTasks.reverseObjectEnumerator) {
|
||||
switch (task.status) {
|
||||
case RCTNetworkTaskFinished:
|
||||
[self->_pendingTasks removeObject:task];
|
||||
if (!tasksToRemove) {
|
||||
tasksToRemove = [NSMutableArray new];
|
||||
}
|
||||
[tasksToRemove addObject:task];
|
||||
self->_activeTasks--;
|
||||
break;
|
||||
case RCTNetworkTaskPending:
|
||||
@@ -248,13 +252,20 @@ static UIImage *RCTResizeImageIfNeeded(UIImage *image,
|
||||
// Check task isn't "stuck"
|
||||
if (task.requestToken == nil) {
|
||||
RCTLogWarn(@"Task orphaned for request %@", task.request);
|
||||
[self->_pendingTasks removeObject:task];
|
||||
if (!tasksToRemove) {
|
||||
tasksToRemove = [NSMutableArray new];
|
||||
}
|
||||
[tasksToRemove addObject:task];
|
||||
self->_activeTasks--;
|
||||
[task cancel];
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (tasksToRemove) {
|
||||
[self->_pendingTasks removeObjectsInArray:tasksToRemove];
|
||||
}
|
||||
|
||||
// Start queued decode
|
||||
NSInteger activeDecodes = self->_scheduledDecodes - self->_pendingDecodes.count;
|
||||
@@ -381,9 +392,10 @@ static UIImage *RCTResizeImageIfNeeded(UIImage *image,
|
||||
});
|
||||
|
||||
return ^{
|
||||
if (cancelLoad && !cancelled) {
|
||||
cancelLoad();
|
||||
cancelLoad = nil;
|
||||
dispatch_block_t cancelLoadLocal = cancelLoad;
|
||||
cancelLoad = nil;
|
||||
if (cancelLoadLocal && !cancelled) {
|
||||
cancelLoadLocal();
|
||||
}
|
||||
OSAtomicOr32Barrier(1, &cancelled);
|
||||
};
|
||||
@@ -515,8 +527,9 @@ static UIImage *RCTResizeImageIfNeeded(UIImage *image,
|
||||
__block volatile uint32_t cancelled = 0;
|
||||
__block dispatch_block_t cancelLoad = nil;
|
||||
dispatch_block_t cancellationBlock = ^{
|
||||
if (cancelLoad && !cancelled) {
|
||||
cancelLoad();
|
||||
dispatch_block_t cancelLoadLocal = cancelLoad;
|
||||
if (cancelLoadLocal && !cancelled) {
|
||||
cancelLoadLocal();
|
||||
}
|
||||
OSAtomicOr32Barrier(1, &cancelled);
|
||||
};
|
||||
|
||||
@@ -26,7 +26,7 @@ const currentCentroidY = TouchHistoryMath.currentCentroidY;
|
||||
* single-touch gestures resilient to extra touches, and can be used to
|
||||
* recognize simple multi-touch gestures.
|
||||
*
|
||||
* By default, `PanResponder` holds an `InteractionManager handle to block
|
||||
* By default, `PanResponder` holds an `InteractionManager` handle to block
|
||||
* long-running JS events from interrupting active gestures.
|
||||
*
|
||||
* It provides a predictable wrapper of the responder handlers provided by the
|
||||
|
||||
@@ -139,7 +139,6 @@
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = appletvos;
|
||||
SKIP_INSTALL = YES;
|
||||
TVOS_DEPLOYMENT_TARGET = 9.2;
|
||||
};
|
||||
name = Debug;
|
||||
@@ -157,7 +156,6 @@
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = appletvos;
|
||||
SKIP_INSTALL = YES;
|
||||
TVOS_DEPLOYMENT_TARGET = 9.2;
|
||||
};
|
||||
name = Release;
|
||||
@@ -196,11 +194,11 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
SKIP_INSTALL = YES;
|
||||
WARNING_CFLAGS = (
|
||||
"-Werror",
|
||||
"-Wall",
|
||||
@@ -236,10 +234,10 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
SKIP_INSTALL = YES;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
WARNING_CFLAGS = (
|
||||
"-Werror",
|
||||
@@ -254,7 +252,6 @@
|
||||
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = RCTLinking;
|
||||
SKIP_INSTALL = YES;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -264,7 +261,6 @@
|
||||
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = RCTLinking;
|
||||
SKIP_INSTALL = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
||||
@@ -292,7 +292,6 @@
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = appletvos;
|
||||
SKIP_INSTALL = YES;
|
||||
TVOS_DEPLOYMENT_TARGET = 9.2;
|
||||
};
|
||||
name = Debug;
|
||||
@@ -310,7 +309,6 @@
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = appletvos;
|
||||
SKIP_INSTALL = YES;
|
||||
TVOS_DEPLOYMENT_TARGET = 9.2;
|
||||
};
|
||||
name = Release;
|
||||
@@ -351,11 +349,11 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
SKIP_INSTALL = YES;
|
||||
WARNING_CFLAGS = (
|
||||
"-Werror",
|
||||
"-Wall",
|
||||
@@ -392,10 +390,10 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
SKIP_INSTALL = YES;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
WARNING_CFLAGS = (
|
||||
"-Werror",
|
||||
@@ -410,7 +408,6 @@
|
||||
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = RCTAnimation;
|
||||
SKIP_INSTALL = YES;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -420,7 +417,6 @@
|
||||
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = RCTAnimation;
|
||||
SKIP_INSTALL = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
||||
@@ -181,7 +181,6 @@
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = appletvos;
|
||||
SKIP_INSTALL = YES;
|
||||
TVOS_DEPLOYMENT_TARGET = 9.2;
|
||||
};
|
||||
name = Debug;
|
||||
@@ -199,7 +198,6 @@
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = appletvos;
|
||||
SKIP_INSTALL = YES;
|
||||
TVOS_DEPLOYMENT_TARGET = 9.2;
|
||||
};
|
||||
name = Release;
|
||||
@@ -243,11 +241,11 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
SKIP_INSTALL = YES;
|
||||
WARNING_CFLAGS = (
|
||||
"-Werror",
|
||||
"-Wall",
|
||||
@@ -287,10 +285,10 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
SKIP_INSTALL = YES;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
WARNING_CFLAGS = (
|
||||
"-Werror",
|
||||
@@ -307,7 +305,6 @@
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = RCTNetwork;
|
||||
RUN_CLANG_STATIC_ANALYZER = YES;
|
||||
SKIP_INSTALL = YES;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -318,7 +315,6 @@
|
||||
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = RCTNetwork;
|
||||
SKIP_INSTALL = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
||||
@@ -92,9 +92,9 @@ export type PushNotificationEventName = $Enum<{
|
||||
* }
|
||||
* // Required for the notification event. You must call the completion handler after handling the remote notification.
|
||||
* - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
|
||||
* fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
|
||||
* fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
|
||||
* {
|
||||
* [RCTPushNotificationManager didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];
|
||||
* [RCTPushNotificationManager didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];
|
||||
* }
|
||||
* // Required for the registrationError event.
|
||||
* - (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
/* Begin PBXBuildFile section */
|
||||
148699CF1ABD045300480536 /* RCTPushNotificationManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 148699CE1ABD045300480536 /* RCTPushNotificationManager.m */; };
|
||||
3D0574931DE6009C00184BB4 /* RCTPushNotificationManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 148699CE1ABD045300480536 /* RCTPushNotificationManager.m */; };
|
||||
3D5FA66B1DE4B7110058FD77 /* RCTPushNotificationManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 148699CD1ABD045300480536 /* RCTPushNotificationManager.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
@@ -80,17 +79,6 @@
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXHeadersBuildPhase section */
|
||||
3D5FA66A1DE4B70C0058FD77 /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
3D5FA66B1DE4B7110058FD77 /* RCTPushNotificationManager.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXHeadersBuildPhase section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
3D05745E1DE6004600184BB4 /* RCTPushNotification-tvOS */ = {
|
||||
isa = PBXNativeTarget;
|
||||
@@ -113,7 +101,6 @@
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RCTPushNotification" */;
|
||||
buildPhases = (
|
||||
3D5FA66A1DE4B70C0058FD77 /* Headers */,
|
||||
58B511D71A9E6C8500147676 /* Sources */,
|
||||
58B511D81A9E6C8500147676 /* Frameworks */,
|
||||
58B511D91A9E6C8500147676 /* CopyFiles */,
|
||||
@@ -200,7 +187,6 @@
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = appletvos;
|
||||
SKIP_INSTALL = YES;
|
||||
TVOS_DEPLOYMENT_TARGET = 10.0;
|
||||
};
|
||||
name = Debug;
|
||||
@@ -218,7 +204,6 @@
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = appletvos;
|
||||
SKIP_INSTALL = YES;
|
||||
TVOS_DEPLOYMENT_TARGET = 10.0;
|
||||
};
|
||||
name = Release;
|
||||
@@ -255,11 +240,11 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
SKIP_INSTALL = YES;
|
||||
WARNING_CFLAGS = (
|
||||
"-Wextra",
|
||||
"-Wall",
|
||||
@@ -297,10 +282,10 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
SKIP_INSTALL = YES;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
WARNING_CFLAGS = (
|
||||
"-Wextra",
|
||||
@@ -318,7 +303,6 @@
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = RCTPushNotification;
|
||||
RUN_CLANG_STATIC_ANALYZER = YES;
|
||||
SKIP_INSTALL = YES;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -329,7 +313,6 @@
|
||||
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = RCTPushNotification;
|
||||
SKIP_INSTALL = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
@@ -343,6 +326,7 @@
|
||||
3D0574661DE6004600184BB4 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RCTPushNotification" */ = {
|
||||
isa = XCConfigurationList;
|
||||
|
||||
@@ -13,8 +13,10 @@
|
||||
2D3B5F301D9B0F3D00451313 /* FBSnapshotTestController.m in Sources */ = {isa = PBXBuildFile; fileRef = 58E64FE71AB964CD007446E2 /* FBSnapshotTestController.m */; };
|
||||
2D3B5F311D9B0F4200451313 /* UIImage+Compare.m in Sources */ = {isa = PBXBuildFile; fileRef = 58E64FE91AB964CD007446E2 /* UIImage+Compare.m */; };
|
||||
2D3B5F321D9B0F4500451313 /* UIImage+Diff.m in Sources */ = {isa = PBXBuildFile; fileRef = 58E64FEB1AB964CD007446E2 /* UIImage+Diff.m */; };
|
||||
3DED3AA21DE6FC3400336DD7 /* RCTTestRunner.h in Headers */ = {isa = PBXBuildFile; fileRef = 585135351AB3C56F00882537 /* RCTTestRunner.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
3DED3AA41DE6FC4C00336DD7 /* RCTTestRunner.h in Headers */ = {isa = PBXBuildFile; fileRef = 585135351AB3C56F00882537 /* RCTTestRunner.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
3D3030281DF82A6300D6DDAE /* RCTTestRunner.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 585135351AB3C56F00882537 /* RCTTestRunner.h */; };
|
||||
3D30302A1DF82A8300D6DDAE /* RCTTestRunner.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 585135351AB3C56F00882537 /* RCTTestRunner.h */; };
|
||||
3DED3AA21DE6FC3400336DD7 /* RCTTestRunner.h in Headers */ = {isa = PBXBuildFile; fileRef = 585135351AB3C56F00882537 /* RCTTestRunner.h */; settings = {ATTRIBUTES = (Private, ); }; };
|
||||
3DED3AA41DE6FC4C00336DD7 /* RCTTestRunner.h in Headers */ = {isa = PBXBuildFile; fileRef = 585135351AB3C56F00882537 /* RCTTestRunner.h */; settings = {ATTRIBUTES = (Private, ); }; };
|
||||
585135371AB3C56F00882537 /* RCTTestModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 585135341AB3C56F00882537 /* RCTTestModule.m */; };
|
||||
585135381AB3C57000882537 /* RCTTestRunner.m in Sources */ = {isa = PBXBuildFile; fileRef = 585135361AB3C56F00882537 /* RCTTestRunner.m */; };
|
||||
58E64FED1AB964CD007446E2 /* FBSnapshotTestController.m in Sources */ = {isa = PBXBuildFile; fileRef = 58E64FE71AB964CD007446E2 /* FBSnapshotTestController.m */; };
|
||||
@@ -23,6 +25,31 @@
|
||||
9913A84B1BBE833400D70E66 /* RCTSnapshotManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 9913A84A1BBE833400D70E66 /* RCTSnapshotManager.m */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
3D3030271DF8299E00D6DDAE /* Copy Headers */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = include/RCTTest;
|
||||
dstSubfolderSpec = 16;
|
||||
files = (
|
||||
3D3030281DF82A6300D6DDAE /* RCTTestRunner.h in Copy Headers */,
|
||||
);
|
||||
name = "Copy Headers";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
3D3030291DF82A6E00D6DDAE /* Copy Headers */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = include/RCTTest;
|
||||
dstSubfolderSpec = 16;
|
||||
files = (
|
||||
3D30302A1DF82A8300D6DDAE /* RCTTestRunner.h in Copy Headers */,
|
||||
);
|
||||
name = "Copy Headers";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
2D2A286E1D9B047700D4039D /* libRCTTest-tvOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libRCTTest-tvOS.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
580C376F1AB104AF0015E709 /* libRCTTest.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTTest.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
@@ -127,6 +154,7 @@
|
||||
buildConfigurationList = 2D2A28761D9B047700D4039D /* Build configuration list for PBXNativeTarget "RCTTest-tvOS" */;
|
||||
buildPhases = (
|
||||
3DED3AA31DE6FC4700336DD7 /* Headers */,
|
||||
3D3030291DF82A6E00D6DDAE /* Copy Headers */,
|
||||
2D2A286A1D9B047700D4039D /* Sources */,
|
||||
2D2A286B1D9B047700D4039D /* Frameworks */,
|
||||
);
|
||||
@@ -144,6 +172,7 @@
|
||||
buildConfigurationList = 580C37831AB104AF0015E709 /* Build configuration list for PBXNativeTarget "RCTTest" */;
|
||||
buildPhases = (
|
||||
3DED3AA11DE6FC2200336DD7 /* Headers */,
|
||||
3D3030271DF8299E00D6DDAE /* Copy Headers */,
|
||||
580C376B1AB104AF0015E709 /* Sources */,
|
||||
580C376C1AB104AF0015E709 /* Frameworks */,
|
||||
);
|
||||
@@ -236,7 +265,6 @@
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/RCTTest;
|
||||
SDKROOT = appletvos;
|
||||
SKIP_INSTALL = YES;
|
||||
TVOS_DEPLOYMENT_TARGET = 9.2;
|
||||
};
|
||||
name = Debug;
|
||||
@@ -255,7 +283,6 @@
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/RCTTest;
|
||||
SDKROOT = appletvos;
|
||||
SKIP_INSTALL = YES;
|
||||
TVOS_DEPLOYMENT_TARGET = 9.2;
|
||||
};
|
||||
name = Release;
|
||||
@@ -295,11 +322,11 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
SKIP_INSTALL = YES;
|
||||
WARNING_CFLAGS = (
|
||||
"-Werror",
|
||||
"-Wall",
|
||||
@@ -336,10 +363,10 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
SKIP_INSTALL = YES;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
WARNING_CFLAGS = (
|
||||
"-Werror",
|
||||
@@ -360,7 +387,6 @@
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/RCTTest;
|
||||
RUN_CLANG_STATIC_ANALYZER = YES;
|
||||
SKIP_INSTALL = YES;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -375,7 +401,6 @@
|
||||
);
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/RCTTest;
|
||||
SKIP_INSTALL = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
||||
@@ -139,7 +139,6 @@
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = appletvos;
|
||||
SKIP_INSTALL = YES;
|
||||
TVOS_DEPLOYMENT_TARGET = 9.2;
|
||||
};
|
||||
name = Debug;
|
||||
@@ -157,7 +156,6 @@
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = appletvos;
|
||||
SKIP_INSTALL = YES;
|
||||
TVOS_DEPLOYMENT_TARGET = 9.2;
|
||||
};
|
||||
name = Release;
|
||||
@@ -197,11 +195,11 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
SKIP_INSTALL = YES;
|
||||
WARNING_CFLAGS = (
|
||||
"-Werror",
|
||||
"-Wall",
|
||||
@@ -238,10 +236,10 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
SKIP_INSTALL = YES;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
WARNING_CFLAGS = (
|
||||
"-Werror",
|
||||
@@ -256,7 +254,6 @@
|
||||
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = RCTSettings;
|
||||
SKIP_INSTALL = YES;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -266,7 +263,6 @@
|
||||
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = RCTSettings;
|
||||
SKIP_INSTALL = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
||||
@@ -39,16 +39,16 @@ CGFloat const RCTTextAutoSizeGranularity = 0.001f;
|
||||
CGFloat _effectiveLetterSpacing;
|
||||
}
|
||||
|
||||
static CSSSize RCTMeasure(CSSNodeRef node, float width, CSSMeasureMode widthMode, float height, CSSMeasureMode heightMode)
|
||||
static YGSize RCTMeasure(YGNodeRef node, float width, YGMeasureMode widthMode, float height, YGMeasureMode heightMode)
|
||||
{
|
||||
RCTShadowText *shadowText = (__bridge RCTShadowText *)CSSNodeGetContext(node);
|
||||
RCTShadowText *shadowText = (__bridge RCTShadowText *)YGNodeGetContext(node);
|
||||
NSTextStorage *textStorage = [shadowText buildTextStorageForWidth:width widthMode:widthMode];
|
||||
[shadowText calculateTextFrame:textStorage];
|
||||
NSLayoutManager *layoutManager = textStorage.layoutManagers.firstObject;
|
||||
NSTextContainer *textContainer = layoutManager.textContainers.firstObject;
|
||||
CGSize computedSize = [layoutManager usedRectForTextContainer:textContainer].size;
|
||||
|
||||
CSSSize result;
|
||||
YGSize result;
|
||||
result.width = RCTCeilPixelValue(computedSize.width);
|
||||
if (shadowText->_effectiveLetterSpacing < 0) {
|
||||
result.width -= shadowText->_effectiveLetterSpacing;
|
||||
@@ -68,7 +68,7 @@ static CSSSize RCTMeasure(CSSNodeRef node, float width, CSSMeasureMode widthMode
|
||||
_cachedTextStorageWidth = -1;
|
||||
_cachedTextStorageWidthMode = -1;
|
||||
_fontSizeMultiplier = 1.0;
|
||||
CSSNodeSetMeasureFunc(self.cssNode, RCTMeasure);
|
||||
YGNodeSetMeasureFunc(self.cssNode, RCTMeasure);
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(contentSizeMultiplierDidChange:)
|
||||
name:RCTUIManagerWillUpdateViewsDueToContentSizeMultiplierChangeNotification
|
||||
@@ -95,7 +95,7 @@ static CSSSize RCTMeasure(CSSNodeRef node, float width, CSSMeasureMode widthMode
|
||||
|
||||
- (void)contentSizeMultiplierDidChange:(NSNotification *)note
|
||||
{
|
||||
CSSNodeMarkDirty(self.cssNode);
|
||||
YGNodeMarkDirty(self.cssNode);
|
||||
[self dirtyText];
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ static CSSSize RCTMeasure(CSSNodeRef node, float width, CSSMeasureMode widthMode
|
||||
|
||||
|
||||
NSNumber *parentTag = [[self reactSuperview] reactTag];
|
||||
NSTextStorage *textStorage = [self buildTextStorageForWidth:width widthMode:CSSMeasureModeExactly];
|
||||
NSTextStorage *textStorage = [self buildTextStorageForWidth:width widthMode:YGMeasureModeExactly];
|
||||
CGRect textFrame = [self calculateTextFrame:textStorage];
|
||||
BOOL selectable = _selectable;
|
||||
[applierBlocks addObject:^(NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
||||
@@ -140,7 +140,7 @@ static CSSSize RCTMeasure(CSSNodeRef node, float width, CSSMeasureMode widthMode
|
||||
return parentProperties;
|
||||
}
|
||||
|
||||
- (void)applyLayoutNode:(CSSNodeRef)node
|
||||
- (void)applyLayoutNode:(YGNodeRef)node
|
||||
viewsWithNewFrame:(NSMutableSet<RCTShadowView *> *)viewsWithNewFrame
|
||||
absolutePosition:(CGPoint)absolutePosition
|
||||
{
|
||||
@@ -148,22 +148,22 @@ static CSSSize RCTMeasure(CSSNodeRef node, float width, CSSMeasureMode widthMode
|
||||
[self dirtyPropagation];
|
||||
}
|
||||
|
||||
- (void)applyLayoutToChildren:(CSSNodeRef)node
|
||||
- (void)applyLayoutToChildren:(YGNodeRef)node
|
||||
viewsWithNewFrame:(NSMutableSet<RCTShadowView *> *)viewsWithNewFrame
|
||||
absolutePosition:(CGPoint)absolutePosition
|
||||
{
|
||||
// Run layout on subviews.
|
||||
NSTextStorage *textStorage = [self buildTextStorageForWidth:self.frame.size.width widthMode:CSSMeasureModeExactly];
|
||||
NSTextStorage *textStorage = [self buildTextStorageForWidth:self.frame.size.width widthMode:YGMeasureModeExactly];
|
||||
NSLayoutManager *layoutManager = textStorage.layoutManagers.firstObject;
|
||||
NSTextContainer *textContainer = layoutManager.textContainers.firstObject;
|
||||
NSRange glyphRange = [layoutManager glyphRangeForTextContainer:textContainer];
|
||||
NSRange characterRange = [layoutManager characterRangeForGlyphRange:glyphRange actualGlyphRange:NULL];
|
||||
[layoutManager.textStorage enumerateAttribute:RCTShadowViewAttributeName inRange:characterRange options:0 usingBlock:^(RCTShadowView *child, NSRange range, BOOL *_) {
|
||||
if (child) {
|
||||
CSSNodeRef childNode = child.cssNode;
|
||||
float width = CSSNodeStyleGetWidth(childNode);
|
||||
float height = CSSNodeStyleGetHeight(childNode);
|
||||
if (CSSValueIsUndefined(width) || CSSValueIsUndefined(height)) {
|
||||
YGNodeRef childNode = child.cssNode;
|
||||
float width = YGNodeStyleGetWidth(childNode);
|
||||
float height = YGNodeStyleGetHeight(childNode);
|
||||
if (YGValueIsUndefined(width) || YGValueIsUndefined(height)) {
|
||||
RCTLogError(@"Views nested within a <Text> must have a width and height");
|
||||
}
|
||||
UIFont *font = [textStorage attribute:NSFontAttributeName atIndex:range.location effectiveRange:nil];
|
||||
@@ -187,7 +187,7 @@ static CSSSize RCTMeasure(CSSNodeRef node, float width, CSSMeasureMode widthMode
|
||||
}];
|
||||
}
|
||||
|
||||
- (NSTextStorage *)buildTextStorageForWidth:(CGFloat)width widthMode:(CSSMeasureMode)widthMode
|
||||
- (NSTextStorage *)buildTextStorageForWidth:(CGFloat)width widthMode:(YGMeasureMode)widthMode
|
||||
{
|
||||
if (_cachedTextStorage && width == _cachedTextStorageWidth && widthMode == _cachedTextStorageWidthMode) {
|
||||
return _cachedTextStorage;
|
||||
@@ -208,7 +208,7 @@ static CSSSize RCTMeasure(CSSNodeRef node, float width, CSSMeasureMode widthMode
|
||||
}
|
||||
|
||||
textContainer.maximumNumberOfLines = _numberOfLines;
|
||||
textContainer.size = (CGSize){widthMode == CSSMeasureModeUndefined ? CGFLOAT_MAX : width, CGFLOAT_MAX};
|
||||
textContainer.size = (CGSize){widthMode == YGMeasureModeUndefined ? CGFLOAT_MAX : width, CGFLOAT_MAX};
|
||||
|
||||
[layoutManager addTextContainer:textContainer];
|
||||
[layoutManager ensureLayoutForTextContainer:textContainer];
|
||||
@@ -307,9 +307,9 @@ static CSSSize RCTMeasure(CSSNodeRef node, float width, CSSMeasureMode widthMode
|
||||
[attributedString appendAttributedString:[[NSAttributedString alloc] initWithString:shadowRawText.text ?: @""]];
|
||||
[child setTextComputed];
|
||||
} else {
|
||||
float width = CSSNodeStyleGetWidth(child.cssNode);
|
||||
float height = CSSNodeStyleGetHeight(child.cssNode);
|
||||
if (CSSValueIsUndefined(width) || CSSValueIsUndefined(height)) {
|
||||
float width = YGNodeStyleGetWidth(child.cssNode);
|
||||
float height = YGNodeStyleGetHeight(child.cssNode);
|
||||
if (YGValueIsUndefined(width) || YGValueIsUndefined(height)) {
|
||||
RCTLogError(@"Views nested within a <Text> must have a width and height");
|
||||
}
|
||||
NSTextAttachment *attachment = [NSTextAttachment new];
|
||||
@@ -348,7 +348,7 @@ static CSSSize RCTMeasure(CSSNodeRef node, float width, CSSMeasureMode widthMode
|
||||
|
||||
// create a non-mutable attributedString for use by the Text system which avoids copies down the line
|
||||
_cachedAttributedString = [[NSAttributedString alloc] initWithAttributedString:attributedString];
|
||||
CSSNodeMarkDirty(self.cssNode);
|
||||
YGNodeMarkDirty(self.cssNode);
|
||||
|
||||
return _cachedAttributedString;
|
||||
}
|
||||
@@ -403,10 +403,10 @@ static CSSSize RCTMeasure(CSSNodeRef node, float width, CSSMeasureMode widthMode
|
||||
// We will climb up to the first node which style has been setted as non-inherit
|
||||
if (newTextAlign == NSTextAlignmentRight || newTextAlign == NSTextAlignmentLeft) {
|
||||
RCTShadowView *view = self;
|
||||
while (view != nil && CSSNodeStyleGetDirection(view.cssNode) == CSSDirectionInherit) {
|
||||
while (view != nil && YGNodeStyleGetDirection(view.cssNode) == YGDirectionInherit) {
|
||||
view = [view reactSuperview];
|
||||
}
|
||||
if (view != nil && CSSNodeStyleGetDirection(view.cssNode) == CSSDirectionRTL) {
|
||||
if (view != nil && YGNodeStyleGetDirection(view.cssNode) == YGDirectionRTL) {
|
||||
if (newTextAlign == NSTextAlignmentRight) {
|
||||
newTextAlign = NSTextAlignmentLeft;
|
||||
} else if (newTextAlign == NSTextAlignmentLeft) {
|
||||
|
||||
@@ -221,7 +221,6 @@
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = appletvos;
|
||||
SKIP_INSTALL = YES;
|
||||
TVOS_DEPLOYMENT_TARGET = 9.2;
|
||||
};
|
||||
name = Debug;
|
||||
@@ -239,7 +238,6 @@
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = appletvos;
|
||||
SKIP_INSTALL = YES;
|
||||
TVOS_DEPLOYMENT_TARGET = 9.2;
|
||||
};
|
||||
name = Release;
|
||||
@@ -279,11 +277,11 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
SKIP_INSTALL = YES;
|
||||
WARNING_CFLAGS = (
|
||||
"-Werror",
|
||||
"-Wall",
|
||||
@@ -320,10 +318,10 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
SKIP_INSTALL = YES;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
WARNING_CFLAGS = (
|
||||
"-Werror",
|
||||
@@ -339,7 +337,6 @@
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
RUN_CLANG_STATIC_ANALYZER = YES;
|
||||
SKIP_INSTALL = YES;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -349,7 +346,6 @@
|
||||
CLANG_STATIC_ANALYZER_MODE = deep;
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#import "RCTTextManager.h"
|
||||
|
||||
#import <CSSLayout/CSSLayout.h>
|
||||
#import <yoga/Yoga.h>
|
||||
#import <React/RCTAccessibilityManager.h>
|
||||
#import <React/RCTAssert.h>
|
||||
#import <React/RCTConvert.h>
|
||||
@@ -35,7 +35,7 @@ static void collectDirtyNonTextDescendants(RCTShadowText *shadowView, NSMutableA
|
||||
|
||||
@interface RCTShadowText (Private)
|
||||
|
||||
- (NSTextStorage *)buildTextStorageForWidth:(CGFloat)width widthMode:(CSSMeasureMode)widthMode;
|
||||
- (NSTextStorage *)buildTextStorageForWidth:(CGFloat)width widthMode:(YGMeasureMode)widthMode;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -66,6 +66,13 @@ const TextStylePropTypes = {
|
||||
textAlignVertical: ReactPropTypes.oneOf(
|
||||
['auto' /*default*/, 'top', 'bottom', 'center']
|
||||
),
|
||||
/**
|
||||
* Set to `false` to remove extra font padding intended to make space for certain ascenders / descenders.
|
||||
* With some fonts, this padding can make text look slightly misaligned when centered vertically.
|
||||
* For best results also set `textAlignVertical` to `center`. Default is true.
|
||||
* @platform android
|
||||
*/
|
||||
includeFontPadding: ReactPropTypes.bool,
|
||||
textDecorationLine: ReactPropTypes.oneOf(
|
||||
['none' /*default*/, 'underline', 'line-through', 'underline line-through']
|
||||
),
|
||||
|
||||
@@ -102,13 +102,13 @@ var ARGUMENT_NAMES_RE = /([^\s,]+)/g;
|
||||
*
|
||||
* inline(inlineMe, ['hi', 'bye']); // "hi = bye + bye;"
|
||||
*
|
||||
* @param {function} func Any simple function who's arguments can be replaced via a regex.
|
||||
* @param {string} fnStr Source of any simple function who's arguments can be
|
||||
* replaced via a regex.
|
||||
* @param {array<string>} replaceWithArgs Corresponding names of variables
|
||||
* within an environment, to replace `func` args with.
|
||||
* @return {string} Resulting function body string.
|
||||
*/
|
||||
var inline = function(func, replaceWithArgs) {
|
||||
var fnStr = func.toString();
|
||||
var inline = function(fnStr, replaceWithArgs) {
|
||||
var parameterNames = fnStr.slice(fnStr.indexOf('(') + 1, fnStr.indexOf(')'))
|
||||
.match(ARGUMENT_NAMES_RE) ||
|
||||
[];
|
||||
@@ -126,11 +126,10 @@ var inline = function(func, replaceWithArgs) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Simply a convenient way to inline functions using the function's toString
|
||||
* method.
|
||||
* Simply a convenient way to inline functions using the inline function.
|
||||
*/
|
||||
var MatrixOps = {
|
||||
unroll: function(matVar, m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13, m14, m15) {
|
||||
unroll: `function(matVar, m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13, m14, m15) {
|
||||
m0 = matVar[0];
|
||||
m1 = matVar[1];
|
||||
m2 = matVar[2];
|
||||
@@ -147,29 +146,29 @@ var MatrixOps = {
|
||||
m13 = matVar[13];
|
||||
m14 = matVar[14];
|
||||
m15 = matVar[15];
|
||||
},
|
||||
}`,
|
||||
|
||||
matrixDiffers: function(retVar, matVar, m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13, m14, m15) {
|
||||
matrixDiffers: `function(retVar, matVar, m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13, m14, m15) {
|
||||
retVar = retVar ||
|
||||
m0 !== matVar[0] ||
|
||||
m1 !== matVar[1] ||
|
||||
m2 !== matVar[2] ||
|
||||
m3 !== matVar[3] ||
|
||||
m4 !== matVar[4] ||
|
||||
m5 !== matVar[5] ||
|
||||
m6 !== matVar[6] ||
|
||||
m7 !== matVar[7] ||
|
||||
m8 !== matVar[8] ||
|
||||
m9 !== matVar[9] ||
|
||||
m10 !== matVar[10] ||
|
||||
m11 !== matVar[11] ||
|
||||
m12 !== matVar[12] ||
|
||||
m13 !== matVar[13] ||
|
||||
m14 !== matVar[14] ||
|
||||
m15 !== matVar[15];
|
||||
},
|
||||
m0 !== matVar[0] ||
|
||||
m1 !== matVar[1] ||
|
||||
m2 !== matVar[2] ||
|
||||
m3 !== matVar[3] ||
|
||||
m4 !== matVar[4] ||
|
||||
m5 !== matVar[5] ||
|
||||
m6 !== matVar[6] ||
|
||||
m7 !== matVar[7] ||
|
||||
m8 !== matVar[8] ||
|
||||
m9 !== matVar[9] ||
|
||||
m10 !== matVar[10] ||
|
||||
m11 !== matVar[11] ||
|
||||
m12 !== matVar[12] ||
|
||||
m13 !== matVar[13] ||
|
||||
m14 !== matVar[14] ||
|
||||
m15 !== matVar[15];
|
||||
}`,
|
||||
|
||||
transformScale: function(matVar, opVar) {
|
||||
transformScale: `function(matVar, opVar) {
|
||||
// Scaling matVar by opVar
|
||||
var x = opVar[0];
|
||||
var y = opVar[1];
|
||||
@@ -190,13 +189,13 @@ var MatrixOps = {
|
||||
matVar[13] = matVar[13];
|
||||
matVar[14] = matVar[14];
|
||||
matVar[15] = matVar[15];
|
||||
},
|
||||
}`,
|
||||
|
||||
/**
|
||||
* All of these matrix transforms are not general purpose utilities, and are
|
||||
* only suitable for being inlined for the use of building up interpolators.
|
||||
*/
|
||||
transformTranslate: function(matVar, opVar) {
|
||||
transformTranslate: `function(matVar, opVar) {
|
||||
// Translating matVar by opVar
|
||||
var x = opVar[0];
|
||||
var y = opVar[1];
|
||||
@@ -205,13 +204,13 @@ var MatrixOps = {
|
||||
matVar[13] = matVar[1] * x + matVar[5] * y + matVar[9] * z + matVar[13];
|
||||
matVar[14] = matVar[2] * x + matVar[6] * y + matVar[10] * z + matVar[14];
|
||||
matVar[15] = matVar[3] * x + matVar[7] * y + matVar[11] * z + matVar[15];
|
||||
},
|
||||
}`,
|
||||
|
||||
/**
|
||||
* @param {array} matVar Both the input, and the output matrix.
|
||||
* @param {quaternion specification} q Four element array describing rotation.
|
||||
*/
|
||||
transformRotateRadians: function(matVar, q) {
|
||||
transformRotateRadians: `function(matVar, q) {
|
||||
// Rotating matVar by q
|
||||
var xQuat = q[0], yQuat = q[1], zQuat = q[2], wQuat = q[3];
|
||||
var x2Quat = xQuat + xQuat;
|
||||
@@ -226,7 +225,7 @@ var MatrixOps = {
|
||||
var wxQuat = wQuat * x2Quat;
|
||||
var wyQuat = wQuat * y2Quat;
|
||||
var wzQuat = wQuat * z2Quat;
|
||||
// Step 1: Inlines the construction of a quaternion matrix (`quatMat`)
|
||||
// Step 1: Inlines the construction of a quaternion matrix ('quatMat')
|
||||
var quatMat0 = 1 - (yyQuat + zzQuat);
|
||||
var quatMat1 = xyQuat + wzQuat;
|
||||
var quatMat2 = xzQuat - wyQuat;
|
||||
@@ -267,13 +266,13 @@ var MatrixOps = {
|
||||
matVar[9] = b0 * a01 + b1 * a11 + b2 * a21;
|
||||
matVar[10] = b0 * a02 + b1 * a12 + b2 * a22;
|
||||
matVar[11] = b0 * a03 + b1 * a13 + b2 * a23;
|
||||
}
|
||||
}`
|
||||
};
|
||||
|
||||
// Optimized version of general operation applications that can be used when
|
||||
// the target matrix is known to be the identity matrix.
|
||||
var MatrixOpsInitial = {
|
||||
transformScale: function(matVar, opVar) {
|
||||
transformScale: `function(matVar, opVar) {
|
||||
// Scaling matVar known to be identity by opVar
|
||||
matVar[0] = opVar[0];
|
||||
matVar[1] = 0;
|
||||
@@ -291,10 +290,10 @@ var MatrixOpsInitial = {
|
||||
matVar[13] = 0;
|
||||
matVar[14] = 0;
|
||||
matVar[15] = 1;
|
||||
},
|
||||
}`,
|
||||
|
||||
transformTranslate: function(matVar, opVar) {
|
||||
// Translating matVar known to be identity by opVar';
|
||||
transformTranslate: `function(matVar, opVar) {
|
||||
// Translating matVar known to be identity by opVar;
|
||||
matVar[0] = 1;
|
||||
matVar[1] = 0;
|
||||
matVar[2] = 0;
|
||||
@@ -311,14 +310,14 @@ var MatrixOpsInitial = {
|
||||
matVar[13] = opVar[1];
|
||||
matVar[14] = opVar[2];
|
||||
matVar[15] = 1;
|
||||
},
|
||||
}`,
|
||||
|
||||
/**
|
||||
* @param {array} matVar Both the input, and the output matrix - assumed to be
|
||||
* identity.
|
||||
* @param {quaternion specification} q Four element array describing rotation.
|
||||
*/
|
||||
transformRotateRadians: function(matVar, q) {
|
||||
transformRotateRadians: `function(matVar, q) {
|
||||
|
||||
// Rotating matVar which is known to be identity by q
|
||||
var xQuat = q[0], yQuat = q[1], zQuat = q[2], wQuat = q[3];
|
||||
@@ -334,7 +333,7 @@ var MatrixOpsInitial = {
|
||||
var wxQuat = wQuat * x2Quat;
|
||||
var wyQuat = wQuat * y2Quat;
|
||||
var wzQuat = wQuat * z2Quat;
|
||||
// Step 1: Inlines the construction of a quaternion matrix (`quatMat`)
|
||||
// Step 1: Inlines the construction of a quaternion matrix ('quatMat')
|
||||
var quatMat0 = 1 - (yyQuat + zzQuat);
|
||||
var quatMat1 = xyQuat + wzQuat;
|
||||
var quatMat2 = xzQuat - wyQuat;
|
||||
@@ -366,7 +365,7 @@ var MatrixOpsInitial = {
|
||||
matVar[13] = 0;
|
||||
matVar[14] = 0;
|
||||
matVar[15] = 1;
|
||||
}
|
||||
}`
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -131,11 +131,11 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
SKIP_INSTALL = YES;
|
||||
WARNING_CFLAGS = (
|
||||
"-Werror",
|
||||
"-Wall",
|
||||
@@ -171,10 +171,10 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
SKIP_INSTALL = YES;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
WARNING_CFLAGS = (
|
||||
"-Werror",
|
||||
@@ -190,7 +190,6 @@
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
RUN_CLANG_STATIC_ANALYZER = YES;
|
||||
SKIP_INSTALL = YES;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -200,7 +199,6 @@
|
||||
CLANG_STATIC_ANALYZER_MODE = deep;
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
||||
@@ -11,10 +11,10 @@
|
||||
1338BBE11B04ACC80064A9C9 /* RCTWebSocketExecutor.m in Sources */ = {isa = PBXBuildFile; fileRef = 1338BBDF1B04ACC80064A9C9 /* RCTWebSocketExecutor.m */; };
|
||||
2D3B5F3D1D9B165B00451313 /* RCTSRWebSocket.m in Sources */ = {isa = PBXBuildFile; fileRef = 1338BBDD1B04ACC80064A9C9 /* RCTSRWebSocket.m */; };
|
||||
2D3B5F3E1D9B165B00451313 /* RCTWebSocketExecutor.m in Sources */ = {isa = PBXBuildFile; fileRef = 1338BBDF1B04ACC80064A9C9 /* RCTWebSocketExecutor.m */; };
|
||||
2D3B5F3F1D9B165B00451313 /* RCTWebSocketManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 3DB9106E1C74B1ED00838BBE /* RCTWebSocketManager.m */; };
|
||||
2D3B5F3F1D9B165B00451313 /* RCTWebSocketObserver.m in Sources */ = {isa = PBXBuildFile; fileRef = 3DB9106E1C74B1ED00838BBE /* RCTWebSocketObserver.m */; };
|
||||
2D3B5F401D9B165B00451313 /* RCTWebSocketModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C86DF7B1ADF695F0047B81A /* RCTWebSocketModule.m */; };
|
||||
3C86DF7C1ADF695F0047B81A /* RCTWebSocketModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C86DF7B1ADF695F0047B81A /* RCTWebSocketModule.m */; };
|
||||
3DB9106F1C74B1ED00838BBE /* RCTWebSocketManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 3DB9106E1C74B1ED00838BBE /* RCTWebSocketManager.m */; };
|
||||
3DB9106F1C74B1ED00838BBE /* RCTWebSocketObserver.m in Sources */ = {isa = PBXBuildFile; fileRef = 3DB9106E1C74B1ED00838BBE /* RCTWebSocketObserver.m */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
@@ -26,8 +26,8 @@
|
||||
3C86DF461ADF2C930047B81A /* libRCTWebSocket.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTWebSocket.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
3C86DF7A1ADF695F0047B81A /* RCTWebSocketModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTWebSocketModule.h; sourceTree = "<group>"; };
|
||||
3C86DF7B1ADF695F0047B81A /* RCTWebSocketModule.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.c.objc; path = RCTWebSocketModule.m; sourceTree = "<group>"; tabWidth = 2; };
|
||||
3DB9106D1C74B1ED00838BBE /* RCTWebSocketManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTWebSocketManager.h; sourceTree = "<group>"; };
|
||||
3DB9106E1C74B1ED00838BBE /* RCTWebSocketManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTWebSocketManager.m; sourceTree = "<group>"; };
|
||||
3DB9106D1C74B1ED00838BBE /* RCTWebSocketObserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTWebSocketObserver.h; sourceTree = "<group>"; };
|
||||
3DB9106E1C74B1ED00838BBE /* RCTWebSocketObserver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTWebSocketObserver.m; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
@@ -38,8 +38,8 @@
|
||||
1338BBDD1B04ACC80064A9C9 /* RCTSRWebSocket.m */,
|
||||
1338BBDE1B04ACC80064A9C9 /* RCTWebSocketExecutor.h */,
|
||||
1338BBDF1B04ACC80064A9C9 /* RCTWebSocketExecutor.m */,
|
||||
3DB9106D1C74B1ED00838BBE /* RCTWebSocketManager.h */,
|
||||
3DB9106E1C74B1ED00838BBE /* RCTWebSocketManager.m */,
|
||||
3DB9106D1C74B1ED00838BBE /* RCTWebSocketObserver.h */,
|
||||
3DB9106E1C74B1ED00838BBE /* RCTWebSocketObserver.m */,
|
||||
3C86DF7A1ADF695F0047B81A /* RCTWebSocketModule.h */,
|
||||
3C86DF7B1ADF695F0047B81A /* RCTWebSocketModule.m */,
|
||||
3C86DF471ADF2C930047B81A /* Products */,
|
||||
@@ -134,7 +134,7 @@
|
||||
2D3B5F3E1D9B165B00451313 /* RCTWebSocketExecutor.m in Sources */,
|
||||
2D3B5F401D9B165B00451313 /* RCTWebSocketModule.m in Sources */,
|
||||
2D3B5F3D1D9B165B00451313 /* RCTSRWebSocket.m in Sources */,
|
||||
2D3B5F3F1D9B165B00451313 /* RCTWebSocketManager.m in Sources */,
|
||||
2D3B5F3F1D9B165B00451313 /* RCTWebSocketObserver.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -145,7 +145,7 @@
|
||||
1338BBE01B04ACC80064A9C9 /* RCTSRWebSocket.m in Sources */,
|
||||
3C86DF7C1ADF695F0047B81A /* RCTWebSocketModule.m in Sources */,
|
||||
1338BBE11B04ACC80064A9C9 /* RCTWebSocketExecutor.m in Sources */,
|
||||
3DB9106F1C74B1ED00838BBE /* RCTWebSocketManager.m in Sources */,
|
||||
3DB9106F1C74B1ED00838BBE /* RCTWebSocketObserver.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -164,7 +164,6 @@
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = appletvos;
|
||||
SKIP_INSTALL = YES;
|
||||
TVOS_DEPLOYMENT_TARGET = 9.2;
|
||||
};
|
||||
name = Debug;
|
||||
@@ -179,7 +178,6 @@
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = appletvos;
|
||||
SKIP_INSTALL = YES;
|
||||
TVOS_DEPLOYMENT_TARGET = 9.2;
|
||||
};
|
||||
name = Release;
|
||||
@@ -221,11 +219,11 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
SKIP_INSTALL = YES;
|
||||
WARNING_CFLAGS = (
|
||||
"-Werror",
|
||||
"-Wall",
|
||||
@@ -264,10 +262,10 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
SKIP_INSTALL = YES;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
WARNING_CFLAGS = (
|
||||
"-Werror",
|
||||
@@ -283,7 +281,6 @@
|
||||
GCC_TREAT_WARNINGS_AS_ERRORS = NO;
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -294,7 +291,6 @@
|
||||
GCC_TREAT_WARNINGS_AS_ERRORS = NO;
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
||||
@@ -141,6 +141,7 @@ RCT_EXPORT_MODULE()
|
||||
RCTWSMessageCallback callback = _callbacks[messageID];
|
||||
if (callback) {
|
||||
callback(error, reply);
|
||||
[_callbacks removeObjectForKey:messageID];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,152 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#import "RCTWebSocketManager.h"
|
||||
|
||||
#import <React/RCTConvert.h>
|
||||
#import <React/RCTDefines.h>
|
||||
#import <React/RCTLog.h>
|
||||
#import <React/RCTUtils.h>
|
||||
|
||||
#import "RCTSRWebSocket.h"
|
||||
|
||||
#if RCT_DEV // Only supported in dev mode
|
||||
|
||||
#pragma mark - RCTWebSocketObserver
|
||||
|
||||
@interface RCTWebSocketObserver : NSObject <RCTSRWebSocketDelegate> {
|
||||
NSURL *_url;
|
||||
}
|
||||
|
||||
@property (nonatomic, strong) RCTSRWebSocket *socket;
|
||||
@property (nonatomic, weak) id<RCTWebSocketProxyDelegate> delegate;
|
||||
@property (nonatomic, strong) dispatch_semaphore_t socketOpenSemaphore;
|
||||
|
||||
- (instancetype)initWithURL:(NSURL *)url delegate:(id<RCTWebSocketProxyDelegate>)delegate;
|
||||
|
||||
@end
|
||||
|
||||
@implementation RCTWebSocketObserver
|
||||
|
||||
- (instancetype)initWithURL:(NSURL *)url delegate:(id<RCTWebSocketProxyDelegate>)delegate
|
||||
{
|
||||
if ((self = [self init])) {
|
||||
_url = url;
|
||||
_delegate = delegate;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)start
|
||||
{
|
||||
[self stop];
|
||||
_socket = [[RCTSRWebSocket alloc] initWithURL:_url];
|
||||
_socket.delegate = self;
|
||||
|
||||
[_socket open];
|
||||
}
|
||||
|
||||
- (void)stop
|
||||
{
|
||||
_socket.delegate = nil;
|
||||
[_socket closeWithCode:1000 reason:@"Invalidated"];
|
||||
_socket = nil;
|
||||
}
|
||||
|
||||
- (void)webSocket:(RCTSRWebSocket *)webSocket didReceiveMessage:(id)message
|
||||
{
|
||||
if (_delegate) {
|
||||
NSError *error = nil;
|
||||
NSDictionary<NSString *, id> *msg = RCTJSONParse(message, &error);
|
||||
|
||||
if (!error) {
|
||||
[_delegate socketProxy:[RCTWebSocketManager sharedInstance] didReceiveMessage:msg];
|
||||
} else {
|
||||
RCTLogError(@"WebSocketManager failed to parse message with error %@\n<message>\n%@\n</message>", error, message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)reconnect
|
||||
{
|
||||
__weak RCTSRWebSocket *socket = _socket;
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
// Only reconnect if the observer wasn't stoppped while we were waiting
|
||||
if (socket) {
|
||||
[self start];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
- (void)webSocket:(RCTSRWebSocket *)webSocket didFailWithError:(NSError *)error
|
||||
{
|
||||
[self reconnect];
|
||||
}
|
||||
|
||||
- (void)webSocket:(RCTSRWebSocket *)webSocket didCloseWithCode:(NSInteger)code reason:(NSString *)reason wasClean:(BOOL)wasClean
|
||||
{
|
||||
[self reconnect];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark - RCTWebSocketManager
|
||||
|
||||
@interface RCTWebSocketManager()
|
||||
|
||||
@property (nonatomic, strong) NSMutableDictionary *sockets;
|
||||
@property (nonatomic, strong) dispatch_queue_t queue;
|
||||
|
||||
@end
|
||||
|
||||
@implementation RCTWebSocketManager
|
||||
|
||||
+ (instancetype)sharedInstance
|
||||
{
|
||||
static RCTWebSocketManager *sharedInstance = nil;
|
||||
static dispatch_once_t onceToken;
|
||||
|
||||
dispatch_once(&onceToken, ^{
|
||||
sharedInstance = [self new];
|
||||
});
|
||||
|
||||
return sharedInstance;
|
||||
}
|
||||
|
||||
- (void)setDelegate:(id<RCTWebSocketProxyDelegate>)delegate forURL:(NSURL *)url
|
||||
{
|
||||
NSString *key = [url absoluteString];
|
||||
RCTWebSocketObserver *observer = _sockets[key];
|
||||
|
||||
if (observer) {
|
||||
if (!delegate) {
|
||||
[observer stop];
|
||||
[_sockets removeObjectForKey:key];
|
||||
} else {
|
||||
observer.delegate = delegate;
|
||||
}
|
||||
} else {
|
||||
RCTWebSocketObserver *newObserver = [[RCTWebSocketObserver alloc] initWithURL:url delegate:delegate];
|
||||
[newObserver start];
|
||||
_sockets[key] = newObserver;
|
||||
}
|
||||
}
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
if ((self = [super init])) {
|
||||
_sockets = [NSMutableDictionary new];
|
||||
_queue = dispatch_queue_create("com.facebook.react.WebSocketManager", DISPATCH_QUEUE_SERIAL);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
+2
-2
@@ -8,11 +8,11 @@
|
||||
*/
|
||||
|
||||
#import <React/RCTDefines.h>
|
||||
#import <React/RCTWebSocketProxy.h>
|
||||
#import <React/RCTWebSocketObserverProtocol.h>
|
||||
|
||||
#if RCT_DEV // Only supported in dev mode
|
||||
|
||||
@interface RCTWebSocketManager : NSObject <RCTWebSocketProxy>
|
||||
@interface RCTWebSocketObserver : NSObject <RCTWebSocketObserver>
|
||||
@end
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,92 @@
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#import "RCTWebSocketObserver.h"
|
||||
|
||||
#import <React/RCTConvert.h>
|
||||
#import <React/RCTDefines.h>
|
||||
#import <React/RCTLog.h>
|
||||
#import <React/RCTUtils.h>
|
||||
|
||||
#import "RCTSRWebSocket.h"
|
||||
|
||||
#if RCT_DEV // Only supported in dev mode
|
||||
|
||||
@interface RCTWebSocketObserver () <RCTSRWebSocketDelegate>
|
||||
@end
|
||||
|
||||
@implementation RCTWebSocketObserver {
|
||||
NSURL *_url;
|
||||
RCTSRWebSocket *_socket;
|
||||
}
|
||||
|
||||
@synthesize delegate = _delegate;
|
||||
|
||||
- (instancetype)initWithURL:(NSURL *)url
|
||||
{
|
||||
if ((self = [self init])) {
|
||||
_url = url;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)start
|
||||
{
|
||||
[self stop];
|
||||
_socket = [[RCTSRWebSocket alloc] initWithURL:_url];
|
||||
_socket.delegate = self;
|
||||
|
||||
[_socket open];
|
||||
}
|
||||
|
||||
- (void)stop
|
||||
{
|
||||
_socket.delegate = nil;
|
||||
[_socket closeWithCode:1000 reason:@"Invalidated"];
|
||||
_socket = nil;
|
||||
}
|
||||
|
||||
- (void)webSocket:(RCTSRWebSocket *)webSocket didReceiveMessage:(id)message
|
||||
{
|
||||
if (_delegate) {
|
||||
NSError *error = nil;
|
||||
NSDictionary<NSString *, id> *msg = RCTJSONParse(message, &error);
|
||||
|
||||
if (!error) {
|
||||
[_delegate didReceiveWebSocketMessage:msg];
|
||||
} else {
|
||||
RCTLogError(@"WebSocketManager failed to parse message with error %@\n<message>\n%@\n</message>", error, message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)reconnect
|
||||
{
|
||||
__weak RCTSRWebSocket *socket = _socket;
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
// Only reconnect if the observer wasn't stoppped while we were waiting
|
||||
if (socket) {
|
||||
[self start];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
- (void)webSocket:(RCTSRWebSocket *)webSocket didFailWithError:(NSError *)error
|
||||
{
|
||||
[self reconnect];
|
||||
}
|
||||
|
||||
- (void)webSocket:(RCTSRWebSocket *)webSocket didCloseWithCode:(NSInteger)code reason:(NSString *)reason wasClean:(BOOL)wasClean
|
||||
{
|
||||
[self reconnect];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
+6
-6
@@ -4,7 +4,7 @@ package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
|
||||
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "React"
|
||||
s.version = package['version']
|
||||
s.version = "0.40.0"
|
||||
s.summary = package['description']
|
||||
s.description = <<-DESC
|
||||
React Native apps are built using the React JS
|
||||
@@ -31,10 +31,10 @@ Pod::Spec.new do |s|
|
||||
s.preserve_paths = "cli.js", "Libraries/**/*.js", "lint", "linter.js", "node_modules", "package.json", "packager", "PATENTS", "react-native-cli"
|
||||
|
||||
s.subspec 'Core' do |ss|
|
||||
ss.dependency 'React/CSSLayout'
|
||||
ss.dependency 'React/yoga'
|
||||
ss.dependency 'React/cxxreact'
|
||||
ss.source_files = "React/**/*.{c,h,m,mm,S}"
|
||||
ss.exclude_files = "**/__tests__/*", "IntegrationTests/* ReactCommon/CSSLayout/*"
|
||||
ss.exclude_files = "**/__tests__/*", "IntegrationTests/*", "ReactCommon/yoga/*"
|
||||
ss.frameworks = "JavaScriptCore"
|
||||
ss.libraries = "stdc++"
|
||||
end
|
||||
@@ -50,9 +50,9 @@ Pod::Spec.new do |s|
|
||||
ss.header_dir = 'cxxreact'
|
||||
end
|
||||
|
||||
s.subspec 'CSSLayout' do |ss|
|
||||
ss.source_files = 'ReactCommon/CSSLayout/**/*.{c,h}'
|
||||
ss.header_dir = 'CSSLayout'
|
||||
s.subspec 'yoga' do |ss|
|
||||
ss.source_files = 'ReactCommon/yoga/**/*.{c,h}'
|
||||
ss.header_dir = 'yoga'
|
||||
end
|
||||
|
||||
s.subspec 'ART' do |ss|
|
||||
|
||||
@@ -20,12 +20,6 @@
|
||||
@class RCTEventDispatcher;
|
||||
@class RCTPerformanceLogger;
|
||||
|
||||
/**
|
||||
* This notification triggers a reload of all bridges currently running.
|
||||
* Deprecated, use RCTBridge::requestReload instead.
|
||||
*/
|
||||
RCT_EXTERN NSString *const RCTReloadNotification DEPRECATED_ATTRIBUTE;
|
||||
|
||||
/**
|
||||
* This notification fires when the bridge starts loading the JS bundle.
|
||||
*/
|
||||
@@ -203,7 +197,7 @@ RCT_EXTERN NSString *RCTBridgeModuleNameForClass(Class bridgeModuleClass);
|
||||
/**
|
||||
* Inform the bridge, and anything subscribing to it, that it should reload.
|
||||
*/
|
||||
- (void)requestReload;
|
||||
- (void)requestReload __deprecated_msg("Call reload instead");
|
||||
|
||||
/**
|
||||
* Says whether bridge has started recieving calls from javascript.
|
||||
|
||||
+10
-13
@@ -14,14 +14,13 @@
|
||||
|
||||
#import "RCTConvert.h"
|
||||
#import "RCTEventDispatcher.h"
|
||||
#import "RCTKeyCommands.h"
|
||||
#import "RCTLog.h"
|
||||
#import "RCTModuleData.h"
|
||||
#import "RCTPerformanceLogger.h"
|
||||
#import "RCTProfile.h"
|
||||
#import "RCTReloadCommand.h"
|
||||
#import "RCTUtils.h"
|
||||
|
||||
NSString *const RCTReloadNotification = @"RCTReloadNotification";
|
||||
NSString *const RCTJavaScriptWillStartLoadingNotification = @"RCTJavaScriptWillStartLoadingNotification";
|
||||
NSString *const RCTJavaScriptDidLoadNotification = @"RCTJavaScriptDidLoadNotification";
|
||||
NSString *const RCTJavaScriptDidFailToLoadNotification = @"RCTJavaScriptDidFailToLoadNotification";
|
||||
@@ -120,6 +119,9 @@ void RCTVerifyAllModulesExported(NSArray *extraModules)
|
||||
}
|
||||
#endif
|
||||
|
||||
@interface RCTBridge () <RCTReloadListener>
|
||||
@end
|
||||
|
||||
@implementation RCTBridge
|
||||
{
|
||||
NSURL *_delegateBundleURL;
|
||||
@@ -200,7 +202,6 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init)
|
||||
* This runs only on the main thread, but crashes the subclass
|
||||
* RCTAssertMainQueue();
|
||||
*/
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
[self invalidate];
|
||||
}
|
||||
|
||||
@@ -209,18 +210,15 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init)
|
||||
RCTAssertMainQueue();
|
||||
|
||||
#if TARGET_IPHONE_SIMULATOR
|
||||
RCTKeyCommands *commands = [RCTKeyCommands sharedInstance];
|
||||
|
||||
// reload in current mode
|
||||
__weak typeof(self) weakSelf = self;
|
||||
[commands registerKeyCommandWithInput:@"r"
|
||||
modifierFlags:UIKeyModifierCommand
|
||||
action:^(__unused UIKeyCommand *command) {
|
||||
[weakSelf requestReload];
|
||||
}];
|
||||
RCTRegisterReloadCommandListener(self);
|
||||
#endif
|
||||
}
|
||||
|
||||
- (void)didReceiveReloadCommand
|
||||
{
|
||||
[self reload];
|
||||
}
|
||||
|
||||
- (NSArray<Class> *)moduleClasses
|
||||
{
|
||||
return self.batchedBridge.moduleClasses;
|
||||
@@ -273,7 +271,6 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init)
|
||||
|
||||
- (void)requestReload
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:RCTReloadNotification object:self];
|
||||
[self reload];
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#import <QuartzCore/QuartzCore.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import <CSSLayout/CSSLayout.h>
|
||||
#import <yoga/Yoga.h>
|
||||
#import <React/RCTAnimationType.h>
|
||||
#import <React/RCTBorderStyle.h>
|
||||
#import <React/RCTDefines.h>
|
||||
@@ -109,13 +109,13 @@ typedef id NSPropertyList;
|
||||
+ (NSPropertyList)NSPropertyList:(id)json;
|
||||
|
||||
typedef BOOL css_backface_visibility_t;
|
||||
+ (CSSOverflow)CSSOverflow:(id)json;
|
||||
+ (YGOverflow)YGOverflow:(id)json;
|
||||
+ (css_backface_visibility_t)css_backface_visibility_t:(id)json;
|
||||
+ (CSSFlexDirection)CSSFlexDirection:(id)json;
|
||||
+ (CSSJustify)CSSJustify:(id)json;
|
||||
+ (CSSAlign)CSSAlign:(id)json;
|
||||
+ (CSSPositionType)CSSPositionType:(id)json;
|
||||
+ (CSSWrap)CSSWrap:(id)json;
|
||||
+ (YGFlexDirection)YGFlexDirection:(id)json;
|
||||
+ (YGJustify)YGJustify:(id)json;
|
||||
+ (YGAlign)YGAlign:(id)json;
|
||||
+ (YGPositionType)YGPositionType:(id)json;
|
||||
+ (YGWrap)YGWrap:(id)json;
|
||||
|
||||
+ (RCTPointerEvents)RCTPointerEvents:(id)json;
|
||||
+ (RCTAnimationType)RCTAnimationType:(id)json;
|
||||
|
||||
+33
-33
@@ -614,44 +614,44 @@ RCT_ENUM_CONVERTER(css_backface_visibility_t, (@{
|
||||
@"visible": @YES
|
||||
}), YES, boolValue)
|
||||
|
||||
RCT_ENUM_CONVERTER(CSSOverflow, (@{
|
||||
@"hidden": @(CSSOverflowHidden),
|
||||
@"visible": @(CSSOverflowVisible),
|
||||
@"scroll": @(CSSOverflowScroll),
|
||||
}), CSSOverflowVisible, intValue)
|
||||
RCT_ENUM_CONVERTER(YGOverflow, (@{
|
||||
@"hidden": @(YGOverflowHidden),
|
||||
@"visible": @(YGOverflowVisible),
|
||||
@"scroll": @(YGOverflowScroll),
|
||||
}), YGOverflowVisible, intValue)
|
||||
|
||||
RCT_ENUM_CONVERTER(CSSFlexDirection, (@{
|
||||
@"row": @(CSSFlexDirectionRow),
|
||||
@"row-reverse": @(CSSFlexDirectionRowReverse),
|
||||
@"column": @(CSSFlexDirectionColumn),
|
||||
@"column-reverse": @(CSSFlexDirectionColumnReverse)
|
||||
}), CSSFlexDirectionColumn, intValue)
|
||||
RCT_ENUM_CONVERTER(YGFlexDirection, (@{
|
||||
@"row": @(YGFlexDirectionRow),
|
||||
@"row-reverse": @(YGFlexDirectionRowReverse),
|
||||
@"column": @(YGFlexDirectionColumn),
|
||||
@"column-reverse": @(YGFlexDirectionColumnReverse)
|
||||
}), YGFlexDirectionColumn, intValue)
|
||||
|
||||
RCT_ENUM_CONVERTER(CSSJustify, (@{
|
||||
@"flex-start": @(CSSJustifyFlexStart),
|
||||
@"flex-end": @(CSSJustifyFlexEnd),
|
||||
@"center": @(CSSJustifyCenter),
|
||||
@"space-between": @(CSSJustifySpaceBetween),
|
||||
@"space-around": @(CSSJustifySpaceAround)
|
||||
}), CSSJustifyFlexStart, intValue)
|
||||
RCT_ENUM_CONVERTER(YGJustify, (@{
|
||||
@"flex-start": @(YGJustifyFlexStart),
|
||||
@"flex-end": @(YGJustifyFlexEnd),
|
||||
@"center": @(YGJustifyCenter),
|
||||
@"space-between": @(YGJustifySpaceBetween),
|
||||
@"space-around": @(YGJustifySpaceAround)
|
||||
}), YGJustifyFlexStart, intValue)
|
||||
|
||||
RCT_ENUM_CONVERTER(CSSAlign, (@{
|
||||
@"flex-start": @(CSSAlignFlexStart),
|
||||
@"flex-end": @(CSSAlignFlexEnd),
|
||||
@"center": @(CSSAlignCenter),
|
||||
@"auto": @(CSSAlignAuto),
|
||||
@"stretch": @(CSSAlignStretch)
|
||||
}), CSSAlignFlexStart, intValue)
|
||||
RCT_ENUM_CONVERTER(YGAlign, (@{
|
||||
@"flex-start": @(YGAlignFlexStart),
|
||||
@"flex-end": @(YGAlignFlexEnd),
|
||||
@"center": @(YGAlignCenter),
|
||||
@"auto": @(YGAlignAuto),
|
||||
@"stretch": @(YGAlignStretch)
|
||||
}), YGAlignFlexStart, intValue)
|
||||
|
||||
RCT_ENUM_CONVERTER(CSSPositionType, (@{
|
||||
@"absolute": @(CSSPositionTypeAbsolute),
|
||||
@"relative": @(CSSPositionTypeRelative)
|
||||
}), CSSPositionTypeRelative, intValue)
|
||||
RCT_ENUM_CONVERTER(YGPositionType, (@{
|
||||
@"absolute": @(YGPositionTypeAbsolute),
|
||||
@"relative": @(YGPositionTypeRelative)
|
||||
}), YGPositionTypeRelative, intValue)
|
||||
|
||||
RCT_ENUM_CONVERTER(CSSWrap, (@{
|
||||
@"wrap": @(CSSWrapWrap),
|
||||
@"nowrap": @(CSSWrapNoWrap)
|
||||
}), CSSWrapNoWrap, intValue)
|
||||
RCT_ENUM_CONVERTER(YGWrap, (@{
|
||||
@"wrap": @(YGWrapWrap),
|
||||
@"nowrap": @(YGWrapNoWrap)
|
||||
}), YGWrapNoWrap, intValue)
|
||||
|
||||
RCT_ENUM_CONVERTER(RCTPointerEvents, (@{
|
||||
@"none": @(RCTPointerEventsNone),
|
||||
|
||||
@@ -7,14 +7,13 @@
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <React/RCTDefines.h>
|
||||
|
||||
#if RCT_DEV // Only supported in dev mode
|
||||
|
||||
@protocol RCTWebSocketProxy;
|
||||
|
||||
@protocol RCTWebSocketProxyDelegate
|
||||
- (void)socketProxy:(id<RCTWebSocketProxy>)sender didReceiveMessage:(NSDictionary<NSString *, id> *)message;
|
||||
@protocol RCTReloadListener
|
||||
- (void)didReceiveReloadCommand;
|
||||
@end
|
||||
|
||||
#endif
|
||||
/** Registers a weakly-held observer of the Command+R reload key command. */
|
||||
RCT_EXTERN void RCTRegisterReloadCommandListener(id<RCTReloadListener> listener);
|
||||
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#import "RCTReloadCommand.h"
|
||||
|
||||
#import "RCTKeyCommands.h"
|
||||
|
||||
void RCTRegisterReloadCommandListener(id<RCTReloadListener> listener)
|
||||
{
|
||||
static NSHashTable<id<RCTReloadListener>> *listeners;
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
listeners = [NSHashTable weakObjectsHashTable];
|
||||
[[RCTKeyCommands sharedInstance] registerKeyCommandWithInput:@"r"
|
||||
modifierFlags:UIKeyModifierCommand
|
||||
action:
|
||||
^(__unused UIKeyCommand *command) {
|
||||
NSArray<id<RCTReloadListener>> *copiedListeners;
|
||||
@synchronized (listeners) { // avoid mutation-while-enumerating
|
||||
copiedListeners = [listeners allObjects];
|
||||
}
|
||||
for (id<RCTReloadListener> l in copiedListeners) {
|
||||
[l didReceiveReloadCommand];
|
||||
}
|
||||
}];
|
||||
});
|
||||
|
||||
@synchronized (listeners) {
|
||||
[listeners addObject:listener];
|
||||
}
|
||||
}
|
||||
@@ -8,18 +8,18 @@
|
||||
*/
|
||||
|
||||
#import <React/RCTDefines.h>
|
||||
#import <React/RCTWebSocketProxyDelegate.h>
|
||||
|
||||
#if RCT_DEV // Only supported in dev mode
|
||||
|
||||
@protocol RCTWebSocketProxy
|
||||
|
||||
+ (instancetype)sharedInstance;
|
||||
|
||||
- (void)setDelegate:(id<RCTWebSocketProxyDelegate>)delegate forURL:(NSURL *)url;
|
||||
|
||||
- (instancetype)init __attribute__((unavailable("init not available, call sharedInstance instead")));
|
||||
@protocol RCTWebSocketObserverDelegate
|
||||
- (void)didReceiveWebSocketMessage:(NSDictionary<NSString *, id> *)message;
|
||||
@end
|
||||
|
||||
@protocol RCTWebSocketObserver
|
||||
- (instancetype)initWithURL:(NSURL *)url;
|
||||
@property (nonatomic, weak) id<RCTWebSocketObserverDelegate> delegate;
|
||||
- (void)start;
|
||||
- (void)stop;
|
||||
@end
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,108 @@
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
typedef enum YGFlexDirection {
|
||||
YGFlexDirectionColumn,
|
||||
YGFlexDirectionColumnReverse,
|
||||
YGFlexDirectionRow,
|
||||
YGFlexDirectionRowReverse,
|
||||
YGFlexDirectionCount,
|
||||
} YGFlexDirection;
|
||||
|
||||
typedef enum YGMeasureMode {
|
||||
YGMeasureModeUndefined,
|
||||
YGMeasureModeExactly,
|
||||
YGMeasureModeAtMost,
|
||||
YGMeasureModeCount,
|
||||
} YGMeasureMode;
|
||||
|
||||
typedef enum YGPrintOptions {
|
||||
YGPrintOptionsLayout = 1,
|
||||
YGPrintOptionsStyle = 2,
|
||||
YGPrintOptionsChildren = 4,
|
||||
YGPrintOptionsCount,
|
||||
} YGPrintOptions;
|
||||
|
||||
typedef enum YGEdge {
|
||||
YGEdgeLeft,
|
||||
YGEdgeTop,
|
||||
YGEdgeRight,
|
||||
YGEdgeBottom,
|
||||
YGEdgeStart,
|
||||
YGEdgeEnd,
|
||||
YGEdgeHorizontal,
|
||||
YGEdgeVertical,
|
||||
YGEdgeAll,
|
||||
YGEdgeCount,
|
||||
} YGEdge;
|
||||
|
||||
typedef enum YGPositionType {
|
||||
YGPositionTypeRelative,
|
||||
YGPositionTypeAbsolute,
|
||||
YGPositionTypeCount,
|
||||
} YGPositionType;
|
||||
|
||||
typedef enum YGDimension {
|
||||
YGDimensionWidth,
|
||||
YGDimensionHeight,
|
||||
YGDimensionCount,
|
||||
} YGDimension;
|
||||
|
||||
typedef enum YGJustify {
|
||||
YGJustifyFlexStart,
|
||||
YGJustifyCenter,
|
||||
YGJustifyFlexEnd,
|
||||
YGJustifySpaceBetween,
|
||||
YGJustifySpaceAround,
|
||||
YGJustifyCount,
|
||||
} YGJustify;
|
||||
|
||||
typedef enum YGDirection {
|
||||
YGDirectionInherit,
|
||||
YGDirectionLTR,
|
||||
YGDirectionRTL,
|
||||
YGDirectionCount,
|
||||
} YGDirection;
|
||||
|
||||
typedef enum YGLogLevel {
|
||||
YGLogLevelError,
|
||||
YGLogLevelWarn,
|
||||
YGLogLevelInfo,
|
||||
YGLogLevelDebug,
|
||||
YGLogLevelVerbose,
|
||||
YGLogLevelCount,
|
||||
} YGLogLevel;
|
||||
|
||||
typedef enum YGWrap {
|
||||
YGWrapNoWrap,
|
||||
YGWrapWrap,
|
||||
YGWrapCount,
|
||||
} YGWrap;
|
||||
|
||||
typedef enum YGOverflow {
|
||||
YGOverflowVisible,
|
||||
YGOverflowHidden,
|
||||
YGOverflowScroll,
|
||||
YGOverflowCount,
|
||||
} YGOverflow;
|
||||
|
||||
typedef enum YGExperimentalFeature {
|
||||
YGExperimentalFeatureRounding,
|
||||
YGExperimentalFeatureWebFlexBasis,
|
||||
YGExperimentalFeatureCount,
|
||||
} YGExperimentalFeature;
|
||||
|
||||
typedef enum YGAlign {
|
||||
YGAlignAuto,
|
||||
YGAlignFlexStart,
|
||||
YGAlignCenter,
|
||||
YGAlignFlexEnd,
|
||||
YGAlignStretch,
|
||||
YGAlignCount,
|
||||
} YGAlign;
|
||||
@@ -10,11 +10,11 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define CSS_EXTERN_C_BEGIN extern "C" {
|
||||
#define CSS_EXTERN_C_END }
|
||||
#define YG_EXTERN_C_BEGIN extern "C" {
|
||||
#define YG_EXTERN_C_END }
|
||||
#else
|
||||
#define CSS_EXTERN_C_BEGIN
|
||||
#define CSS_EXTERN_C_END
|
||||
#define YG_EXTERN_C_BEGIN
|
||||
#define YG_EXTERN_C_END
|
||||
#endif
|
||||
|
||||
#ifdef _WINDLL
|
||||
@@ -28,15 +28,15 @@
|
||||
#endif
|
||||
|
||||
#if FB_ASSERTIONS_ENABLED
|
||||
#define CSS_ABORT() abort()
|
||||
#define YG_ABORT() abort()
|
||||
#else
|
||||
#define CSS_ABORT()
|
||||
#define YG_ABORT()
|
||||
#endif
|
||||
|
||||
#ifndef CSS_ASSERT
|
||||
#define CSS_ASSERT(X, message) \
|
||||
if (!(X)) { \
|
||||
CSSLog(CSSLogLevelError, "%s", message); \
|
||||
CSS_ABORT(); \
|
||||
#ifndef YG_ASSERT
|
||||
#define YG_ASSERT(X, message) \
|
||||
if (!(X)) { \
|
||||
YGLog(YGLogLevelError, "%s", message); \
|
||||
YG_ABORT(); \
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,104 @@
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#include "YGNodeList.h"
|
||||
|
||||
extern YGMalloc gYGMalloc;
|
||||
extern YGRealloc gYGRealloc;
|
||||
extern YGFree gYGFree;
|
||||
|
||||
struct YGNodeList {
|
||||
uint32_t capacity;
|
||||
uint32_t count;
|
||||
YGNodeRef *items;
|
||||
};
|
||||
|
||||
YGNodeListRef YGNodeListNew(const uint32_t initialCapacity) {
|
||||
const YGNodeListRef list = gYGMalloc(sizeof(struct YGNodeList));
|
||||
YG_ASSERT(list != NULL, "Could not allocate memory for list");
|
||||
|
||||
list->capacity = initialCapacity;
|
||||
list->count = 0;
|
||||
list->items = gYGMalloc(sizeof(YGNodeRef) * list->capacity);
|
||||
YG_ASSERT(list->items != NULL, "Could not allocate memory for items");
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
void YGNodeListFree(const YGNodeListRef list) {
|
||||
if (list) {
|
||||
gYGFree(list->items);
|
||||
gYGFree(list);
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t YGNodeListCount(const YGNodeListRef list) {
|
||||
if (list) {
|
||||
return list->count;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void YGNodeListAdd(YGNodeListRef *listp, const YGNodeRef node) {
|
||||
if (!*listp) {
|
||||
*listp = YGNodeListNew(4);
|
||||
}
|
||||
YGNodeListInsert(listp, node, (*listp)->count);
|
||||
}
|
||||
|
||||
void YGNodeListInsert(YGNodeListRef *listp, const YGNodeRef node, const uint32_t index) {
|
||||
if (!*listp) {
|
||||
*listp = YGNodeListNew(4);
|
||||
}
|
||||
YGNodeListRef list = *listp;
|
||||
|
||||
if (list->count == list->capacity) {
|
||||
list->capacity *= 2;
|
||||
list->items = gYGRealloc(list->items, sizeof(YGNodeRef) * list->capacity);
|
||||
YG_ASSERT(list->items != NULL, "Could not extend allocation for items");
|
||||
}
|
||||
|
||||
for (uint32_t i = list->count; i > index; i--) {
|
||||
list->items[i] = list->items[i - 1];
|
||||
}
|
||||
|
||||
list->count++;
|
||||
list->items[index] = node;
|
||||
}
|
||||
|
||||
YGNodeRef YGNodeListRemove(const YGNodeListRef list, const uint32_t index) {
|
||||
const YGNodeRef removed = list->items[index];
|
||||
list->items[index] = NULL;
|
||||
|
||||
for (uint32_t i = index; i < list->count - 1; i++) {
|
||||
list->items[i] = list->items[i + 1];
|
||||
list->items[i + 1] = NULL;
|
||||
}
|
||||
|
||||
list->count--;
|
||||
return removed;
|
||||
}
|
||||
|
||||
YGNodeRef YGNodeListDelete(const YGNodeListRef list, const YGNodeRef node) {
|
||||
for (uint32_t i = 0; i < list->count; i++) {
|
||||
if (list->items[i] == node) {
|
||||
return YGNodeListRemove(list, i);
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
YGNodeRef YGNodeListGet(const YGNodeListRef list, const uint32_t index) {
|
||||
if (YGNodeListCount(list) > 0) {
|
||||
return list->items[index];
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "YGMacros.h"
|
||||
#include "Yoga.h"
|
||||
|
||||
YG_EXTERN_C_BEGIN
|
||||
|
||||
typedef struct YGNodeList *YGNodeListRef;
|
||||
|
||||
YGNodeListRef YGNodeListNew(const uint32_t initialCapacity);
|
||||
void YGNodeListFree(const YGNodeListRef list);
|
||||
uint32_t YGNodeListCount(const YGNodeListRef list);
|
||||
void YGNodeListAdd(YGNodeListRef *listp, const YGNodeRef node);
|
||||
void YGNodeListInsert(YGNodeListRef *listp, const YGNodeRef node, const uint32_t index);
|
||||
YGNodeRef YGNodeListRemove(const YGNodeListRef list, const uint32_t index);
|
||||
YGNodeRef YGNodeListDelete(const YGNodeListRef list, const YGNodeRef node);
|
||||
YGNodeRef YGNodeListGet(const YGNodeListRef list, const uint32_t index);
|
||||
|
||||
YG_EXTERN_C_END
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,181 @@
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifndef __cplusplus
|
||||
#include <stdbool.h>
|
||||
#endif
|
||||
|
||||
// Not defined in MSVC++
|
||||
#ifndef NAN
|
||||
static const unsigned long __nan[2] = {0xffffffff, 0x7fffffff};
|
||||
#define NAN (*(const float *) __nan)
|
||||
#endif
|
||||
|
||||
#define YGUndefined NAN
|
||||
|
||||
#include "YGEnums.h"
|
||||
#include "YGMacros.h"
|
||||
|
||||
YG_EXTERN_C_BEGIN
|
||||
|
||||
typedef struct YGSize {
|
||||
float width;
|
||||
float height;
|
||||
} YGSize;
|
||||
|
||||
typedef struct YGNode *YGNodeRef;
|
||||
typedef YGSize (*YGMeasureFunc)(YGNodeRef node,
|
||||
float width,
|
||||
YGMeasureMode widthMode,
|
||||
float height,
|
||||
YGMeasureMode heightMode);
|
||||
typedef void (*YGPrintFunc)(YGNodeRef node);
|
||||
typedef int (*YGLogger)(YGLogLevel level, const char *format, va_list args);
|
||||
|
||||
typedef void *(*YGMalloc)(size_t size);
|
||||
typedef void *(*YGCalloc)(size_t count, size_t size);
|
||||
typedef void *(*YGRealloc)(void *ptr, size_t size);
|
||||
typedef void (*YGFree)(void *ptr);
|
||||
|
||||
// YGNode
|
||||
WIN_EXPORT YGNodeRef YGNodeNew(void);
|
||||
WIN_EXPORT void YGNodeInit(const YGNodeRef node);
|
||||
WIN_EXPORT void YGNodeFree(const YGNodeRef node);
|
||||
WIN_EXPORT void YGNodeFreeRecursive(const YGNodeRef node);
|
||||
WIN_EXPORT void YGNodeReset(const YGNodeRef node);
|
||||
WIN_EXPORT int32_t YGNodeGetInstanceCount(void);
|
||||
|
||||
WIN_EXPORT void YGNodeInsertChild(const YGNodeRef node,
|
||||
const YGNodeRef child,
|
||||
const uint32_t index);
|
||||
WIN_EXPORT void YGNodeRemoveChild(const YGNodeRef node, const YGNodeRef child);
|
||||
WIN_EXPORT YGNodeRef YGNodeGetChild(const YGNodeRef node, const uint32_t index);
|
||||
WIN_EXPORT uint32_t YGNodeChildCount(const YGNodeRef node);
|
||||
|
||||
WIN_EXPORT void YGNodeCalculateLayout(const YGNodeRef node,
|
||||
const float availableWidth,
|
||||
const float availableHeight,
|
||||
const YGDirection parentDirection);
|
||||
|
||||
// Mark a node as dirty. Only valid for nodes with a custom measure function
|
||||
// set.
|
||||
// YG knows when to mark all other nodes as dirty but because nodes with
|
||||
// measure functions
|
||||
// depends on information not known to YG they must perform this dirty
|
||||
// marking manually.
|
||||
WIN_EXPORT void YGNodeMarkDirty(const YGNodeRef node);
|
||||
WIN_EXPORT bool YGNodeIsDirty(const YGNodeRef node);
|
||||
|
||||
WIN_EXPORT void YGNodePrint(const YGNodeRef node, const YGPrintOptions options);
|
||||
|
||||
WIN_EXPORT bool YGValueIsUndefined(const float value);
|
||||
|
||||
WIN_EXPORT bool YGNodeCanUseCachedMeasurement(const YGMeasureMode widthMode,
|
||||
const float width,
|
||||
const YGMeasureMode heightMode,
|
||||
const float height,
|
||||
const YGMeasureMode lastWidthMode,
|
||||
const float lastWidth,
|
||||
const YGMeasureMode lastHeightMode,
|
||||
const float lastHeight,
|
||||
const float lastComputedWidth,
|
||||
const float lastComputedHeight,
|
||||
const float marginRow,
|
||||
const float marginColumn);
|
||||
|
||||
WIN_EXPORT void YGNodeCopyStyle(const YGNodeRef dstNode, const YGNodeRef srcNode);
|
||||
|
||||
#define YG_NODE_PROPERTY(type, name, paramName) \
|
||||
WIN_EXPORT void YGNodeSet##name(const YGNodeRef node, type paramName); \
|
||||
WIN_EXPORT type YGNodeGet##name(const YGNodeRef node);
|
||||
|
||||
#define YG_NODE_STYLE_PROPERTY(type, name, paramName) \
|
||||
WIN_EXPORT void YGNodeStyleSet##name(const YGNodeRef node, const type paramName); \
|
||||
WIN_EXPORT type YGNodeStyleGet##name(const YGNodeRef node);
|
||||
|
||||
#define YG_NODE_STYLE_EDGE_PROPERTY(type, name, paramName) \
|
||||
WIN_EXPORT void YGNodeStyleSet##name(const YGNodeRef node, \
|
||||
const YGEdge edge, \
|
||||
const type paramName); \
|
||||
WIN_EXPORT type YGNodeStyleGet##name(const YGNodeRef node, const YGEdge edge);
|
||||
|
||||
#define YG_NODE_LAYOUT_PROPERTY(type, name) \
|
||||
WIN_EXPORT type YGNodeLayoutGet##name(const YGNodeRef node);
|
||||
|
||||
YG_NODE_PROPERTY(void *, Context, context);
|
||||
YG_NODE_PROPERTY(YGMeasureFunc, MeasureFunc, measureFunc);
|
||||
YG_NODE_PROPERTY(YGPrintFunc, PrintFunc, printFunc);
|
||||
YG_NODE_PROPERTY(bool, HasNewLayout, hasNewLayout);
|
||||
|
||||
YG_NODE_STYLE_PROPERTY(YGDirection, Direction, direction);
|
||||
YG_NODE_STYLE_PROPERTY(YGFlexDirection, FlexDirection, flexDirection);
|
||||
YG_NODE_STYLE_PROPERTY(YGJustify, JustifyContent, justifyContent);
|
||||
YG_NODE_STYLE_PROPERTY(YGAlign, AlignContent, alignContent);
|
||||
YG_NODE_STYLE_PROPERTY(YGAlign, AlignItems, alignItems);
|
||||
YG_NODE_STYLE_PROPERTY(YGAlign, AlignSelf, alignSelf);
|
||||
YG_NODE_STYLE_PROPERTY(YGPositionType, PositionType, positionType);
|
||||
YG_NODE_STYLE_PROPERTY(YGWrap, FlexWrap, flexWrap);
|
||||
YG_NODE_STYLE_PROPERTY(YGOverflow, Overflow, overflow);
|
||||
|
||||
WIN_EXPORT void YGNodeStyleSetFlex(const YGNodeRef node, const float flex);
|
||||
YG_NODE_STYLE_PROPERTY(float, FlexGrow, flexGrow);
|
||||
YG_NODE_STYLE_PROPERTY(float, FlexShrink, flexShrink);
|
||||
YG_NODE_STYLE_PROPERTY(float, FlexBasis, flexBasis);
|
||||
|
||||
YG_NODE_STYLE_EDGE_PROPERTY(float, Position, position);
|
||||
YG_NODE_STYLE_EDGE_PROPERTY(float, Margin, margin);
|
||||
YG_NODE_STYLE_EDGE_PROPERTY(float, Padding, padding);
|
||||
YG_NODE_STYLE_EDGE_PROPERTY(float, Border, border);
|
||||
|
||||
YG_NODE_STYLE_PROPERTY(float, Width, width);
|
||||
YG_NODE_STYLE_PROPERTY(float, Height, height);
|
||||
YG_NODE_STYLE_PROPERTY(float, MinWidth, minWidth);
|
||||
YG_NODE_STYLE_PROPERTY(float, MinHeight, minHeight);
|
||||
YG_NODE_STYLE_PROPERTY(float, MaxWidth, maxWidth);
|
||||
YG_NODE_STYLE_PROPERTY(float, MaxHeight, maxHeight);
|
||||
|
||||
// Yoga specific properties, not compatible with flexbox specification
|
||||
// Aspect ratio control the size of the undefined dimension of a node.
|
||||
// - On a node with a set width/height aspect ratio control the size of the unset dimension
|
||||
// - On a node with a set flex basis aspect ratio controls the size of the node in the cross axis if
|
||||
// unset
|
||||
// - On a node with a measure function aspect ratio works as though the measure function measures
|
||||
// the flex basis
|
||||
// - On a node with flex grow/shrink aspect ratio controls the size of the node in the cross axis if
|
||||
// unset
|
||||
// - Aspect ratio takes min/max dimensions into account
|
||||
YG_NODE_STYLE_PROPERTY(float, AspectRatio, aspectRatio);
|
||||
|
||||
YG_NODE_LAYOUT_PROPERTY(float, Left);
|
||||
YG_NODE_LAYOUT_PROPERTY(float, Top);
|
||||
YG_NODE_LAYOUT_PROPERTY(float, Right);
|
||||
YG_NODE_LAYOUT_PROPERTY(float, Bottom);
|
||||
YG_NODE_LAYOUT_PROPERTY(float, Width);
|
||||
YG_NODE_LAYOUT_PROPERTY(float, Height);
|
||||
YG_NODE_LAYOUT_PROPERTY(YGDirection, Direction);
|
||||
|
||||
WIN_EXPORT void YGSetLogger(YGLogger logger);
|
||||
WIN_EXPORT void YGLog(YGLogLevel level, const char *message, ...);
|
||||
|
||||
WIN_EXPORT void YGSetExperimentalFeatureEnabled(YGExperimentalFeature feature, bool enabled);
|
||||
WIN_EXPORT bool YGIsExperimentalFeatureEnabled(YGExperimentalFeature feature);
|
||||
|
||||
WIN_EXPORT void
|
||||
YGSetMemoryFuncs(YGMalloc cssMalloc, YGCalloc cssCalloc, YGRealloc cssRealloc, YGFree cssFree);
|
||||
|
||||
YG_EXTERN_C_END
|
||||
@@ -20,7 +20,7 @@
|
||||
#import "RCTProfile.h"
|
||||
#import "RCTRootView.h"
|
||||
#import "RCTUtils.h"
|
||||
#import "RCTWebSocketProxy.h"
|
||||
#import "RCTWebSocketObserverProtocol.h"
|
||||
|
||||
#if RCT_DEV
|
||||
|
||||
@@ -131,7 +131,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init)
|
||||
|
||||
typedef void(^RCTDevMenuAlertActionHandler)(UIAlertAction *action);
|
||||
|
||||
@interface RCTDevMenu () <RCTBridgeModule, RCTInvalidating, RCTWebSocketProxyDelegate>
|
||||
@interface RCTDevMenu () <RCTBridgeModule, RCTInvalidating, RCTWebSocketObserverDelegate>
|
||||
|
||||
@property (nonatomic, strong) Class executorClass;
|
||||
|
||||
@@ -267,21 +267,46 @@ RCT_EXPORT_MODULE()
|
||||
// TODO: Move non-UI logic into separate RCTDevSettings module
|
||||
- (void)connectPackager
|
||||
{
|
||||
Class webSocketManagerClass = objc_lookUpClass("RCTWebSocketManager");
|
||||
id<RCTWebSocketProxy> webSocketManager = (id <RCTWebSocketProxy>)[webSocketManagerClass sharedInstance];
|
||||
RCTAssertMainQueue();
|
||||
|
||||
NSURL *url = [self packagerURL];
|
||||
if (url) {
|
||||
[webSocketManager setDelegate:self forURL:url];
|
||||
if (!url) {
|
||||
return;
|
||||
}
|
||||
|
||||
Class webSocketObserverClass = objc_lookUpClass("RCTWebSocketObserver");
|
||||
if (webSocketObserverClass == Nil) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If multiple RCTDevMenus are created, the most recently connected one steals the RCTWebSocketObserver.
|
||||
// (Why this behavior exists is beyond me, as of this writing.)
|
||||
static NSMutableDictionary<NSString *, id<RCTWebSocketObserver>> *observers = nil;
|
||||
if (observers == nil) {
|
||||
observers = [NSMutableDictionary new];
|
||||
}
|
||||
|
||||
NSString *key = [url absoluteString];
|
||||
id<RCTWebSocketObserver> existingObserver = observers[key];
|
||||
if (existingObserver) {
|
||||
existingObserver.delegate = self;
|
||||
} else {
|
||||
id<RCTWebSocketObserver> newObserver = [(id<RCTWebSocketObserver>)[webSocketObserverClass alloc] initWithURL:url];
|
||||
newObserver.delegate = self;
|
||||
[newObserver start];
|
||||
observers[key] = newObserver;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
- (BOOL)isSupportedVersion:(NSNumber *)version
|
||||
{
|
||||
NSArray<NSNumber *> *const kSupportedVersions = @[ @1 ];
|
||||
return [kSupportedVersions containsObject:version];
|
||||
}
|
||||
|
||||
- (void)socketProxy:(__unused id<RCTWebSocketProxy>)sender didReceiveMessage:(NSDictionary<NSString *, id> *)message
|
||||
- (void)didReceiveWebSocketMessage:(NSDictionary<NSString *, id> *)message
|
||||
{
|
||||
if ([self isSupportedVersion:message[@"version"]]) {
|
||||
[self processTarget:message[@"target"] action:message[@"action"] options:message[@"options"]];
|
||||
@@ -563,7 +588,7 @@ RCT_EXPORT_METHOD(show)
|
||||
|
||||
RCT_EXPORT_METHOD(reload)
|
||||
{
|
||||
[_bridge requestReload];
|
||||
[_bridge reload];
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(debugRemotely:(BOOL)enableDebug)
|
||||
|
||||
@@ -56,7 +56,7 @@ RCT_EXPORT_METHOD(reportFatalException:(NSString *)message
|
||||
static NSUInteger reloadRetries = 0;
|
||||
if (!RCT_DEBUG && reloadRetries < _maxReloadAttempts) {
|
||||
reloadRetries++;
|
||||
[_bridge requestReload];
|
||||
[_bridge reload];
|
||||
} else {
|
||||
NSString *description = [@"Unhandled JS Exception: " stringByAppendingString:message];
|
||||
NSDictionary *errorInfo = @{ NSLocalizedDescriptionKey: description, RCTJSStackTraceKey: stack };
|
||||
|
||||
@@ -451,8 +451,9 @@ RCT_EXPORT_METHOD(dismiss)
|
||||
[[[NSURLSession sharedSession] dataTaskWithRequest:request] resume];
|
||||
}
|
||||
|
||||
- (void)reloadFromRedBoxWindow:(__unused RCTRedBoxWindow *)redBoxWindow {
|
||||
[_bridge requestReload];
|
||||
- (void)reloadFromRedBoxWindow:(__unused RCTRedBoxWindow *)redBoxWindow
|
||||
{
|
||||
[_bridge reload];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#import <AVFoundation/AVFoundation.h>
|
||||
|
||||
#import <CSSLayout/CSSLayout.h>
|
||||
#import <yoga/Yoga.h>
|
||||
|
||||
#import "RCTAccessibilityManager.h"
|
||||
#import "RCTAnimationType.h"
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#import "RCTProfile.h"
|
||||
|
||||
#import <dlfcn.h>
|
||||
|
||||
#import <libkern/OSAtomic.h>
|
||||
#import <mach/mach.h>
|
||||
#import <objc/message.h>
|
||||
@@ -19,15 +18,15 @@
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import "RCTAssert.h"
|
||||
#import "RCTBridge.h"
|
||||
#import "RCTBridge+Private.h"
|
||||
#import "RCTBridge.h"
|
||||
#import "RCTComponentData.h"
|
||||
#import "RCTDefines.h"
|
||||
#import "RCTJSCExecutor.h"
|
||||
#import "RCTLog.h"
|
||||
#import "RCTModuleData.h"
|
||||
#import "RCTUtils.h"
|
||||
#import "RCTUIManager.h"
|
||||
#import "RCTJSCExecutor.h"
|
||||
#import "RCTUtils.h"
|
||||
|
||||
NSString *const RCTProfileDidStartProfiling = @"RCTProfileDidStartProfiling";
|
||||
NSString *const RCTProfileDidEndProfiling = @"RCTProfileDidEndProfiling";
|
||||
@@ -363,7 +362,7 @@ void RCTProfileUnhookModules(RCTBridge *bridge)
|
||||
|
||||
+ (void)reload
|
||||
{
|
||||
[RCTProfilingBridge() requestReload];
|
||||
[RCTProfilingBridge() reload];
|
||||
}
|
||||
|
||||
+ (void)toggle:(UIButton *)target
|
||||
|
||||
+1246
-685
File diff suppressed because it is too large
Load Diff
@@ -86,7 +86,9 @@ numberOfRowsInComponent:(__unused NSInteger)component
|
||||
}
|
||||
|
||||
label.font = _font;
|
||||
label.textColor = _color;
|
||||
|
||||
label.textColor = [RCTConvert UIColor:_items[row][@"textColor"]] ?: _color;
|
||||
|
||||
label.textAlignment = _textAlign;
|
||||
label.text = [self pickerView:pickerView titleForRow:row forComponent:component];
|
||||
return label;
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
self = [super init];
|
||||
if (self) {
|
||||
if ([[RCTI18nUtil sharedInstance] isRTL]) {
|
||||
CSSNodeStyleSetDirection(self.cssNode, CSSDirectionRTL);
|
||||
YGNodeStyleSetDirection(self.cssNode, YGDirectionRTL);
|
||||
}
|
||||
}
|
||||
return self;
|
||||
@@ -33,14 +33,14 @@
|
||||
case RCTRootViewSizeFlexibilityNone:
|
||||
break;
|
||||
case RCTRootViewSizeFlexibilityWidth:
|
||||
CSSNodeStyleSetWidth(self.cssNode, CSSUndefined);
|
||||
YGNodeStyleSetWidth(self.cssNode, YGUndefined);
|
||||
break;
|
||||
case RCTRootViewSizeFlexibilityHeight:
|
||||
CSSNodeStyleSetHeight(self.cssNode, CSSUndefined);
|
||||
YGNodeStyleSetHeight(self.cssNode, YGUndefined);
|
||||
break;
|
||||
case RCTRootViewSizeFlexibilityWidthAndHeight:
|
||||
CSSNodeStyleSetWidth(self.cssNode, CSSUndefined);
|
||||
CSSNodeStyleSetHeight(self.cssNode, CSSUndefined);
|
||||
YGNodeStyleSetWidth(self.cssNode, YGUndefined);
|
||||
YGNodeStyleSetHeight(self.cssNode, YGUndefined);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -49,7 +49,7 @@
|
||||
{
|
||||
[self applySizeConstraints];
|
||||
|
||||
CSSNodeCalculateLayout(self.cssNode, CSSUndefined, CSSUndefined, CSSDirectionInherit);
|
||||
YGNodeCalculateLayout(self.cssNode, YGUndefined, YGUndefined, YGDirectionInherit);
|
||||
|
||||
NSMutableSet<RCTShadowView *> *viewsWithNewFrame = [NSMutableSet set];
|
||||
[self applyLayoutNode:self.cssNode viewsWithNewFrame:viewsWithNewFrame absolutePosition:CGPointZero];
|
||||
|
||||
@@ -87,8 +87,8 @@ RCT_EXPORT_VIEW_PROPERTY(onScrollAnimationEnd, RCTDirectEventBlock)
|
||||
// is set to from js we want to clip drawing or not. This piece of code ensures
|
||||
// that css-layout is always treating the contents of a scroll container as
|
||||
// overflow: 'scroll'.
|
||||
RCT_CUSTOM_SHADOW_PROPERTY(overflow, CSSOverflow, RCTShadowView) {
|
||||
view.overflow = CSSOverflowScroll;
|
||||
RCT_CUSTOM_SHADOW_PROPERTY(overflow, YGOverflow, RCTShadowView) {
|
||||
view.overflow = YGOverflowScroll;
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(getContentSize:(nonnull NSNumber *)reactTag
|
||||
|
||||
+14
-14
@@ -9,7 +9,7 @@
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import <CSSLayout/CSSLayout.h>
|
||||
#import <yoga/Yoga.h>
|
||||
#import <React/RCTComponent.h>
|
||||
#import <React/RCTRootView.h>
|
||||
|
||||
@@ -44,7 +44,7 @@ typedef void (^RCTApplierBlock)(NSDictionary<NSNumber *, UIView *> *viewRegistry
|
||||
- (void)removeReactSubview:(RCTShadowView *)subview NS_REQUIRES_SUPER;
|
||||
|
||||
@property (nonatomic, weak, readonly) RCTShadowView *superview;
|
||||
@property (nonatomic, assign, readonly) CSSNodeRef cssNode;
|
||||
@property (nonatomic, assign, readonly) YGNodeRef cssNode;
|
||||
@property (nonatomic, copy) NSString *viewName;
|
||||
@property (nonatomic, strong) UIColor *backgroundColor; // Used to propagate to children
|
||||
@property (nonatomic, copy) RCTDirectEventBlock onLayout;
|
||||
@@ -126,12 +126,12 @@ typedef void (^RCTApplierBlock)(NSDictionary<NSNumber *, UIView *> *viewRegistry
|
||||
/**
|
||||
* Flexbox properties. All zero/disabled by default
|
||||
*/
|
||||
@property (nonatomic, assign) CSSFlexDirection flexDirection;
|
||||
@property (nonatomic, assign) CSSJustify justifyContent;
|
||||
@property (nonatomic, assign) CSSAlign alignSelf;
|
||||
@property (nonatomic, assign) CSSAlign alignItems;
|
||||
@property (nonatomic, assign) CSSPositionType position;
|
||||
@property (nonatomic, assign) CSSWrap flexWrap;
|
||||
@property (nonatomic, assign) YGFlexDirection flexDirection;
|
||||
@property (nonatomic, assign) YGJustify justifyContent;
|
||||
@property (nonatomic, assign) YGAlign alignSelf;
|
||||
@property (nonatomic, assign) YGAlign alignItems;
|
||||
@property (nonatomic, assign) YGPositionType position;
|
||||
@property (nonatomic, assign) YGWrap flexWrap;
|
||||
|
||||
@property (nonatomic, assign) float flexGrow;
|
||||
@property (nonatomic, assign) float flexShrink;
|
||||
@@ -149,7 +149,7 @@ typedef void (^RCTApplierBlock)(NSDictionary<NSNumber *, UIView *> *viewRegistry
|
||||
/**
|
||||
* Clipping properties
|
||||
*/
|
||||
@property (nonatomic, assign) CSSOverflow overflow;
|
||||
@property (nonatomic, assign) YGOverflow overflow;
|
||||
|
||||
/**
|
||||
* Calculate property changes that need to be propagated to the view.
|
||||
@@ -183,21 +183,21 @@ typedef void (^RCTApplierBlock)(NSDictionary<NSNumber *, UIView *> *viewRegistry
|
||||
* is split into two methods so subclasses can override `applyLayoutToChildren:`
|
||||
* while using default implementation of `applyLayoutNode:`.
|
||||
*/
|
||||
- (void)applyLayoutNode:(CSSNodeRef)node
|
||||
- (void)applyLayoutNode:(YGNodeRef)node
|
||||
viewsWithNewFrame:(NSMutableSet<RCTShadowView *> *)viewsWithNewFrame
|
||||
absolutePosition:(CGPoint)absolutePosition NS_REQUIRES_SUPER;
|
||||
|
||||
/**
|
||||
* Enumerate the child nodes and tell them to apply layout.
|
||||
*/
|
||||
- (void)applyLayoutToChildren:(CSSNodeRef)node
|
||||
- (void)applyLayoutToChildren:(YGNodeRef)node
|
||||
viewsWithNewFrame:(NSMutableSet<RCTShadowView *> *)viewsWithNewFrame
|
||||
absolutePosition:(CGPoint)absolutePosition;
|
||||
|
||||
/**
|
||||
* Return whether or not this node acts as a leaf node in the eyes of CSSLayout. For example
|
||||
* RCTShadowText has children which it does not want CSSLayout to lay out so in the eyes of
|
||||
* CSSLayout it is a leaf node.
|
||||
* Return whether or not this node acts as a leaf node in the eyes of Yoga. For example
|
||||
* RCTShadowText has children which it does not want Yoga to lay out so in the eyes of
|
||||
* Yoga it is a leaf node.
|
||||
*/
|
||||
- (BOOL)isCSSLeafNode;
|
||||
|
||||
|
||||
+118
-118
@@ -50,53 +50,53 @@ typedef NS_ENUM(unsigned int, meta_prop_t) {
|
||||
|
||||
// cssNode api
|
||||
|
||||
static void RCTPrint(CSSNodeRef node)
|
||||
static void RCTPrint(YGNodeRef node)
|
||||
{
|
||||
RCTShadowView *shadowView = (__bridge RCTShadowView *)CSSNodeGetContext(node);
|
||||
RCTShadowView *shadowView = (__bridge RCTShadowView *)YGNodeGetContext(node);
|
||||
printf("%s(%zd), ", shadowView.viewName.UTF8String, shadowView.reactTag.integerValue);
|
||||
}
|
||||
|
||||
// Enforces precedence rules, e.g. marginLeft > marginHorizontal > margin.
|
||||
#define DEFINE_PROCESS_META_PROPS(type) \
|
||||
static void RCTProcessMetaProps##type(const float metaProps[META_PROP_COUNT], CSSNodeRef node) { \
|
||||
if (!CSSValueIsUndefined(metaProps[META_PROP_LEFT])) { \
|
||||
CSSNodeStyleSet##type(node, CSSEdgeStart, metaProps[META_PROP_LEFT]); \
|
||||
} else if (!CSSValueIsUndefined(metaProps[META_PROP_HORIZONTAL])) { \
|
||||
CSSNodeStyleSet##type(node, CSSEdgeStart, metaProps[META_PROP_HORIZONTAL]); \
|
||||
} else if (!CSSValueIsUndefined(metaProps[META_PROP_ALL])) { \
|
||||
CSSNodeStyleSet##type(node, CSSEdgeStart, metaProps[META_PROP_ALL]); \
|
||||
static void RCTProcessMetaProps##type(const float metaProps[META_PROP_COUNT], YGNodeRef node) { \
|
||||
if (!YGValueIsUndefined(metaProps[META_PROP_LEFT])) { \
|
||||
YGNodeStyleSet##type(node, YGEdgeStart, metaProps[META_PROP_LEFT]); \
|
||||
} else if (!YGValueIsUndefined(metaProps[META_PROP_HORIZONTAL])) { \
|
||||
YGNodeStyleSet##type(node, YGEdgeStart, metaProps[META_PROP_HORIZONTAL]); \
|
||||
} else if (!YGValueIsUndefined(metaProps[META_PROP_ALL])) { \
|
||||
YGNodeStyleSet##type(node, YGEdgeStart, metaProps[META_PROP_ALL]); \
|
||||
} else { \
|
||||
CSSNodeStyleSet##type(node, CSSEdgeStart, 0); \
|
||||
YGNodeStyleSet##type(node, YGEdgeStart, 0); \
|
||||
} \
|
||||
\
|
||||
if (!CSSValueIsUndefined(metaProps[META_PROP_RIGHT])) { \
|
||||
CSSNodeStyleSet##type(node, CSSEdgeEnd, metaProps[META_PROP_RIGHT]); \
|
||||
} else if (!CSSValueIsUndefined(metaProps[META_PROP_HORIZONTAL])) { \
|
||||
CSSNodeStyleSet##type(node, CSSEdgeEnd, metaProps[META_PROP_HORIZONTAL]); \
|
||||
} else if (!CSSValueIsUndefined(metaProps[META_PROP_ALL])) { \
|
||||
CSSNodeStyleSet##type(node, CSSEdgeEnd, metaProps[META_PROP_ALL]); \
|
||||
if (!YGValueIsUndefined(metaProps[META_PROP_RIGHT])) { \
|
||||
YGNodeStyleSet##type(node, YGEdgeEnd, metaProps[META_PROP_RIGHT]); \
|
||||
} else if (!YGValueIsUndefined(metaProps[META_PROP_HORIZONTAL])) { \
|
||||
YGNodeStyleSet##type(node, YGEdgeEnd, metaProps[META_PROP_HORIZONTAL]); \
|
||||
} else if (!YGValueIsUndefined(metaProps[META_PROP_ALL])) { \
|
||||
YGNodeStyleSet##type(node, YGEdgeEnd, metaProps[META_PROP_ALL]); \
|
||||
} else { \
|
||||
CSSNodeStyleSet##type(node, CSSEdgeEnd, 0); \
|
||||
YGNodeStyleSet##type(node, YGEdgeEnd, 0); \
|
||||
} \
|
||||
\
|
||||
if (!CSSValueIsUndefined(metaProps[META_PROP_TOP])) { \
|
||||
CSSNodeStyleSet##type(node, CSSEdgeTop, metaProps[META_PROP_TOP]); \
|
||||
} else if (!CSSValueIsUndefined(metaProps[META_PROP_VERTICAL])) { \
|
||||
CSSNodeStyleSet##type(node, CSSEdgeTop, metaProps[META_PROP_VERTICAL]); \
|
||||
} else if (!CSSValueIsUndefined(metaProps[META_PROP_ALL])) { \
|
||||
CSSNodeStyleSet##type(node, CSSEdgeTop, metaProps[META_PROP_ALL]); \
|
||||
if (!YGValueIsUndefined(metaProps[META_PROP_TOP])) { \
|
||||
YGNodeStyleSet##type(node, YGEdgeTop, metaProps[META_PROP_TOP]); \
|
||||
} else if (!YGValueIsUndefined(metaProps[META_PROP_VERTICAL])) { \
|
||||
YGNodeStyleSet##type(node, YGEdgeTop, metaProps[META_PROP_VERTICAL]); \
|
||||
} else if (!YGValueIsUndefined(metaProps[META_PROP_ALL])) { \
|
||||
YGNodeStyleSet##type(node, YGEdgeTop, metaProps[META_PROP_ALL]); \
|
||||
} else { \
|
||||
CSSNodeStyleSet##type(node, CSSEdgeTop, 0); \
|
||||
YGNodeStyleSet##type(node, YGEdgeTop, 0); \
|
||||
} \
|
||||
\
|
||||
if (!CSSValueIsUndefined(metaProps[META_PROP_BOTTOM])) { \
|
||||
CSSNodeStyleSet##type(node, CSSEdgeBottom, metaProps[META_PROP_BOTTOM]); \
|
||||
} else if (!CSSValueIsUndefined(metaProps[META_PROP_VERTICAL])) { \
|
||||
CSSNodeStyleSet##type(node, CSSEdgeBottom, metaProps[META_PROP_VERTICAL]); \
|
||||
} else if (!CSSValueIsUndefined(metaProps[META_PROP_ALL])) { \
|
||||
CSSNodeStyleSet##type(node, CSSEdgeBottom, metaProps[META_PROP_ALL]); \
|
||||
if (!YGValueIsUndefined(metaProps[META_PROP_BOTTOM])) { \
|
||||
YGNodeStyleSet##type(node, YGEdgeBottom, metaProps[META_PROP_BOTTOM]); \
|
||||
} else if (!YGValueIsUndefined(metaProps[META_PROP_VERTICAL])) { \
|
||||
YGNodeStyleSet##type(node, YGEdgeBottom, metaProps[META_PROP_VERTICAL]); \
|
||||
} else if (!YGValueIsUndefined(metaProps[META_PROP_ALL])) { \
|
||||
YGNodeStyleSet##type(node, YGEdgeBottom, metaProps[META_PROP_ALL]); \
|
||||
} else { \
|
||||
CSSNodeStyleSet##type(node, CSSEdgeBottom, 0); \
|
||||
YGNodeStyleSet##type(node, YGEdgeBottom, 0); \
|
||||
} \
|
||||
}
|
||||
|
||||
@@ -133,38 +133,38 @@ DEFINE_PROCESS_META_PROPS(Border);
|
||||
// width = 213.5 - 106.5 = 107
|
||||
// You'll notice that this is the same width we calculated for the parent view because we've taken its position into account.
|
||||
|
||||
- (void)applyLayoutNode:(CSSNodeRef)node
|
||||
- (void)applyLayoutNode:(YGNodeRef)node
|
||||
viewsWithNewFrame:(NSMutableSet<RCTShadowView *> *)viewsWithNewFrame
|
||||
absolutePosition:(CGPoint)absolutePosition
|
||||
{
|
||||
if (!CSSNodeGetHasNewLayout(node)) {
|
||||
if (!YGNodeGetHasNewLayout(node)) {
|
||||
return;
|
||||
}
|
||||
CSSNodeSetHasNewLayout(node, false);
|
||||
YGNodeSetHasNewLayout(node, false);
|
||||
|
||||
#if RCT_DEBUG
|
||||
// This works around a breaking change in css-layout where setting flexBasis needs to be set explicitly, instead of relying on flex to propagate.
|
||||
// We check for it by seeing if a width/height is provided along with a flexBasis of 0 and the width/height is laid out as 0.
|
||||
if ((!CSSValueIsUndefined(CSSNodeStyleGetFlexBasis(node)) && CSSNodeStyleGetFlexBasis(node) == 0) &&
|
||||
((!CSSValueIsUndefined(CSSNodeStyleGetWidth(node)) && CSSNodeStyleGetWidth(node) > 0 && CSSNodeLayoutGetWidth(node) == 0) ||
|
||||
(!CSSValueIsUndefined(CSSNodeStyleGetHeight(node)) && CSSNodeStyleGetHeight(node) > 0 && CSSNodeLayoutGetHeight(node) == 0))) {
|
||||
if ((!YGValueIsUndefined(YGNodeStyleGetFlexBasis(node)) && YGNodeStyleGetFlexBasis(node) == 0) &&
|
||||
((!YGValueIsUndefined(YGNodeStyleGetWidth(node)) && YGNodeStyleGetWidth(node) > 0 && YGNodeLayoutGetWidth(node) == 0) ||
|
||||
(!YGValueIsUndefined(YGNodeStyleGetHeight(node)) && YGNodeStyleGetHeight(node) > 0 && YGNodeLayoutGetHeight(node) == 0))) {
|
||||
RCTLogError(@"View was rendered with explicitly set width/height but with a 0 flexBasis. (This might be fixed by changing flex: to flexGrow:) View: %@", self);
|
||||
}
|
||||
#endif
|
||||
|
||||
CGPoint absoluteTopLeft = {
|
||||
absolutePosition.x + CSSNodeLayoutGetLeft(node),
|
||||
absolutePosition.y + CSSNodeLayoutGetTop(node)
|
||||
absolutePosition.x + YGNodeLayoutGetLeft(node),
|
||||
absolutePosition.y + YGNodeLayoutGetTop(node)
|
||||
};
|
||||
|
||||
CGPoint absoluteBottomRight = {
|
||||
absolutePosition.x + CSSNodeLayoutGetLeft(node) + CSSNodeLayoutGetWidth(node),
|
||||
absolutePosition.y + CSSNodeLayoutGetTop(node) + CSSNodeLayoutGetHeight(node)
|
||||
absolutePosition.x + YGNodeLayoutGetLeft(node) + YGNodeLayoutGetWidth(node),
|
||||
absolutePosition.y + YGNodeLayoutGetTop(node) + YGNodeLayoutGetHeight(node)
|
||||
};
|
||||
|
||||
CGRect frame = {{
|
||||
RCTRoundPixelValue(CSSNodeLayoutGetLeft(node)),
|
||||
RCTRoundPixelValue(CSSNodeLayoutGetTop(node)),
|
||||
RCTRoundPixelValue(YGNodeLayoutGetLeft(node)),
|
||||
RCTRoundPixelValue(YGNodeLayoutGetTop(node)),
|
||||
}, {
|
||||
RCTRoundPixelValue(absoluteBottomRight.x - absoluteTopLeft.x),
|
||||
RCTRoundPixelValue(absoluteBottomRight.y - absoluteTopLeft.y)
|
||||
@@ -175,19 +175,19 @@ DEFINE_PROCESS_META_PROPS(Border);
|
||||
[viewsWithNewFrame addObject:self];
|
||||
}
|
||||
|
||||
absolutePosition.x += CSSNodeLayoutGetLeft(node);
|
||||
absolutePosition.y += CSSNodeLayoutGetTop(node);
|
||||
absolutePosition.x += YGNodeLayoutGetLeft(node);
|
||||
absolutePosition.y += YGNodeLayoutGetTop(node);
|
||||
|
||||
[self applyLayoutToChildren:node viewsWithNewFrame:viewsWithNewFrame absolutePosition:absolutePosition];
|
||||
}
|
||||
|
||||
- (void)applyLayoutToChildren:(CSSNodeRef)node
|
||||
- (void)applyLayoutToChildren:(YGNodeRef)node
|
||||
viewsWithNewFrame:(NSMutableSet<RCTShadowView *> *)viewsWithNewFrame
|
||||
absolutePosition:(CGPoint)absolutePosition
|
||||
{
|
||||
for (unsigned int i = 0; i < CSSNodeChildCount(node); ++i) {
|
||||
for (unsigned int i = 0; i < YGNodeChildCount(node); ++i) {
|
||||
RCTShadowView *child = (RCTShadowView *)_reactSubviews[i];
|
||||
[child applyLayoutNode:CSSNodeGetChild(node, i)
|
||||
[child applyLayoutNode:YGNodeGetChild(node, i)
|
||||
viewsWithNewFrame:viewsWithNewFrame
|
||||
absolutePosition:absolutePosition];
|
||||
}
|
||||
@@ -261,14 +261,14 @@ DEFINE_PROCESS_META_PROPS(Border);
|
||||
}
|
||||
|
||||
if (!CGRectEqualToRect(frame, _frame)) {
|
||||
CSSNodeStyleSetPositionType(_cssNode, CSSPositionTypeAbsolute);
|
||||
CSSNodeStyleSetWidth(_cssNode, frame.size.width);
|
||||
CSSNodeStyleSetHeight(_cssNode, frame.size.height);
|
||||
CSSNodeStyleSetPosition(_cssNode, CSSEdgeLeft, frame.origin.x);
|
||||
CSSNodeStyleSetPosition(_cssNode, CSSEdgeTop, frame.origin.y);
|
||||
YGNodeStyleSetPositionType(_cssNode, YGPositionTypeAbsolute);
|
||||
YGNodeStyleSetWidth(_cssNode, frame.size.width);
|
||||
YGNodeStyleSetHeight(_cssNode, frame.size.height);
|
||||
YGNodeStyleSetPosition(_cssNode, YGEdgeLeft, frame.origin.x);
|
||||
YGNodeStyleSetPosition(_cssNode, YGEdgeTop, frame.origin.y);
|
||||
}
|
||||
|
||||
CSSNodeCalculateLayout(_cssNode, frame.size.width, frame.size.height, CSSDirectionInherit);
|
||||
YGNodeCalculateLayout(_cssNode, frame.size.width, frame.size.height, YGDirectionInherit);
|
||||
[self applyLayoutNode:_cssNode viewsWithNewFrame:viewsWithNewFrame absolutePosition:absolutePosition];
|
||||
}
|
||||
|
||||
@@ -304,12 +304,12 @@ DEFINE_PROCESS_META_PROPS(Border);
|
||||
{
|
||||
if ((self = [super init])) {
|
||||
|
||||
_frame = CGRectMake(0, 0, CSSUndefined, CSSUndefined);
|
||||
_frame = CGRectMake(0, 0, YGUndefined, YGUndefined);
|
||||
|
||||
for (unsigned int ii = 0; ii < META_PROP_COUNT; ii++) {
|
||||
_paddingMetaProps[ii] = CSSUndefined;
|
||||
_marginMetaProps[ii] = CSSUndefined;
|
||||
_borderMetaProps[ii] = CSSUndefined;
|
||||
_paddingMetaProps[ii] = YGUndefined;
|
||||
_marginMetaProps[ii] = YGUndefined;
|
||||
_borderMetaProps[ii] = YGUndefined;
|
||||
}
|
||||
|
||||
_newView = YES;
|
||||
@@ -318,9 +318,9 @@ DEFINE_PROCESS_META_PROPS(Border);
|
||||
|
||||
_reactSubviews = [NSMutableArray array];
|
||||
|
||||
_cssNode = CSSNodeNew();
|
||||
CSSNodeSetContext(_cssNode, (__bridge void *)self);
|
||||
CSSNodeSetPrintFunc(_cssNode, RCTPrint);
|
||||
_cssNode = YGNodeNew();
|
||||
YGNodeSetContext(_cssNode, (__bridge void *)self);
|
||||
YGNodeSetPrintFunc(_cssNode, RCTPrint);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@@ -332,7 +332,7 @@ DEFINE_PROCESS_META_PROPS(Border);
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
CSSNodeFree(_cssNode);
|
||||
YGNodeFree(_cssNode);
|
||||
}
|
||||
|
||||
- (BOOL)isCSSLeafNode
|
||||
@@ -375,7 +375,7 @@ DEFINE_PROCESS_META_PROPS(Border);
|
||||
{
|
||||
[_reactSubviews insertObject:subview atIndex:atIndex];
|
||||
if (![self isCSSLeafNode]) {
|
||||
CSSNodeInsertChild(_cssNode, subview.cssNode, (uint32_t)atIndex);
|
||||
YGNodeInsertChild(_cssNode, subview.cssNode, (uint32_t)atIndex);
|
||||
}
|
||||
subview->_superview = self;
|
||||
_didUpdateSubviews = YES;
|
||||
@@ -391,7 +391,7 @@ DEFINE_PROCESS_META_PROPS(Border);
|
||||
subview->_superview = nil;
|
||||
[_reactSubviews removeObject:subview];
|
||||
if (![self isCSSLeafNode]) {
|
||||
CSSNodeRemoveChild(_cssNode, subview.cssNode);
|
||||
YGNodeRemoveChild(_cssNode, subview.cssNode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -491,27 +491,27 @@ RCT_PADDING_PROPERTY(Right, RIGHT)
|
||||
|
||||
- (UIEdgeInsets)paddingAsInsets
|
||||
{
|
||||
if (CSSNodeLayoutGetDirection(_cssNode) == CSSDirectionRTL) {
|
||||
if (YGNodeLayoutGetDirection(_cssNode) == YGDirectionRTL) {
|
||||
return (UIEdgeInsets){
|
||||
CSSNodeStyleGetPadding(_cssNode, CSSEdgeTop),
|
||||
!CSSValueIsUndefined(CSSNodeStyleGetPadding(_cssNode, CSSEdgeEnd)) ?
|
||||
CSSNodeStyleGetPadding(_cssNode, CSSEdgeEnd) :
|
||||
CSSNodeStyleGetPadding(_cssNode, CSSEdgeLeft),
|
||||
CSSNodeStyleGetPadding(_cssNode, CSSEdgeBottom),
|
||||
!CSSValueIsUndefined(CSSNodeStyleGetPadding(_cssNode, CSSEdgeStart)) ?
|
||||
CSSNodeStyleGetPadding(_cssNode, CSSEdgeStart) :
|
||||
CSSNodeStyleGetPadding(_cssNode, CSSEdgeRight)
|
||||
YGNodeStyleGetPadding(_cssNode, YGEdgeTop),
|
||||
!YGValueIsUndefined(YGNodeStyleGetPadding(_cssNode, YGEdgeEnd)) ?
|
||||
YGNodeStyleGetPadding(_cssNode, YGEdgeEnd) :
|
||||
YGNodeStyleGetPadding(_cssNode, YGEdgeLeft),
|
||||
YGNodeStyleGetPadding(_cssNode, YGEdgeBottom),
|
||||
!YGValueIsUndefined(YGNodeStyleGetPadding(_cssNode, YGEdgeStart)) ?
|
||||
YGNodeStyleGetPadding(_cssNode, YGEdgeStart) :
|
||||
YGNodeStyleGetPadding(_cssNode, YGEdgeRight)
|
||||
};
|
||||
} else {
|
||||
return (UIEdgeInsets){
|
||||
CSSNodeStyleGetPadding(_cssNode, CSSEdgeTop),
|
||||
!CSSValueIsUndefined(CSSNodeStyleGetPadding(_cssNode, CSSEdgeStart)) ?
|
||||
CSSNodeStyleGetPadding(_cssNode, CSSEdgeStart) :
|
||||
CSSNodeStyleGetPadding(_cssNode, CSSEdgeLeft),
|
||||
CSSNodeStyleGetPadding(_cssNode, CSSEdgeBottom),
|
||||
!CSSValueIsUndefined(CSSNodeStyleGetPadding(_cssNode, CSSEdgeEnd)) ?
|
||||
CSSNodeStyleGetPadding(_cssNode, CSSEdgeEnd) :
|
||||
CSSNodeStyleGetPadding(_cssNode, CSSEdgeRight)
|
||||
YGNodeStyleGetPadding(_cssNode, YGEdgeTop),
|
||||
!YGValueIsUndefined(YGNodeStyleGetPadding(_cssNode, YGEdgeStart)) ?
|
||||
YGNodeStyleGetPadding(_cssNode, YGEdgeStart) :
|
||||
YGNodeStyleGetPadding(_cssNode, YGEdgeLeft),
|
||||
YGNodeStyleGetPadding(_cssNode, YGEdgeBottom),
|
||||
!YGValueIsUndefined(YGNodeStyleGetPadding(_cssNode, YGEdgeEnd)) ?
|
||||
YGNodeStyleGetPadding(_cssNode, YGEdgeEnd) :
|
||||
YGNodeStyleGetPadding(_cssNode, YGEdgeRight)
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -541,12 +541,12 @@ RCT_BORDER_PROPERTY(Right, RIGHT)
|
||||
#define RCT_DIMENSION_PROPERTY(setProp, getProp, cssProp) \
|
||||
- (void)set##setProp:(float)value \
|
||||
{ \
|
||||
CSSNodeStyleSet##cssProp(_cssNode, value); \
|
||||
YGNodeStyleSet##cssProp(_cssNode, value); \
|
||||
[self dirtyText]; \
|
||||
} \
|
||||
- (float)getProp \
|
||||
{ \
|
||||
return CSSNodeStyleGet##cssProp(_cssNode); \
|
||||
return YGNodeStyleGet##cssProp(_cssNode); \
|
||||
}
|
||||
|
||||
RCT_DIMENSION_PROPERTY(Width, width, Width)
|
||||
@@ -561,45 +561,45 @@ RCT_DIMENSION_PROPERTY(MaxHeight, maxHeight, MaxHeight)
|
||||
#define RCT_POSITION_PROPERTY(setProp, getProp, edge) \
|
||||
- (void)set##setProp:(float)value \
|
||||
{ \
|
||||
CSSNodeStyleSetPosition(_cssNode, edge, value); \
|
||||
YGNodeStyleSetPosition(_cssNode, edge, value); \
|
||||
[self dirtyText]; \
|
||||
} \
|
||||
- (float)getProp \
|
||||
{ \
|
||||
return CSSNodeStyleGetPosition(_cssNode, edge); \
|
||||
return YGNodeStyleGetPosition(_cssNode, edge); \
|
||||
}
|
||||
|
||||
RCT_POSITION_PROPERTY(Top, top, CSSEdgeTop)
|
||||
RCT_POSITION_PROPERTY(Right, right, CSSEdgeEnd)
|
||||
RCT_POSITION_PROPERTY(Bottom, bottom, CSSEdgeBottom)
|
||||
RCT_POSITION_PROPERTY(Left, left, CSSEdgeStart)
|
||||
RCT_POSITION_PROPERTY(Top, top, YGEdgeTop)
|
||||
RCT_POSITION_PROPERTY(Right, right, YGEdgeEnd)
|
||||
RCT_POSITION_PROPERTY(Bottom, bottom, YGEdgeBottom)
|
||||
RCT_POSITION_PROPERTY(Left, left, YGEdgeStart)
|
||||
|
||||
- (void)setFrame:(CGRect)frame
|
||||
{
|
||||
if (!CGRectEqualToRect(frame, _frame)) {
|
||||
_frame = frame;
|
||||
CSSNodeStyleSetPosition(_cssNode, CSSEdgeLeft, CGRectGetMinX(frame));
|
||||
CSSNodeStyleSetPosition(_cssNode, CSSEdgeTop, CGRectGetMinY(frame));
|
||||
CSSNodeStyleSetWidth(_cssNode, CGRectGetWidth(frame));
|
||||
CSSNodeStyleSetHeight(_cssNode, CGRectGetHeight(frame));
|
||||
YGNodeStyleSetPosition(_cssNode, YGEdgeLeft, CGRectGetMinX(frame));
|
||||
YGNodeStyleSetPosition(_cssNode, YGEdgeTop, CGRectGetMinY(frame));
|
||||
YGNodeStyleSetWidth(_cssNode, CGRectGetWidth(frame));
|
||||
YGNodeStyleSetHeight(_cssNode, CGRectGetHeight(frame));
|
||||
}
|
||||
}
|
||||
|
||||
static inline void RCTAssignSuggestedDimension(CSSNodeRef cssNode, CSSDimension dimension, CGFloat amount)
|
||||
static inline void RCTAssignSuggestedDimension(YGNodeRef cssNode, YGDimension dimension, CGFloat amount)
|
||||
{
|
||||
if (amount != UIViewNoIntrinsicMetric) {
|
||||
switch (dimension) {
|
||||
case CSSDimensionWidth:
|
||||
if (isnan(CSSNodeStyleGetWidth(cssNode))) {
|
||||
CSSNodeStyleSetWidth(cssNode, amount);
|
||||
case YGDimensionWidth:
|
||||
if (isnan(YGNodeStyleGetWidth(cssNode))) {
|
||||
YGNodeStyleSetWidth(cssNode, amount);
|
||||
}
|
||||
break;
|
||||
case CSSDimensionHeight:
|
||||
if (isnan(CSSNodeStyleGetHeight(cssNode))) {
|
||||
CSSNodeStyleSetHeight(cssNode, amount);
|
||||
case YGDimensionHeight:
|
||||
if (isnan(YGNodeStyleGetHeight(cssNode))) {
|
||||
YGNodeStyleSetHeight(cssNode, amount);
|
||||
}
|
||||
break;
|
||||
case CSSDimensionCount:
|
||||
case YGDimensionCount:
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -607,51 +607,51 @@ static inline void RCTAssignSuggestedDimension(CSSNodeRef cssNode, CSSDimension
|
||||
|
||||
- (void)setIntrinsicContentSize:(CGSize)size
|
||||
{
|
||||
if (CSSNodeStyleGetFlexGrow(_cssNode) == 0 && CSSNodeStyleGetFlexShrink(_cssNode) == 0) {
|
||||
RCTAssignSuggestedDimension(_cssNode, CSSDimensionHeight, size.height);
|
||||
RCTAssignSuggestedDimension(_cssNode, CSSDimensionWidth, size.width);
|
||||
if (YGNodeStyleGetFlexGrow(_cssNode) == 0 && YGNodeStyleGetFlexShrink(_cssNode) == 0) {
|
||||
RCTAssignSuggestedDimension(_cssNode, YGDimensionHeight, size.height);
|
||||
RCTAssignSuggestedDimension(_cssNode, YGDimensionWidth, size.width);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setTopLeft:(CGPoint)topLeft
|
||||
{
|
||||
CSSNodeStyleSetPosition(_cssNode, CSSEdgeLeft, topLeft.x);
|
||||
CSSNodeStyleSetPosition(_cssNode, CSSEdgeTop, topLeft.y);
|
||||
YGNodeStyleSetPosition(_cssNode, YGEdgeLeft, topLeft.x);
|
||||
YGNodeStyleSetPosition(_cssNode, YGEdgeTop, topLeft.y);
|
||||
}
|
||||
|
||||
- (void)setSize:(CGSize)size
|
||||
{
|
||||
CSSNodeStyleSetWidth(_cssNode, size.width);
|
||||
CSSNodeStyleSetHeight(_cssNode, size.height);
|
||||
YGNodeStyleSetWidth(_cssNode, size.width);
|
||||
YGNodeStyleSetHeight(_cssNode, size.height);
|
||||
}
|
||||
|
||||
// Flex
|
||||
|
||||
- (void)setFlex:(float)value
|
||||
{
|
||||
CSSNodeStyleSetFlex(_cssNode, value);
|
||||
YGNodeStyleSetFlex(_cssNode, value);
|
||||
}
|
||||
|
||||
#define RCT_STYLE_PROPERTY(setProp, getProp, cssProp, type) \
|
||||
- (void)set##setProp:(type)value \
|
||||
{ \
|
||||
CSSNodeStyleSet##cssProp(_cssNode, value); \
|
||||
YGNodeStyleSet##cssProp(_cssNode, value); \
|
||||
} \
|
||||
- (type)getProp \
|
||||
{ \
|
||||
return CSSNodeStyleGet##cssProp(_cssNode); \
|
||||
return YGNodeStyleGet##cssProp(_cssNode); \
|
||||
}
|
||||
|
||||
RCT_STYLE_PROPERTY(FlexGrow, flexGrow, FlexGrow, float)
|
||||
RCT_STYLE_PROPERTY(FlexShrink, flexShrink, FlexShrink, float)
|
||||
RCT_STYLE_PROPERTY(FlexBasis, flexBasis, FlexBasis, float)
|
||||
RCT_STYLE_PROPERTY(FlexDirection, flexDirection, FlexDirection, CSSFlexDirection)
|
||||
RCT_STYLE_PROPERTY(JustifyContent, justifyContent, JustifyContent, CSSJustify)
|
||||
RCT_STYLE_PROPERTY(AlignSelf, alignSelf, AlignSelf, CSSAlign)
|
||||
RCT_STYLE_PROPERTY(AlignItems, alignItems, AlignItems, CSSAlign)
|
||||
RCT_STYLE_PROPERTY(Position, position, PositionType, CSSPositionType)
|
||||
RCT_STYLE_PROPERTY(FlexWrap, flexWrap, FlexWrap, CSSWrap)
|
||||
RCT_STYLE_PROPERTY(Overflow, overflow, Overflow, CSSOverflow)
|
||||
RCT_STYLE_PROPERTY(FlexDirection, flexDirection, FlexDirection, YGFlexDirection)
|
||||
RCT_STYLE_PROPERTY(JustifyContent, justifyContent, JustifyContent, YGJustify)
|
||||
RCT_STYLE_PROPERTY(AlignSelf, alignSelf, AlignSelf, YGAlign)
|
||||
RCT_STYLE_PROPERTY(AlignItems, alignItems, AlignItems, YGAlign)
|
||||
RCT_STYLE_PROPERTY(Position, position, PositionType, YGPositionType)
|
||||
RCT_STYLE_PROPERTY(FlexWrap, flexWrap, FlexWrap, YGWrap)
|
||||
RCT_STYLE_PROPERTY(Overflow, overflow, Overflow, YGOverflow)
|
||||
RCT_STYLE_PROPERTY(AspectRatio, aspectRatio, AspectRatio, float)
|
||||
|
||||
- (void)setBackgroundColor:(UIColor *)color
|
||||
|
||||
@@ -109,10 +109,10 @@ RCT_REMAP_VIEW_PROPERTY(shadowColor, layer.shadowColor, CGColor)
|
||||
RCT_REMAP_VIEW_PROPERTY(shadowOffset, layer.shadowOffset, CGSize)
|
||||
RCT_REMAP_VIEW_PROPERTY(shadowOpacity, layer.shadowOpacity, float)
|
||||
RCT_REMAP_VIEW_PROPERTY(shadowRadius, layer.shadowRadius, CGFloat)
|
||||
RCT_CUSTOM_VIEW_PROPERTY(overflow, CSSOverflow, RCTView)
|
||||
RCT_CUSTOM_VIEW_PROPERTY(overflow, YGOverflow, RCTView)
|
||||
{
|
||||
if (json) {
|
||||
view.clipsToBounds = [RCTConvert CSSOverflow:json] != CSSOverflowVisible;
|
||||
view.clipsToBounds = [RCTConvert YGOverflow:json] != YGOverflowVisible;
|
||||
} else {
|
||||
view.clipsToBounds = defaultView.clipsToBounds;
|
||||
}
|
||||
@@ -288,15 +288,15 @@ RCT_EXPORT_SHADOW_PROPERTY(flex, float)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(flexGrow, float)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(flexShrink, float)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(flexBasis, float)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(flexDirection, CSSFlexDirection)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(flexWrap, CSSWrap)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(justifyContent, CSSJustify)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(alignItems, CSSAlign)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(alignSelf, CSSAlign)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(position, CSSPositionType)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(flexDirection, YGFlexDirection)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(flexWrap, YGWrap)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(justifyContent, YGJustify)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(alignItems, YGAlign)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(alignSelf, YGAlign)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(position, YGPositionType)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(aspectRatio, float)
|
||||
|
||||
RCT_EXPORT_SHADOW_PROPERTY(overflow, CSSOverflow)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(overflow, YGOverflow)
|
||||
|
||||
RCT_EXPORT_SHADOW_PROPERTY(onLayout, RCTDirectEventBlock)
|
||||
|
||||
|
||||
+4
-3
@@ -35,7 +35,7 @@ JSC_DEPS = [
|
||||
'//native/third-party/jsc:jsc_legacy_profiler',
|
||||
]
|
||||
|
||||
CSSLAYOUT_TARGET = '//ReactAndroid/src/main/java/com/facebook:csslayout'
|
||||
YOGA_TARGET = '//ReactAndroid/src/main/java/com/facebook:yoga'
|
||||
FBGLOGINIT_TARGET = '//ReactAndroid/src/main/jni/first-party/fbgloginit:fbgloginit'
|
||||
FBJNI_TARGET = '//ReactAndroid/src/main/jni/first-party/fb:jni'
|
||||
JNI_TARGET = '//ReactAndroid/src/main/jni/first-party/jni-hack:jni-hack'
|
||||
@@ -103,13 +103,14 @@ def rn_robolectric_test(name, srcs, vm_args = None, *args, **kwargs):
|
||||
'buck-out/bin'))
|
||||
|
||||
# RN tests use Powermock, which means they get their own ClassLoaders.
|
||||
# Because the csslayout native library (or any native library) can only be loaded into one
|
||||
# Because the yoga native library (or any native library) can only be loaded into one
|
||||
# ClassLoader at a time, we need to run each in its own process, hence fork_mode = 'per_test'.
|
||||
robolectric_test(
|
||||
name = name,
|
||||
use_cxx_libraries = True,
|
||||
cxx_library_whitelist = [
|
||||
'//ReactAndroid/src/main/jni/first-party/csslayoutjni:jni',
|
||||
'//ReactCommon/yoga:yoga',
|
||||
'//ReactAndroid/src/main/jni/first-party/yogajni:jni',
|
||||
],
|
||||
fork_mode = 'per_test',
|
||||
srcs = srcs,
|
||||
|
||||
@@ -35,19 +35,17 @@ task createNativeDepsDirectories {
|
||||
}
|
||||
|
||||
task downloadBoost(dependsOn: createNativeDepsDirectories, type: Download) {
|
||||
// Use ZIP version as it's faster this way to selectively extract some parts of the archive
|
||||
src 'https://unpkg.com/boost-mirror@1.57.0/boost.zip'
|
||||
// alternative
|
||||
// src 'http://mirror.nienbo.com/boost/boost_1_57_0.zip'
|
||||
src 'https://github.com/react-native-community/boost-for-react-native/releases/download/v1.57.0-1/boost_1_57_0.tar.gz'
|
||||
onlyIfNewer true
|
||||
overwrite false
|
||||
dest new File(downloadsDir, 'boost_1_57_0.zip')
|
||||
dest new File(downloadsDir, 'boost_1_57_0.tar.gz')
|
||||
}
|
||||
|
||||
task prepareBoost(dependsOn: boostPath ? [] : [downloadBoost], type: Copy) {
|
||||
from boostPath ?: zipTree(downloadBoost.dest)
|
||||
from boostPath ?: tarTree(resources.gzip(downloadBoost.dest))
|
||||
from 'src/main/jni/third-party/boost/Android.mk'
|
||||
include 'boost_1_57_0/boost/**/*.hpp', 'Android.mk'
|
||||
includeEmptyDirs = false
|
||||
into "$thirdPartyNdkDir/boost"
|
||||
}
|
||||
|
||||
@@ -121,7 +119,8 @@ task prepareGlog(dependsOn: dependenciesPath ? [] : [downloadGlog], type: Copy)
|
||||
}
|
||||
|
||||
task downloadJSCHeaders(type: Download) {
|
||||
def jscAPIBaseURL = 'https://svn.webkit.org/repository/webkit/!svn/bc/174650/trunk/Source/JavaScriptCore/API/'
|
||||
// in sync with webkit SVN revision 174650
|
||||
def jscAPIBaseURL = 'https://raw.githubusercontent.com/WebKit/webkit/38b15a3ba3c1b0798f2036f7cea36ffdc096202e/Source/JavaScriptCore/API/'
|
||||
def jscHeaderFiles = ['JavaScript.h', 'JSBase.h', 'JSContextRef.h', 'JSObjectRef.h', 'JSRetainPtr.h', 'JSStringRef.h', 'JSValueRef.h', 'WebKitAvailability.h']
|
||||
def output = new File(downloadsDir, 'jsc')
|
||||
output.mkdirs()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
VERSION_NAME=1000.0.0-master
|
||||
VERSION_NAME=0.40.0
|
||||
GROUP=com.facebook.react
|
||||
|
||||
POM_NAME=ReactNative
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
include_defs('//ReactAndroid/DEFS')
|
||||
|
||||
android_library(
|
||||
name = 'csslayout',
|
||||
srcs = glob(['csslayout/*.java']),
|
||||
name = 'yoga',
|
||||
srcs = glob(['yoga/*.java']),
|
||||
deps = [
|
||||
react_native_dep('java/com/facebook/proguard/annotations:annotations'),
|
||||
react_native_dep('libraries/soloader/java/com/facebook/soloader:soloader'),
|
||||
@@ -13,5 +13,5 @@ android_library(
|
||||
)
|
||||
|
||||
project_config(
|
||||
src_target = ':csslayout',
|
||||
src_target = ':yoga',
|
||||
)
|
||||
|
||||
@@ -1,549 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
package com.facebook.csslayout;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
import com.facebook.soloader.SoLoader;
|
||||
|
||||
@DoNotStrip
|
||||
public class CSSNode implements CSSNodeAPI<CSSNode> {
|
||||
|
||||
static {
|
||||
SoLoader.loadLibrary("csslayout");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get native instance count. Useful for testing only.
|
||||
*/
|
||||
static native int jni_CSSNodeGetInstanceCount();
|
||||
static native void jni_CSSLog(int level, String message);
|
||||
|
||||
private static native void jni_CSSLayoutSetLogger(Object logger);
|
||||
public static void setLogger(CSSLogger logger) {
|
||||
jni_CSSLayoutSetLogger(logger);
|
||||
}
|
||||
|
||||
private static native void jni_CSSLayoutSetExperimentalFeatureEnabled(
|
||||
int feature,
|
||||
boolean enabled);
|
||||
public static void setExperimentalFeatureEnabled(
|
||||
CSSExperimentalFeature feature,
|
||||
boolean enabled) {
|
||||
jni_CSSLayoutSetExperimentalFeatureEnabled(feature.intValue(), enabled);
|
||||
}
|
||||
|
||||
private static native boolean jni_CSSLayoutIsExperimentalFeatureEnabled(int feature);
|
||||
public static boolean isExperimentalFeatureEnabled(CSSExperimentalFeature feature) {
|
||||
return jni_CSSLayoutIsExperimentalFeatureEnabled(feature.intValue());
|
||||
}
|
||||
|
||||
private CSSNode mParent;
|
||||
private List<CSSNode> mChildren;
|
||||
private MeasureFunction mMeasureFunction;
|
||||
private long mNativePointer;
|
||||
private Object mData;
|
||||
|
||||
private boolean mHasSetPadding = false;
|
||||
private boolean mHasSetMargin = false;
|
||||
private boolean mHasSetBorder = false;
|
||||
private boolean mHasSetPosition = false;
|
||||
|
||||
@DoNotStrip
|
||||
private float mWidth = CSSConstants.UNDEFINED;
|
||||
@DoNotStrip
|
||||
private float mHeight = CSSConstants.UNDEFINED;
|
||||
@DoNotStrip
|
||||
private float mTop = CSSConstants.UNDEFINED;
|
||||
@DoNotStrip
|
||||
private float mLeft = CSSConstants.UNDEFINED;
|
||||
@DoNotStrip
|
||||
private int mLayoutDirection = 0;
|
||||
|
||||
private native long jni_CSSNodeNew();
|
||||
public CSSNode() {
|
||||
mNativePointer = jni_CSSNodeNew();
|
||||
if (mNativePointer == 0) {
|
||||
throw new IllegalStateException("Failed to allocate native memory");
|
||||
}
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeFree(long nativePointer);
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
try {
|
||||
jni_CSSNodeFree(mNativePointer);
|
||||
} finally {
|
||||
super.finalize();
|
||||
}
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeReset(long nativePointer);
|
||||
@Override
|
||||
public void reset() {
|
||||
mHasSetPadding = false;
|
||||
mHasSetMargin = false;
|
||||
mHasSetBorder = false;
|
||||
mHasSetPosition = false;
|
||||
|
||||
mWidth = CSSConstants.UNDEFINED;
|
||||
mHeight = CSSConstants.UNDEFINED;
|
||||
mTop = CSSConstants.UNDEFINED;
|
||||
mLeft = CSSConstants.UNDEFINED;
|
||||
mLayoutDirection = 0;
|
||||
|
||||
mMeasureFunction = null;
|
||||
mData = null;
|
||||
|
||||
jni_CSSNodeReset(mNativePointer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getChildCount() {
|
||||
return mChildren == null ? 0 : mChildren.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CSSNode getChildAt(int i) {
|
||||
return mChildren.get(i);
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeInsertChild(long nativePointer, long childPointer, int index);
|
||||
@Override
|
||||
public void addChildAt(CSSNode child, int i) {
|
||||
if (child.mParent != null) {
|
||||
throw new IllegalStateException("Child already has a parent, it must be removed first.");
|
||||
}
|
||||
|
||||
if (mChildren == null) {
|
||||
mChildren = new ArrayList<>(4);
|
||||
}
|
||||
mChildren.add(i, child);
|
||||
child.mParent = this;
|
||||
jni_CSSNodeInsertChild(mNativePointer, child.mNativePointer, i);
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeRemoveChild(long nativePointer, long childPointer);
|
||||
@Override
|
||||
public CSSNode removeChildAt(int i) {
|
||||
|
||||
final CSSNode child = mChildren.remove(i);
|
||||
child.mParent = null;
|
||||
jni_CSSNodeRemoveChild(mNativePointer, child.mNativePointer);
|
||||
return child;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable
|
||||
CSSNode getParent() {
|
||||
return mParent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int indexOf(CSSNode child) {
|
||||
return mChildren == null ? -1 : mChildren.indexOf(child);
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeCalculateLayout(long nativePointer);
|
||||
@Override
|
||||
public void calculateLayout() {
|
||||
jni_CSSNodeCalculateLayout(mNativePointer);
|
||||
}
|
||||
|
||||
private native boolean jni_CSSNodeHasNewLayout(long nativePointer);
|
||||
@Override
|
||||
public boolean hasNewLayout() {
|
||||
return jni_CSSNodeHasNewLayout(mNativePointer);
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeMarkDirty(long nativePointer);
|
||||
@Override
|
||||
public void dirty() {
|
||||
jni_CSSNodeMarkDirty(mNativePointer);
|
||||
}
|
||||
|
||||
private native boolean jni_CSSNodeIsDirty(long nativePointer);
|
||||
@Override
|
||||
public boolean isDirty() {
|
||||
return jni_CSSNodeIsDirty(mNativePointer);
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeMarkLayoutSeen(long nativePointer);
|
||||
@Override
|
||||
public void markLayoutSeen() {
|
||||
jni_CSSNodeMarkLayoutSeen(mNativePointer);
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeCopyStyle(long dstNativePointer, long srcNativePointer);
|
||||
@Override
|
||||
public void copyStyle(CSSNode srcNode) {
|
||||
jni_CSSNodeCopyStyle(mNativePointer, srcNode.mNativePointer);
|
||||
}
|
||||
|
||||
private native int jni_CSSNodeStyleGetDirection(long nativePointer);
|
||||
@Override
|
||||
public CSSDirection getStyleDirection() {
|
||||
return CSSDirection.values()[jni_CSSNodeStyleGetDirection(mNativePointer)];
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeStyleSetDirection(long nativePointer, int direction);
|
||||
@Override
|
||||
public void setDirection(CSSDirection direction) {
|
||||
jni_CSSNodeStyleSetDirection(mNativePointer, direction.intValue());
|
||||
}
|
||||
|
||||
private native int jni_CSSNodeStyleGetFlexDirection(long nativePointer);
|
||||
@Override
|
||||
public CSSFlexDirection getFlexDirection() {
|
||||
return CSSFlexDirection.values()[jni_CSSNodeStyleGetFlexDirection(mNativePointer)];
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeStyleSetFlexDirection(long nativePointer, int flexDirection);
|
||||
@Override
|
||||
public void setFlexDirection(CSSFlexDirection flexDirection) {
|
||||
jni_CSSNodeStyleSetFlexDirection(mNativePointer, flexDirection.intValue());
|
||||
}
|
||||
|
||||
private native int jni_CSSNodeStyleGetJustifyContent(long nativePointer);
|
||||
@Override
|
||||
public CSSJustify getJustifyContent() {
|
||||
return CSSJustify.values()[jni_CSSNodeStyleGetJustifyContent(mNativePointer)];
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeStyleSetJustifyContent(long nativePointer, int justifyContent);
|
||||
@Override
|
||||
public void setJustifyContent(CSSJustify justifyContent) {
|
||||
jni_CSSNodeStyleSetJustifyContent(mNativePointer, justifyContent.intValue());
|
||||
}
|
||||
|
||||
private native int jni_CSSNodeStyleGetAlignItems(long nativePointer);
|
||||
@Override
|
||||
public CSSAlign getAlignItems() {
|
||||
return CSSAlign.values()[jni_CSSNodeStyleGetAlignItems(mNativePointer)];
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeStyleSetAlignItems(long nativePointer, int alignItems);
|
||||
@Override
|
||||
public void setAlignItems(CSSAlign alignItems) {
|
||||
jni_CSSNodeStyleSetAlignItems(mNativePointer, alignItems.intValue());
|
||||
}
|
||||
|
||||
private native int jni_CSSNodeStyleGetAlignSelf(long nativePointer);
|
||||
@Override
|
||||
public CSSAlign getAlignSelf() {
|
||||
return CSSAlign.values()[jni_CSSNodeStyleGetAlignSelf(mNativePointer)];
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeStyleSetAlignSelf(long nativePointer, int alignSelf);
|
||||
@Override
|
||||
public void setAlignSelf(CSSAlign alignSelf) {
|
||||
jni_CSSNodeStyleSetAlignSelf(mNativePointer, alignSelf.intValue());
|
||||
}
|
||||
|
||||
private native int jni_CSSNodeStyleGetAlignContent(long nativePointer);
|
||||
@Override
|
||||
public CSSAlign getAlignContent() {
|
||||
return CSSAlign.values()[jni_CSSNodeStyleGetAlignContent(mNativePointer)];
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeStyleSetAlignContent(long nativePointer, int alignContent);
|
||||
@Override
|
||||
public void setAlignContent(CSSAlign alignContent) {
|
||||
jni_CSSNodeStyleSetAlignContent(mNativePointer, alignContent.intValue());
|
||||
}
|
||||
|
||||
private native int jni_CSSNodeStyleGetPositionType(long nativePointer);
|
||||
@Override
|
||||
public CSSPositionType getPositionType() {
|
||||
return CSSPositionType.values()[jni_CSSNodeStyleGetPositionType(mNativePointer)];
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeStyleSetPositionType(long nativePointer, int positionType);
|
||||
@Override
|
||||
public void setPositionType(CSSPositionType positionType) {
|
||||
jni_CSSNodeStyleSetPositionType(mNativePointer, positionType.intValue());
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeStyleSetFlexWrap(long nativePointer, int wrapType);
|
||||
@Override
|
||||
public void setWrap(CSSWrap flexWrap) {
|
||||
jni_CSSNodeStyleSetFlexWrap(mNativePointer, flexWrap.intValue());
|
||||
}
|
||||
|
||||
private native int jni_CSSNodeStyleGetOverflow(long nativePointer);
|
||||
@Override
|
||||
public CSSOverflow getOverflow() {
|
||||
return CSSOverflow.values()[jni_CSSNodeStyleGetOverflow(mNativePointer)];
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeStyleSetOverflow(long nativePointer, int overflow);
|
||||
@Override
|
||||
public void setOverflow(CSSOverflow overflow) {
|
||||
jni_CSSNodeStyleSetOverflow(mNativePointer, overflow.intValue());
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeStyleSetFlex(long nativePointer, float flex);
|
||||
@Override
|
||||
public void setFlex(float flex) {
|
||||
jni_CSSNodeStyleSetFlex(mNativePointer, flex);
|
||||
}
|
||||
|
||||
private native float jni_CSSNodeStyleGetFlexGrow(long nativePointer);
|
||||
@Override
|
||||
public float getFlexGrow() {
|
||||
return jni_CSSNodeStyleGetFlexGrow(mNativePointer);
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeStyleSetFlexGrow(long nativePointer, float flexGrow);
|
||||
@Override
|
||||
public void setFlexGrow(float flexGrow) {
|
||||
jni_CSSNodeStyleSetFlexGrow(mNativePointer, flexGrow);
|
||||
}
|
||||
|
||||
private native float jni_CSSNodeStyleGetFlexShrink(long nativePointer);
|
||||
@Override
|
||||
public float getFlexShrink() {
|
||||
return jni_CSSNodeStyleGetFlexShrink(mNativePointer);
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeStyleSetFlexShrink(long nativePointer, float flexShrink);
|
||||
@Override
|
||||
public void setFlexShrink(float flexShrink) {
|
||||
jni_CSSNodeStyleSetFlexShrink(mNativePointer, flexShrink);
|
||||
}
|
||||
|
||||
private native float jni_CSSNodeStyleGetFlexBasis(long nativePointer);
|
||||
@Override
|
||||
public float getFlexBasis() {
|
||||
return jni_CSSNodeStyleGetFlexBasis(mNativePointer);
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeStyleSetFlexBasis(long nativePointer, float flexBasis);
|
||||
@Override
|
||||
public void setFlexBasis(float flexBasis) {
|
||||
jni_CSSNodeStyleSetFlexBasis(mNativePointer, flexBasis);
|
||||
}
|
||||
|
||||
private native float jni_CSSNodeStyleGetMargin(long nativePointer, int edge);
|
||||
@Override
|
||||
public float getMargin(CSSEdge edge) {
|
||||
if (!mHasSetMargin) {
|
||||
return edge.intValue() < CSSEdge.START.intValue() ? 0 : CSSConstants.UNDEFINED;
|
||||
}
|
||||
return jni_CSSNodeStyleGetMargin(mNativePointer, edge.intValue());
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeStyleSetMargin(long nativePointer, int edge, float margin);
|
||||
@Override
|
||||
public void setMargin(CSSEdge edge, float margin) {
|
||||
mHasSetMargin = true;
|
||||
jni_CSSNodeStyleSetMargin(mNativePointer, edge.intValue(), margin);
|
||||
}
|
||||
|
||||
private native float jni_CSSNodeStyleGetPadding(long nativePointer, int edge);
|
||||
@Override
|
||||
public float getPadding(CSSEdge edge) {
|
||||
if (!mHasSetPadding) {
|
||||
return edge.intValue() < CSSEdge.START.intValue() ? 0 : CSSConstants.UNDEFINED;
|
||||
}
|
||||
return jni_CSSNodeStyleGetPadding(mNativePointer, edge.intValue());
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeStyleSetPadding(long nativePointer, int edge, float padding);
|
||||
@Override
|
||||
public void setPadding(CSSEdge edge, float padding) {
|
||||
mHasSetPadding = true;
|
||||
jni_CSSNodeStyleSetPadding(mNativePointer, edge.intValue(), padding);
|
||||
}
|
||||
|
||||
private native float jni_CSSNodeStyleGetBorder(long nativePointer, int edge);
|
||||
@Override
|
||||
public float getBorder(CSSEdge edge) {
|
||||
if (!mHasSetBorder) {
|
||||
return edge.intValue() < CSSEdge.START.intValue() ? 0 : CSSConstants.UNDEFINED;
|
||||
}
|
||||
return jni_CSSNodeStyleGetBorder(mNativePointer, edge.intValue());
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeStyleSetBorder(long nativePointer, int edge, float border);
|
||||
@Override
|
||||
public void setBorder(CSSEdge edge, float border) {
|
||||
mHasSetBorder = true;
|
||||
jni_CSSNodeStyleSetBorder(mNativePointer, edge.intValue(), border);
|
||||
}
|
||||
|
||||
private native float jni_CSSNodeStyleGetPosition(long nativePointer, int edge);
|
||||
@Override
|
||||
public float getPosition(CSSEdge edge) {
|
||||
if (!mHasSetPosition) {
|
||||
return CSSConstants.UNDEFINED;
|
||||
}
|
||||
return jni_CSSNodeStyleGetPosition(mNativePointer, edge.intValue());
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeStyleSetPosition(long nativePointer, int edge, float position);
|
||||
@Override
|
||||
public void setPosition(CSSEdge edge, float position) {
|
||||
mHasSetPosition = true;
|
||||
jni_CSSNodeStyleSetPosition(mNativePointer, edge.intValue(), position);
|
||||
}
|
||||
|
||||
private native float jni_CSSNodeStyleGetWidth(long nativePointer);
|
||||
@Override
|
||||
public float getWidth() {
|
||||
return jni_CSSNodeStyleGetWidth(mNativePointer);
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeStyleSetWidth(long nativePointer, float width);
|
||||
@Override
|
||||
public void setWidth(float width) {
|
||||
jni_CSSNodeStyleSetWidth(mNativePointer, width);
|
||||
}
|
||||
|
||||
private native float jni_CSSNodeStyleGetHeight(long nativePointer);
|
||||
@Override
|
||||
public float getHeight() {
|
||||
return jni_CSSNodeStyleGetHeight(mNativePointer);
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeStyleSetHeight(long nativePointer, float height);
|
||||
@Override
|
||||
public void setHeight(float height) {
|
||||
jni_CSSNodeStyleSetHeight(mNativePointer, height);
|
||||
}
|
||||
|
||||
private native float jni_CSSNodeStyleGetMinWidth(long nativePointer);
|
||||
@Override
|
||||
public float getMinWidth() {
|
||||
return jni_CSSNodeStyleGetMinWidth(mNativePointer);
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeStyleSetMinWidth(long nativePointer, float minWidth);
|
||||
@Override
|
||||
public void setMinWidth(float minWidth) {
|
||||
jni_CSSNodeStyleSetMinWidth(mNativePointer, minWidth);
|
||||
}
|
||||
|
||||
private native float jni_CSSNodeStyleGetMinHeight(long nativePointer);
|
||||
@Override
|
||||
public float getMinHeight() {
|
||||
return jni_CSSNodeStyleGetMinHeight(mNativePointer);
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeStyleSetMinHeight(long nativePointer, float minHeight);
|
||||
@Override
|
||||
public void setMinHeight(float minHeight) {
|
||||
jni_CSSNodeStyleSetMinHeight(mNativePointer, minHeight);
|
||||
}
|
||||
|
||||
private native float jni_CSSNodeStyleGetMaxWidth(long nativePointer);
|
||||
@Override
|
||||
public float getMaxWidth() {
|
||||
return jni_CSSNodeStyleGetMaxWidth(mNativePointer);
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeStyleSetMaxWidth(long nativePointer, float maxWidth);
|
||||
@Override
|
||||
public void setMaxWidth(float maxWidth) {
|
||||
jni_CSSNodeStyleSetMaxWidth(mNativePointer, maxWidth);
|
||||
}
|
||||
|
||||
private native float jni_CSSNodeStyleGetMaxHeight(long nativePointer);
|
||||
@Override
|
||||
public float getMaxHeight() {
|
||||
return jni_CSSNodeStyleGetMaxHeight(mNativePointer);
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeStyleSetMaxHeight(long nativePointer, float maxheight);
|
||||
@Override
|
||||
public void setMaxHeight(float maxheight) {
|
||||
jni_CSSNodeStyleSetMaxHeight(mNativePointer, maxheight);
|
||||
}
|
||||
|
||||
private native float jni_CSSNodeStyleGetAspectRatio(long nativePointer);
|
||||
public float getAspectRatio() {
|
||||
return jni_CSSNodeStyleGetAspectRatio(mNativePointer);
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeStyleSetAspectRatio(long nativePointer, float aspectRatio);
|
||||
public void setAspectRatio(float aspectRatio) {
|
||||
jni_CSSNodeStyleSetAspectRatio(mNativePointer, aspectRatio);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getLayoutX() {
|
||||
return mLeft;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getLayoutY() {
|
||||
return mTop;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getLayoutWidth() {
|
||||
return mWidth;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getLayoutHeight() {
|
||||
return mHeight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CSSDirection getLayoutDirection() {
|
||||
return CSSDirection.values()[mLayoutDirection];
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeSetHasMeasureFunc(long nativePointer, boolean hasMeasureFunc);
|
||||
@Override
|
||||
public void setMeasureFunction(MeasureFunction measureFunction) {
|
||||
mMeasureFunction = measureFunction;
|
||||
jni_CSSNodeSetHasMeasureFunc(mNativePointer, measureFunction != null);
|
||||
}
|
||||
|
||||
// Implementation Note: Why this method needs to stay final
|
||||
//
|
||||
// We cache the jmethodid for this method in CSSLayout code. This means that even if a subclass
|
||||
// were to override measure, we'd still call this implementation from layout code since the
|
||||
// overriding method will have a different jmethodid. This is final to prevent that mistake.
|
||||
@DoNotStrip
|
||||
public final long measure(float width, int widthMode, float height, int heightMode) {
|
||||
if (!isMeasureDefined()) {
|
||||
throw new RuntimeException("Measure function isn't defined!");
|
||||
}
|
||||
|
||||
return mMeasureFunction.measure(
|
||||
this,
|
||||
width,
|
||||
CSSMeasureMode.values()[widthMode],
|
||||
height,
|
||||
CSSMeasureMode.values()[heightMode]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMeasureDefined() {
|
||||
return mMeasureFunction != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(Object data) {
|
||||
mData = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getData() {
|
||||
return mData;
|
||||
}
|
||||
}
|
||||
@@ -1,92 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
package com.facebook.csslayout;
|
||||
|
||||
public interface CSSNodeAPI<CSSNodeType extends CSSNodeAPI> {
|
||||
|
||||
interface MeasureFunction {
|
||||
/**
|
||||
* Return a value created by MeasureOutput.make(width, height);
|
||||
*/
|
||||
long measure(
|
||||
CSSNodeAPI node,
|
||||
float width,
|
||||
CSSMeasureMode widthMode,
|
||||
float height,
|
||||
CSSMeasureMode heightMode);
|
||||
}
|
||||
|
||||
int getChildCount();
|
||||
CSSNodeType getChildAt(int i);
|
||||
void addChildAt(CSSNodeType child, int i);
|
||||
CSSNodeType removeChildAt(int i);
|
||||
CSSNodeType getParent();
|
||||
int indexOf(CSSNodeType child);
|
||||
void setMeasureFunction(MeasureFunction measureFunction);
|
||||
boolean isMeasureDefined();
|
||||
void calculateLayout();
|
||||
boolean isDirty();
|
||||
boolean hasNewLayout();
|
||||
void dirty();
|
||||
void markLayoutSeen();
|
||||
void copyStyle(CSSNodeType srcNode);
|
||||
CSSDirection getStyleDirection();
|
||||
void setDirection(CSSDirection direction);
|
||||
CSSFlexDirection getFlexDirection();
|
||||
void setFlexDirection(CSSFlexDirection flexDirection);
|
||||
CSSJustify getJustifyContent();
|
||||
void setJustifyContent(CSSJustify justifyContent);
|
||||
CSSAlign getAlignItems();
|
||||
void setAlignItems(CSSAlign alignItems);
|
||||
CSSAlign getAlignSelf();
|
||||
void setAlignSelf(CSSAlign alignSelf);
|
||||
CSSAlign getAlignContent();
|
||||
void setAlignContent(CSSAlign alignContent);
|
||||
CSSPositionType getPositionType();
|
||||
void setPositionType(CSSPositionType positionType);
|
||||
void setWrap(CSSWrap flexWrap);
|
||||
void setFlex(float flex);
|
||||
float getFlexGrow();
|
||||
void setFlexGrow(float flexGrow);
|
||||
float getFlexShrink();
|
||||
void setFlexShrink(float flexShrink);
|
||||
float getFlexBasis();
|
||||
void setFlexBasis(float flexBasis);
|
||||
float getMargin(CSSEdge edge);
|
||||
void setMargin(CSSEdge edge, float margin);
|
||||
float getPadding(CSSEdge edge);
|
||||
void setPadding(CSSEdge edge, float padding);
|
||||
float getBorder(CSSEdge edge);
|
||||
void setBorder(CSSEdge edge, float border);
|
||||
float getPosition(CSSEdge edge);
|
||||
void setPosition(CSSEdge edge, float position);
|
||||
float getWidth();
|
||||
void setWidth(float width);
|
||||
float getHeight();
|
||||
void setHeight(float height);
|
||||
float getMaxWidth();
|
||||
void setMaxWidth(float maxWidth);
|
||||
float getMinWidth();
|
||||
void setMinWidth(float minWidth);
|
||||
float getMaxHeight();
|
||||
void setMaxHeight(float maxHeight);
|
||||
float getMinHeight();
|
||||
void setMinHeight(float minHeight);
|
||||
float getLayoutX();
|
||||
float getLayoutY();
|
||||
float getLayoutWidth();
|
||||
float getLayoutHeight();
|
||||
CSSDirection getLayoutDirection();
|
||||
CSSOverflow getOverflow();
|
||||
void setOverflow(CSSOverflow overflow);
|
||||
void setData(Object data);
|
||||
Object getData();
|
||||
void reset();
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
The source of truth for css-layout is: https://github.com/facebook/css-layout
|
||||
|
||||
The code here should be kept in sync with GitHub.
|
||||
HEAD at the time this code was synced: https://github.com/facebook/css-layout/commit/a1f36b53f5464c8ee7abc311765dc3ecb1b879c6
|
||||
|
||||
There is generated code in:
|
||||
- README (this file)
|
||||
- fbandroid/java/com/facebook/csslayout
|
||||
- fbandroid/javatests/com/facebook/csslayout
|
||||
- fbobjc/Libraries/FBReactKit/js/react-native-github/React/Layout
|
||||
|
||||
The code was generated by running 'make' in the css-layout folder and running:
|
||||
|
||||
scripts/sync-css-layout.sh <pathToGithubRepo> <pathToFbSourceRepo>
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
@@ -29,6 +30,10 @@ import javax.annotation.Nullable;
|
||||
* class doesn't implement {@link ReactApplication}.
|
||||
*/
|
||||
public class ReactActivityDelegate {
|
||||
|
||||
private final int REQUEST_OVERLAY_PERMISSION_CODE = 1111;
|
||||
private static final String REDBOX_PERMISSION_GRANTED_MESSAGE =
|
||||
"Overlay permissions have been granted.";
|
||||
private static final String REDBOX_PERMISSION_MESSAGE =
|
||||
"Overlay permissions needs to be granted in order for react native apps to run in dev mode";
|
||||
|
||||
@@ -79,17 +84,19 @@ public class ReactActivityDelegate {
|
||||
}
|
||||
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
if (getReactNativeHost().getUseDeveloperSupport() && Build.VERSION.SDK_INT >= 23) {
|
||||
boolean needsOverlayPermission = false;
|
||||
if (getReactNativeHost().getUseDeveloperSupport() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
// Get permission to show redbox in dev builds.
|
||||
if (!Settings.canDrawOverlays(getContext())) {
|
||||
Intent serviceIntent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION);
|
||||
getContext().startActivity(serviceIntent);
|
||||
needsOverlayPermission = true;
|
||||
Intent serviceIntent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:" + getContext().getPackageName()));
|
||||
FLog.w(ReactConstants.TAG, REDBOX_PERMISSION_MESSAGE);
|
||||
Toast.makeText(getContext(), REDBOX_PERMISSION_MESSAGE, Toast.LENGTH_LONG).show();
|
||||
((Activity) getContext()).startActivityForResult(serviceIntent, REQUEST_OVERLAY_PERMISSION_CODE);
|
||||
}
|
||||
}
|
||||
|
||||
if (mMainComponentName != null) {
|
||||
if (mMainComponentName != null && !needsOverlayPermission) {
|
||||
loadApp(mMainComponentName);
|
||||
}
|
||||
mDoubleTapReloadRecognizer = new DoubleTapReloadRecognizer();
|
||||
@@ -140,6 +147,16 @@ public class ReactActivityDelegate {
|
||||
if (getReactNativeHost().hasInstance()) {
|
||||
getReactNativeHost().getReactInstanceManager()
|
||||
.onActivityResult(getPlainActivity(), requestCode, resultCode, data);
|
||||
} else {
|
||||
// Did we request overlay permissions?
|
||||
if (requestCode == REQUEST_OVERLAY_PERMISSION_CODE && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
if (Settings.canDrawOverlays(getContext())) {
|
||||
if (mMainComponentName != null) {
|
||||
loadApp(mMainComponentName);
|
||||
}
|
||||
Toast.makeText(getContext(), REDBOX_PERMISSION_GRANTED_MESSAGE, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,8 +208,7 @@ public class ReactActivityDelegate {
|
||||
mPermissionsCallback = new Callback() {
|
||||
@Override
|
||||
public void invoke(Object... args) {
|
||||
if (mPermissionListener != null &&
|
||||
mPermissionListener.onRequestPermissionsResult(requestCode, permissions, grantResults)) {
|
||||
if (mPermissionListener != null && mPermissionListener.onRequestPermissionsResult(requestCode, permissions, grantResults)) {
|
||||
mPermissionListener = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,10 +56,21 @@ import com.facebook.react.uimanager.events.EventDispatcher;
|
||||
*/
|
||||
public class ReactRootView extends SizeMonitoringFrameLayout implements RootView {
|
||||
|
||||
/**
|
||||
* Listener interface for react root view events
|
||||
*/
|
||||
public interface ReactRootViewEventListener {
|
||||
/**
|
||||
* Called when the react context is attached to a ReactRootView.
|
||||
*/
|
||||
void onAttachedToReactInstance(ReactRootView rootView);
|
||||
}
|
||||
|
||||
private @Nullable ReactInstanceManager mReactInstanceManager;
|
||||
private @Nullable String mJSModuleName;
|
||||
private @Nullable Bundle mLaunchOptions;
|
||||
private @Nullable CustomGlobalLayoutListener mCustomGlobalLayoutListener;
|
||||
private @Nullable ReactRootViewEventListener mRootViewEventListener;
|
||||
private int mRootViewTag;
|
||||
private boolean mWasMeasured = false;
|
||||
private boolean mIsAttachedToInstance = false;
|
||||
@@ -224,6 +235,16 @@ public class ReactRootView extends SizeMonitoringFrameLayout implements RootView
|
||||
}
|
||||
}
|
||||
|
||||
public void onAttachedToReactInstance() {
|
||||
if (mRootViewEventListener != null) {
|
||||
mRootViewEventListener.onAttachedToReactInstance(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void setEventListener(ReactRootViewEventListener eventListener) {
|
||||
mRootViewEventListener = eventListener;
|
||||
}
|
||||
|
||||
/* package */ String getJSModuleName() {
|
||||
return Assertions.assertNotNull(mJSModuleName);
|
||||
}
|
||||
|
||||
@@ -810,6 +810,7 @@ import static com.facebook.systrace.Systrace.TRACE_TAG_REACT_JAVA_BRIDGE;
|
||||
appParams.putDouble("rootTag", rootTag);
|
||||
appParams.putMap("initialProps", initialProps);
|
||||
catalystInstance.getJSModule(AppRegistry.class).runApplication(jsAppModuleName, appParams);
|
||||
rootView.onAttachedToReactInstance();
|
||||
Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,9 @@ import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.facebook.react.module.annotations.ReactModule;
|
||||
|
||||
@ReactModule(name = "JSCHeapCapture")
|
||||
// This module is being called only by Java via the static method "captureHeap" that
|
||||
// requires it to alreay be initialized, thus we eagerly initialize this module
|
||||
@ReactModule(name = "JSCHeapCapture", needsEagerInit = true)
|
||||
public class JSCHeapCapture extends ReactContextBaseJavaModule {
|
||||
public interface HeapCapture extends JavaScriptModule {
|
||||
void captureHeap(String path);
|
||||
|
||||
@@ -21,7 +21,9 @@ import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.facebook.react.module.annotations.ReactModule;
|
||||
|
||||
@ReactModule(name = "JSCSamplingProfiler")
|
||||
// This module is being called only by Java via the static method "poke" that
|
||||
// requires it to alreay be initialized, thus we eagerly initialize this module
|
||||
@ReactModule(name = "JSCSamplingProfiler", needsEagerInit = true)
|
||||
public class JSCSamplingProfiler extends ReactContextBaseJavaModule {
|
||||
public interface SamplingProfiler extends JavaScriptModule {
|
||||
void poke(int token);
|
||||
|
||||
@@ -9,7 +9,7 @@ android_library(
|
||||
'layoutanimation/*.java'
|
||||
]),
|
||||
deps = [
|
||||
CSSLAYOUT_TARGET,
|
||||
YOGA_TARGET,
|
||||
react_native_dep('java/com/facebook/systrace:systrace'),
|
||||
react_native_dep('libraries/fbcore/src/main/java/com/facebook/common/logging:logging'),
|
||||
react_native_dep('third-party/android/support/v4:lib-support-v4'),
|
||||
|
||||
@@ -6,13 +6,13 @@ import javax.annotation.Nullable;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import com.facebook.csslayout.CSSAlign;
|
||||
import com.facebook.csslayout.CSSConstants;
|
||||
import com.facebook.csslayout.CSSFlexDirection;
|
||||
import com.facebook.csslayout.CSSJustify;
|
||||
import com.facebook.csslayout.CSSOverflow;
|
||||
import com.facebook.csslayout.CSSPositionType;
|
||||
import com.facebook.csslayout.CSSWrap;
|
||||
import com.facebook.yoga.YogaAlign;
|
||||
import com.facebook.yoga.YogaConstants;
|
||||
import com.facebook.yoga.YogaFlexDirection;
|
||||
import com.facebook.yoga.YogaJustify;
|
||||
import com.facebook.yoga.YogaOverflow;
|
||||
import com.facebook.yoga.YogaPositionType;
|
||||
import com.facebook.yoga.YogaWrap;
|
||||
import com.facebook.react.uimanager.annotations.ReactProp;
|
||||
import com.facebook.react.uimanager.annotations.ReactPropGroup;
|
||||
|
||||
@@ -27,57 +27,57 @@ import com.facebook.react.uimanager.annotations.ReactPropGroup;
|
||||
*/
|
||||
public class LayoutShadowNode extends ReactShadowNode {
|
||||
|
||||
@ReactProp(name = ViewProps.WIDTH, defaultFloat = CSSConstants.UNDEFINED)
|
||||
@ReactProp(name = ViewProps.WIDTH, defaultFloat = YogaConstants.UNDEFINED)
|
||||
public void setWidth(float width) {
|
||||
if (isVirtual()) {
|
||||
return;
|
||||
}
|
||||
setStyleWidth(CSSConstants.isUndefined(width) ? width : PixelUtil.toPixelFromDIP(width));
|
||||
setStyleWidth(YogaConstants.isUndefined(width) ? width : PixelUtil.toPixelFromDIP(width));
|
||||
}
|
||||
|
||||
@ReactProp(name = ViewProps.MIN_WIDTH, defaultFloat = CSSConstants.UNDEFINED)
|
||||
@ReactProp(name = ViewProps.MIN_WIDTH, defaultFloat = YogaConstants.UNDEFINED)
|
||||
public void setMinWidth(float minWidth) {
|
||||
if (isVirtual()) {
|
||||
return;
|
||||
}
|
||||
setStyleMinWidth(
|
||||
CSSConstants.isUndefined(minWidth) ? minWidth : PixelUtil.toPixelFromDIP(minWidth));
|
||||
YogaConstants.isUndefined(minWidth) ? minWidth : PixelUtil.toPixelFromDIP(minWidth));
|
||||
}
|
||||
|
||||
@ReactProp(name = ViewProps.MAX_WIDTH, defaultFloat = CSSConstants.UNDEFINED)
|
||||
@ReactProp(name = ViewProps.MAX_WIDTH, defaultFloat = YogaConstants.UNDEFINED)
|
||||
public void setMaxWidth(float maxWidth) {
|
||||
if (isVirtual()) {
|
||||
return;
|
||||
}
|
||||
setStyleMaxWidth(
|
||||
CSSConstants.isUndefined(maxWidth) ? maxWidth : PixelUtil.toPixelFromDIP(maxWidth));
|
||||
YogaConstants.isUndefined(maxWidth) ? maxWidth : PixelUtil.toPixelFromDIP(maxWidth));
|
||||
}
|
||||
|
||||
@ReactProp(name = ViewProps.HEIGHT, defaultFloat = CSSConstants.UNDEFINED)
|
||||
@ReactProp(name = ViewProps.HEIGHT, defaultFloat = YogaConstants.UNDEFINED)
|
||||
public void setHeight(float height) {
|
||||
if (isVirtual()) {
|
||||
return;
|
||||
}
|
||||
setStyleHeight(
|
||||
CSSConstants.isUndefined(height) ? height : PixelUtil.toPixelFromDIP(height));
|
||||
YogaConstants.isUndefined(height) ? height : PixelUtil.toPixelFromDIP(height));
|
||||
}
|
||||
|
||||
@ReactProp(name = ViewProps.MIN_HEIGHT, defaultFloat = CSSConstants.UNDEFINED)
|
||||
@ReactProp(name = ViewProps.MIN_HEIGHT, defaultFloat = YogaConstants.UNDEFINED)
|
||||
public void setMinHeight(float minHeight) {
|
||||
if (isVirtual()) {
|
||||
return;
|
||||
}
|
||||
setStyleMinHeight(
|
||||
CSSConstants.isUndefined(minHeight) ? minHeight : PixelUtil.toPixelFromDIP(minHeight));
|
||||
YogaConstants.isUndefined(minHeight) ? minHeight : PixelUtil.toPixelFromDIP(minHeight));
|
||||
}
|
||||
|
||||
@ReactProp(name = ViewProps.MAX_HEIGHT, defaultFloat = CSSConstants.UNDEFINED)
|
||||
@ReactProp(name = ViewProps.MAX_HEIGHT, defaultFloat = YogaConstants.UNDEFINED)
|
||||
public void setMaxHeight(float maxHeight) {
|
||||
if (isVirtual()) {
|
||||
return;
|
||||
}
|
||||
setStyleMaxHeight(
|
||||
CSSConstants.isUndefined(maxHeight) ? maxHeight : PixelUtil.toPixelFromDIP(maxHeight));
|
||||
YogaConstants.isUndefined(maxHeight) ? maxHeight : PixelUtil.toPixelFromDIP(maxHeight));
|
||||
}
|
||||
|
||||
@ReactProp(name = ViewProps.FLEX, defaultFloat = 0f)
|
||||
@@ -112,7 +112,7 @@ public class LayoutShadowNode extends ReactShadowNode {
|
||||
super.setFlexBasis(flexBasis);
|
||||
}
|
||||
|
||||
@ReactProp(name = ViewProps.ASPECT_RATIO, defaultFloat = CSSConstants.UNDEFINED)
|
||||
@ReactProp(name = ViewProps.ASPECT_RATIO, defaultFloat = YogaConstants.UNDEFINED)
|
||||
public void setAspectRatio(float aspectRatio) {
|
||||
setStyleAspectRatio(aspectRatio);
|
||||
}
|
||||
@@ -123,7 +123,7 @@ public class LayoutShadowNode extends ReactShadowNode {
|
||||
return;
|
||||
}
|
||||
setFlexDirection(
|
||||
flexDirection == null ? CSSFlexDirection.COLUMN : CSSFlexDirection.valueOf(
|
||||
flexDirection == null ? YogaFlexDirection.COLUMN : YogaFlexDirection.valueOf(
|
||||
flexDirection.toUpperCase(Locale.US).replace("-", "_")));
|
||||
}
|
||||
|
||||
@@ -133,9 +133,9 @@ public class LayoutShadowNode extends ReactShadowNode {
|
||||
return;
|
||||
}
|
||||
if (flexWrap == null || flexWrap.equals("nowrap")) {
|
||||
setFlexWrap(CSSWrap.NO_WRAP);
|
||||
setFlexWrap(YogaWrap.NO_WRAP);
|
||||
} else if (flexWrap.equals("wrap")) {
|
||||
setFlexWrap(CSSWrap.WRAP);
|
||||
setFlexWrap(YogaWrap.WRAP);
|
||||
} else {
|
||||
throw new IllegalArgumentException("Unknown flexWrap value: " + flexWrap);
|
||||
}
|
||||
@@ -146,7 +146,7 @@ public class LayoutShadowNode extends ReactShadowNode {
|
||||
if (isVirtual()) {
|
||||
return;
|
||||
}
|
||||
setAlignSelf(alignSelf == null ? CSSAlign.AUTO : CSSAlign.valueOf(
|
||||
setAlignSelf(alignSelf == null ? YogaAlign.AUTO : YogaAlign.valueOf(
|
||||
alignSelf.toUpperCase(Locale.US).replace("-", "_")));
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ public class LayoutShadowNode extends ReactShadowNode {
|
||||
return;
|
||||
}
|
||||
setAlignItems(
|
||||
alignItems == null ? CSSAlign.STRETCH : CSSAlign.valueOf(
|
||||
alignItems == null ? YogaAlign.STRETCH : YogaAlign.valueOf(
|
||||
alignItems.toUpperCase(Locale.US).replace("-", "_")));
|
||||
}
|
||||
|
||||
@@ -165,7 +165,7 @@ public class LayoutShadowNode extends ReactShadowNode {
|
||||
if (isVirtual()) {
|
||||
return;
|
||||
}
|
||||
setJustifyContent(justifyContent == null ? CSSJustify.FLEX_START : CSSJustify.valueOf(
|
||||
setJustifyContent(justifyContent == null ? YogaJustify.FLEX_START : YogaJustify.valueOf(
|
||||
justifyContent.toUpperCase(Locale.US).replace("-", "_")));
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ public class LayoutShadowNode extends ReactShadowNode {
|
||||
if (isVirtual()) {
|
||||
return;
|
||||
}
|
||||
setOverflow(overflow == null ? CSSOverflow.VISIBLE : CSSOverflow.valueOf(
|
||||
setOverflow(overflow == null ? YogaOverflow.VISIBLE : YogaOverflow.valueOf(
|
||||
overflow.toUpperCase(Locale.US).replace("-", "_")));
|
||||
}
|
||||
|
||||
@@ -186,7 +186,7 @@ public class LayoutShadowNode extends ReactShadowNode {
|
||||
ViewProps.MARGIN_RIGHT,
|
||||
ViewProps.MARGIN_TOP,
|
||||
ViewProps.MARGIN_BOTTOM,
|
||||
}, defaultFloat = CSSConstants.UNDEFINED)
|
||||
}, defaultFloat = YogaConstants.UNDEFINED)
|
||||
public void setMargins(int index, float margin) {
|
||||
if (isVirtual()) {
|
||||
return;
|
||||
@@ -202,14 +202,14 @@ public class LayoutShadowNode extends ReactShadowNode {
|
||||
ViewProps.PADDING_RIGHT,
|
||||
ViewProps.PADDING_TOP,
|
||||
ViewProps.PADDING_BOTTOM,
|
||||
}, defaultFloat = CSSConstants.UNDEFINED)
|
||||
}, defaultFloat = YogaConstants.UNDEFINED)
|
||||
public void setPaddings(int index, float padding) {
|
||||
if (isVirtual()) {
|
||||
return;
|
||||
}
|
||||
setPadding(
|
||||
ViewProps.PADDING_MARGIN_SPACING_TYPES[index],
|
||||
CSSConstants.isUndefined(padding) ? padding : PixelUtil.toPixelFromDIP(padding));
|
||||
YogaConstants.isUndefined(padding) ? padding : PixelUtil.toPixelFromDIP(padding));
|
||||
}
|
||||
|
||||
@ReactPropGroup(names = {
|
||||
@@ -218,7 +218,7 @@ public class LayoutShadowNode extends ReactShadowNode {
|
||||
ViewProps.BORDER_RIGHT_WIDTH,
|
||||
ViewProps.BORDER_TOP_WIDTH,
|
||||
ViewProps.BORDER_BOTTOM_WIDTH,
|
||||
}, defaultFloat = CSSConstants.UNDEFINED)
|
||||
}, defaultFloat = YogaConstants.UNDEFINED)
|
||||
public void setBorderWidths(int index, float borderWidth) {
|
||||
if (isVirtual()) {
|
||||
return;
|
||||
@@ -231,14 +231,14 @@ public class LayoutShadowNode extends ReactShadowNode {
|
||||
ViewProps.RIGHT,
|
||||
ViewProps.TOP,
|
||||
ViewProps.BOTTOM,
|
||||
}, defaultFloat = CSSConstants.UNDEFINED)
|
||||
}, defaultFloat = YogaConstants.UNDEFINED)
|
||||
public void setPositionValues(int index, float position) {
|
||||
if (isVirtual()) {
|
||||
return;
|
||||
}
|
||||
setPosition(
|
||||
ViewProps.POSITION_SPACING_TYPES[index],
|
||||
CSSConstants.isUndefined(position) ? position : PixelUtil.toPixelFromDIP(position));
|
||||
YogaConstants.isUndefined(position) ? position : PixelUtil.toPixelFromDIP(position));
|
||||
}
|
||||
|
||||
@ReactProp(name = ViewProps.POSITION)
|
||||
@@ -246,8 +246,8 @@ public class LayoutShadowNode extends ReactShadowNode {
|
||||
if (isVirtual()) {
|
||||
return;
|
||||
}
|
||||
CSSPositionType positionType = position == null ?
|
||||
CSSPositionType.RELATIVE : CSSPositionType.valueOf(position.toUpperCase(Locale.US));
|
||||
YogaPositionType positionType = position == null ?
|
||||
YogaPositionType.RELATIVE : YogaPositionType.valueOf(position.toUpperCase(Locale.US));
|
||||
setPositionType(positionType);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,25 +13,25 @@ import javax.annotation.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.facebook.csslayout.CSSAlign;
|
||||
import com.facebook.csslayout.CSSEdge;
|
||||
import com.facebook.csslayout.CSSConstants;
|
||||
import com.facebook.csslayout.CSSDirection;
|
||||
import com.facebook.csslayout.CSSFlexDirection;
|
||||
import com.facebook.csslayout.CSSJustify;
|
||||
import com.facebook.csslayout.CSSNode;
|
||||
import com.facebook.csslayout.CSSNodeAPI;
|
||||
import com.facebook.csslayout.CSSOverflow;
|
||||
import com.facebook.csslayout.CSSPositionType;
|
||||
import com.facebook.csslayout.CSSWrap;
|
||||
import com.facebook.yoga.YogaAlign;
|
||||
import com.facebook.yoga.YogaEdge;
|
||||
import com.facebook.yoga.YogaConstants;
|
||||
import com.facebook.yoga.YogaDirection;
|
||||
import com.facebook.yoga.YogaFlexDirection;
|
||||
import com.facebook.yoga.YogaJustify;
|
||||
import com.facebook.yoga.YogaMeasureFunction;
|
||||
import com.facebook.yoga.YogaNode;
|
||||
import com.facebook.yoga.YogaOverflow;
|
||||
import com.facebook.yoga.YogaPositionType;
|
||||
import com.facebook.yoga.YogaWrap;
|
||||
import com.facebook.infer.annotation.Assertions;
|
||||
import com.facebook.react.uimanager.annotations.ReactPropertyHolder;
|
||||
|
||||
/**
|
||||
* Base node class for representing virtual tree of React nodes. Shadow nodes are used primarily
|
||||
* for layouting therefore it extends {@link CSSNode} to allow that. They also help with handling
|
||||
* Common base subclass of {@link CSSNode} for all layout nodes for react-based view. It extends
|
||||
* {@link CSSNode} by adding additional capabilities.
|
||||
* for layouting therefore it extends {@link YogaNode} to allow that. They also help with handling
|
||||
* Common base subclass of {@link YogaNode} for all layout nodes for react-based view. It extends
|
||||
* {@link YogaNode} by adding additional capabilities.
|
||||
*
|
||||
* Instances of this class receive property updates from JS via @{link UIManagerModule}. Subclasses
|
||||
* may use {@link #updateShadowNode} to persist some of the updated fields in the node instance that
|
||||
@@ -43,7 +43,7 @@ import com.facebook.react.uimanager.annotations.ReactPropertyHolder;
|
||||
* custom subclass of it if necessary.
|
||||
*
|
||||
* The primary use-case for {@link ReactShadowNode} nodes is to calculate layouting. Although this
|
||||
* might be extended. For some examples please refer to ARTGroupCSSNode or ReactTextCSSNode.
|
||||
* might be extended. For some examples please refer to ARTGroupYogaNode or ReactTextYogaNode.
|
||||
*
|
||||
* This class allows for the native view hierarchy to not be an exact copy of the hierarchy received
|
||||
* from JS by keeping track of both JS children (e.g. {@link #getChildCount()} and separately native
|
||||
@@ -72,18 +72,18 @@ public class ReactShadowNode {
|
||||
private float mAbsoluteRight;
|
||||
private float mAbsoluteBottom;
|
||||
private final Spacing mDefaultPadding = new Spacing(0);
|
||||
private final Spacing mPadding = new Spacing(CSSConstants.UNDEFINED);
|
||||
private final CSSNode mCSSNode;
|
||||
private final Spacing mPadding = new Spacing(YogaConstants.UNDEFINED);
|
||||
private final YogaNode mYogaNode;
|
||||
|
||||
public ReactShadowNode() {
|
||||
if (!isVirtual()) {
|
||||
CSSNode node = CSSNodePool.get().acquire();
|
||||
YogaNode node = YogaNodePool.get().acquire();
|
||||
if (node == null) {
|
||||
node = new CSSNode();
|
||||
node = new YogaNode();
|
||||
}
|
||||
mCSSNode = node;
|
||||
mYogaNode = node;
|
||||
} else {
|
||||
mCSSNode = null;
|
||||
mYogaNode = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,12 +138,12 @@ public class ReactShadowNode {
|
||||
|
||||
public void dirty() {
|
||||
if (!isVirtual()) {
|
||||
mCSSNode.dirty();
|
||||
mYogaNode.dirty();
|
||||
}
|
||||
}
|
||||
|
||||
public final boolean isDirty() {
|
||||
return mCSSNode != null && mCSSNode.isDirty();
|
||||
return mYogaNode != null && mYogaNode.isDirty();
|
||||
}
|
||||
|
||||
public void addChildAt(ReactShadowNode child, int i) {
|
||||
@@ -159,13 +159,13 @@ public class ReactShadowNode {
|
||||
|
||||
// If a CSS node has measure defined, the layout algorithm will not visit its children. Even
|
||||
// more, it asserts that you don't add children to nodes with measure functions.
|
||||
if (mCSSNode != null && !mCSSNode.isMeasureDefined()) {
|
||||
CSSNode childCSSNode = child.mCSSNode;
|
||||
if (childCSSNode == null) {
|
||||
if (mYogaNode != null && !mYogaNode.isMeasureDefined()) {
|
||||
YogaNode childYogaNode = child.mYogaNode;
|
||||
if (childYogaNode == null) {
|
||||
throw new RuntimeException(
|
||||
"Cannot add a child that doesn't have a CSS node to a node without a measure function!");
|
||||
}
|
||||
mCSSNode.addChildAt(childCSSNode, i);
|
||||
mYogaNode.addChildAt(childYogaNode, i);
|
||||
}
|
||||
markUpdated();
|
||||
|
||||
@@ -183,8 +183,8 @@ public class ReactShadowNode {
|
||||
ReactShadowNode removed = mChildren.remove(i);
|
||||
removed.mParent = null;
|
||||
|
||||
if (mCSSNode != null && !mCSSNode.isMeasureDefined()) {
|
||||
mCSSNode.removeChildAt(i);
|
||||
if (mYogaNode != null && !mYogaNode.isMeasureDefined()) {
|
||||
mYogaNode.removeChildAt(i);
|
||||
}
|
||||
markUpdated();
|
||||
|
||||
@@ -217,8 +217,8 @@ public class ReactShadowNode {
|
||||
|
||||
int decrease = 0;
|
||||
for (int i = getChildCount() - 1; i >= 0; i--) {
|
||||
if (mCSSNode != null && !mCSSNode.isMeasureDefined()) {
|
||||
mCSSNode.removeChildAt(i);
|
||||
if (mYogaNode != null && !mYogaNode.isMeasureDefined()) {
|
||||
mYogaNode.removeChildAt(i);
|
||||
}
|
||||
ReactShadowNode toRemove = getChildAt(i);
|
||||
toRemove.mParent = null;
|
||||
@@ -339,16 +339,16 @@ public class ReactShadowNode {
|
||||
}
|
||||
|
||||
public void calculateLayout() {
|
||||
mCSSNode.calculateLayout();
|
||||
mYogaNode.calculateLayout();
|
||||
}
|
||||
|
||||
public final boolean hasNewLayout() {
|
||||
return mCSSNode == null ? false : mCSSNode.hasNewLayout();
|
||||
return mYogaNode == null ? false : mYogaNode.hasNewLayout();
|
||||
}
|
||||
|
||||
public final void markLayoutSeen() {
|
||||
if (mCSSNode != null) {
|
||||
mCSSNode.markLayoutSeen();
|
||||
if (mYogaNode != null) {
|
||||
mYogaNode.markLayoutSeen();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -463,19 +463,19 @@ public class ReactShadowNode {
|
||||
}
|
||||
|
||||
public final float getLayoutX() {
|
||||
return mCSSNode.getLayoutX();
|
||||
return mYogaNode.getLayoutX();
|
||||
}
|
||||
|
||||
public final float getLayoutY() {
|
||||
return mCSSNode.getLayoutY();
|
||||
return mYogaNode.getLayoutY();
|
||||
}
|
||||
|
||||
public final float getLayoutWidth() {
|
||||
return mCSSNode.getLayoutWidth();
|
||||
return mYogaNode.getLayoutWidth();
|
||||
}
|
||||
|
||||
public final float getLayoutHeight() {
|
||||
return mCSSNode.getLayoutHeight();
|
||||
return mYogaNode.getLayoutHeight();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -506,96 +506,96 @@ public class ReactShadowNode {
|
||||
return Math.round(mAbsoluteBottom - mAbsoluteTop);
|
||||
}
|
||||
|
||||
public final CSSDirection getLayoutDirection() {
|
||||
return mCSSNode.getLayoutDirection();
|
||||
public final YogaDirection getLayoutDirection() {
|
||||
return mYogaNode.getLayoutDirection();
|
||||
}
|
||||
|
||||
public void setLayoutDirection(CSSDirection direction) {
|
||||
mCSSNode.setDirection(direction);
|
||||
public void setLayoutDirection(YogaDirection direction) {
|
||||
mYogaNode.setDirection(direction);
|
||||
}
|
||||
|
||||
public final float getStyleWidth() {
|
||||
return mCSSNode.getWidth();
|
||||
return mYogaNode.getWidth();
|
||||
}
|
||||
|
||||
public void setStyleWidth(float widthPx) {
|
||||
mCSSNode.setWidth(widthPx);
|
||||
mYogaNode.setWidth(widthPx);
|
||||
}
|
||||
|
||||
public void setStyleMinWidth(float widthPx) {
|
||||
mCSSNode.setMinWidth(widthPx);
|
||||
mYogaNode.setMinWidth(widthPx);
|
||||
}
|
||||
|
||||
public void setStyleMaxWidth(float widthPx) {
|
||||
mCSSNode.setMaxWidth(widthPx);
|
||||
mYogaNode.setMaxWidth(widthPx);
|
||||
}
|
||||
|
||||
public final float getStyleHeight() {
|
||||
return mCSSNode.getHeight();
|
||||
return mYogaNode.getHeight();
|
||||
}
|
||||
|
||||
public void setStyleHeight(float heightPx) {
|
||||
mCSSNode.setHeight(heightPx);
|
||||
mYogaNode.setHeight(heightPx);
|
||||
}
|
||||
|
||||
public void setStyleMinHeight(float widthPx) {
|
||||
mCSSNode.setMinHeight(widthPx);
|
||||
mYogaNode.setMinHeight(widthPx);
|
||||
}
|
||||
|
||||
public void setStyleMaxHeight(float widthPx) {
|
||||
mCSSNode.setMaxHeight(widthPx);
|
||||
mYogaNode.setMaxHeight(widthPx);
|
||||
}
|
||||
|
||||
public void setFlex(float flex) {
|
||||
mCSSNode.setFlex(flex);
|
||||
mYogaNode.setFlex(flex);
|
||||
}
|
||||
|
||||
public void setFlexGrow(float flexGrow) {
|
||||
mCSSNode.setFlexGrow(flexGrow);
|
||||
mYogaNode.setFlexGrow(flexGrow);
|
||||
}
|
||||
|
||||
public void setFlexShrink(float flexShrink) {
|
||||
mCSSNode.setFlexShrink(flexShrink);
|
||||
mYogaNode.setFlexShrink(flexShrink);
|
||||
}
|
||||
|
||||
public void setFlexBasis(float flexBasis) {
|
||||
mCSSNode.setFlexBasis(flexBasis);
|
||||
mYogaNode.setFlexBasis(flexBasis);
|
||||
}
|
||||
|
||||
public void setStyleAspectRatio(float aspectRatio) {
|
||||
mCSSNode.setAspectRatio(aspectRatio);
|
||||
mYogaNode.setAspectRatio(aspectRatio);
|
||||
}
|
||||
|
||||
public void setFlexDirection(CSSFlexDirection flexDirection) {
|
||||
mCSSNode.setFlexDirection(flexDirection);
|
||||
public void setFlexDirection(YogaFlexDirection flexDirection) {
|
||||
mYogaNode.setFlexDirection(flexDirection);
|
||||
}
|
||||
|
||||
public void setFlexWrap(CSSWrap wrap) {
|
||||
mCSSNode.setWrap(wrap);
|
||||
public void setFlexWrap(YogaWrap wrap) {
|
||||
mYogaNode.setWrap(wrap);
|
||||
}
|
||||
|
||||
public void setAlignSelf(CSSAlign alignSelf) {
|
||||
mCSSNode.setAlignSelf(alignSelf);
|
||||
public void setAlignSelf(YogaAlign alignSelf) {
|
||||
mYogaNode.setAlignSelf(alignSelf);
|
||||
}
|
||||
|
||||
public void setAlignItems(CSSAlign alignItems) {
|
||||
mCSSNode.setAlignItems(alignItems);
|
||||
public void setAlignItems(YogaAlign alignItems) {
|
||||
mYogaNode.setAlignItems(alignItems);
|
||||
}
|
||||
|
||||
public void setJustifyContent(CSSJustify justifyContent) {
|
||||
mCSSNode.setJustifyContent(justifyContent);
|
||||
public void setJustifyContent(YogaJustify justifyContent) {
|
||||
mYogaNode.setJustifyContent(justifyContent);
|
||||
}
|
||||
|
||||
public void setOverflow(CSSOverflow overflow) {
|
||||
mCSSNode.setOverflow(overflow);
|
||||
public void setOverflow(YogaOverflow overflow) {
|
||||
mYogaNode.setOverflow(overflow);
|
||||
}
|
||||
|
||||
public void setMargin(int spacingType, float margin) {
|
||||
mCSSNode.setMargin(CSSEdge.fromInt(spacingType), margin);
|
||||
mYogaNode.setMargin(YogaEdge.fromInt(spacingType), margin);
|
||||
}
|
||||
|
||||
public final float getPadding(int spacingType) {
|
||||
return mCSSNode.getPadding(CSSEdge.fromInt(spacingType));
|
||||
return mYogaNode.getPadding(YogaEdge.fromInt(spacingType));
|
||||
}
|
||||
|
||||
public void setDefaultPadding(int spacingType, float padding) {
|
||||
@@ -614,66 +614,66 @@ public class ReactShadowNode {
|
||||
spacingType == Spacing.RIGHT ||
|
||||
spacingType == Spacing.START ||
|
||||
spacingType == Spacing.END) {
|
||||
if (CSSConstants.isUndefined(mPadding.getRaw(spacingType)) &&
|
||||
CSSConstants.isUndefined(mPadding.getRaw(Spacing.HORIZONTAL)) &&
|
||||
CSSConstants.isUndefined(mPadding.getRaw(Spacing.ALL))) {
|
||||
mCSSNode.setPadding(CSSEdge.fromInt(spacingType), mDefaultPadding.getRaw(spacingType));
|
||||
if (YogaConstants.isUndefined(mPadding.getRaw(spacingType)) &&
|
||||
YogaConstants.isUndefined(mPadding.getRaw(Spacing.HORIZONTAL)) &&
|
||||
YogaConstants.isUndefined(mPadding.getRaw(Spacing.ALL))) {
|
||||
mYogaNode.setPadding(YogaEdge.fromInt(spacingType), mDefaultPadding.getRaw(spacingType));
|
||||
} else {
|
||||
mCSSNode.setPadding(CSSEdge.fromInt(spacingType), mPadding.getRaw(spacingType));
|
||||
mYogaNode.setPadding(YogaEdge.fromInt(spacingType), mPadding.getRaw(spacingType));
|
||||
}
|
||||
} else if (spacingType == Spacing.TOP || spacingType == Spacing.BOTTOM) {
|
||||
if (CSSConstants.isUndefined(mPadding.getRaw(spacingType)) &&
|
||||
CSSConstants.isUndefined(mPadding.getRaw(Spacing.VERTICAL)) &&
|
||||
CSSConstants.isUndefined(mPadding.getRaw(Spacing.ALL))) {
|
||||
mCSSNode.setPadding(CSSEdge.fromInt(spacingType), mDefaultPadding.getRaw(spacingType));
|
||||
if (YogaConstants.isUndefined(mPadding.getRaw(spacingType)) &&
|
||||
YogaConstants.isUndefined(mPadding.getRaw(Spacing.VERTICAL)) &&
|
||||
YogaConstants.isUndefined(mPadding.getRaw(Spacing.ALL))) {
|
||||
mYogaNode.setPadding(YogaEdge.fromInt(spacingType), mDefaultPadding.getRaw(spacingType));
|
||||
} else {
|
||||
mCSSNode.setPadding(CSSEdge.fromInt(spacingType), mPadding.getRaw(spacingType));
|
||||
mYogaNode.setPadding(YogaEdge.fromInt(spacingType), mPadding.getRaw(spacingType));
|
||||
}
|
||||
} else {
|
||||
if (CSSConstants.isUndefined(mPadding.getRaw(spacingType))) {
|
||||
mCSSNode.setPadding(CSSEdge.fromInt(spacingType), mDefaultPadding.getRaw(spacingType));
|
||||
if (YogaConstants.isUndefined(mPadding.getRaw(spacingType))) {
|
||||
mYogaNode.setPadding(YogaEdge.fromInt(spacingType), mDefaultPadding.getRaw(spacingType));
|
||||
} else {
|
||||
mCSSNode.setPadding(CSSEdge.fromInt(spacingType), mPadding.getRaw(spacingType));
|
||||
mYogaNode.setPadding(YogaEdge.fromInt(spacingType), mPadding.getRaw(spacingType));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setBorder(int spacingType, float borderWidth) {
|
||||
mCSSNode.setBorder(CSSEdge.fromInt(spacingType), borderWidth);
|
||||
mYogaNode.setBorder(YogaEdge.fromInt(spacingType), borderWidth);
|
||||
}
|
||||
|
||||
public void setPosition(int spacingType, float position) {
|
||||
mCSSNode.setPosition(CSSEdge.fromInt(spacingType), position);
|
||||
mYogaNode.setPosition(YogaEdge.fromInt(spacingType), position);
|
||||
}
|
||||
|
||||
public void setPositionType(CSSPositionType positionType) {
|
||||
mCSSNode.setPositionType(positionType);
|
||||
public void setPositionType(YogaPositionType positionType) {
|
||||
mYogaNode.setPositionType(positionType);
|
||||
}
|
||||
|
||||
public void setShouldNotifyOnLayout(boolean shouldNotifyOnLayout) {
|
||||
mShouldNotifyOnLayout = shouldNotifyOnLayout;
|
||||
}
|
||||
|
||||
public void setMeasureFunction(CSSNodeAPI.MeasureFunction measureFunction) {
|
||||
if ((measureFunction == null ^ mCSSNode.isMeasureDefined()) &&
|
||||
public void setMeasureFunction(YogaMeasureFunction measureFunction) {
|
||||
if ((measureFunction == null ^ mYogaNode.isMeasureDefined()) &&
|
||||
getChildCount() != 0) {
|
||||
throw new RuntimeException(
|
||||
"Since a node with a measure function does not add any native CSSLayout children, it's " +
|
||||
"Since a node with a measure function does not add any native yoga children, it's " +
|
||||
"not safe to transition to/from having a measure function unless a node has no children");
|
||||
}
|
||||
mCSSNode.setMeasureFunction(measureFunction);
|
||||
mYogaNode.setMeasureFunction(measureFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return mCSSNode.toString();
|
||||
return mYogaNode.toString();
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
if (mCSSNode != null) {
|
||||
mCSSNode.reset();
|
||||
CSSNodePool.get().release(mCSSNode);
|
||||
if (mYogaNode != null) {
|
||||
mYogaNode.reset();
|
||||
YogaNodePool.get().release(mYogaNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
package com.facebook.react.uimanager;
|
||||
|
||||
import com.facebook.csslayout.CSSConstants;
|
||||
import com.facebook.yoga.YogaConstants;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@@ -96,7 +96,7 @@ public class Spacing {
|
||||
if (!FloatUtil.floatsEqual(mSpacing[spacingType], value)) {
|
||||
mSpacing[spacingType] = value;
|
||||
|
||||
if (CSSConstants.isUndefined(value)) {
|
||||
if (YogaConstants.isUndefined(value)) {
|
||||
mValueFlags &= ~sFlagsMap[spacingType];
|
||||
} else {
|
||||
mValueFlags |= sFlagsMap[spacingType];
|
||||
@@ -120,7 +120,7 @@ public class Spacing {
|
||||
*/
|
||||
public float get(int spacingType) {
|
||||
float defaultValue = (spacingType == START || spacingType == END
|
||||
? CSSConstants.UNDEFINED
|
||||
? YogaConstants.UNDEFINED
|
||||
: mDefaultValue);
|
||||
|
||||
if (mValueFlags == 0) {
|
||||
@@ -159,7 +159,7 @@ public class Spacing {
|
||||
* recycling {@link Spacing} instances.
|
||||
*/
|
||||
public void reset() {
|
||||
Arrays.fill(mSpacing, CSSConstants.UNDEFINED);
|
||||
Arrays.fill(mSpacing, YogaConstants.UNDEFINED);
|
||||
mHasAliasesSet = false;
|
||||
mValueFlags = 0;
|
||||
}
|
||||
@@ -178,15 +178,15 @@ public class Spacing {
|
||||
|
||||
private static float[] newFullSpacingArray() {
|
||||
return new float[] {
|
||||
CSSConstants.UNDEFINED,
|
||||
CSSConstants.UNDEFINED,
|
||||
CSSConstants.UNDEFINED,
|
||||
CSSConstants.UNDEFINED,
|
||||
CSSConstants.UNDEFINED,
|
||||
CSSConstants.UNDEFINED,
|
||||
CSSConstants.UNDEFINED,
|
||||
CSSConstants.UNDEFINED,
|
||||
CSSConstants.UNDEFINED,
|
||||
YogaConstants.UNDEFINED,
|
||||
YogaConstants.UNDEFINED,
|
||||
YogaConstants.UNDEFINED,
|
||||
YogaConstants.UNDEFINED,
|
||||
YogaConstants.UNDEFINED,
|
||||
YogaConstants.UNDEFINED,
|
||||
YogaConstants.UNDEFINED,
|
||||
YogaConstants.UNDEFINED,
|
||||
YogaConstants.UNDEFINED,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.facebook.common.logging.FLog;
|
||||
import com.facebook.csslayout.CSSDirection;
|
||||
import com.facebook.yoga.YogaDirection;
|
||||
import com.facebook.infer.annotation.Assertions;
|
||||
import com.facebook.react.animation.Animation;
|
||||
import com.facebook.react.bridge.Arguments;
|
||||
@@ -84,7 +84,7 @@ public class UIImplementation {
|
||||
ReactShadowNode rootCSSNode = new ReactShadowNode();
|
||||
I18nUtil sharedI18nUtilInstance = I18nUtil.getInstance();
|
||||
if (sharedI18nUtilInstance.isRTL(mReactContext)) {
|
||||
rootCSSNode.setLayoutDirection(CSSDirection.RTL);
|
||||
rootCSSNode.setLayoutDirection(YogaDirection.RTL);
|
||||
}
|
||||
rootCSSNode.setViewClassName("Root");
|
||||
return rootCSSNode;
|
||||
|
||||
@@ -144,7 +144,7 @@ public class UIManagerModule extends ReactContextBaseJavaModule implements
|
||||
mEventDispatcher.onCatalystInstanceDestroyed();
|
||||
|
||||
getReactApplicationContext().unregisterComponentCallbacks(mMemoryTrimCallback);
|
||||
CSSNodePool.get().clear();
|
||||
YogaNodePool.get().clear();
|
||||
}
|
||||
|
||||
private static Map<String, Object> createConstants(List<ViewManager> viewManagerList) {
|
||||
@@ -570,7 +570,7 @@ public class UIManagerModule extends ReactContextBaseJavaModule implements
|
||||
@Override
|
||||
public void onTrimMemory(int level) {
|
||||
if (level >= TRIM_MEMORY_MODERATE) {
|
||||
CSSNodePool.get().clear();
|
||||
YogaNodePool.get().clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user