NavButton breakout
This commit is contained in:
parent
afe511b448
commit
79328b6b62
2 changed files with 18 additions and 4 deletions
|
@ -52,12 +52,10 @@ export function PostsContainer({ navigation }): JSX.Element {
|
|||
const getItemCount = (_data: unknown): number => postData.length;
|
||||
|
||||
const getItem = (_data: unknown, index: number): Post => postData[index];
|
||||
|
||||
return (
|
||||
<>
|
||||
<Button
|
||||
title="Go to Details"
|
||||
onPress={() => navigation.navigate("New")}
|
||||
/>
|
||||
<NavButton onPress={() => navigation.navigate("New")} text="New Post" />
|
||||
<SafeAreaView style={style.postsContainer}>
|
||||
<VirtualizedList
|
||||
data={postData}
|
||||
|
@ -82,3 +80,15 @@ export function PostsContainer({ navigation }): JSX.Element {
|
|||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function NavButton({
|
||||
onPress,
|
||||
text,
|
||||
}: {
|
||||
onPress: () => void;
|
||||
text: string;
|
||||
}): JSX.Element {
|
||||
return (
|
||||
<Button title={text} onPress={onPress} color={style.navButton.color} />
|
||||
);
|
||||
}
|
||||
|
|
|
@ -62,4 +62,8 @@ export const style = StyleSheet.create({
|
|||
errorText: {
|
||||
color: colorScheme.error,
|
||||
},
|
||||
navButton: {
|
||||
backgroundColor: colorScheme.background,
|
||||
color: colorScheme.postFont,
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue