Skip to content

Commit cd214df

Browse files
authored
Merge pull request #313 from brunohkbx/fix/blur-view-prop-types
fix(BlurView): Add PropTypes to viewRef according docs
2 parents 064efe2 + dd4ec22 commit cd214df

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/BlurView.android.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
requireNativeComponent,
66
DeviceEventEmitter,
77
ViewPropTypes,
8+
Platform,
89
} from 'react-native';
910

1011
const OVERLAY_COLORS = {
@@ -65,8 +66,8 @@ class BlurView extends Component {
6566
if (this.props.children != null) {
6667
throw new Error(
6768
'[ReactNativeBlur]: BlurView cannot contain any child views on Android. ' +
68-
'You should use "position: absolute" on the BlurView, ' +
69-
'and place other views in front of it.'
69+
'You should use "position: absolute" on the BlurView, ' +
70+
'and place other views in front of it.'
7071
);
7172
}
7273

@@ -92,7 +93,10 @@ BlurView.propTypes = {
9293
blurRadius: PropTypes.number,
9394
downsampleFactor: PropTypes.number,
9495
overlayColor: PropTypes.string,
95-
viewRef: PropTypes.number.isRequired,
96+
viewRef: Platform.select({
97+
android: PropTypes.number.isRequired,
98+
default: PropTypes.number,
99+
}),
96100
};
97101

98102
BlurView.defaultProps = {

0 commit comments

Comments
 (0)