Add iOS 13 blurs

This commit is contained in:
Sebastian Trebunak 2020-01-18 09:47:17 +01:00
parent dc00052b41
commit 5487e0fdea
3 changed files with 53 additions and 1 deletions

16
index.d.ts vendored
View File

@ -6,6 +6,22 @@ export interface BlurViewProperties {
| "xlight"
| "light"
| "dark"
// iOS 13+ only
| "chromeMaterial"
| "material"
| "thickMaterial"
| "thinMaterial"
| "ultraThinMaterial"
| "chromeMaterialDark"
| "materialDark"
| "thickMaterialDark"
| "thinMaterialDark"
| "ultraThinMaterialDark"
| "chromeMaterialLight"
| "materialLight"
| "thickMaterialLight"
| "thinMaterialLight"
| "ultraThinMaterialLight"
// tvOS and iOS 10+ only
| "regular"
| "prominent"

View File

@ -59,6 +59,27 @@
if ([self.blurType isEqual: @"prominent"]) return UIBlurEffectStyleProminent;
#endif
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 /* __IPHONE_10_0 */
// Adaptable blur styles
if ([self.blurType isEqual: @"chromeMaterial"]) return UIBlurEffectStyleSystemUltraThinMaterial;
if ([self.blurType isEqual: @"material"]) return UIBlurEffectStyleSystemMaterial;
if ([self.blurType isEqual: @"thickMaterial"]) return UIBlurEffectStyleSystemThickMaterial;
if ([self.blurType isEqual: @"thinMaterial"]) return UIBlurEffectStyleSystemUltraThinMaterial;
if ([self.blurType isEqual: @"ultraThinMaterial"]) return UIBlurEffectStyleSystemUltraThinMaterial;
// dark blur styles
if ([self.blurType isEqual: @"chromeMaterialDark"]) return UIBlurEffectStyleSystemChromeMaterialDark;
if ([self.blurType isEqual: @"materialDark"]) return UIBlurEffectStyleSystemMaterialDark;
if ([self.blurType isEqual: @"thickMaterialDark"]) return UIBlurEffectStyleSystemThickMaterialDark;
if ([self.blurType isEqual: @"thinMaterialDark"]) return UIBlurEffectStyleSystemUltraThinMaterialDark;
if ([self.blurType isEqual: @"ultraThinMaterialDark"]) return UIBlurEffectStyleSystemUltraThinMaterialDark;
// light blur styles
if ([self.blurType isEqual: @"chromeMaterialLight"]) return UIBlurEffectStyleSystemChromeMaterialLight;
if ([self.blurType isEqual: @"materialLight"]) return UIBlurEffectStyleSystemMaterialLight;
if ([self.blurType isEqual: @"thickMaterialLight"]) return UIBlurEffectStyleSystemThickMaterialLight;
if ([self.blurType isEqual: @"thinMaterialLight"]) return UIBlurEffectStyleSystemUltraThinMaterialLight;
if ([self.blurType isEqual: @"ultraThinMaterialLight"]) return UIBlurEffectStyleSystemUltraThinMaterialLight;
#endif
#if TARGET_OS_TV
if ([self.blurType isEqual: @"regular"]) return UIBlurEffectStyleRegular;
if ([self.blurType isEqual: @"prominent"]) return UIBlurEffectStyleProminent;

View File

@ -33,6 +33,21 @@ BlurView.propTypes = {
'prominent',
'regular',
'extraDark',
'chromeMaterial',
'material',
'thickMaterial',
'thinMaterial',
'ultraThinMaterial',
'chromeMaterialDark',
'materialDark',
'thickMaterialDark',
'thinMaterialDark',
'ultraThinMaterialDark',
'chromeMaterialLight',
'materialLight',
'thickMaterialLight',
'thinMaterialLight',
'ultraThinMaterialLight',
]),
blurAmount: PropTypes.number,
};