Allow transparent blur-type for ios
Patch from https://github.com/Kureev/react-native-blur/pull/513
This commit is contained in:
parent
ec607e5265
commit
1bb58aa0d1
|
@ -52,6 +52,7 @@ cd ios && pod install
|
|||
| `extraDark` | extra dark blur type (tvOS only)
|
||||
| `regular` | regular blur type (iOS 10+ and tvOS only)
|
||||
| `prominent` | prominent blur type (iOS 10+ and tvOS only)
|
||||
| `transparent` | transparent blur type (iOS 10+ and tvOS only)
|
||||
|
||||
#### blurType (iOS 13 only)
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ import {
|
|||
|
||||
const blurTypeValues =
|
||||
Platform.OS === 'ios'
|
||||
? ['xlight', 'light', 'dark', 'regular', 'prominent']
|
||||
? ['xlight', 'light', 'dark', 'regular', 'prominent', 'transparent']
|
||||
: ['xlight', 'light', 'dark'];
|
||||
|
||||
const Blurs = () => {
|
||||
|
|
|
@ -131,6 +131,7 @@ using namespace facebook::react;
|
|||
|
||||
- (UIBlurEffectStyle)blurEffectStyle
|
||||
{
|
||||
if ([self.blurType isEqual: @"transparent"]) return UIBlurEffectStyleDark;
|
||||
if ([self.blurType isEqual: @"xlight"]) return UIBlurEffectStyleExtraLight;
|
||||
if ([self.blurType isEqual: @"light"]) return UIBlurEffectStyleLight;
|
||||
if ([self.blurType isEqual: @"dark"]) return UIBlurEffectStyleDark;
|
||||
|
@ -183,6 +184,12 @@ using namespace facebook::react;
|
|||
UIBlurEffectStyle style = [self blurEffectStyle];
|
||||
self.blurEffect = [BlurEffectWithAmount effectWithStyle:style andBlurAmount:self.blurAmount];
|
||||
self.blurEffectView.effect = self.blurEffect;
|
||||
|
||||
if ([self.blurType isEqual: @"transparent"]) {
|
||||
for (UIView *subview in self.blurEffectView.subviews) {
|
||||
subview.backgroundColor = [UIColor clearColor];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)updateFallbackView
|
||||
|
|
|
@ -6,6 +6,7 @@ type BlurType =
|
|||
| 'dark'
|
||||
| 'light'
|
||||
| 'xlight'
|
||||
| 'transparent'
|
||||
| 'prominent'
|
||||
| 'regular'
|
||||
| 'extraDark'
|
||||
|
|
|
@ -10,6 +10,7 @@ interface NativeProps extends ViewProps {
|
|||
| 'dark'
|
||||
| 'light'
|
||||
| 'xlight'
|
||||
| 'transparent'
|
||||
| 'prominent'
|
||||
| 'regular'
|
||||
| 'extraDark'
|
||||
|
|
|
@ -10,6 +10,7 @@ interface NativeProps extends ViewProps {
|
|||
| 'dark'
|
||||
| 'light'
|
||||
| 'xlight'
|
||||
| 'transparent'
|
||||
| 'prominent'
|
||||
| 'regular'
|
||||
| 'extraDark'
|
||||
|
|
Loading…
Reference in New Issue