Skip to content

Commit 6dee69f

Browse files
authored
Merge pull request #2077 from StoDevX/gradient-buttons
Use gradients on the homescreen buttons
2 parents 10d92f8 + 1060a11 commit 6dee69f

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

source/views/home/button.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import * as React from 'react'
44
import {Text, StyleSheet, Platform} from 'react-native'
55
import Icon from 'react-native-vector-icons/Entypo'
66
import type {ViewType} from '../views'
7+
import LinearGradient from 'react-native-linear-gradient'
78
import {Touchable} from '../components/touchable'
89
import * as c from '../components/colors'
910

@@ -15,6 +16,22 @@ type Props = {
1516
export function HomeScreenButton({view, onPress}: Props) {
1617
const style = {backgroundColor: view.tint}
1718

19+
if (view.gradient) {
20+
return (
21+
<Touchable onPress={onPress}>
22+
<LinearGradient
23+
colors={view.gradient}
24+
end={{x: 1, y: 0.85}}
25+
start={{x: 0, y: 0.05}}
26+
style={[styles.rectangle]}
27+
>
28+
<Icon name={view.icon} size={32} style={styles.rectangleButtonIcon} />
29+
<Text style={styles.rectangleButtonText}>{view.title}</Text>
30+
</LinearGradient>
31+
</Touchable>
32+
)
33+
}
34+
1835
return (
1936
<Touchable
2037
accessibilityComponentType="button"
@@ -55,9 +72,11 @@ const styles = StyleSheet.create({
5572
// Text styling in buttons
5673
rectangleButtonIcon: {
5774
color: c.white,
75+
backgroundColor: c.transparent,
5876
},
5977
rectangleButtonText: {
6078
color: c.white,
79+
backgroundColor: c.transparent,
6180
fontFamily: Platform.OS === 'ios' ? 'System' : 'sans-serif-condensed',
6281
fontSize: 14,
6382
},

0 commit comments

Comments
 (0)