1 | 'use strict';
|
2 |
|
3 | import React, {
|
4 | Component,
|
5 | PropTypes,
|
6 | } from 'react';
|
7 |
|
8 | import {
|
9 | View,
|
10 | } from 'react-native';
|
11 |
|
12 | import deprecatedPropType from 'react-native/Libraries/Utilities/deprecatedPropType';
|
13 |
|
14 | export default class BlurView extends Component {
|
15 | static propTypes = {
|
16 | tintEffect: deprecatedPropType(
|
17 | PropTypes.string,
|
18 | 'Use the `tint` prop instead.'
|
19 | ),
|
20 | tint: PropTypes.oneOf(['light', 'default', 'dark']),
|
21 | ...View.propTypes,
|
22 | };
|
23 |
|
24 | render() {
|
25 | let { tint } = this.props;
|
26 |
|
27 | let backgroundColor;
|
28 | if (tint === 'dark') {
|
29 | backgroundColor = 'rgba(0,0,0,0.5)';
|
30 | } else if (tint === 'light') {
|
31 | backgroundColor = 'rgba(255,255,255,0.7)';
|
32 | } else {
|
33 | backgroundColor = 'rgba(255,255,255,0.4)';
|
34 | }
|
35 |
|
36 | return (
|
37 | <View
|
38 | {...this.props}
|
39 | style={[this.props.style, { backgroundColor }]}
|
40 | />
|
41 | );
|
42 | }
|
43 | }
|