Skip to content

Commit

Permalink
chore: Fix homepage layout issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Jul 31, 2021
1 parent 1f8319b commit a25d3b5
Showing 1 changed file with 21 additions and 17 deletions.
38 changes: 21 additions & 17 deletions src/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,25 @@ import {StackNavigationProp} from '@react-navigation/stack';
import {stackPageData, Routes} from './routes';
import {Button} from '../components';

const styles = StyleSheet.create({
block: {
flex: 1,
},
});

type ModalStackNavigation = StackNavigationProp<{}>;

const Link = ({
children,
navigation,
params,
to,
title,
description,
}: {
to: string;
children: JSX.Element;
title: string;
description: string;
children?: JSX.Element;
params: Routes['params'];
navigation: ModalStackNavigation;
}) => {
Expand All @@ -29,18 +38,17 @@ const Link = ({
bordered={false}
textStyle={styles.block}
onPress={() => navigation.push(to as never, {...params} as never)}>
{children}
<View style={styles.block}>
<Text>{title || ''}</Text>
<View>
<Text>{description}</Text>
</View>
</View>
</Button>
</View>
);
};

const styles = StyleSheet.create({
block: {
flex: 1,
},
});

export default ({navigation}: {navigation: ModalStackNavigation}) => {
return (
<ScrollView>
Expand All @@ -51,14 +59,10 @@ export default ({navigation}: {navigation: ModalStackNavigation}) => {
<Link
to={props.name as never}
navigation={navigation}
params={props.params}>
<View style={styles.block}>
<Text>{props.params.title || ''}</Text>
<View>
<Text>{props.params.description}</Text>
</View>
</View>
</Link>
params={props.params}
title={props.params.title}
description={props.params.description}
/>
</View>
);
})}
Expand Down

0 comments on commit a25d3b5

Please sign in to comment.