[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
This commit is contained in:
Julien K 2017-06-26 14:43:33 +02:00 committed by Alexey
parent 8868be730c
commit e41c7dbcd5
4 changed files with 30 additions and 1 deletions

View File

@ -65,6 +65,9 @@ android {
- `xlight` - extra light blur type
- `light` - light blur type
- `dark` - dark blur type
- `extraDark` - extra dark blur type (tvOS only)
- `regular` - regular blur type (tvOS only)
- `prominent` - prominent blur type (tvOS only)
- `blurAmount` (Default: 10, Number)
- `0-100` - Adjusts blur intensity

View File

@ -53,6 +53,13 @@
if ([self.blurType isEqual: @"xlight"]) return UIBlurEffectStyleExtraLight;
if ([self.blurType isEqual: @"light"]) return UIBlurEffectStyleLight;
if ([self.blurType isEqual: @"dark"]) return UIBlurEffectStyleDark;
#ifdef TARGET_OS_TV
if ([self.blurType isEqual: @"extraDark"]) return UIBlurEffectStyleExtraDark;
if ([self.blurType isEqual: @"regular"]) return UIBlurEffectStyleRegular;
if ([self.blurType isEqual: @"prominent"]) return UIBlurEffectStyleProminent;
#endif
return UIBlurEffectStyleDark;
}

View File

@ -2,6 +2,12 @@ import React, { Component, PropTypes } from 'react';
import { View, requireNativeComponent, ViewPropTypes } from 'react-native';
class BlurView extends Component {
setNativeProps = nativeProps => {
if (this._root) {
this._root.setNativeProps(nativeProps);
}
}
render() {
return (
<NativeBlurView
@ -17,7 +23,14 @@ class BlurView extends Component {
BlurView.propTypes = {
...(ViewPropTypes || View.propTypes),
blurType: PropTypes.oneOf(['dark', 'light', 'xlight']),
blurType: PropTypes.oneOf([
'dark',
'light',
'xlight',
'prominent',
'regular',
'extraDark',
]),
blurAmount: PropTypes.number,
};

View File

@ -2,6 +2,12 @@ import React, { Component, PropTypes } from 'react';
import { requireNativeComponent } from 'react-native';
class VibrancyView extends Component {
setNativeProps = nativeProps => {
if (this._root) {
this._root.setNativeProps(nativeProps);
}
}
render() {
return (
<NativeVibrancyView