Fix problems with example project run
This commit is contained in:
parent
fa879cacad
commit
79a8ab4aed
|
@ -13,7 +13,6 @@
|
|||
00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */; };
|
||||
00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */; };
|
||||
00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */; };
|
||||
00E356F31AD99517003FC87E /* BasicTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* BasicTests.m */; };
|
||||
133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 78C398B91ACF4ADC00677621 /* libRCTLinking.a */; };
|
||||
139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */; };
|
||||
139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */; };
|
||||
|
@ -23,6 +22,7 @@
|
|||
13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
|
||||
146834051AC3E58100842450 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; };
|
||||
832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; };
|
||||
A603A2D81BC32B9D0056F78B /* libRNBlur.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A603A2D71BC32B8D0056F78B /* libRNBlur.a */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
|
@ -61,13 +61,6 @@
|
|||
remoteGlobalIDString = 832C81801AAF6DEF007FA2F7;
|
||||
remoteInfo = RCTVibration;
|
||||
};
|
||||
00E356F41AD99517003FC87E /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 13B07F861A680F5B00A75B9A;
|
||||
remoteInfo = Basic;
|
||||
};
|
||||
139105C01AF99BAD00B5F7CC /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */;
|
||||
|
@ -103,9 +96,9 @@
|
|||
remoteGlobalIDString = 58B5119B1A9E6C1200147676;
|
||||
remoteInfo = RCTText;
|
||||
};
|
||||
A68BD7F21BC31851005F02DF /* PBXContainerItemProxy */ = {
|
||||
A603A2D61BC32B8D0056F78B /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = A68BD7EE1BC31851005F02DF /* RNBlur.xcodeproj */;
|
||||
containerPortal = A603A2C81BC32B8C0056F78B /* RNBlur.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = A68BD7BC1BC31318005F02DF;
|
||||
remoteInfo = RNBlur;
|
||||
|
@ -119,7 +112,6 @@
|
|||
00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTImage.xcodeproj; path = "../node_modules/react-native/Libraries/Image/RCTImage.xcodeproj"; sourceTree = "<group>"; };
|
||||
00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTNetwork.xcodeproj; path = "../node_modules/react-native/Libraries/Network/RCTNetwork.xcodeproj"; sourceTree = "<group>"; };
|
||||
00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTVibration.xcodeproj; path = "../node_modules/react-native/Libraries/Vibration/RCTVibration.xcodeproj"; sourceTree = "<group>"; };
|
||||
00E356EE1AD99517003FC87E /* BasicTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = BasicTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
00E356F21AD99517003FC87E /* BasicTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BasicTests.m; sourceTree = "<group>"; };
|
||||
139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTSettings.xcodeproj; path = "../node_modules/react-native/Libraries/Settings/RCTSettings.xcodeproj"; sourceTree = "<group>"; };
|
||||
|
@ -134,17 +126,10 @@
|
|||
146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = "../node_modules/react-native/React/React.xcodeproj"; sourceTree = "<group>"; };
|
||||
78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = "<group>"; };
|
||||
832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "../node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = "<group>"; };
|
||||
A68BD7EE1BC31851005F02DF /* RNBlur.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RNBlur.xcodeproj; path = ../../../ios/RNBlur.xcodeproj; sourceTree = "<group>"; };
|
||||
A603A2C81BC32B8C0056F78B /* RNBlur.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RNBlur.xcodeproj; path = ../../../ios/RNBlur.xcodeproj; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
00E356EB1AD99517003FC87E /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
13B07F8C1A680F5B00A75B9A /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
|
@ -159,6 +144,7 @@
|
|||
832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */,
|
||||
00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */,
|
||||
139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */,
|
||||
A603A2D81BC32B9D0056F78B /* libRNBlur.a in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -271,7 +257,7 @@
|
|||
832341AE1AAA6A7D00B99B32 /* Libraries */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
A68BD7EE1BC31851005F02DF /* RNBlur.xcodeproj */,
|
||||
A603A2C81BC32B8C0056F78B /* RNBlur.xcodeproj */,
|
||||
146833FF1AC3E56700842450 /* React.xcodeproj */,
|
||||
00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */,
|
||||
00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */,
|
||||
|
@ -310,15 +296,14 @@
|
|||
isa = PBXGroup;
|
||||
children = (
|
||||
13B07F961A680F5B00A75B9A /* Basic.app */,
|
||||
00E356EE1AD99517003FC87E /* BasicTests.xctest */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
A68BD7EF1BC31851005F02DF /* Products */ = {
|
||||
A603A2C91BC32B8C0056F78B /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
A68BD7F31BC31851005F02DF /* libRNBlur.a */,
|
||||
A603A2D71BC32B8D0056F78B /* libRNBlur.a */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
|
@ -326,24 +311,6 @@
|
|||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
00E356ED1AD99517003FC87E /* BasicTests */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "BasicTests" */;
|
||||
buildPhases = (
|
||||
00E356EA1AD99517003FC87E /* Sources */,
|
||||
00E356EB1AD99517003FC87E /* Frameworks */,
|
||||
00E356EC1AD99517003FC87E /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
00E356F51AD99517003FC87E /* PBXTargetDependency */,
|
||||
);
|
||||
name = BasicTests;
|
||||
productName = BasicTests;
|
||||
productReference = 00E356EE1AD99517003FC87E /* BasicTests.xctest */;
|
||||
productType = "com.apple.product-type.bundle.unit-test";
|
||||
};
|
||||
13B07F861A680F5B00A75B9A /* Basic */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "Basic" */;
|
||||
|
@ -369,12 +336,6 @@
|
|||
attributes = {
|
||||
LastUpgradeCheck = 0610;
|
||||
ORGANIZATIONNAME = Facebook;
|
||||
TargetAttributes = {
|
||||
00E356ED1AD99517003FC87E = {
|
||||
CreatedOnToolsVersion = 6.2;
|
||||
TestTargetID = 13B07F861A680F5B00A75B9A;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "Basic" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
|
@ -429,14 +390,13 @@
|
|||
ProjectRef = 146833FF1AC3E56700842450 /* React.xcodeproj */;
|
||||
},
|
||||
{
|
||||
ProductGroup = A68BD7EF1BC31851005F02DF /* Products */;
|
||||
ProjectRef = A68BD7EE1BC31851005F02DF /* RNBlur.xcodeproj */;
|
||||
ProductGroup = A603A2C91BC32B8C0056F78B /* Products */;
|
||||
ProjectRef = A603A2C81BC32B8C0056F78B /* RNBlur.xcodeproj */;
|
||||
},
|
||||
);
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
13B07F861A680F5B00A75B9A /* Basic */,
|
||||
00E356ED1AD99517003FC87E /* BasicTests */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
@ -512,23 +472,16 @@
|
|||
remoteRef = 832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
A68BD7F31BC31851005F02DF /* libRNBlur.a */ = {
|
||||
A603A2D71BC32B8D0056F78B /* libRNBlur.a */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = archive.ar;
|
||||
path = libRNBlur.a;
|
||||
remoteRef = A68BD7F21BC31851005F02DF /* PBXContainerItemProxy */;
|
||||
remoteRef = A603A2D61BC32B8D0056F78B /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
/* End PBXReferenceProxy section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
00E356EC1AD99517003FC87E /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
13B07F8E1A680F5B00A75B9A /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
|
@ -542,14 +495,6 @@
|
|||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
00E356EA1AD99517003FC87E /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
00E356F31AD99517003FC87E /* BasicTests.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
13B07F871A680F5B00A75B9A /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
|
@ -561,14 +506,6 @@
|
|||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
00E356F51AD99517003FC87E /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 13B07F861A680F5B00A75B9A /* Basic */;
|
||||
targetProxy = 00E356F41AD99517003FC87E /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin PBXVariantGroup section */
|
||||
13B07FB11A68108700A75B9A /* LaunchScreen.xib */ = {
|
||||
isa = PBXVariantGroup;
|
||||
|
@ -582,43 +519,6 @@
|
|||
/* End PBXVariantGroup section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
00E356F61AD99517003FC87E /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(SDKROOT)/Developer/Library/Frameworks",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
INFOPLIST_FILE = BasicTests/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Basic.app/Basic";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
00E356F71AD99517003FC87E /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(SDKROOT)/Developer/Library/Frameworks",
|
||||
"$(inherited)",
|
||||
);
|
||||
INFOPLIST_FILE = BasicTests/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Basic.app/Basic";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
13B07F941A680F5B00A75B9A /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
|
@ -740,15 +640,6 @@
|
|||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "BasicTests" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
00E356F61AD99517003FC87E /* Debug */,
|
||||
00E356F71AD99517003FC87E /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "Basic" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#import <UIKit/UIKit.h>
|
||||
#import <RCTView.h>
|
||||
|
||||
@interface BlurView : RCTView
|
||||
@interface BlurView : UIView
|
||||
|
||||
@property (nonatomic, copy) NSString *blurType;
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
RCT_EXPORT_MODULE();
|
||||
|
||||
- (RCTView *)view
|
||||
- (UIView *)view
|
||||
{
|
||||
return [[BlurView alloc] init];
|
||||
}
|
||||
|
|
|
@ -27,14 +27,14 @@
|
|||
|
||||
/* Begin PBXFileReference section */
|
||||
A68BD7BC1BC31318005F02DF /* libRNBlur.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRNBlur.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
A68BD7C81BC31332005F02DF /* VibrancyView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VibrancyView.h; sourceTree = "<group>"; };
|
||||
A68BD7C91BC31332005F02DF /* VibrancyView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VibrancyView.m; sourceTree = "<group>"; };
|
||||
A68BD7CA1BC31332005F02DF /* VibrancyViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VibrancyViewManager.h; sourceTree = "<group>"; };
|
||||
A68BD7CB1BC31332005F02DF /* VibrancyViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VibrancyViewManager.m; sourceTree = "<group>"; };
|
||||
A68BD7CE1BC31341005F02DF /* BlurView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BlurView.h; sourceTree = "<group>"; };
|
||||
A68BD7CF1BC31341005F02DF /* BlurView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BlurView.m; sourceTree = "<group>"; };
|
||||
A68BD7D01BC31341005F02DF /* BlurViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BlurViewManager.h; sourceTree = "<group>"; };
|
||||
A68BD7D11BC31341005F02DF /* BlurViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BlurViewManager.m; sourceTree = "<group>"; };
|
||||
A68BD7C81BC31332005F02DF /* VibrancyView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VibrancyView.h; sourceTree = SOURCE_ROOT; };
|
||||
A68BD7C91BC31332005F02DF /* VibrancyView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VibrancyView.m; sourceTree = SOURCE_ROOT; };
|
||||
A68BD7CA1BC31332005F02DF /* VibrancyViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VibrancyViewManager.h; sourceTree = SOURCE_ROOT; };
|
||||
A68BD7CB1BC31332005F02DF /* VibrancyViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VibrancyViewManager.m; sourceTree = SOURCE_ROOT; };
|
||||
A68BD7CE1BC31341005F02DF /* BlurView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BlurView.h; sourceTree = SOURCE_ROOT; };
|
||||
A68BD7CF1BC31341005F02DF /* BlurView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BlurView.m; sourceTree = SOURCE_ROOT; };
|
||||
A68BD7D01BC31341005F02DF /* BlurViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BlurViewManager.h; sourceTree = SOURCE_ROOT; };
|
||||
A68BD7D11BC31341005F02DF /* BlurViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BlurViewManager.m; sourceTree = SOURCE_ROOT; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
|
@ -172,6 +172,7 @@
|
|||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = "";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
|
@ -208,6 +209,7 @@
|
|||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = "";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
|
@ -218,6 +220,11 @@
|
|||
A68BD7C61BC31318005F02DF /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = YES;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(SRCROOT)/../node_modules/react-native/React/**",
|
||||
"$(SRCROOT)/../react-native/React/**",
|
||||
);
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
|
@ -227,6 +234,12 @@
|
|||
A68BD7C71BC31318005F02DF /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = YES;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(SRCROOT)/../node_modules/react-native/React/**",
|
||||
"$(SRCROOT)/../react-native/React/**",
|
||||
);
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
|
|
|
@ -0,0 +1,84 @@
|
|||
/**
|
||||
* 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 "RCTView.h"
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import "RCTPointerEvents.h"
|
||||
|
||||
@protocol RCTAutoInsetsProtocol;
|
||||
|
||||
@class RCTView;
|
||||
typedef void (^RCTViewEventHandler)(RCTView *view);
|
||||
|
||||
@interface RCTView : UIView
|
||||
|
||||
@property (nonatomic, copy) RCTViewEventHandler accessibilityTapHandler;
|
||||
@property (nonatomic, copy) RCTViewEventHandler magicTapHandler;
|
||||
|
||||
/**
|
||||
* Used to control how touch events are processed.
|
||||
*/
|
||||
@property (nonatomic, assign) RCTPointerEvents pointerEvents;
|
||||
|
||||
+ (void)autoAdjustInsetsForView:(UIView<RCTAutoInsetsProtocol> *)parentView
|
||||
withScrollView:(UIScrollView *)scrollView
|
||||
updateOffset:(BOOL)updateOffset;
|
||||
|
||||
/**
|
||||
* Find the first view controller whose view, or any subview is the specified view.
|
||||
*/
|
||||
+ (UIEdgeInsets)contentInsetsForView:(UIView *)curView;
|
||||
|
||||
/**
|
||||
* This is an optimization used to improve performance
|
||||
* for large scrolling views with many subviews, such as a
|
||||
* list or table. If set to YES, any clipped subviews will
|
||||
* be removed from the view hierarchy whenever -updateClippedSubviews
|
||||
* is called. This would typically be triggered by a scroll event
|
||||
*/
|
||||
@property (nonatomic, assign) BOOL removeClippedSubviews;
|
||||
|
||||
/**
|
||||
* Hide subviews if they are outside the view bounds.
|
||||
* This is an optimisation used predominantly with RKScrollViews
|
||||
* but it is applied recursively to all subviews that have
|
||||
* removeClippedSubviews set to YES
|
||||
*/
|
||||
- (void)updateClippedSubviews;
|
||||
|
||||
/**
|
||||
* Border radii.
|
||||
*/
|
||||
@property (nonatomic, assign) CGFloat borderRadius;
|
||||
@property (nonatomic, assign) CGFloat borderTopLeftRadius;
|
||||
@property (nonatomic, assign) CGFloat borderTopRightRadius;
|
||||
@property (nonatomic, assign) CGFloat borderBottomLeftRadius;
|
||||
@property (nonatomic, assign) CGFloat borderBottomRightRadius;
|
||||
|
||||
/**
|
||||
* Border colors (actually retained).
|
||||
*/
|
||||
@property (nonatomic, assign) CGColorRef borderTopColor;
|
||||
@property (nonatomic, assign) CGColorRef borderRightColor;
|
||||
@property (nonatomic, assign) CGColorRef borderBottomColor;
|
||||
@property (nonatomic, assign) CGColorRef borderLeftColor;
|
||||
@property (nonatomic, assign) CGColorRef borderColor;
|
||||
|
||||
/**
|
||||
* Border widths.
|
||||
*/
|
||||
@property (nonatomic, assign) CGFloat borderTopWidth;
|
||||
@property (nonatomic, assign) CGFloat borderRightWidth;
|
||||
@property (nonatomic, assign) CGFloat borderBottomWidth;
|
||||
@property (nonatomic, assign) CGFloat borderLeftWidth;
|
||||
@property (nonatomic, assign) CGFloat borderWidth;
|
||||
|
||||
@end
|
|
@ -0,0 +1,644 @@
|
|||
/**
|
||||
* 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 "RCTView.h"
|
||||
|
||||
#import "RCTAutoInsetsProtocol.h"
|
||||
#import "RCTBorderDrawing.h"
|
||||
#import "RCTConvert.h"
|
||||
#import "RCTLog.h"
|
||||
#import "RCTUtils.h"
|
||||
#import "UIView+React.h"
|
||||
|
||||
static UIView *RCTViewHitTest(UIView *view, CGPoint point, UIEvent *event)
|
||||
{
|
||||
for (UIView *subview in [view.subviews reverseObjectEnumerator]) {
|
||||
if (!subview.isHidden && subview.isUserInteractionEnabled && subview.alpha > 0) {
|
||||
CGPoint convertedPoint = [subview convertPoint:point fromView:view];
|
||||
UIView *subviewHitTestView = [subview hitTest:convertedPoint withEvent:event];
|
||||
if (subviewHitTestView != nil) {
|
||||
return subviewHitTestView;
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
@implementation UIView (RCTViewUnmounting)
|
||||
|
||||
- (void)react_remountAllSubviews
|
||||
{
|
||||
// Normal views don't support unmounting, so all
|
||||
// this does is forward message to our subviews,
|
||||
// in case any of those do support it
|
||||
|
||||
for (UIView *subview in self.subviews) {
|
||||
[subview react_remountAllSubviews];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)react_updateClippedSubviewsWithClipRect:(CGRect)clipRect relativeToView:(UIView *)clipView
|
||||
{
|
||||
// Even though we don't support subview unmounting
|
||||
// we do support clipsToBounds, so if that's enabled
|
||||
// we'll update the clipping
|
||||
|
||||
if (self.clipsToBounds && self.subviews.count > 0) {
|
||||
clipRect = [clipView convertRect:clipRect toView:self];
|
||||
clipRect = CGRectIntersection(clipRect, self.bounds);
|
||||
clipView = self;
|
||||
}
|
||||
|
||||
// Normal views don't support unmounting, so all
|
||||
// this does is forward message to our subviews,
|
||||
// in case any of those do support it
|
||||
|
||||
for (UIView *subview in self.subviews) {
|
||||
[subview react_updateClippedSubviewsWithClipRect:clipRect relativeToView:clipView];
|
||||
}
|
||||
}
|
||||
|
||||
- (UIView *)react_findClipView
|
||||
{
|
||||
UIView *testView = self;
|
||||
UIView *clipView = nil;
|
||||
CGRect clipRect = self.bounds;
|
||||
while (testView) {
|
||||
if (testView.clipsToBounds) {
|
||||
if (clipView) {
|
||||
CGRect testRect = [clipView convertRect:clipRect toView:testView];
|
||||
if (!CGRectContainsRect(testView.bounds, testRect)) {
|
||||
clipView = testView;
|
||||
clipRect = CGRectIntersection(testView.bounds, testRect);
|
||||
}
|
||||
} else {
|
||||
clipView = testView;
|
||||
clipRect = [self convertRect:self.bounds toView:clipView];
|
||||
}
|
||||
}
|
||||
testView = testView.superview;
|
||||
}
|
||||
return clipView ?: self.window;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
static NSString *RCTRecursiveAccessibilityLabel(UIView *view)
|
||||
{
|
||||
NSMutableString *str = [NSMutableString stringWithString:@""];
|
||||
for (UIView *subview in view.subviews) {
|
||||
NSString *label = subview.accessibilityLabel;
|
||||
if (label) {
|
||||
[str appendString:@" "];
|
||||
[str appendString:label];
|
||||
} else {
|
||||
[str appendString:RCTRecursiveAccessibilityLabel(subview)];
|
||||
}
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
@implementation RCTView
|
||||
{
|
||||
NSMutableArray *_reactSubviews;
|
||||
UIColor *_backgroundColor;
|
||||
}
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
if ((self = [super initWithFrame:frame])) {
|
||||
_borderWidth = -1;
|
||||
_borderTopWidth = -1;
|
||||
_borderRightWidth = -1;
|
||||
_borderBottomWidth = -1;
|
||||
_borderLeftWidth = -1;
|
||||
_borderTopLeftRadius = -1;
|
||||
_borderTopRightRadius = -1;
|
||||
_borderBottomLeftRadius = -1;
|
||||
_borderBottomRightRadius = -1;
|
||||
|
||||
_backgroundColor = super.backgroundColor;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:unused)
|
||||
|
||||
- (NSString *)accessibilityLabel
|
||||
{
|
||||
if (super.accessibilityLabel) {
|
||||
return super.accessibilityLabel;
|
||||
}
|
||||
return RCTRecursiveAccessibilityLabel(self);
|
||||
}
|
||||
|
||||
- (void)setPointerEvents:(RCTPointerEvents)pointerEvents
|
||||
{
|
||||
_pointerEvents = pointerEvents;
|
||||
self.userInteractionEnabled = (pointerEvents != RCTPointerEventsNone);
|
||||
if (pointerEvents == RCTPointerEventsBoxNone) {
|
||||
self.accessibilityViewIsModal = NO;
|
||||
}
|
||||
}
|
||||
|
||||
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
|
||||
{
|
||||
switch (_pointerEvents) {
|
||||
case RCTPointerEventsNone:
|
||||
return nil;
|
||||
case RCTPointerEventsUnspecified:
|
||||
return RCTViewHitTest(self, point, event) ?: [super hitTest:point withEvent:event];
|
||||
case RCTPointerEventsBoxOnly:
|
||||
return [super hitTest:point withEvent:event] ? self: nil;
|
||||
case RCTPointerEventsBoxNone:
|
||||
return RCTViewHitTest(self, point, event);
|
||||
default:
|
||||
RCTLogError(@"Invalid pointer-events specified %zd on %@", _pointerEvents, self);
|
||||
return [super hitTest:point withEvent:event];
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)accessibilityActivate
|
||||
{
|
||||
if (self.accessibilityTapHandler) {
|
||||
self.accessibilityTapHandler(self);
|
||||
return YES;
|
||||
} else {
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)accessibilityPerformMagicTap
|
||||
{
|
||||
if (self.magicTapHandler) {
|
||||
self.magicTapHandler(self);
|
||||
return YES;
|
||||
} else {
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
|
||||
- (NSString *)description
|
||||
{
|
||||
NSString *superDescription = super.description;
|
||||
NSRange semicolonRange = [superDescription rangeOfString:@";"];
|
||||
NSString *replacement = [NSString stringWithFormat:@"; reactTag: %@;", self.reactTag];
|
||||
return [superDescription stringByReplacingCharactersInRange:semicolonRange withString:replacement];
|
||||
}
|
||||
|
||||
#pragma mark - Statics for dealing with layoutGuides
|
||||
|
||||
+ (void)autoAdjustInsetsForView:(UIView<RCTAutoInsetsProtocol> *)parentView
|
||||
withScrollView:(UIScrollView *)scrollView
|
||||
updateOffset:(BOOL)updateOffset
|
||||
{
|
||||
UIEdgeInsets baseInset = parentView.contentInset;
|
||||
CGFloat previousInsetTop = scrollView.contentInset.top;
|
||||
CGPoint contentOffset = scrollView.contentOffset;
|
||||
|
||||
if (parentView.automaticallyAdjustContentInsets) {
|
||||
UIEdgeInsets autoInset = [self contentInsetsForView:parentView];
|
||||
baseInset.top += autoInset.top;
|
||||
baseInset.bottom += autoInset.bottom;
|
||||
baseInset.left += autoInset.left;
|
||||
baseInset.right += autoInset.right;
|
||||
}
|
||||
scrollView.contentInset = baseInset;
|
||||
scrollView.scrollIndicatorInsets = baseInset;
|
||||
|
||||
if (updateOffset) {
|
||||
// If we're adjusting the top inset, then let's also adjust the contentOffset so that the view
|
||||
// elements above the top guide do not cover the content.
|
||||
// This is generally only needed when your views are initially laid out, for
|
||||
// manual changes to contentOffset, you can optionally disable this step
|
||||
CGFloat currentInsetTop = scrollView.contentInset.top;
|
||||
if (currentInsetTop != previousInsetTop) {
|
||||
contentOffset.y -= (currentInsetTop - previousInsetTop);
|
||||
scrollView.contentOffset = contentOffset;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+ (UIEdgeInsets)contentInsetsForView:(UIView *)view
|
||||
{
|
||||
while (view) {
|
||||
UIViewController *controller = view.reactViewController;
|
||||
if (controller) {
|
||||
return (UIEdgeInsets){
|
||||
controller.topLayoutGuide.length, 0,
|
||||
controller.bottomLayoutGuide.length, 0
|
||||
};
|
||||
}
|
||||
view = view.superview;
|
||||
}
|
||||
return UIEdgeInsetsZero;
|
||||
}
|
||||
|
||||
#pragma mark - View unmounting
|
||||
|
||||
- (void)react_remountAllSubviews
|
||||
{
|
||||
if (_reactSubviews) {
|
||||
NSUInteger index = 0;
|
||||
for (UIView *view in _reactSubviews) {
|
||||
if (view.superview != self) {
|
||||
if (index < self.subviews.count) {
|
||||
[self insertSubview:view atIndex:index];
|
||||
} else {
|
||||
[self addSubview:view];
|
||||
}
|
||||
[view react_remountAllSubviews];
|
||||
}
|
||||
index++;
|
||||
}
|
||||
} else {
|
||||
// If react_subviews is nil, we must already be showing all subviews
|
||||
[super react_remountAllSubviews];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)remountSubview:(UIView *)view
|
||||
{
|
||||
// Calculate insertion index for view
|
||||
NSInteger index = 0;
|
||||
for (UIView *subview in _reactSubviews) {
|
||||
if (subview == view) {
|
||||
[self insertSubview:view atIndex:index];
|
||||
break;
|
||||
}
|
||||
if (subview.superview) {
|
||||
// View is mounted, so bump the index
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)mountOrUnmountSubview:(UIView *)view withClipRect:(CGRect)clipRect relativeToView:(UIView *)clipView
|
||||
{
|
||||
if (view.clipsToBounds) {
|
||||
|
||||
// View has cliping enabled, so we can easily test if it is partially
|
||||
// or completely within the clipRect, and mount or unmount it accordingly
|
||||
|
||||
if (!CGRectIsEmpty(CGRectIntersection(clipRect, view.frame))) {
|
||||
|
||||
// View is at least partially visible, so remount it if unmounted
|
||||
if (view.superview == nil) {
|
||||
[self remountSubview:view];
|
||||
}
|
||||
|
||||
// Then test its subviews
|
||||
if (CGRectContainsRect(clipRect, view.frame)) {
|
||||
[view react_remountAllSubviews];
|
||||
} else {
|
||||
[view react_updateClippedSubviewsWithClipRect:clipRect relativeToView:clipView];
|
||||
}
|
||||
|
||||
} else if (view.superview) {
|
||||
|
||||
// View is completely outside the clipRect, so unmount it
|
||||
[view removeFromSuperview];
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
// View has clipping disabled, so there's no way to tell if it has
|
||||
// any visible subviews without an expensive recursive test, so we'll
|
||||
// just add it.
|
||||
|
||||
if (view.superview == nil) {
|
||||
[self remountSubview:view];
|
||||
}
|
||||
|
||||
// Check if subviews need to be mounted/unmounted
|
||||
[view react_updateClippedSubviewsWithClipRect:clipRect relativeToView:clipView];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)react_updateClippedSubviewsWithClipRect:(CGRect)clipRect relativeToView:(UIView *)clipView
|
||||
{
|
||||
// TODO (#5906496): for scrollviews (the primary use-case) we could
|
||||
// optimize this by only doing a range check along the scroll axis,
|
||||
// instead of comparing the whole frame
|
||||
|
||||
if (_reactSubviews == nil) {
|
||||
// Use default behavior if unmounting is disabled
|
||||
return [super react_updateClippedSubviewsWithClipRect:clipRect relativeToView:clipView];
|
||||
}
|
||||
|
||||
if (_reactSubviews.count == 0) {
|
||||
// Do nothing if we have no subviews
|
||||
return;
|
||||
}
|
||||
|
||||
if (CGSizeEqualToSize(self.bounds.size, CGSizeZero)) {
|
||||
// Do nothing if layout hasn't happened yet
|
||||
return;
|
||||
}
|
||||
|
||||
// Convert clipping rect to local coordinates
|
||||
clipRect = [clipView convertRect:clipRect toView:self];
|
||||
clipView = self;
|
||||
if (self.clipsToBounds) {
|
||||
clipRect = CGRectIntersection(clipRect, self.bounds);
|
||||
}
|
||||
|
||||
// Mount / unmount views
|
||||
for (UIView *view in _reactSubviews) {
|
||||
[self mountOrUnmountSubview:view withClipRect:clipRect relativeToView:clipView];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setRemoveClippedSubviews:(BOOL)removeClippedSubviews
|
||||
{
|
||||
if (removeClippedSubviews && !_reactSubviews) {
|
||||
_reactSubviews = [self.subviews mutableCopy];
|
||||
} else if (!removeClippedSubviews && _reactSubviews) {
|
||||
[self react_remountAllSubviews];
|
||||
_reactSubviews = nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)removeClippedSubviews
|
||||
{
|
||||
return _reactSubviews != nil;
|
||||
}
|
||||
|
||||
- (void)insertReactSubview:(UIView *)view atIndex:(NSInteger)atIndex
|
||||
{
|
||||
if (_reactSubviews == nil) {
|
||||
[self insertSubview:view atIndex:atIndex];
|
||||
} else {
|
||||
[_reactSubviews insertObject:view atIndex:atIndex];
|
||||
|
||||
// Find a suitable view to use for clipping
|
||||
UIView *clipView = [self react_findClipView];
|
||||
if (clipView) {
|
||||
|
||||
// If possible, don't add subviews if they are clipped
|
||||
[self mountOrUnmountSubview:view withClipRect:clipView.bounds relativeToView:clipView];
|
||||
|
||||
} else {
|
||||
|
||||
// Fallback if we can't find a suitable clipView
|
||||
[self remountSubview:view];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)removeReactSubview:(UIView *)subview
|
||||
{
|
||||
[_reactSubviews removeObject:subview];
|
||||
[subview removeFromSuperview];
|
||||
}
|
||||
|
||||
- (NSArray *)reactSubviews
|
||||
{
|
||||
// The _reactSubviews array is only used when we have hidden
|
||||
// offscreen views. If _reactSubviews is nil, we can assume
|
||||
// that [self reactSubviews] and [self subviews] are the same
|
||||
|
||||
return _reactSubviews ?: self.subviews;
|
||||
}
|
||||
|
||||
- (void)updateClippedSubviews
|
||||
{
|
||||
// Find a suitable view to use for clipping
|
||||
UIView *clipView = [self react_findClipView];
|
||||
if (clipView) {
|
||||
[self react_updateClippedSubviewsWithClipRect:clipView.bounds relativeToView:clipView];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)layoutSubviews
|
||||
{
|
||||
// TODO (#5906496): this a nasty performance drain, but necessary
|
||||
// to prevent gaps appearing when the loading spinner disappears.
|
||||
// We might be able to fix this another way by triggering a call
|
||||
// to updateClippedSubviews manually after loading
|
||||
|
||||
[super layoutSubviews];
|
||||
|
||||
if (_reactSubviews) {
|
||||
[self updateClippedSubviews];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Borders
|
||||
|
||||
- (UIColor *)backgroundColor
|
||||
{
|
||||
return _backgroundColor;
|
||||
}
|
||||
|
||||
- (void)setBackgroundColor:(UIColor *)backgroundColor
|
||||
{
|
||||
if ([_backgroundColor isEqual:backgroundColor]) {
|
||||
return;
|
||||
}
|
||||
|
||||
_backgroundColor = backgroundColor;
|
||||
[self.layer setNeedsDisplay];
|
||||
}
|
||||
|
||||
- (UIEdgeInsets)bordersAsInsets
|
||||
{
|
||||
const CGFloat borderWidth = MAX(0, _borderWidth);
|
||||
|
||||
return (UIEdgeInsets) {
|
||||
_borderTopWidth >= 0 ? _borderTopWidth : borderWidth,
|
||||
_borderLeftWidth >= 0 ? _borderLeftWidth : borderWidth,
|
||||
_borderBottomWidth >= 0 ? _borderBottomWidth : borderWidth,
|
||||
_borderRightWidth >= 0 ? _borderRightWidth : borderWidth,
|
||||
};
|
||||
}
|
||||
|
||||
- (RCTCornerRadii)cornerRadii
|
||||
{
|
||||
const CGRect bounds = self.bounds;
|
||||
const CGFloat maxRadius = MIN(bounds.size.height, bounds.size.width);
|
||||
const CGFloat radius = MAX(0, _borderRadius);
|
||||
|
||||
return (RCTCornerRadii){
|
||||
MIN(_borderTopLeftRadius >= 0 ? _borderTopLeftRadius : radius, maxRadius),
|
||||
MIN(_borderTopRightRadius >= 0 ? _borderTopRightRadius : radius, maxRadius),
|
||||
MIN(_borderBottomLeftRadius >= 0 ? _borderBottomLeftRadius : radius, maxRadius),
|
||||
MIN(_borderBottomRightRadius >= 0 ? _borderBottomRightRadius : radius, maxRadius),
|
||||
};
|
||||
}
|
||||
|
||||
- (RCTBorderColors)borderColors
|
||||
{
|
||||
return (RCTBorderColors){
|
||||
_borderTopColor ?: _borderColor,
|
||||
_borderLeftColor ?: _borderColor,
|
||||
_borderBottomColor ?: _borderColor,
|
||||
_borderRightColor ?: _borderColor,
|
||||
};
|
||||
}
|
||||
|
||||
- (void)displayLayer:(CALayer *)layer
|
||||
{
|
||||
const RCTCornerRadii cornerRadii = [self cornerRadii];
|
||||
const UIEdgeInsets borderInsets = [self bordersAsInsets];
|
||||
const RCTBorderColors borderColors = [self borderColors];
|
||||
|
||||
BOOL useIOSBorderRendering =
|
||||
!RCTRunningInTestEnvironment() &&
|
||||
RCTCornerRadiiAreEqual(cornerRadii) &&
|
||||
RCTBorderInsetsAreEqual(borderInsets) &&
|
||||
RCTBorderColorsAreEqual(borderColors) &&
|
||||
|
||||
// iOS draws borders in front of the content whereas CSS draws them behind
|
||||
// the content. For this reason, only use iOS border drawing when clipping
|
||||
// or when the border is hidden.
|
||||
|
||||
(borderInsets.top == 0 || CGColorGetAlpha(borderColors.top) == 0 || self.clipsToBounds);
|
||||
|
||||
// iOS clips to the outside of the border, but CSS clips to the inside. To
|
||||
// solve this, we'll need to add a container view inside the main view to
|
||||
// correctly clip the subviews.
|
||||
|
||||
if (useIOSBorderRendering) {
|
||||
layer.cornerRadius = cornerRadii.topLeft;
|
||||
layer.borderColor = borderColors.left;
|
||||
layer.borderWidth = borderInsets.left;
|
||||
layer.backgroundColor = _backgroundColor.CGColor;
|
||||
layer.contents = nil;
|
||||
layer.needsDisplayOnBoundsChange = NO;
|
||||
layer.mask = nil;
|
||||
return;
|
||||
}
|
||||
|
||||
UIImage *image = RCTGetBorderImage([self cornerRadii],
|
||||
[self bordersAsInsets],
|
||||
[self borderColors],
|
||||
_backgroundColor.CGColor,
|
||||
self.clipsToBounds);
|
||||
|
||||
CGRect contentsCenter = ({
|
||||
CGSize size = image.size;
|
||||
UIEdgeInsets insets = image.capInsets;
|
||||
CGRectMake(
|
||||
insets.left / size.width,
|
||||
insets.top / size.height,
|
||||
1.0 / size.width,
|
||||
1.0 / size.height
|
||||
);
|
||||
});
|
||||
|
||||
if (RCTRunningInTestEnvironment()) {
|
||||
const CGSize size = self.bounds.size;
|
||||
UIGraphicsBeginImageContextWithOptions(size, NO, image.scale);
|
||||
[image drawInRect:(CGRect){CGPointZero, size}];
|
||||
image = UIGraphicsGetImageFromCurrentImageContext();
|
||||
UIGraphicsEndImageContext();
|
||||
contentsCenter = CGRectMake(0, 0, 1, 1);
|
||||
}
|
||||
|
||||
layer.backgroundColor = NULL;
|
||||
layer.contents = (id)image.CGImage;
|
||||
layer.contentsCenter = contentsCenter;
|
||||
layer.contentsScale = image.scale;
|
||||
layer.magnificationFilter = kCAFilterNearest;
|
||||
layer.needsDisplayOnBoundsChange = YES;
|
||||
|
||||
[self updateClippingForLayer:layer];
|
||||
}
|
||||
|
||||
- (void)updateClippingForLayer:(CALayer *)layer
|
||||
{
|
||||
CALayer *mask = nil;
|
||||
CGFloat cornerRadius = 0;
|
||||
|
||||
if (self.clipsToBounds) {
|
||||
|
||||
const RCTCornerRadii cornerRadii = [self cornerRadii];
|
||||
if (RCTCornerRadiiAreEqual(cornerRadii)) {
|
||||
|
||||
cornerRadius = cornerRadii.topLeft;
|
||||
|
||||
} else {
|
||||
|
||||
CAShapeLayer *shapeLayer = [CAShapeLayer layer];
|
||||
CGPathRef path = RCTPathCreateWithRoundedRect(self.bounds, RCTGetCornerInsets(cornerRadii, UIEdgeInsetsZero), NULL);
|
||||
shapeLayer.path = path;
|
||||
CGPathRelease(path);
|
||||
mask = shapeLayer;
|
||||
}
|
||||
}
|
||||
|
||||
layer.cornerRadius = cornerRadius;
|
||||
layer.mask = mask;
|
||||
}
|
||||
|
||||
#pragma mark Border Color
|
||||
|
||||
#define setBorderColor(side) \
|
||||
- (void)setBorder##side##Color:(CGColorRef)color \
|
||||
{ \
|
||||
if (CGColorEqualToColor(_border##side##Color, color)) { \
|
||||
return; \
|
||||
} \
|
||||
CGColorRelease(_border##side##Color); \
|
||||
_border##side##Color = CGColorRetain(color); \
|
||||
[self.layer setNeedsDisplay]; \
|
||||
}
|
||||
|
||||
setBorderColor()
|
||||
setBorderColor(Top)
|
||||
setBorderColor(Right)
|
||||
setBorderColor(Bottom)
|
||||
setBorderColor(Left)
|
||||
|
||||
#pragma mark - Border Width
|
||||
|
||||
#define setBorderWidth(side) \
|
||||
- (void)setBorder##side##Width:(CGFloat)width \
|
||||
{ \
|
||||
if (_border##side##Width == width) { \
|
||||
return; \
|
||||
} \
|
||||
_border##side##Width = width; \
|
||||
[self.layer setNeedsDisplay]; \
|
||||
}
|
||||
|
||||
setBorderWidth()
|
||||
setBorderWidth(Top)
|
||||
setBorderWidth(Right)
|
||||
setBorderWidth(Bottom)
|
||||
setBorderWidth(Left)
|
||||
|
||||
#define setBorderRadius(side) \
|
||||
- (void)setBorder##side##Radius:(CGFloat)radius \
|
||||
{ \
|
||||
if (_border##side##Radius == radius) { \
|
||||
return; \
|
||||
} \
|
||||
_border##side##Radius = radius; \
|
||||
[self.layer setNeedsDisplay]; \
|
||||
}
|
||||
|
||||
setBorderRadius()
|
||||
setBorderRadius(TopLeft)
|
||||
setBorderRadius(TopRight)
|
||||
setBorderRadius(BottomLeft)
|
||||
setBorderRadius(BottomRight)
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
CGColorRelease(_borderColor);
|
||||
CGColorRelease(_borderTopColor);
|
||||
CGColorRelease(_borderRightColor);
|
||||
CGColorRelease(_borderBottomColor);
|
||||
CGColorRelease(_borderLeftColor);
|
||||
}
|
||||
|
||||
@end
|
|
@ -0,0 +1,123 @@
|
|||
/**
|
||||
* 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 <UIKit/UIKit.h>
|
||||
|
||||
#import "RCTBridgeModule.h"
|
||||
#import "RCTConvert.h"
|
||||
#import "RCTLog.h"
|
||||
|
||||
@class RCTBridge;
|
||||
@class RCTEventDispatcher;
|
||||
@class RCTShadowView;
|
||||
@class RCTSparseArray;
|
||||
@class RCTUIManager;
|
||||
|
||||
typedef void (^RCTViewManagerUIBlock)(RCTUIManager *uiManager, RCTSparseArray *viewRegistry);
|
||||
|
||||
@interface RCTViewManager : NSObject <RCTBridgeModule>
|
||||
|
||||
/**
|
||||
* The bridge can be used to access both the RCTUIIManager and the RCTEventDispatcher,
|
||||
* allowing the manager (or the views that it manages) to manipulate the view
|
||||
* hierarchy and send events back to the JS context.
|
||||
*/
|
||||
@property (nonatomic, weak) RCTBridge *bridge;
|
||||
|
||||
/**
|
||||
* This method instantiates a native view to be managed by the module. Override
|
||||
* this to return a custom view instance, which may be preconfigured with default
|
||||
* properties, subviews, etc. This method will be called many times, and should
|
||||
* return a fresh instance each time. The view module MUST NOT cache the returned
|
||||
* view and return the same instance for subsequent calls.
|
||||
*/
|
||||
- (UIView *)view;
|
||||
|
||||
/**
|
||||
* This method instantiates a native view using the props passed into the component.
|
||||
* This method should be used when you need to know about specific props in order to
|
||||
* initialize a view. By default, this just calls the -view method. Each prop will
|
||||
* still be set individually, after the view is created. Like the -view method,
|
||||
* -viewWithProps: should return a fresh instance each time it is called.
|
||||
*/
|
||||
- (UIView *)viewWithProps:(NSDictionary *)props;
|
||||
|
||||
/**
|
||||
* This method instantiates a shadow view to be managed by the module. If omitted,
|
||||
* an ordinary RCTShadowView instance will be created, which is typically fine for
|
||||
* most view types. As with the -view method, the -shadowView method should return
|
||||
* a fresh instance each time it is called.
|
||||
*/
|
||||
- (RCTShadowView *)shadowView;
|
||||
|
||||
/**
|
||||
* Returns an array of names of events that can be sent by native views. This
|
||||
* should return bubbling, directly-dispatched event types. The event name
|
||||
* should not include a prefix such as 'on' or 'top', as this will be applied
|
||||
* as needed. When subscribing to the event, use the 'Captured' suffix to
|
||||
* indicate the captured form, or omit the suffix for the bubbling form.
|
||||
*
|
||||
* Note that this method is not inherited when you subclass a view module, and
|
||||
* you should not call [super customBubblingEventTypes] when overriding it.
|
||||
*/
|
||||
- (NSArray *)customBubblingEventTypes;
|
||||
|
||||
/**
|
||||
* Returns an array of names of events that can be sent by native views. This
|
||||
* should return non-bubbling, directly-dispatched event types. The event name
|
||||
* should not include a prefix such as 'on' or 'top', as this will be applied
|
||||
* as needed.
|
||||
*
|
||||
* Note that this method is not inherited when you subclass a view module, and
|
||||
* you should not call [super customDirectEventTypes] when overriding it.
|
||||
*/
|
||||
- (NSArray *)customDirectEventTypes;
|
||||
|
||||
/**
|
||||
* Called to notify manager that layout has finished, in case any calculated
|
||||
* properties need to be copied over from shadow view to view.
|
||||
*/
|
||||
- (RCTViewManagerUIBlock)uiBlockToAmendWithShadowView:(RCTShadowView *)shadowView;
|
||||
|
||||
/**
|
||||
* Called after view hierarchy manipulation has finished, and all shadow props
|
||||
* have been set, but before layout has been performed. Useful for performing
|
||||
* custo layout logic or tasks that involve walking the view hierarchy.
|
||||
* To be deprecated, hopefully.
|
||||
*/
|
||||
- (RCTViewManagerUIBlock)uiBlockToAmendWithShadowViewRegistry:(RCTSparseArray *)shadowViewRegistry;
|
||||
|
||||
/**
|
||||
* This handles the simple case, where JS and native property names match.
|
||||
*/
|
||||
#define RCT_EXPORT_VIEW_PROPERTY(name, type) \
|
||||
+ (NSArray *)propConfig_##name { return @[@#type]; }
|
||||
|
||||
/**
|
||||
* This macro maps a named property to an arbitrary key path in the view.
|
||||
*/
|
||||
#define RCT_REMAP_VIEW_PROPERTY(name, keyPath, type) \
|
||||
+ (NSArray *)propConfig_##name { return @[@#type, @#keyPath]; }
|
||||
|
||||
/**
|
||||
* This macro can be used when you need to provide custom logic for setting
|
||||
* view properties. The macro should be followed by a method body, which can
|
||||
* refer to "json", "view" and "defaultView" to implement the required logic.
|
||||
*/
|
||||
#define RCT_CUSTOM_VIEW_PROPERTY(name, type, viewClass) \
|
||||
RCT_REMAP_VIEW_PROPERTY(name, __custom__, type) \
|
||||
- (void)set_##name:(id)json forView:(viewClass *)view withDefaultView:(viewClass *)defaultView
|
||||
|
||||
/**
|
||||
* This macro is used to map properties to the shadow view, instead of the view.
|
||||
*/
|
||||
#define RCT_EXPORT_SHADOW_PROPERTY(name, type) \
|
||||
+ (NSArray *)propConfigShadow_##name { return @[@#type]; }
|
||||
|
||||
@end
|
|
@ -0,0 +1,296 @@
|
|||
/**
|
||||
* 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 "RCTViewManager.h"
|
||||
|
||||
#import "RCTBridge.h"
|
||||
#import "RCTConvert.h"
|
||||
#import "RCTEventDispatcher.h"
|
||||
#import "RCTLog.h"
|
||||
#import "RCTShadowView.h"
|
||||
#import "RCTUIManager.h"
|
||||
#import "RCTUtils.h"
|
||||
#import "RCTView.h"
|
||||
#import "UIView+React.h"
|
||||
|
||||
@implementation RCTConvert(UIAccessibilityTraits)
|
||||
|
||||
RCT_MULTI_ENUM_CONVERTER(UIAccessibilityTraits, (@{
|
||||
@"none": @(UIAccessibilityTraitNone),
|
||||
@"button": @(UIAccessibilityTraitButton),
|
||||
@"link": @(UIAccessibilityTraitLink),
|
||||
@"header": @(UIAccessibilityTraitHeader),
|
||||
@"search": @(UIAccessibilityTraitSearchField),
|
||||
@"image": @(UIAccessibilityTraitImage),
|
||||
@"selected": @(UIAccessibilityTraitSelected),
|
||||
@"plays": @(UIAccessibilityTraitPlaysSound),
|
||||
@"key": @(UIAccessibilityTraitKeyboardKey),
|
||||
@"text": @(UIAccessibilityTraitStaticText),
|
||||
@"summary": @(UIAccessibilityTraitSummaryElement),
|
||||
@"disabled": @(UIAccessibilityTraitNotEnabled),
|
||||
@"frequentUpdates": @(UIAccessibilityTraitUpdatesFrequently),
|
||||
@"startsMedia": @(UIAccessibilityTraitStartsMediaSession),
|
||||
@"adjustable": @(UIAccessibilityTraitAdjustable),
|
||||
@"allowsDirectInteraction": @(UIAccessibilityTraitAllowsDirectInteraction),
|
||||
@"pageTurn": @(UIAccessibilityTraitCausesPageTurn),
|
||||
}), UIAccessibilityTraitNone, unsignedLongLongValue)
|
||||
|
||||
@end
|
||||
|
||||
@implementation RCTViewManager
|
||||
|
||||
@synthesize bridge = _bridge;
|
||||
|
||||
RCT_EXPORT_MODULE()
|
||||
|
||||
- (dispatch_queue_t)methodQueue
|
||||
{
|
||||
return _bridge.uiManager.methodQueue;
|
||||
}
|
||||
|
||||
- (UIView *)viewWithProps:(NSDictionary *)props
|
||||
{
|
||||
return [self view];
|
||||
}
|
||||
|
||||
- (UIView *)view
|
||||
{
|
||||
return [RCTView new];
|
||||
}
|
||||
|
||||
- (RCTShadowView *)shadowView
|
||||
{
|
||||
return [RCTShadowView new];
|
||||
}
|
||||
|
||||
- (NSArray *)customBubblingEventTypes
|
||||
{
|
||||
return @[
|
||||
|
||||
// Generic events
|
||||
@"press",
|
||||
@"change",
|
||||
@"change",
|
||||
@"focus",
|
||||
@"blur",
|
||||
@"submitEditing",
|
||||
@"endEditing",
|
||||
|
||||
// Touch events
|
||||
@"touchStart",
|
||||
@"touchMove",
|
||||
@"touchCancel",
|
||||
@"touchEnd",
|
||||
];
|
||||
}
|
||||
|
||||
- (NSArray *)customDirectEventTypes
|
||||
{
|
||||
return @[
|
||||
@"layout",
|
||||
@"accessibilityTap",
|
||||
@"magicTap",
|
||||
];
|
||||
}
|
||||
|
||||
- (NSDictionary *)constantsToExport
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (RCTViewManagerUIBlock)uiBlockToAmendWithShadowView:(__unused RCTShadowView *)shadowView
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (RCTViewManagerUIBlock)uiBlockToAmendWithShadowViewRegistry:(__unused RCTSparseArray *)shadowViewRegistry
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
#pragma mark - View properties
|
||||
|
||||
RCT_EXPORT_VIEW_PROPERTY(accessibilityLabel, NSString)
|
||||
RCT_EXPORT_VIEW_PROPERTY(accessibilityTraits, UIAccessibilityTraits)
|
||||
RCT_EXPORT_VIEW_PROPERTY(backgroundColor, UIColor)
|
||||
RCT_REMAP_VIEW_PROPERTY(accessible, isAccessibilityElement, BOOL)
|
||||
RCT_REMAP_VIEW_PROPERTY(testID, accessibilityIdentifier, NSString)
|
||||
RCT_REMAP_VIEW_PROPERTY(backfaceVisibility, layer.doubleSided, css_backface_visibility_t)
|
||||
RCT_REMAP_VIEW_PROPERTY(opacity, alpha, CGFloat)
|
||||
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_REMAP_VIEW_PROPERTY(overflow, clipsToBounds, css_clip_t)
|
||||
RCT_CUSTOM_VIEW_PROPERTY(shouldRasterizeIOS, BOOL, RCTView)
|
||||
{
|
||||
view.layer.shouldRasterize = json ? [RCTConvert BOOL:json] : defaultView.layer.shouldRasterize;
|
||||
view.layer.rasterizationScale = view.layer.shouldRasterize ? [UIScreen mainScreen].scale : defaultView.layer.rasterizationScale;
|
||||
}
|
||||
RCT_CUSTOM_VIEW_PROPERTY(transformMatrix, CATransform3D, RCTView)
|
||||
{
|
||||
view.layer.transform = json ? [RCTConvert CATransform3D:json] : defaultView.layer.transform;
|
||||
// TODO: Improve this by enabling edge antialiasing only for transforms with rotation or skewing
|
||||
view.layer.allowsEdgeAntialiasing = !CATransform3DIsIdentity(view.layer.transform);
|
||||
}
|
||||
RCT_CUSTOM_VIEW_PROPERTY(pointerEvents, RCTPointerEvents, RCTView)
|
||||
{
|
||||
if ([view respondsToSelector:@selector(setPointerEvents:)]) {
|
||||
view.pointerEvents = json ? [RCTConvert RCTPointerEvents:json] : defaultView.pointerEvents;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!json) {
|
||||
view.userInteractionEnabled = defaultView.userInteractionEnabled;
|
||||
return;
|
||||
}
|
||||
|
||||
switch ([RCTConvert RCTPointerEvents:json]) {
|
||||
case RCTPointerEventsUnspecified:
|
||||
// Pointer events "unspecified" acts as if a stylesheet had not specified,
|
||||
// which is different than "auto" in CSS (which cannot and will not be
|
||||
// supported in `React`. "auto" may override a parent's "none".
|
||||
// Unspecified values do not.
|
||||
// This wouldn't override a container view's `userInteractionEnabled = NO`
|
||||
view.userInteractionEnabled = YES;
|
||||
case RCTPointerEventsNone:
|
||||
view.userInteractionEnabled = NO;
|
||||
break;
|
||||
default:
|
||||
RCTLogError(@"UIView base class does not support pointerEvent value: %@", json);
|
||||
}
|
||||
}
|
||||
RCT_CUSTOM_VIEW_PROPERTY(removeClippedSubviews, BOOL, RCTView)
|
||||
{
|
||||
if ([view respondsToSelector:@selector(setRemoveClippedSubviews:)]) {
|
||||
view.removeClippedSubviews = json ? [RCTConvert BOOL:json] : defaultView.removeClippedSubviews;
|
||||
}
|
||||
}
|
||||
RCT_CUSTOM_VIEW_PROPERTY(borderRadius, CGFloat, RCTView) {
|
||||
if ([view respondsToSelector:@selector(setBorderRadius:)]) {
|
||||
view.borderRadius = json ? [RCTConvert CGFloat:json] : defaultView.borderRadius;
|
||||
} else {
|
||||
view.layer.cornerRadius = json ? [RCTConvert CGFloat:json] : defaultView.layer.cornerRadius;
|
||||
}
|
||||
}
|
||||
RCT_CUSTOM_VIEW_PROPERTY(borderColor, CGColor, RCTView)
|
||||
{
|
||||
if ([view respondsToSelector:@selector(setBorderColor:)]) {
|
||||
view.borderColor = json ? [RCTConvert CGColor:json] : defaultView.borderColor;
|
||||
} else {
|
||||
view.layer.borderColor = json ? [RCTConvert CGColor:json] : defaultView.layer.borderColor;
|
||||
}
|
||||
}
|
||||
RCT_CUSTOM_VIEW_PROPERTY(borderWidth, CGFloat, RCTView)
|
||||
{
|
||||
if ([view respondsToSelector:@selector(setBorderWidth:)]) {
|
||||
view.borderWidth = json ? [RCTConvert CGFloat:json] : defaultView.borderWidth;
|
||||
} else {
|
||||
view.layer.borderWidth = json ? [RCTConvert CGFloat:json] : defaultView.layer.borderWidth;
|
||||
}
|
||||
}
|
||||
RCT_CUSTOM_VIEW_PROPERTY(onAccessibilityTap, BOOL, __unused RCTView)
|
||||
{
|
||||
view.accessibilityTapHandler = [self eventHandlerWithName:@"accessibilityTap" json:json];
|
||||
}
|
||||
RCT_CUSTOM_VIEW_PROPERTY(onMagicTap, BOOL, __unused RCTView)
|
||||
{
|
||||
view.magicTapHandler = [self eventHandlerWithName:@"magicTap" json:json];
|
||||
}
|
||||
|
||||
- (RCTViewEventHandler)eventHandlerWithName:(NSString *)eventName json:(id)json
|
||||
{
|
||||
RCTViewEventHandler handler = nil;
|
||||
if ([RCTConvert BOOL:json]) {
|
||||
__weak RCTViewManager *weakSelf = self;
|
||||
handler = ^(RCTView *tappedView) {
|
||||
NSDictionary *body = @{ @"target": tappedView.reactTag };
|
||||
[weakSelf.bridge.eventDispatcher sendInputEventWithName:eventName body:body];
|
||||
};
|
||||
}
|
||||
return handler;
|
||||
}
|
||||
|
||||
#define RCT_VIEW_BORDER_PROPERTY(SIDE) \
|
||||
RCT_CUSTOM_VIEW_PROPERTY(border##SIDE##Width, CGFloat, RCTView) \
|
||||
{ \
|
||||
if ([view respondsToSelector:@selector(setBorder##SIDE##Width:)]) { \
|
||||
view.border##SIDE##Width = json ? [RCTConvert CGFloat:json] : defaultView.border##SIDE##Width; \
|
||||
} \
|
||||
} \
|
||||
RCT_CUSTOM_VIEW_PROPERTY(border##SIDE##Color, UIColor, RCTView) \
|
||||
{ \
|
||||
if ([view respondsToSelector:@selector(setBorder##SIDE##Color:)]) { \
|
||||
view.border##SIDE##Color = json ? [RCTConvert CGColor:json] : defaultView.border##SIDE##Color; \
|
||||
} \
|
||||
}
|
||||
|
||||
RCT_VIEW_BORDER_PROPERTY(Top)
|
||||
RCT_VIEW_BORDER_PROPERTY(Right)
|
||||
RCT_VIEW_BORDER_PROPERTY(Bottom)
|
||||
RCT_VIEW_BORDER_PROPERTY(Left)
|
||||
|
||||
#define RCT_VIEW_BORDER_RADIUS_PROPERTY(SIDE) \
|
||||
RCT_CUSTOM_VIEW_PROPERTY(border##SIDE##Radius, CGFloat, RCTView) \
|
||||
{ \
|
||||
if ([view respondsToSelector:@selector(setBorder##SIDE##Radius:)]) { \
|
||||
view.border##SIDE##Radius = json ? [RCTConvert CGFloat:json] : defaultView.border##SIDE##Radius; \
|
||||
} \
|
||||
} \
|
||||
|
||||
RCT_VIEW_BORDER_RADIUS_PROPERTY(TopLeft)
|
||||
RCT_VIEW_BORDER_RADIUS_PROPERTY(TopRight)
|
||||
RCT_VIEW_BORDER_RADIUS_PROPERTY(BottomLeft)
|
||||
RCT_VIEW_BORDER_RADIUS_PROPERTY(BottomRight)
|
||||
|
||||
#pragma mark - ShadowView properties
|
||||
|
||||
RCT_EXPORT_SHADOW_PROPERTY(backgroundColor, UIColor)
|
||||
|
||||
RCT_EXPORT_SHADOW_PROPERTY(top, CGFloat)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(right, CGFloat)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(bottom, CGFloat)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(left, CGFloat);
|
||||
|
||||
RCT_EXPORT_SHADOW_PROPERTY(width, CGFloat)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(height, CGFloat)
|
||||
|
||||
RCT_EXPORT_SHADOW_PROPERTY(borderTopWidth, CGFloat)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(borderRightWidth, CGFloat)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(borderBottomWidth, CGFloat)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(borderLeftWidth, CGFloat)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(borderWidth, CGFloat)
|
||||
|
||||
RCT_EXPORT_SHADOW_PROPERTY(marginTop, CGFloat)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(marginRight, CGFloat)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(marginBottom, CGFloat)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(marginLeft, CGFloat)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(marginVertical, CGFloat)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(marginHorizontal, CGFloat)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(margin, CGFloat)
|
||||
|
||||
RCT_EXPORT_SHADOW_PROPERTY(paddingTop, CGFloat)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(paddingRight, CGFloat)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(paddingBottom, CGFloat)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(paddingLeft, CGFloat)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(paddingVertical, CGFloat)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(paddingHorizontal, CGFloat)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(padding, CGFloat)
|
||||
|
||||
RCT_EXPORT_SHADOW_PROPERTY(flex, CGFloat)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(flexDirection, css_flex_direction_t)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(flexWrap, css_wrap_type_t)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(justifyContent, css_justify_t)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(alignItems, css_align_t)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(alignSelf, css_align_t)
|
||||
RCT_EXPORT_SHADOW_PROPERTY(position, css_position_type_t)
|
||||
|
||||
RCT_EXPORT_SHADOW_PROPERTY(onLayout, BOOL)
|
||||
|
||||
@end
|
Loading…
Reference in New Issue