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 getItemCount = (_data: unknown): number => postData.length;
|
||||||
|
|
||||||
const getItem = (_data: unknown, index: number): Post => postData[index];
|
const getItem = (_data: unknown, index: number): Post => postData[index];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Button
|
<NavButton onPress={() => navigation.navigate("New")} text="New Post" />
|
||||||
title="Go to Details"
|
|
||||||
onPress={() => navigation.navigate("New")}
|
|
||||||
/>
|
|
||||||
<SafeAreaView style={style.postsContainer}>
|
<SafeAreaView style={style.postsContainer}>
|
||||||
<VirtualizedList
|
<VirtualizedList
|
||||||
data={postData}
|
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: {
|
errorText: {
|
||||||
color: colorScheme.error,
|
color: colorScheme.error,
|
||||||
},
|
},
|
||||||
|
navButton: {
|
||||||
|
backgroundColor: colorScheme.background,
|
||||||
|
color: colorScheme.postFont,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue