Skip to content

Commit 65e713a

Browse files
committed
修改组件实例首页样式
1 parent 5516203 commit 65e713a

File tree

1 file changed

+17
-54
lines changed

1 file changed

+17
-54
lines changed

example/examples/src/Home.tsx

Lines changed: 17 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import React from 'react';
2-
import {View, Text, StyleSheet, ScrollView} from 'react-native';
2+
import {View, StyleSheet, ScrollView} from 'react-native';
33
import {StackNavigationProp} from '@react-navigation/stack';
4-
import {stackPageData, Routes} from './routes';
5-
import {Button} from '@uiw/react-native';
4+
import {stackPageData} from './routes';
5+
import { Grid } from '@uiw/react-native';
66

77
const styles = StyleSheet.create({
88
block: {
@@ -12,60 +12,23 @@ const styles = StyleSheet.create({
1212

1313
type ModalStackNavigation = StackNavigationProp<{}>;
1414

15-
const Link = ({
16-
navigation,
17-
params,
18-
to,
19-
title,
20-
description,
21-
}: {
22-
to: string;
23-
title: string;
24-
description: string;
25-
children?: JSX.Element;
26-
params: Routes['params'];
27-
navigation: ModalStackNavigation;
28-
}) => {
29-
return (
30-
<View
31-
// eslint-disable-next-line react-native/no-inline-styles
32-
style={{
33-
borderBottomColor: '#CDCDCD',
34-
borderBottomWidth: StyleSheet.hairlineWidth,
35-
flex: 1,
36-
}}>
37-
<Button
38-
bordered={false}
39-
textStyle={styles.block}
40-
onPress={() => navigation.push(to as never, {...params} as never)}>
41-
<View style={styles.block}>
42-
<Text>{title || ''}</Text>
43-
<View>
44-
<Text style={{color: '#969696'}}>{description}</Text>
45-
</View>
46-
</View>
47-
</Button>
48-
</View>
49-
);
50-
};
51-
52-
export default ({navigation}: {navigation: ModalStackNavigation}) => {
15+
export default ({ navigation }: { navigation: ModalStackNavigation }) => {
16+
const uri = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADYAAAA2CAMAAAC7m5rvAAAAllBMVEUAAAC/v7+qqqrHx8evr6/ExMS5ubmxsbGsrKysrKytra2pqam8vLy9vb2lpaXExMT////s7Oz8/Pz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+8SJDjKdvADqbg+SCOtmyw9p94anDKwCDw7Pq8JJ7LduTga69rtaf0b3uIJyneAySe32AIPdc+r8D1bM6c23oulzvzB9S6BDnf1+HDifkUugYBCrT1OcCVd1QClQpLALQubDoHAGlsBiDMG3J0pMUthdzKhfw5LtLiUE4hnx0AgDNtnEQVZYQ5XyHf8jWasjXBAPBxgQDziQYFqwmGNmMlIrpDH+ZzihHs5A8+co4eeKUPEFKngKHIXnKvn0H++epmoWppoaP079JDL8//lsa+p9Jb0qx77sUexG0WmmhS7HvRyn2TxZ1zUyK+LY0AAAAAElFTkSuQmCC';
17+
18+
const data = Array.from(stackPageData.map((_val, i) => {
19+
return { icon: uri, text: _val.name }
20+
}));
5321
return (
5422
<ScrollView>
5523
<View style={styles.block}>
56-
{stackPageData.map((props, index) => {
57-
return (
58-
<View key={index}>
59-
<Link
60-
to={props.name as never}
61-
navigation={navigation}
62-
params={props.params}
63-
title={props.params.title}
64-
description={props.params.description}
65-
/>
66-
</View>
67-
);
68-
})}
24+
<Grid
25+
data={data}
26+
columns={3}
27+
itemStyle={{ height: 100 }}
28+
onPress={(data1,index) => {
29+
navigation.push(data1.text as never,{...stackPageData[index].params} as never)
30+
}}
31+
/>
6932
</View>
7033
</ScrollView>
7134
);

0 commit comments

Comments
 (0)