-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathApp.tsx
207 lines (201 loc) · 4.98 KB
/
App.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
import MaskedView from '@react-native-masked-view/masked-view';
import {LinearGradient} from 'react-native-linear-gradient';
import {range} from 'lodash';
import React from 'react';
import {
ImageBackground,
ScrollView,
StyleSheet,
Text,
View,
ViewProps,
} from 'react-native';
import {GradientBorderView} from './package/index';
function Giraffe() {
return (
<MaskedView
style={{flex: 1}}
maskElement={
<View style={[StyleSheet.absoluteFill]}>
<ImageBackground
style={[StyleSheet.absoluteFill]}
resizeMode="contain"
source={require('./giraffe.png')}
/>
</View>
}>
<LinearGradient
colors={['red', 'blue']}
style={StyleSheet.absoluteFill}
pointerEvents="none"
/>
</MaskedView>
);
}
export function FadeOutTopView({
fadeHeight = 100,
...props
}: ViewProps & {fadeHeight?: number}) {
return (
<MaskedView
style={{flex: 1}}
maskElement={
<View style={StyleSheet.absoluteFill}>
<LinearGradient
colors={['rgba(0, 0, 0, 0)', 'rgba(0,0,0,1)']}
style={{
height: fadeHeight,
position: 'absolute',
left: 0,
right: 0,
top: 0,
}}
/>
<View
style={{
position: 'absolute',
top: fadeHeight,
left: 0,
right: 0,
bottom: 0,
backgroundColor: 'black',
}}
/>
</View>
}
{...props}
/>
);
}
function FadeOut() {
return (
<View>
<Text
style={{
color: 'white',
fontSize: 40,
marginLeft: 24,
marginTop: 50,
}}>
A Fade Effect
</Text>
<FadeOutTopView style={{flex: 1}}>
<ScrollView contentContainerStyle={{padding: 16}}>
{range(10).map(e => (
<GradientBorderView
style={{
padding: 16,
borderRadius: 10,
borderWidth: 5,
backgroundColor: 'rgba(255, 255, 255, 0.6)',
marginBottom: 20,
}}
gradientProps={{
colors: ['red', 'orange'],
}}>
<Text
style={{
fontSize: 24,
marginBottom: 16,
}}>
Title
</Text>
<Text style={{fontSize: 15}}>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor
in reprehenderit in voluptate velit esse cillum dolore eu fugiat
nulla pariatur.
</Text>
</GradientBorderView>
))}
</ScrollView>
</FadeOutTopView>
</View>
);
}
const App = () => {
return (
<View
style={{
flex: 1,
backgroundColor: 'white',
justifyContent: 'center',
alignItems: 'center',
}}>
{/* <View
style={StyleSheet.absoluteFill}
>
<ImageBackground
source={require('./background.jpg')}
style={StyleSheet.absoluteFill}
blurRadius={2}
/>
<View
style={[StyleSheet.absoluteFill, { backgroundColor: 'rgba(0,0,0,0.3)' }]}
/>
</View> */}
{/* <FadeOut /> */}
{/* <GradientBorderView
style={{
borderWidth: 10,
width: 100,
height: 100,
borderTopRightRadius: 100
}}
gradientProps={{
colors: ['red', 'orange']
}}
/> */}
{/* <GradientBorderView
style={{
justifyContent: 'center',
alignItems: 'center',
width: 100,
height: 100,
borderLeftWidth: 5,
borderTopLeftRadius: 40,
borderRightWidth: 5,
borderBottomRightRadius: 5,
borderBottomWidth: 2,
borderBottomLeftRadius: 20,
borderTopWidth: 0.25
}}
gradientProps={{
colors: ['red', 'orange', 'yellow', 'green'],
start: { x: 0.5, y: 0, },
end: { x: 1, y: 1 }
}}
>
<Text style={{
color: 'white',
fontSize: 24,
}}>
Cool!
</Text>
</GradientBorderView> */}
<GradientBorderView
gradientProps={{
colors: ['red', 'orange'],
}}
style={{
borderWidth: 5,
borderRadius: 5,
height: 50,
width: 50,
}}
/>
{/* <View
style={{
borderWidth: 5,
borderRadius: 5,
height: 50,
width: 50,
borderColor: 'black',
}}
/> */}
</View>
);
};
export default App;