Skip to content

Commit d95c29d

Browse files
levibuzoliccharpeni
authored andcommitted
Enable regular and prominent BlurEffectStyles for iOS 10.0+ (#276)
Previously `regular`, `prominent` and `extraDark` were only available on tvOS. iOS 10.0+ adds support for `regular` and `prominent` according to the [BlurEffect.Style docs](https://developer.apple.com/documentation/uikit/uiblureffect/style). https://developer.apple.com/documentation/uikit/uiblureffect/style/regular https://developer.apple.com/documentation/uikit/uiblureffect/style/prominent `extraDark` Remains tvOS only.
1 parent 74892c4 commit d95c29d

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ android {
6969
- `light` - light blur type
7070
- `dark` - dark blur type
7171
- `extraDark` - extra dark blur type (tvOS only)
72-
- `regular` - regular blur type (tvOS only)
73-
- `prominent` - prominent blur type (tvOS only)
72+
- `regular` - regular blur type (iOS 10+ and tvOS only)
73+
- `prominent` - prominent blur type (iOS 10+ and tvOS only)
7474
- `blurAmount` (Default: 10, Number)
7575
- `0-100` - Adjusts blur intensity
7676

examples/Basic/index.ios.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class Basic extends Component {
6767
</Text>
6868

6969
<SegmentedControlIOS
70-
values={['xlight', 'light', 'dark']}
70+
values={['xlight', 'light', 'dark', 'regular', 'prominent']}
7171
selectedIndex={this.state.blurActiveSegment}
7272
onChange={(event) => {this._onBlurChange(event)}}
7373
onValueChange={(value) => {this._onBlurValueChange(value)}}
@@ -89,7 +89,7 @@ class Basic extends Component {
8989
</Text>
9090

9191
<SegmentedControlIOS
92-
values={['xlight', 'light', 'dark']}
92+
values={['xlight', 'light', 'dark', 'regular', 'prominent']}
9393
selectedIndex={this.state.vibrancyActiveSegment}
9494
onChange={(event) => {this._onVibrancyChange(event)}}
9595
onValueChange={(value) => {this._onVibrancyValueChange(value)}}

ios/BlurView.m

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,18 @@ - (UIBlurEffectStyle)blurEffectStyle
5353
if ([self.blurType isEqual: @"xlight"]) return UIBlurEffectStyleExtraLight;
5454
if ([self.blurType isEqual: @"light"]) return UIBlurEffectStyleLight;
5555
if ([self.blurType isEqual: @"dark"]) return UIBlurEffectStyleDark;
56-
56+
57+
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 100000 /* __IPHONE_10_0 */
58+
if ([self.blurType isEqual: @"regular"]) return UIBlurEffectStyleRegular;
59+
if ([self.blurType isEqual: @"prominent"]) return UIBlurEffectStyleProminent;
60+
#endif
61+
5762
#if TARGET_OS_TV
58-
if ([self.blurType isEqual: @"extraDark"]) return UIBlurEffectStyleExtraDark;
5963
if ([self.blurType isEqual: @"regular"]) return UIBlurEffectStyleRegular;
6064
if ([self.blurType isEqual: @"prominent"]) return UIBlurEffectStyleProminent;
65+
if ([self.blurType isEqual: @"extraDark"]) return UIBlurEffectStyleExtraDark;
6166
#endif
62-
67+
6368
return UIBlurEffectStyleDark;
6469
}
6570

0 commit comments

Comments
 (0)