Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Godefroy Ponsinet <godefroy.ponsinet@outlook.com>
- Loading branch information
Showing
4 changed files
with
95 additions
and
6 deletions.
There are no files selected for viewing
94 changes: 92 additions & 2 deletions
94
client/react-native/common/components/Screens/Chats/List.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,97 @@ | ||
import { PureComponent } from 'react' | ||
import React, { PureComponent } from 'react' | ||
import { FlatList, TouchableOpacity } from 'react-native' | ||
import { Screen, Flex, Text, Separator } from '../../Library' | ||
import { colors } from '../../../constants' | ||
import { | ||
marginLeft, | ||
paddingLeft, | ||
paddingRight, | ||
padding, | ||
borderBottom, | ||
} from '../../../styles' | ||
|
||
const genChats = ( | ||
title = [ | ||
'Myla Maldonado', | ||
'Graeme Kenny', | ||
'Sienna-Rose Carter', | ||
'Marcos Odonnell', | ||
'Arnold Puckett', | ||
'Chay Blake', | ||
'Katarina Rosario', | ||
'Amy-Louise Chaney', | ||
'Janet Steele', | ||
'Rodney Ayala', | ||
] | ||
) => | ||
title.map((t, k) => ({ | ||
id: k.toString(), | ||
title: t, | ||
})) | ||
|
||
const Header = ({ navigation }) => ( | ||
<Flex.Rows | ||
size={1} | ||
style={[ | ||
{ backgroundColor: colors.white, height: 72 }, | ||
borderBottom, | ||
padding, | ||
]} | ||
> | ||
<Flex.Cols size={1} align='start' space='between'> | ||
<Text icon='feather-users' large color={colors.black}> | ||
Contacts | ||
</Text> | ||
</Flex.Cols> | ||
</Flex.Rows> | ||
) | ||
const Item = ({ data: { id, title }, navigation }) => ( | ||
<TouchableOpacity | ||
onPress={() => navigation.push('Detail', { id })} | ||
style={{ | ||
backgroundColor: colors.white, | ||
paddingVertical: 16, | ||
height: 71, | ||
}} | ||
> | ||
<Flex.Cols align='left' style={{ marginLeft }}> | ||
<Flex.Rows size={1} align='left'> | ||
<Text color={colors.black} left middle> | ||
{title} | ||
</Text> | ||
<Text color={colors.subtleGrey} tiny> | ||
Last message sent 3 hours ago ... | ||
</Text> | ||
</Flex.Rows> | ||
</Flex.Cols> | ||
</TouchableOpacity> | ||
) | ||
|
||
export default class List extends PureComponent { | ||
static navigationOptions = ({ navigation }) => ({ | ||
header: <Header navigation={navigation} />, | ||
tabBarVisible: true, | ||
}) | ||
render () { | ||
return null | ||
const { navigation } = this.props | ||
return ( | ||
<Screen style={[{ backgroundColor: colors.white }]}> | ||
<FlatList | ||
data={genChats()} | ||
style={[paddingLeft, paddingRight]} | ||
ItemSeparatorComponent={({ highlighted }) => ( | ||
<Separator highlighted={highlighted} /> | ||
)} | ||
renderItem={data => ( | ||
<Item | ||
key={data.id} | ||
data={data.item} | ||
separators={data.separators} | ||
navigation={navigation} | ||
/> | ||
)} | ||
/> | ||
</Screen> | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters