1 | import React, { Component } from 'react';
|
2 | import PropTypes from 'prop-types';
|
3 | import { ViewPropTypes, requireNativeComponent } from 'react-native';
|
4 |
|
5 | import deprecatedPropType from 'react-native/Libraries/Utilities/deprecatedPropType';
|
6 |
|
7 | export default class BlurView extends Component {
|
8 | static propTypes = {
|
9 | tintEffect: deprecatedPropType(
|
10 | PropTypes.string,
|
11 | 'Use the `tint` prop instead.'
|
12 | ),
|
13 | tint: PropTypes.oneOf(['light', 'default', 'dark']).isRequired,
|
14 | intensity: PropTypes.number.isRequired,
|
15 | ...ViewPropTypes,
|
16 | };
|
17 |
|
18 | static defaultProps = {
|
19 | tint: 'default',
|
20 | intensity: 50,
|
21 | };
|
22 |
|
23 | render() {
|
24 | let { style, ...nativeProps } = this.props;
|
25 |
|
26 | if (nativeProps.tintEffect) {
|
27 | nativeProps.tint = nativeProps.tintEffect;
|
28 | delete nativeProps.tintEffect;
|
29 | }
|
30 |
|
31 | return (
|
32 | <NativeBlurView
|
33 | {...nativeProps}
|
34 | style={[style, { backgroundColor: 'transparent' }]}
|
35 | />
|
36 | );
|
37 | }
|
38 | }
|
39 |
|
40 | const NativeBlurView = requireNativeComponent('ExponentBlurView', null);
|