-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCustomFilterViewExample02.tsx
104 lines (98 loc) · 2.38 KB
/
CustomFilterViewExample02.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
// @ts-ignore
import * as React from 'react';
import { StyleSheet, View, Text } from 'react-native';
import { CustomFilterView } from 'react-native-ios-visual-effect-view';
import { CounterDisplay } from '../components/CounterDisplay';
const emojiString =
"❤️🛑🍒🍓💃"
+ "\n🧡🍊🥕🍑🎃"
+ "\n💛🌟🌻🍋🍌"
+ "\n💚🍀🌿🍏🌳"
+ "\n💙🌊🦋🔵💎"
+ "\n💜🍇💐🛸🌌"
+ "\n💖🌸💝🎀💗"
+ "\n🤍✨🌙🦢🦄"
+ "\n🖤🌑🦇🕷️🕸️";
export function CustomFilterViewExample02() {
return (
<View style={styles.container}>
<Text style={styles.label}>
{emojiString}
</Text>
<CustomFilterView
style={styles.effectOverlay}
backgroundLayerSamplingSizeScale={1}
currentFilters={{
backgroundFilters: [
{
filterName: 'gaussianBlur',
radius: 18,
shouldNormalizeEdges: true,
},
{
filterName: 'brightenColors',
amount: -0.5
},
{
filterName: 'contrastColors',
amount: 0.3,
},
{
filterName: 'colorBlackAndWhite',
amount: 1,
},
],
tintConfig: {
opacity: 0.75,
blendMode: 'color',
tintColor: 'red',
},
foregroundFilters: [
{
filterName: 'gaussianBlur',
radius: 4,
shouldNormalizeEdges: false
},
{
filterName: 'colorMatrixVibrant',
colorMatrix: {
mode: 'preset',
preset: {
mode: 'presetName',
presetName: 'preset14'
},
},
},
]
}}
>
<View style={styles.effectContent}>
<CounterDisplay/>
</View>
</CustomFilterView>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
backgroundColor: 'white',
},
label: {
fontSize: 72,
},
effectOverlay: {
position: 'absolute',
top: 0,
bottom: 0,
left: 0,
right: 0,
},
effectContent: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
},
});