Skip to content

Commit 629661b

Browse files
committed
Fix android list border radius Isolate list card
1 parent 2920434 commit 629661b

File tree

5 files changed

+61
-91
lines changed

5 files changed

+61
-91
lines changed

src/components/Card/List/index.tsx

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import React from 'react';
2+
import {ViewStyle, View, Text, Platform, ListRenderItem} from 'react-native';
3+
4+
import {TouchableShadow} from '../../Shadow/Touchable';
5+
import {K} from '../../../store/constants';
6+
import {ViewShadow} from '../../Shadow/View';
7+
import {List, ListItem} from '@ui-kitten/components';
8+
9+
export const ListCard = (props: {
10+
theme: string;
11+
data: ReadonlyArray<any> | null | undefined;
12+
style?: ViewStyle;
13+
firstInPage?: boolean;
14+
}) => {
15+
const themeFont = Platform.OS === 'ios' ? K.fonts.ios : K.fonts.android;
16+
const themeColor = props.theme === 'dark' ? K.colors.dark : K.colors.light;
17+
18+
const renderItem = ({item, index}) => {
19+
return (
20+
<ListItem
21+
title={`${item.title}`}
22+
onPress={item.onPress}
23+
style={{height: 50}}
24+
titleStyle={{...themeFont.subhead, color: themeColor.primaryText}}
25+
/>
26+
);
27+
};
28+
29+
return (
30+
<ViewShadow
31+
theme={props.theme}
32+
style={{
33+
height: props.data.length * 50,
34+
marginTop: props.firstInPage ? -20 : 0,
35+
marginBottom: 20,
36+
borderRadius: 20,
37+
...Platform.select({
38+
ios: {
39+
40+
},
41+
android: {
42+
overflow: 'hidden',
43+
}
44+
})
45+
}}>
46+
<List
47+
data={props.data}
48+
renderItem={renderItem}
49+
scrollEnabled={false}
50+
style={{overflow: 'hidden', borderRadius: 20}}
51+
/>
52+
</ViewShadow>
53+
);
54+
};

src/components/Text/Body/index.tsx

Lines changed: 0 additions & 26 deletions
This file was deleted.

src/components/Text/Header/index.tsx

Lines changed: 0 additions & 26 deletions
This file was deleted.

src/pages/Settings/index.tsx

Lines changed: 4 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import Modal, {
1111
import {K} from '../../store/constants';
1212
import {PageHeader} from '../../components/Page/PageHeader';
1313
import {ViewShadow} from '../../components/Shadow/View';
14+
import {ListCard} from '../../components/Card/List';
1415

1516
const SettingsPageC = (props: any) => {
1617
const themeColor = props.theme === 'dark' ? K.colors.dark : K.colors.light;
@@ -41,7 +42,7 @@ const SettingsPageC = (props: any) => {
4142
collecting data about you if you have location sharing turned on.
4243
</Text>
4344
<Text
44-
style={{color: themeColor.secondaryText}}
45+
style={{color: themeColor.secondaryText}}
4546
onPress={() => {
4647
Linking.openURL(
4748
'https://firebase.google.com/terms/data-processing-terms',
@@ -149,17 +150,6 @@ const SettingsPageC = (props: any) => {
149150
},
150151
];
151152

152-
const renderItem = ({item, index}) => {
153-
return (
154-
<ListItem
155-
title={`${item.title}`}
156-
onPress={item.onPress}
157-
style={{height: 50}}
158-
titleStyle={{...themeFont.subhead, color: themeColor.primaryText}}
159-
/>
160-
);
161-
};
162-
163153
return (
164154
<Layout style={{height: '100%', flex: 1}}>
165155
<ScrollView>
@@ -170,24 +160,8 @@ const SettingsPageC = (props: any) => {
170160
navigation={props.navigation}
171161
/>
172162
<Layout style={{marginHorizontal: 20}}>
173-
<ViewShadow theme={props.theme} style={{height: (50*3), marginTop: -20}}>
174-
<List
175-
data={list1}
176-
renderItem={renderItem}
177-
scrollEnabled={false}
178-
style={{borderRadius: 20, overflow: 'hidden'}}
179-
/>
180-
</ViewShadow>
181-
<ViewShadow
182-
theme={props.theme}
183-
style={{height: (50*4), marginTop: 20, marginBottom: 20}}>
184-
<List
185-
data={list2}
186-
renderItem={renderItem}
187-
scrollEnabled={false}
188-
style={{overflow: 'hidden', borderRadius: 20}}
189-
/>
190-
</ViewShadow>
163+
<ListCard theme={props.theme} data={list1} firstInPage/>
164+
<ListCard theme={props.theme} data={list2} />
191165
</Layout>
192166
</ScrollView>
193167

src/pages/SettingsPeople/index.tsx

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import React from 'react';
2+
import {View} 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

1112
const SettingsPeoplePageC = (props: any) => {
1213
const themeColor = props.theme === 'dark' ? K.colors.dark : K.colors.light;
@@ -60,14 +61,7 @@ const SettingsPeoplePageC = (props: any) => {
6061
/>
6162
{/* //TODO: ACTION BUTTON PRESS^^ */}
6263
<Layout style={{marginHorizontal: 20}}>
63-
<ViewShadow theme={props.theme} style={{height: 150, marginTop: -20}}>
64-
<List
65-
data={list}
66-
renderItem={renderItem}
67-
scrollEnabled={false}
68-
style={{borderRadius: 20, overflow: 'hidden'}}
69-
/>
70-
</ViewShadow>
64+
<ListCard theme={props.theme} data={list} firstInPage />
7165
</Layout>
7266
</Layout>
7367
);

0 commit comments

Comments
 (0)