Skip to content

Commit dfd3051

Browse files
committed
Info button in upper right corner
1 parent 333c10d commit dfd3051

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

App.js

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ function Button({title, onPress, onFocus, isTVSelectable}) {
2323
);
2424
}
2525

26+
Button.defaultProps = {
27+
isTVSelectable: true,
28+
};
29+
2630
function HomeScreen({navigation}) {
2731
const [isFocused, setIsFocused] = React.useState(false);
2832
React.useEffect(() => {
@@ -156,6 +160,15 @@ const headerOptions = (title) => {
156160
headerStyle: styles.header,
157161
headerTitleContainerStyle: styles.headerTitleContainer,
158162
headerTitleStyle: styles.headerTitle,
163+
headerRight: () => (
164+
<TouchableOpacity
165+
style={styles.infoButtonContainer}
166+
onPress={() => alert('Info')} /* eslint-disable-line no-alert */
167+
onFocus={() => console.log('Focus: Info button')}>
168+
<View style={styles.spacer} />
169+
<Text style={styles.headerBackTitle}>Info</Text>
170+
</TouchableOpacity>
171+
),
159172
};
160173
};
161174

@@ -182,7 +195,7 @@ const styles = StyleSheet.create({
182195
color: colors.white,
183196
},
184197
headerBackTitle: {
185-
fontSize: 30,
198+
fontSize: 40,
186199
color: colors.white,
187200
},
188201
headerTitleContainer: {
@@ -197,4 +210,14 @@ const styles = StyleSheet.create({
197210
flexDirection: 'row',
198211
margin: 100,
199212
},
213+
infoButtonContainer: {
214+
backgroundColor: 'transparent',
215+
width: 700,
216+
flexDirection: 'row',
217+
alignItems: 'center',
218+
justifyContent: 'center',
219+
},
220+
spacer: {
221+
flex: 1,
222+
},
200223
});

0 commit comments

Comments
 (0)