Skip to content

Commit 6843dbb

Browse files
authored
Merge pull request #349 from sebinq/master
Add new iOS blurs featured in iOS 13+
2 parents 9b5ffd1 + 3253745 commit 6843dbb

File tree

5 files changed

+85
-1
lines changed

5 files changed

+85
-1
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,22 @@ import { BlurView, VibrancyView } from "@react-native-community/blur";
7777
- `extraDark` - extra dark blur type (tvOS only)
7878
- `regular` - regular blur type (iOS 10+ and tvOS only)
7979
- `prominent` - prominent blur type (iOS 10+ and tvOS only)
80+
- iOS 13 only Blur types:
81+
- `chromeMaterial` - An adaptable blur effect that creates the appearance of the system chrome.
82+
- `material` - An adaptable blur effect that creates the appearance of a material with normal thickness.
83+
- `thickMaterial` - An adaptable blur effect that creates the appearance of a material that is thicker than normal.
84+
- `thinMaterial` - An adaptable blur effect that creates the appearance of an ultra-thin material.
85+
- `ultraThinMaterial` - An adaptable blur effect that creates the appearance of an ultra-thin material.
86+
- `chromeMaterialDark` - A blur effect that creates the appearance of an ultra-thin material and is always dark.
87+
- `materialDark` - A blur effect that creates the appearance of a thin material and is always dark.
88+
- `thickMaterialDark` - A blur effect that creates the appearance of a material with normal thickness and is always dark.
89+
- `thinMaterialDark` - A blur effect that creates the appearance of a material that is thicker than normal and is always dark.
90+
- `ultraThinMaterialDark` - A blur effect that creates the appearance of the system chrome and is always dark.
91+
- `chromeMaterialLight` - An adaptable blur effect that creates the appearance of the system chrome.
92+
- `materialLight` - An adaptable blur effect that creates the appearance of a material with normal thickness.
93+
- `thickMaterialLight` - An adaptable blur effect that creates the appearance of a material that is thicker than normal.
94+
- `thinMaterialLight` - An adaptable blur effect that creates the appearance of a thin material.
95+
- `ultraThinMaterialLight` - An adaptable blur effect that creates the appearance of an ultra-thin material.
8096
- `blurAmount` (Default: 10, Number)
8197
- `0-100` - Adjusts blur intensity
8298

index.d.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,22 @@ export interface BlurViewProperties {
66
| "xlight"
77
| "light"
88
| "dark"
9+
// iOS 13+ only
10+
| "chromeMaterial"
11+
| "material"
12+
| "thickMaterial"
13+
| "thinMaterial"
14+
| "ultraThinMaterial"
15+
| "chromeMaterialDark"
16+
| "materialDark"
17+
| "thickMaterialDark"
18+
| "thinMaterialDark"
19+
| "ultraThinMaterialDark"
20+
| "chromeMaterialLight"
21+
| "materialLight"
22+
| "thickMaterialLight"
23+
| "thinMaterialLight"
24+
| "ultraThinMaterialLight"
925
// tvOS and iOS 10+ only
1026
| "regular"
1127
| "prominent"

index.js.flow

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,22 @@ export type BlurType =
1010
| 'xlight'
1111
| 'light'
1212
| 'dark'
13+
// iOS 13+ only
14+
| "chromeMaterial"
15+
| "material"
16+
| "thickMaterial"
17+
| "thinMaterial"
18+
| "ultraThinMaterial"
19+
| "chromeMaterialDark"
20+
| "materialDark"
21+
| "thickMaterialDark"
22+
| "thinMaterialDark"
23+
| "ultraThinMaterialDark"
24+
| "chromeMaterialLight"
25+
| "materialLight"
26+
| "thickMaterialLight"
27+
| "thinMaterialLight"
28+
| "ultraThinMaterialLight"
1329
// tvOS and iOS 10+ only
1430
| 'regular'
1531
| 'prominent'

ios/BlurView.m

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,28 @@ - (UIBlurEffectStyle)blurEffectStyle
5858
if ([self.blurType isEqual: @"regular"]) return UIBlurEffectStyleRegular;
5959
if ([self.blurType isEqual: @"prominent"]) return UIBlurEffectStyleProminent;
6060
#endif
61-
61+
62+
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 /* __IPHONE_13_0 */
63+
// Adaptable blur styles
64+
if ([self.blurType isEqual: @"chromeMaterial"]) return UIBlurEffectStyleSystemChromeMaterial;
65+
if ([self.blurType isEqual: @"material"]) return UIBlurEffectStyleSystemMaterial;
66+
if ([self.blurType isEqual: @"thickMaterial"]) return UIBlurEffectStyleSystemThickMaterial;
67+
if ([self.blurType isEqual: @"thinMaterial"]) return UIBlurEffectStyleSystemThinMaterial;
68+
if ([self.blurType isEqual: @"ultraThinMaterial"]) return UIBlurEffectStyleSystemUltraThinMaterial;
69+
// dark blur styles
70+
if ([self.blurType isEqual: @"chromeMaterialDark"]) return UIBlurEffectStyleSystemChromeMaterialDark;
71+
if ([self.blurType isEqual: @"materialDark"]) return UIBlurEffectStyleSystemMaterialDark;
72+
if ([self.blurType isEqual: @"thickMaterialDark"]) return UIBlurEffectStyleSystemThickMaterialDark;
73+
if ([self.blurType isEqual: @"thinMaterialDark"]) return UIBlurEffectStyleSystemThinMaterialDark;
74+
if ([self.blurType isEqual: @"ultraThinMaterialDark"]) return UIBlurEffectStyleSystemUltraThinMaterialDark;
75+
// light blur styles
76+
if ([self.blurType isEqual: @"chromeMaterialLight"]) return UIBlurEffectStyleSystemChromeMaterialLight;
77+
if ([self.blurType isEqual: @"materialLight"]) return UIBlurEffectStyleSystemMaterialLight;
78+
if ([self.blurType isEqual: @"thickMaterialLight"]) return UIBlurEffectStyleSystemThickMaterialLight;
79+
if ([self.blurType isEqual: @"thinMaterialLight"]) return UIBlurEffectStyleSystemThinMaterialLight;
80+
if ([self.blurType isEqual: @"ultraThinMaterialLight"]) return UIBlurEffectStyleSystemUltraThinMaterialLight;
81+
#endif
82+
6283
#if TARGET_OS_TV
6384
if ([self.blurType isEqual: @"regular"]) return UIBlurEffectStyleRegular;
6485
if ([self.blurType isEqual: @"prominent"]) return UIBlurEffectStyleProminent;

src/BlurView.ios.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,21 @@ BlurView.propTypes = {
3333
'prominent',
3434
'regular',
3535
'extraDark',
36+
'chromeMaterial',
37+
'material',
38+
'thickMaterial',
39+
'thinMaterial',
40+
'ultraThinMaterial',
41+
'chromeMaterialDark',
42+
'materialDark',
43+
'thickMaterialDark',
44+
'thinMaterialDark',
45+
'ultraThinMaterialDark',
46+
'chromeMaterialLight',
47+
'materialLight',
48+
'thickMaterialLight',
49+
'thinMaterialLight',
50+
'ultraThinMaterialLight',
3651
]),
3752
blurAmount: PropTypes.number,
3853
};

0 commit comments

Comments
 (0)