Skip to content

Commit 634ec22

Browse files
committed
Update all lists to use ListCard
1 parent 629661b commit 634ec22

File tree

5 files changed

+25
-27
lines changed

5 files changed

+25
-27
lines changed

App.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import {K} from './src/store/constants';
2525

2626
import {HomePage} from './src/pages/Home';
2727
import {SettingsPage} from './src/pages/Settings';
28-
import {SettingsToggleThemePage} from './src/pages/SettingsToggleTheme';
28+
import {SettingsThemePage} from './src/pages/SettingsTheme';
2929
import {FindPage} from './src/pages/Find';
3030
import {SettingsPeoplePage} from './src/pages/SettingsPeople';
3131

@@ -38,7 +38,7 @@ const SettingsPageNest = () => {
3838
return (
3939
<Stack.Navigator initialRouteName="Settings" headerMode="none">
4040
<Stack.Screen name="Settings" component={SettingsPage} />
41-
<Stack.Screen name="Theme" component={SettingsToggleThemePage} />
41+
<Stack.Screen name="Theme" component={SettingsThemePage} />
4242
<Stack.Screen name="People" component={SettingsPeoplePage} />
4343
</Stack.Navigator>
4444
);

src/components/Card/List/index.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export const ListCard = (props: {
1111
data: ReadonlyArray<any> | null | undefined;
1212
style?: ViewStyle;
1313
firstInPage?: boolean;
14+
renderItem?({ item, index }): JSX.Element;
1415
}) => {
1516
const themeFont = Platform.OS === 'ios' ? K.fonts.ios : K.fonts.android;
1617
const themeColor = props.theme === 'dark' ? K.colors.dark : K.colors.light;
@@ -21,7 +22,7 @@ export const ListCard = (props: {
2122
title={`${item.title}`}
2223
onPress={item.onPress}
2324
style={{height: 50}}
24-
titleStyle={{...themeFont.subhead, color: themeColor.primaryText}}
25+
titleStyle={{...themeFont.subhead, color: themeColor.primaryText, marginLeft: 10}}
2526
/>
2627
);
2728
};
@@ -35,17 +36,15 @@ export const ListCard = (props: {
3536
marginBottom: 20,
3637
borderRadius: 20,
3738
...Platform.select({
38-
ios: {
39-
40-
},
39+
ios: {},
4140
android: {
4241
overflow: 'hidden',
4342
}
4443
})
4544
}}>
4645
<List
4746
data={props.data}
48-
renderItem={renderItem}
47+
renderItem={props.renderItem ?? renderItem}
4948
scrollEnabled={false}
5049
style={{overflow: 'hidden', borderRadius: 20}}
5150
/>

src/pages/Home/index.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {ViewShadow} from '../../components/Shadow/View';
99
import {TextButton} from '../../components/Button/Text';
1010

1111
const HomePageC = (props: any) => {
12-
console.log(props.theme)
12+
console.log(props.theme);
1313
const themeColor = props.theme === 'dark' ? K.colors.dark : K.colors.light;
1414
const themeFont = Platform.OS === 'ios' ? K.fonts.ios : K.fonts.android;
1515

@@ -23,11 +23,14 @@ const HomePageC = (props: any) => {
2323
navigation={props.navigation}
2424
/>
2525
<Layout style={{marginHorizontal: 20}}>
26-
<ViewShadow theme={props.theme} style={{marginTop: -20}}>
26+
<ViewShadow
27+
theme={props.theme}
28+
style={{marginTop: -20, borderRadius: 20, overflow: 'hidden'}}>
29+
{/* //FIXME: SHADOW NOT SHOWING */}
2730
<Layout
2831
style={{
29-
overflow: 'hidden',
3032
borderRadius: 20,
33+
overflow: 'hidden',
3134
padding: 20,
3235
backgroundColor: '#E41C1C',
3336
}}>

src/pages/SettingsToggleTheme/index.tsx renamed to src/pages/SettingsTheme/index.tsx

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
import React from 'react';
2+
import {View, Platform} from 'react-native';
23
import {Layout, List, ListItem, Text} from '@ui-kitten/components';
34
import {connect} from 'react-redux';
45
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
56

67
import {K} from '../../store/constants';
78
import {PageHeader} from '../../components/Page/PageHeader';
89
import {ViewShadow} from '../../components/Shadow/View';
9-
import {View} from 'react-native';
10+
import {ListCard} from '../../components/Card/List';
1011

11-
const SettingsToggleThemePageC = (props: any) => {
12+
const SettingsThemePageC = (props: any) => {
1213
const themeColor = props.theme === 'dark' ? K.colors.dark : K.colors.light;
14+
const themeFont = Platform.OS === 'ios' ? K.fonts.ios : K.fonts.android;
1315

1416
const list = [
1517
{
@@ -45,6 +47,7 @@ const SettingsToggleThemePageC = (props: any) => {
4547
title={`${item.title}`}
4648
onPress={item.onPress}
4749
style={{height: 50, ...selectedStyle}}
50+
titleStyle={{...themeFont.subhead, color: themeColor.primaryText, marginLeft: 10}}
4851
icon={() =>
4952
item.selected ? (
5053
<Icon
@@ -74,14 +77,7 @@ const SettingsToggleThemePageC = (props: any) => {
7477
onLeadingButtonPress={() => props.navigation.navigate('Settings')}
7578
/>
7679
<Layout style={{marginHorizontal: 20}}>
77-
<ViewShadow theme={props.theme} style={{height: 150, marginTop: -20}}>
78-
<List
79-
data={list}
80-
renderItem={renderItem}
81-
scrollEnabled={false}
82-
style={{borderRadius: 20, overflow: 'hidden'}}
83-
/>
84-
</ViewShadow>
80+
<ListCard theme={props.theme} data={list} firstInPage renderItem={renderItem} />
8581
</Layout>
8682
</Layout>
8783
);
@@ -102,7 +98,7 @@ const mapDispatchToProps = (dispatch: any) => {
10298
};
10399
};
104100

105-
export const SettingsToggleThemePage = connect(
101+
export const SettingsThemePage = connect(
106102
mapStateToProps,
107103
mapDispatchToProps,
108-
)(SettingsToggleThemePageC);
104+
)(SettingsThemePageC);

src/store/constants.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {iOSUIKit, human} from 'react-native-typography';
1+
import {iOSUIKit, human, robotoWeights} from 'react-native-typography';
22

33
export const K = {
44
colors: {
@@ -40,16 +40,16 @@ export const K = {
4040
body: iOSUIKit.bodyObject,
4141
},
4242
android: {
43-
largeTitleE: human.largeTitleObject,
43+
largeTitleE: {...human.largeTitleObject, ...robotoWeights.medium},
4444
largeTitle: human.largeTitleObject,
4545

46-
smallTitleE: human.title3Object,
46+
smallTitleE: {...human.title3Object, ...robotoWeights.medium},
4747
smallTitle: human.title3Object,
4848

49-
subheadE: human.subheadObject,
49+
subheadE: {...human.subheadObject, ...robotoWeights.medium},
5050
subhead: human.subheadObject,
5151

52-
bodyE: human.bodyObject,
52+
bodyE: {...human.bodyObject, ...robotoWeights.medium},
5353
body: human.bodyObject,
5454
}
5555
}

0 commit comments

Comments
 (0)