Skip to content

Commit e41c7db

Browse files
JulienKodeKureev
authored andcommitted
[tvOS] Add new blur types and setNativeProps (#210)
* [BlurView] Add tvOS blurTypes * [BlurView] Add setNativeProps to use it in touchablehightlight * [BlurView] Add blurTypes of tvOS * [README] Add tvOS blur types * [VibrancyView] Add setNativeProps
1 parent 8868be7 commit e41c7db

4 files changed

Lines changed: 30 additions & 1 deletion

File tree

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ android {
6565
- `xlight` - extra light blur type
6666
- `light` - light blur type
6767
- `dark` - dark blur type
68+
- `extraDark` - extra dark blur type (tvOS only)
69+
- `regular` - regular blur type (tvOS only)
70+
- `prominent` - prominent blur type (tvOS only)
6871
- `blurAmount` (Default: 10, Number)
6972
- `0-100` - Adjusts blur intensity
7073

ios/BlurView.m

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,13 @@ - (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+
57+
#ifdef TARGET_OS_TV
58+
if ([self.blurType isEqual: @"extraDark"]) return UIBlurEffectStyleExtraDark;
59+
if ([self.blurType isEqual: @"regular"]) return UIBlurEffectStyleRegular;
60+
if ([self.blurType isEqual: @"prominent"]) return UIBlurEffectStyleProminent;
61+
#endif
62+
5663
return UIBlurEffectStyleDark;
5764
}
5865

src/BlurView.ios.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ import React, { Component, PropTypes } from 'react';
22
import { View, requireNativeComponent, ViewPropTypes } from 'react-native';
33

44
class BlurView extends Component {
5+
setNativeProps = nativeProps => {
6+
if (this._root) {
7+
this._root.setNativeProps(nativeProps);
8+
}
9+
}
10+
511
render() {
612
return (
713
<NativeBlurView
@@ -17,7 +23,14 @@ class BlurView extends Component {
1723

1824
BlurView.propTypes = {
1925
...(ViewPropTypes || View.propTypes),
20-
blurType: PropTypes.oneOf(['dark', 'light', 'xlight']),
26+
blurType: PropTypes.oneOf([
27+
'dark',
28+
'light',
29+
'xlight',
30+
'prominent',
31+
'regular',
32+
'extraDark',
33+
]),
2134
blurAmount: PropTypes.number,
2235
};
2336

src/VibrancyView.ios.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ import React, { Component, PropTypes } from 'react';
22
import { requireNativeComponent } from 'react-native';
33

44
class VibrancyView extends Component {
5+
setNativeProps = nativeProps => {
6+
if (this._root) {
7+
this._root.setNativeProps(nativeProps);
8+
}
9+
}
10+
511
render() {
612
return (
713
<NativeVibrancyView

0 commit comments

Comments
 (0)