Skip to content

Commit 33d62f1

Browse files
levibuzoliccharpeni
authored andcommitted
Flow definition (#308)
* Add flow definition * Minor chnage to the comments in the TypeScript definition to reflect 1a061eb
1 parent 2dca68f commit 33d62f1

File tree

2 files changed

+43
-3
lines changed

2 files changed

+43
-3
lines changed

index.d.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ export interface BlurViewProperties {
66
| "xlight"
77
| "light"
88
| "dark"
9-
// tvOS only
10-
| "extraDark"
9+
// tvOS and iOS 10+ only
1110
| "regular"
12-
| "prominent";
11+
| "prominent"
12+
// tvOS only
13+
| "extraDark";
1314
blurAmount?: number; // 0 - 100
1415
style?: StyleProp<ViewStyle>;
1516
viewRef?: number | null;

index.js.flow

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// @flow
2+
3+
import * as React from 'react';
4+
import {View} from 'react-native';
5+
6+
type ViewProps = React.ElementProps<typeof View>;
7+
type ViewStyleProp = $PropertyType<ViewProps, 'style'>;
8+
9+
export type BlurType =
10+
| 'xlight'
11+
| 'light'
12+
| 'dark'
13+
// tvOS and iOS 10+ only
14+
| 'regular'
15+
| 'prominent'
16+
// tvOS only
17+
| 'extraDark';
18+
19+
export type BlurViewProps = {
20+
blurType: BlurType,
21+
blurAmount: number, // 0 - 100
22+
style?: ?ViewStyleProp,
23+
viewRef?: ?React.ElementRef<any>,
24+
};
25+
26+
export class BlurView extends React.Component<BlurViewProps> {
27+
static defaultProps = {
28+
blurType: 'dark',
29+
blurAmount: 10,
30+
};
31+
}
32+
33+
export type VibrancyViewProps = BlurViewProps;
34+
35+
export class VibrancyView extends React.Component<VibrancyViewProps> {
36+
static defaultProps = {
37+
blurAmount: 10,
38+
};
39+
}

0 commit comments

Comments
 (0)