mirror of
https://github.com/status-im/react-native-blur.git
synced 2025-01-11 09:05:54 +00:00
[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:
parent
8868be730c
commit
e41c7dbcd5
@ -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
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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,
|
||||
};
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user