Skip to content

Commit 019bb4a

Browse files
committed
render gradients in home.js
1 parent bd758b3 commit 019bb4a

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+
start={{x: 0, y: 0.05}}
24+
end={{x: 1, y: 0.85}}
25+
colors={view.gradient}
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"
@@ -56,9 +73,11 @@ const styles = StyleSheet.create({
5673
// Text styling in buttons
5774
rectangleButtonIcon: {
5875
color: c.white,
76+
backgroundColor: c.transparent,
5977
},
6078
rectangleButtonText: {
6179
color: c.white,
80+
backgroundColor: c.transparent,
6281
// marginTop: cellVerticalPadding / 2,
6382
fontFamily: Platform.OS === 'ios' ? 'System' : 'sans-serif-condensed',
6483
// textAlign: 'center',

0 commit comments

Comments
 (0)