Fixed all the issues with iOS, and allow individual blurAmounts (instead of one shared value.)
Also changed VibrancyView to be a subclass of BlurView.
This commit is contained in:
parent
4e5ecf0109
commit
10858e396b
|
@ -168,8 +168,6 @@ const Menu = React.createClass({
|
|||
- `blurAmount` (Default: 10, Number) - blur amount effect
|
||||
- `0-100` - Adjusts blur intensity
|
||||
|
||||
*Note: `blurAmount` does not refresh with Hot Reloading. You must a refresh the app to view the results of the changes*
|
||||
|
||||
### Android
|
||||
|
||||
Android support uses an [external library](https://github.com/500px/500px-android-blur) which has slightly different properties and setup requirements. This is why extra code must be added manually to the `android/app/build.gradle` file as documented above.
|
||||
|
|
|
@ -16,9 +16,9 @@ import {
|
|||
import { BlurView, VibrancyView } from 'react-native-blur'
|
||||
|
||||
class Basic extends Component {
|
||||
constructor(props) {
|
||||
super(props)
|
||||
|
||||
constructor() {
|
||||
super()
|
||||
this.state = {
|
||||
showBlurs: true,
|
||||
blurBlurType: 'light',
|
||||
|
@ -60,14 +60,15 @@ class Basic extends Component {
|
|||
blurAmount={10}
|
||||
style={[styles.blurView]} />
|
||||
|
||||
<Text style={styles.welcome}>{`Blur component`}</Text>
|
||||
<Text style={styles.welcome}>Blur component</Text>
|
||||
|
||||
<SegmentedControlIOS
|
||||
values={['xlight', 'light', 'dark']}
|
||||
selectedIndex={this.state.blurActiveSegment}
|
||||
onChange={(event) => {this._onBlurChange(event)}}
|
||||
onValueChange={(value) => {this._onBlurValueChange(value)}}
|
||||
tintColor={this.state.blurBlurType == 'xlight' ? 'black' : 'white'}/>
|
||||
tintColor={this.state.blurBlurType === 'xlight' ? 'black' : 'white'}
|
||||
/>
|
||||
</View>
|
||||
|
||||
{/*
|
||||
|
@ -76,15 +77,16 @@ class Basic extends Component {
|
|||
*/}
|
||||
<VibrancyView
|
||||
blurType={this.state.vibrancyBlurType}
|
||||
blurAmount={1}
|
||||
blurAmount={10}
|
||||
style={[styles.container, styles.blurContainer]}>
|
||||
<Text style={styles.welcome}>{`Vibrancy component`}</Text>
|
||||
<Text style={styles.welcome}>Vibrancy component</Text>
|
||||
<SegmentedControlIOS
|
||||
values={['xlight', 'light', 'dark']}
|
||||
selectedIndex={this.state.vibrancyActiveSegment}
|
||||
onChange={(event) => {this._onVibrancyChange(event)}}
|
||||
onValueChange={(value) => {this._onVibrancyValueChange(value)}}
|
||||
tintColor={this.state.vibrancyBlurType == 'xlight' ? 'black' : 'white'}/>
|
||||
tintColor="white"
|
||||
/>
|
||||
</VibrancyView>
|
||||
</View>
|
||||
)
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
};
|
||||
objectVersion = 46;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; };
|
||||
00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; };
|
||||
|
@ -102,6 +103,13 @@
|
|||
remoteGlobalIDString = 83CBBA2E1A601D0E00E9B192;
|
||||
remoteInfo = React;
|
||||
};
|
||||
209F89F11EA224BB004ABC64 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 482A4E939D364AA89A71D498 /* RNBlur.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = A68BD7BC1BC31318005F02DF;
|
||||
remoteInfo = RNBlur;
|
||||
};
|
||||
2D02E4911E0B4A5D006451C7 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */;
|
||||
|
@ -252,11 +260,11 @@
|
|||
146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = "../node_modules/react-native/React/React.xcodeproj"; sourceTree = "<group>"; };
|
||||
2D02E47B1E0B4A5D006451C7 /* Basic-tvOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Basic-tvOS.app"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
2D02E4901E0B4A5D006451C7 /* Basic-tvOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Basic-tvOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
482A4E939D364AA89A71D498 /* RNBlur.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNBlur.xcodeproj; path = ../../../ios/RNBlur.xcodeproj; sourceTree = "<group>"; };
|
||||
5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAnimation.xcodeproj; path = "../node_modules/react-native/Libraries/NativeAnimation/RCTAnimation.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>"; };
|
||||
482A4E939D364AA89A71D498 /* RNBlur.xcodeproj */ = {isa = PBXFileReference; name = "RNBlur.xcodeproj"; path = "../node_modules/react-native-blur/ios/RNBlur.xcodeproj"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; };
|
||||
A8E69D2A0C5C4828B32057AD /* libRNBlur.a */ = {isa = PBXFileReference; name = "libRNBlur.a"; path = "libRNBlur.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; };
|
||||
A8E69D2A0C5C4828B32057AD /* libRNBlur.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNBlur.a; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
|
@ -418,6 +426,14 @@
|
|||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
209F89D51EA224BB004ABC64 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
209F89F21EA224BB004ABC64 /* libRNBlur.a */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
5E91572E1DD0AC6500FF2AA8 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
@ -568,7 +584,7 @@
|
|||
83CBB9F71A601CBA00E9B192 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 610;
|
||||
LastUpgradeCheck = 0830;
|
||||
ORGANIZATIONNAME = Facebook;
|
||||
TargetAttributes = {
|
||||
00E356ED1AD99517003FC87E = {
|
||||
|
@ -642,6 +658,10 @@
|
|||
ProductGroup = 146834001AC3E56700842450 /* Products */;
|
||||
ProjectRef = 146833FF1AC3E56700842450 /* React.xcodeproj */;
|
||||
},
|
||||
{
|
||||
ProductGroup = 209F89D51EA224BB004ABC64 /* Products */;
|
||||
ProjectRef = 482A4E939D364AA89A71D498 /* RNBlur.xcodeproj */;
|
||||
},
|
||||
);
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
|
@ -710,6 +730,13 @@
|
|||
remoteRef = 146834031AC3E56700842450 /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
209F89F21EA224BB004ABC64 /* libRNBlur.a */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = archive.ar;
|
||||
path = libRNBlur.a;
|
||||
remoteRef = 209F89F11EA224BB004ABC64 /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
3DAD3E841DF850E9000B6D8A /* libRCTImage-tvOS.a */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = archive.ar;
|
||||
|
@ -967,23 +994,24 @@
|
|||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
INFOPLIST_FILE = BasicTests/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
OTHER_LDFLAGS = (
|
||||
"-ObjC",
|
||||
"-lc++",
|
||||
);
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Basic.app/Basic";
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"\"$(SRCROOT)/$(TARGET_NAME)\"",
|
||||
);
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(SRCROOT)/../node_modules/react-native-blur/ios",
|
||||
);
|
||||
INFOPLIST_FILE = BasicTests/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"\"$(SRCROOT)/$(TARGET_NAME)\"",
|
||||
);
|
||||
OTHER_LDFLAGS = (
|
||||
"-ObjC",
|
||||
"-lc++",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Basic.app/Basic";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
|
@ -992,23 +1020,24 @@
|
|||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
INFOPLIST_FILE = BasicTests/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
OTHER_LDFLAGS = (
|
||||
"-ObjC",
|
||||
"-lc++",
|
||||
);
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Basic.app/Basic";
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"\"$(SRCROOT)/$(TARGET_NAME)\"",
|
||||
);
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(SRCROOT)/../node_modules/react-native-blur/ios",
|
||||
);
|
||||
INFOPLIST_FILE = BasicTests/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"\"$(SRCROOT)/$(TARGET_NAME)\"",
|
||||
);
|
||||
OTHER_LDFLAGS = (
|
||||
"-ObjC",
|
||||
"-lc++",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Basic.app/Basic";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
@ -1018,6 +1047,10 @@
|
|||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEAD_CODE_STRIPPING = NO;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(SRCROOT)/../node_modules/react-native-blur/ios",
|
||||
);
|
||||
INFOPLIST_FILE = Basic/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
OTHER_LDFLAGS = (
|
||||
|
@ -1025,12 +1058,9 @@
|
|||
"-ObjC",
|
||||
"-lc++",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_NAME = Basic;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(SRCROOT)/../node_modules/react-native-blur/ios",
|
||||
);
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
|
@ -1039,6 +1069,10 @@
|
|||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(SRCROOT)/../node_modules/react-native-blur/ios",
|
||||
);
|
||||
INFOPLIST_FILE = Basic/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
OTHER_LDFLAGS = (
|
||||
|
@ -1046,12 +1080,9 @@
|
|||
"-ObjC",
|
||||
"-lc++",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_NAME = Basic;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(SRCROOT)/../node_modules/react-native-blur/ios",
|
||||
);
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
@ -1067,8 +1098,16 @@
|
|||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(SRCROOT)/../node_modules/react-native-blur/ios",
|
||||
);
|
||||
INFOPLIST_FILE = "Basic-tvOS/Info.plist";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"\"$(SRCROOT)/$(TARGET_NAME)\"",
|
||||
);
|
||||
OTHER_LDFLAGS = (
|
||||
"-ObjC",
|
||||
"-lc++",
|
||||
|
@ -1078,14 +1117,6 @@
|
|||
SDKROOT = appletvos;
|
||||
TARGETED_DEVICE_FAMILY = 3;
|
||||
TVOS_DEPLOYMENT_TARGET = 9.2;
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"\"$(SRCROOT)/$(TARGET_NAME)\"",
|
||||
);
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(SRCROOT)/../node_modules/react-native-blur/ios",
|
||||
);
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
|
@ -1101,8 +1132,16 @@
|
|||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(SRCROOT)/../node_modules/react-native-blur/ios",
|
||||
);
|
||||
INFOPLIST_FILE = "Basic-tvOS/Info.plist";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"\"$(SRCROOT)/$(TARGET_NAME)\"",
|
||||
);
|
||||
OTHER_LDFLAGS = (
|
||||
"-ObjC",
|
||||
"-lc++",
|
||||
|
@ -1112,14 +1151,6 @@
|
|||
SDKROOT = appletvos;
|
||||
TARGETED_DEVICE_FAMILY = 3;
|
||||
TVOS_DEPLOYMENT_TARGET = 9.2;
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"\"$(SRCROOT)/$(TARGET_NAME)\"",
|
||||
);
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(SRCROOT)/../node_modules/react-native-blur/ios",
|
||||
);
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
@ -1136,15 +1167,15 @@
|
|||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
INFOPLIST_FILE = "Basic-tvOSTests/Info.plist";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"\"$(SRCROOT)/$(TARGET_NAME)\"",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.REACT.Basic-tvOSTests";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = appletvos;
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Basic-tvOS.app/Basic-tvOS";
|
||||
TVOS_DEPLOYMENT_TARGET = 10.1;
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"\"$(SRCROOT)/$(TARGET_NAME)\"",
|
||||
);
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
|
@ -1161,15 +1192,15 @@
|
|||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
INFOPLIST_FILE = "Basic-tvOSTests/Info.plist";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"\"$(SRCROOT)/$(TARGET_NAME)\"",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.REACT.Basic-tvOSTests";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = appletvos;
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Basic-tvOS.app/Basic-tvOS";
|
||||
TVOS_DEPLOYMENT_TARGET = 10.1;
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"\"$(SRCROOT)/$(TARGET_NAME)\"",
|
||||
);
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
@ -1186,15 +1217,19 @@
|
|||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
|
@ -1227,8 +1262,10 @@
|
|||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
|
@ -1236,6 +1273,7 @@
|
|||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0820"
|
||||
LastUpgradeVersion = "0830"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "NO"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0620"
|
||||
LastUpgradeVersion = "0830"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "NO"
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)</string>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
|
@ -24,6 +24,19 @@
|
|||
<string>1</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>NSAppTransportSecurity</key>
|
||||
<dict>
|
||||
<key>NSExceptionDomains</key>
|
||||
<dict>
|
||||
<key>localhost</key>
|
||||
<dict>
|
||||
<key>NSExceptionAllowsInsecureHTTPLoads</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>NSLocationWhenInUseUsageDescription</key>
|
||||
<string></string>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>LaunchScreen</string>
|
||||
<key>UIRequiredDeviceCapabilities</key>
|
||||
|
@ -38,19 +51,5 @@
|
|||
</array>
|
||||
<key>UIViewControllerBasedStatusBarAppearance</key>
|
||||
<false/>
|
||||
<key>NSLocationWhenInUseUsageDescription</key>
|
||||
<string></string>
|
||||
<key>NSAppTransportSecurity</key>
|
||||
<!--See http://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/ -->
|
||||
<dict>
|
||||
<key>NSExceptionDomains</key>
|
||||
<dict>
|
||||
<key>localhost</key>
|
||||
<dict>
|
||||
<key>NSExceptionAllowsInsecureHTTPLoads</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)</string>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface BlurAmount : UIBlurEffect
|
||||
|
||||
@property (nonatomic, copy) NSNumber *blurAmount;
|
||||
|
||||
+ (id)updateBlurAmount:(NSNumber*)blurAmount;
|
||||
|
||||
@end
|
|
@ -1,54 +0,0 @@
|
|||
#import "BlurAmount.h"
|
||||
#import <objc/runtime.h>
|
||||
|
||||
@interface UIBlurEffect (Protected)
|
||||
|
||||
@property (nonatomic, readonly) id effectSettings;
|
||||
@property (nonatomic, copy, class) NSNumber *localBlurAmount;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation BlurAmount
|
||||
|
||||
static NSNumber *_localBlurAmount = nil;
|
||||
|
||||
+ (instancetype)effectWithStyle:(UIBlurEffectStyle)style
|
||||
{
|
||||
id result = [super effectWithStyle:style];
|
||||
object_setClass(result, self);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
- (id)effectSettings
|
||||
{
|
||||
id settings = [super effectSettings];
|
||||
[settings setValue:BlurAmount.localBlurAmount forKey:@"blurRadius"];
|
||||
return settings;
|
||||
}
|
||||
|
||||
- (id)copyWithZone:(NSZone*)zone
|
||||
{
|
||||
id result = [super copyWithZone:zone];
|
||||
object_setClass(result, [self class]);
|
||||
return result;
|
||||
}
|
||||
|
||||
+ (void)setLocalBlurAmount:(NSNumber *)localBlurAmount {
|
||||
if (localBlurAmount != _localBlurAmount) {
|
||||
_localBlurAmount = localBlurAmount;
|
||||
}
|
||||
}
|
||||
|
||||
+ (NSNumber *)localBlurAmount {
|
||||
return _localBlurAmount;
|
||||
}
|
||||
|
||||
+ (id)updateBlurAmount:(NSNumber*)blurAmount
|
||||
{
|
||||
self.localBlurAmount = blurAmount;
|
||||
return blurAmount;
|
||||
}
|
||||
|
||||
@end
|
|
@ -0,0 +1,7 @@
|
|||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface BlurEffectWithAmount : UIBlurEffect
|
||||
@property (nonatomic, strong) NSNumber *blurAmount;
|
||||
|
||||
+ (instancetype)effectWithStyle:(UIBlurEffectStyle)style andBlurAmount:(NSNumber*)blurAmount;
|
||||
@end
|
|
@ -0,0 +1,65 @@
|
|||
//
|
||||
// We subclass UIBlurEffect so that we can set the BlurAmount.
|
||||
// See: http://stackoverflow.com/a/30744777/304706
|
||||
//
|
||||
|
||||
#import "BlurEffectWithAmount.h"
|
||||
#import <objc/runtime.h>
|
||||
|
||||
@interface UIBlurEffect (Protected)
|
||||
|
||||
@property (nonatomic, readonly) id effectSettings;
|
||||
|
||||
@end
|
||||
|
||||
@implementation BlurEffectWithAmount
|
||||
@dynamic blurAmount;
|
||||
|
||||
+ (instancetype)effectWithStyle:(UIBlurEffectStyle)style
|
||||
{
|
||||
id instance = [super effectWithStyle:style];
|
||||
object_setClass(instance, self);
|
||||
return instance;
|
||||
}
|
||||
|
||||
+ (instancetype)effectWithStyle:(UIBlurEffectStyle)style andBlurAmount:(NSNumber*)blurAmount
|
||||
{
|
||||
BlurEffectWithAmount *effect = (BlurEffectWithAmount*)[self effectWithStyle:style];
|
||||
effect.blurAmount = blurAmount;
|
||||
return effect;
|
||||
}
|
||||
|
||||
- (void)setBlurAmount:(NSNumber*)blurAmount {
|
||||
objc_setAssociatedObject(self,
|
||||
@selector(blurAmount),
|
||||
blurAmount,
|
||||
OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
||||
}
|
||||
|
||||
- (NSNumber*)blurAmount {
|
||||
return objc_getAssociatedObject(self, @selector(blurAmount));
|
||||
}
|
||||
|
||||
- (id)effectSettings
|
||||
{
|
||||
id settings = [super effectSettings];
|
||||
NSNumber *blurAmount = self.blurAmount;
|
||||
if (blurAmount) {
|
||||
[settings setValue:blurAmount forKey:@"blurRadius"];
|
||||
}
|
||||
return settings;
|
||||
}
|
||||
|
||||
- (id)copyWithZone:(NSZone*)zone
|
||||
{
|
||||
id instance = [super copyWithZone:zone];
|
||||
object_setClass(instance, [self class]);
|
||||
// Must also copy blur amount to new instance
|
||||
objc_setAssociatedObject(instance,
|
||||
@selector(blurAmount),
|
||||
self.blurAmount,
|
||||
OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
||||
return instance;
|
||||
}
|
||||
|
||||
@end
|
|
@ -1,8 +1,13 @@
|
|||
#import <UIKit/UIKit.h>
|
||||
#import "BlurEffectWithAmount.h"
|
||||
|
||||
@interface BlurView : UIView
|
||||
|
||||
@property (nonatomic, copy) NSString *blurType;
|
||||
@property (nonatomic, copy) NSNumber *blurAmount;
|
||||
|
||||
@property (nonatomic, strong) BlurEffectWithAmount *blurEffect;
|
||||
@property (nonatomic, strong) UIVisualEffectView *blurEffectView;
|
||||
|
||||
- (void)updateBlurEffect;
|
||||
@end
|
||||
|
|
|
@ -1,48 +1,66 @@
|
|||
#import <UIKit/UIKit.h>
|
||||
#import "BlurView.h"
|
||||
#import "BlurAmount.h"
|
||||
#import "BlurEffectWithAmount.h"
|
||||
|
||||
@interface BlurView ()
|
||||
|
||||
@property (nonatomic, strong) UIVisualEffectView *visualEffectView;
|
||||
@property (nonatomic, strong) UIBlurEffect *blurEffect;
|
||||
|
||||
@end
|
||||
|
||||
@implementation BlurView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame {
|
||||
if (self = [super initWithFrame:frame]) {
|
||||
self.blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
|
||||
self.visualEffectView = [[UIVisualEffectView alloc] initWithEffect:self.blurEffect];
|
||||
self.visualEffectView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
||||
self.visualEffectView.frame = frame;
|
||||
self.blurEffectView = [[UIVisualEffectView alloc] init];
|
||||
self.blurEffectView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
||||
self.blurEffectView.frame = frame;
|
||||
|
||||
self.blurAmount = @10;
|
||||
self.blurType = @"dark";
|
||||
[self updateBlurEffect];
|
||||
|
||||
self.clipsToBounds = true;
|
||||
|
||||
[self addSubview:self.visualEffectView];
|
||||
[self addSubview:self.blurEffectView];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)layoutSubviews
|
||||
{
|
||||
[super layoutSubviews];
|
||||
self.blurEffectView.frame = self.bounds;
|
||||
}
|
||||
|
||||
- (void)setBlurType:(NSString *)blurType
|
||||
{
|
||||
if ([blurType isEqual: @"xlight"]) {
|
||||
self.blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleExtraLight];
|
||||
} else if ([blurType isEqual: @"light"]) {
|
||||
self.blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
|
||||
} else if ([blurType isEqual: @"dark"]) {
|
||||
self.blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
|
||||
} else {
|
||||
self.blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
|
||||
if (blurType && ![self.blurType isEqual:blurType]) {
|
||||
_blurType = blurType;
|
||||
[self updateBlurEffect];
|
||||
}
|
||||
self.visualEffectView.effect = self.blurEffect;
|
||||
}
|
||||
|
||||
- (void)setBlurAmount:(NSNumber *)blurAmount
|
||||
{
|
||||
[BlurAmount updateBlurAmount:blurAmount];
|
||||
if (blurAmount && ![self.blurAmount isEqualToNumber:blurAmount]) {
|
||||
_blurAmount = blurAmount;
|
||||
[self updateBlurEffect];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
- (UIBlurEffectStyle)blurEffectStyle
|
||||
{
|
||||
if ([self.blurType isEqual: @"xlight"]) return UIBlurEffectStyleExtraLight;
|
||||
if ([self.blurType isEqual: @"light"]) return UIBlurEffectStyleLight;
|
||||
if ([self.blurType isEqual: @"dark"]) return UIBlurEffectStyleDark;
|
||||
return UIBlurEffectStyleDark;
|
||||
}
|
||||
|
||||
- (void)updateBlurEffect
|
||||
{
|
||||
UIBlurEffectStyle style = [self blurEffectStyle];
|
||||
self.blurEffect = [BlurEffectWithAmount effectWithStyle:style andBlurAmount:self.blurAmount];
|
||||
self.blurEffectView.effect = self.blurEffect;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
256D23D71E1EBA540023CA16 /* BlurEffectWithAmount.m in Sources */ = {isa = PBXBuildFile; fileRef = 256D23D61E1EBA540023CA16 /* BlurEffectWithAmount.m */; };
|
||||
A68BD7CC1BC31332005F02DF /* VibrancyView.m in Sources */ = {isa = PBXBuildFile; fileRef = A68BD7C91BC31332005F02DF /* VibrancyView.m */; };
|
||||
A68BD7CD1BC31332005F02DF /* VibrancyViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = A68BD7CB1BC31332005F02DF /* VibrancyViewManager.m */; };
|
||||
256D23D71E1EBA540023CA16 /* BlurAmount.m in Sources */ = {isa = PBXBuildFile; fileRef = 256D23D61E1EBA540023CA16 /* BlurAmount.m */; };
|
||||
A68BD7D21BC31341005F02DF /* BlurView.m in Sources */ = {isa = PBXBuildFile; fileRef = A68BD7CF1BC31341005F02DF /* BlurView.m */; };
|
||||
A68BD7D31BC31341005F02DF /* BlurViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = A68BD7D11BC31341005F02DF /* BlurViewManager.m */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
@ -27,13 +27,13 @@
|
|||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
256D23D51E1EBA540023CA16 /* BlurEffectWithAmount.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BlurEffectWithAmount.h; sourceTree = "<group>"; };
|
||||
256D23D61E1EBA540023CA16 /* BlurEffectWithAmount.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BlurEffectWithAmount.m; sourceTree = "<group>"; };
|
||||
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 = 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; };
|
||||
256D23D51E1EBA540023CA16 /* BlurAmount.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BlurAmount.h; sourceTree = "<group>"; };
|
||||
256D23D61E1EBA540023CA16 /* BlurAmount.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BlurAmount.m; sourceTree = "<group>"; };
|
||||
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; };
|
||||
|
@ -54,8 +54,8 @@
|
|||
A68BD7B31BC31318005F02DF = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
256D23D51E1EBA540023CA16 /* BlurAmount.h */,
|
||||
256D23D61E1EBA540023CA16 /* BlurAmount.m */,
|
||||
256D23D51E1EBA540023CA16 /* BlurEffectWithAmount.h */,
|
||||
256D23D61E1EBA540023CA16 /* BlurEffectWithAmount.m */,
|
||||
A68BD7CE1BC31341005F02DF /* BlurView.h */,
|
||||
A68BD7CF1BC31341005F02DF /* BlurView.m */,
|
||||
A68BD7D01BC31341005F02DF /* BlurViewManager.h */,
|
||||
|
@ -134,7 +134,7 @@
|
|||
files = (
|
||||
A68BD7CC1BC31332005F02DF /* VibrancyView.m in Sources */,
|
||||
A68BD7CD1BC31332005F02DF /* VibrancyViewManager.m in Sources */,
|
||||
256D23D71E1EBA540023CA16 /* BlurAmount.m in Sources */,
|
||||
256D23D71E1EBA540023CA16 /* BlurEffectWithAmount.m in Sources */,
|
||||
A68BD7D21BC31341005F02DF /* BlurView.m in Sources */,
|
||||
A68BD7D31BC31341005F02DF /* BlurViewManager.m in Sources */,
|
||||
);
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface VibrancyView : UIView
|
||||
|
||||
@property (nonatomic, copy) NSString *blurType;
|
||||
#import "BlurView.h"
|
||||
|
||||
@interface VibrancyView : BlurView
|
||||
@end
|
|
@ -1,12 +1,11 @@
|
|||
#import <UIKit/UIKit.h>
|
||||
#import "VibrancyView.h"
|
||||
#import "BlurView.h"
|
||||
#import <React/RCTComponent.h>
|
||||
#import "BlurView.h"
|
||||
#import "VibrancyView.h"
|
||||
|
||||
@interface VibrancyView ()
|
||||
|
||||
@property (nonatomic, strong) UIVisualEffectView *visualEffectView;
|
||||
@property (nonatomic, strong) UIVisualEffectView *vibrancyView;
|
||||
@property (nonatomic, strong) UIVibrancyEffect *vibrancyEffect;
|
||||
@property (nonatomic, strong) UIVisualEffectView *vibrancyEffectView;
|
||||
|
||||
@end
|
||||
|
||||
|
@ -14,17 +13,11 @@
|
|||
|
||||
- (instancetype)initWithFrame:(CGRect)frame {
|
||||
if (self = [super initWithFrame:frame]) {
|
||||
UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
|
||||
self.visualEffectView = [[UIVisualEffectView alloc] initWithEffect:blurEffect];
|
||||
self.vibrancyEffectView = [[UIVisualEffectView alloc] init];
|
||||
self.vibrancyEffectView.frame = frame;
|
||||
[self updateVibrancyEffect];
|
||||
|
||||
UIVibrancyEffect *vibrancyEffect = [UIVibrancyEffect effectForBlurEffect:blurEffect];
|
||||
self.vibrancyView = [[UIVisualEffectView alloc] initWithEffect:vibrancyEffect];
|
||||
|
||||
self.visualEffectView.frame = frame;
|
||||
self.vibrancyView.frame = frame;
|
||||
|
||||
[self addSubview:self.visualEffectView];
|
||||
[self.visualEffectView.contentView addSubview:self.vibrancyView];
|
||||
[self.blurEffectView.contentView addSubview:self.vibrancyEffectView];
|
||||
}
|
||||
|
||||
return self;
|
||||
|
@ -33,29 +26,23 @@
|
|||
- (void)layoutSubviews
|
||||
{
|
||||
[super layoutSubviews];
|
||||
|
||||
self.visualEffectView.frame = self.bounds;
|
||||
self.vibrancyView.frame = self.bounds;
|
||||
}
|
||||
|
||||
- (void)setBlurType:(NSString *)blurType {
|
||||
UIBlurEffect *blurEffect;
|
||||
|
||||
self.clipsToBounds = true;
|
||||
if ([blurType isEqual: @"xlight"]) {
|
||||
blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleExtraLight];
|
||||
} else if ([blurType isEqual: @"light"]) {
|
||||
blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
|
||||
} else if ([blurType isEqual: @"dark"]) {
|
||||
blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
|
||||
} else {
|
||||
blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
|
||||
}
|
||||
self.visualEffectView.effect = blurEffect;
|
||||
self.vibrancyEffectView.frame = self.bounds;
|
||||
}
|
||||
|
||||
- (void)insertReactSubview:(id<RCTComponent>)subview atIndex:(NSInteger)atIndex {
|
||||
[self.vibrancyView.contentView addSubview:(UIView*)subview];
|
||||
[self.vibrancyEffectView.contentView addSubview:(UIView*)subview];
|
||||
}
|
||||
|
||||
- (void)updateBlurEffect
|
||||
{
|
||||
[super updateBlurEffect];
|
||||
[self updateVibrancyEffect];
|
||||
}
|
||||
|
||||
- (void)updateVibrancyEffect
|
||||
{
|
||||
self.vibrancyEffect = [UIVibrancyEffect effectForBlurEffect:self.blurEffect];
|
||||
self.vibrancyEffectView.effect = self.vibrancyEffect;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "VibrancyViewManager.h"
|
||||
#import "VibrancyView.h"
|
||||
|
||||
|
@ -13,5 +11,6 @@ RCT_EXPORT_MODULE();
|
|||
}
|
||||
|
||||
RCT_EXPORT_VIEW_PROPERTY(blurType, NSString);
|
||||
RCT_EXPORT_VIEW_PROPERTY(blurAmount, NSNumber);
|
||||
|
||||
@end
|
||||
|
|
|
@ -8,7 +8,7 @@ class VibrancyView extends Component {
|
|||
{...this.props}
|
||||
style={[{
|
||||
backgroundColor: 'transparent',
|
||||
}, this.props.style
|
||||
}, this.props.style,
|
||||
]}
|
||||
/>
|
||||
);
|
||||
|
@ -17,6 +17,11 @@ class VibrancyView extends Component {
|
|||
|
||||
VibrancyView.propTypes = {
|
||||
blurType: PropTypes.string,
|
||||
blurAmount: PropTypes.number.isRequired,
|
||||
};
|
||||
|
||||
VibrancyView.defaultProps = {
|
||||
blurAmount: 10,
|
||||
};
|
||||
|
||||
const NativeVibrancyView = requireNativeComponent('VibrancyView', VibrancyView);
|
||||
|
|
Loading…
Reference in New Issue