Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 1 addition & 79 deletions App.tsx
Original file line number Diff line number Diff line change
@@ -1,38 +1,9 @@
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 {StyleSheet, 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
Expand Down Expand Up @@ -69,55 +40,6 @@ export function FadeOutTopView({
);
}

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
Expand Down
12 changes: 6 additions & 6 deletions package/src/components/GradientBorderView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,17 +109,17 @@ export const GradientBorderView = ({
{props.children}
<GradientBorder
gradientProps={gradientProps}
borderRadius={styles.borderRadius}
borderRadius={styles.borderRadius as number}
borderWidth={styles.borderWidth}
borderBottomWidth={styles.borderBottomWidth}
borderRightWidth={styles.borderRightWidth}
borderLeftWidth={styles.borderLeftWidth}
borderTopWidth={styles.borderTopWidth}
borderTopLeftRadius={styles.borderTopLeftRadius}
borderTopRightRadius={styles.borderTopRightRadius}
borderBottomRightRadius={styles.borderBottomRightRadius}
borderBottomLeftRadius={styles.borderBottomLeftRadius}
borderTopLeftRadius={styles.borderTopLeftRadius as number}
borderTopRightRadius={styles.borderTopRightRadius as number}
borderBottomRightRadius={styles.borderBottomRightRadius as number}
borderBottomLeftRadius={styles.borderBottomLeftRadius as number}
/>
</View>
);
}
};