Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(rn): added contact detail screen and subscreens
- Loading branch information
Showing
7 changed files
with
229 additions
and
55 deletions.
There are no files selected for viewing
112 changes: 70 additions & 42 deletions
112
client/react-native/common/components/Screens/Contacts/Detail.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,54 +1,82 @@ | ||
import React, { PureComponent } from 'react' | ||
import { Menu } from '../../Library' | ||
import { Image, Share } from 'react-native' | ||
import { Menu, Header, Screen } from '../../Library' | ||
import { colors } from '../../../constants' | ||
|
||
export default class Detail extends PureComponent { | ||
static navigationOptions = ({ navigation }) => ({ | ||
tabBarVisible: false, | ||
header: ( | ||
<Header | ||
navigation={navigation} | ||
title='Contact details' | ||
rightBtnIcon={'edit-2'} | ||
onPressRightBtn={() => | ||
navigation.push('contacts/detail/edit', { | ||
contact: navigation.getParam('contact'), | ||
}) | ||
} | ||
backBtn | ||
/> | ||
), | ||
}) | ||
render () { | ||
const { navigation } = this.props | ||
const contact = navigation.getParam('contact') | ||
return ( | ||
<Menu> | ||
<Menu.Section customMarginTop={1}> | ||
<Menu.Item | ||
icon='message-circle' | ||
title='Send a message' | ||
onPress={() => console.log('Send')} | ||
<Screen> | ||
<Menu absolute> | ||
<Menu.Header | ||
icon={ | ||
<Image | ||
style={{ width: 78, height: 78, borderRadius: 39 }} | ||
source={{ | ||
uri: | ||
'https://api.adorable.io/avatars/285/' + | ||
contact.id + | ||
'.png', | ||
}} | ||
/> | ||
} | ||
title={contact.overrideDisplayName || contact.displayName} | ||
/> | ||
<Menu.Item | ||
icon='phone' | ||
title='Call' | ||
onPress={() => console.log('Call')} | ||
/> | ||
</Menu.Section> | ||
<Menu.Section> | ||
<Menu.Item | ||
icon='eye' | ||
title='View public key' | ||
onPress={() => console.log('Public')} | ||
/> | ||
<Menu.Item | ||
icon='share' | ||
title='Share this contact' | ||
onPress={() => console.log('Share')} | ||
/> | ||
</Menu.Section> | ||
<Menu.Section> | ||
<Menu.Item | ||
icon='slash' | ||
title='Block this contact' | ||
onPress={() => console.log('Block')} | ||
/> | ||
</Menu.Section> | ||
<Menu.Section> | ||
<Menu.Item | ||
icon='trash-2' | ||
title='Delete this contact' | ||
color={colors.error} | ||
onPress={() => console.log('Delete')} | ||
/> | ||
</Menu.Section> | ||
</Menu> | ||
<Menu.Section> | ||
<Menu.Item | ||
icon='message-circle' | ||
title='Send a message' | ||
onPress={() => console.log('Send')} | ||
/> | ||
<Menu.Item | ||
icon='phone' | ||
title='Call' | ||
onPress={() => console.log('Call')} | ||
/> | ||
</Menu.Section> | ||
<Menu.Section> | ||
<Menu.Item | ||
icon='eye' | ||
title='View public key' | ||
onPress={() => | ||
navigation.push('contacts/detail/publickey', { id: contact.id }) | ||
} | ||
/> | ||
<Menu.Item | ||
icon='share' | ||
title='Share this contact' | ||
onPress={() => | ||
Share.share({ message: contact.id }).catch(() => null) | ||
} | ||
/> | ||
</Menu.Section> | ||
<Menu.Section> | ||
<Menu.Item | ||
icon='slash' | ||
title='Block this contact' | ||
color={colors.error} | ||
onPress={() => console.log('Block')} | ||
/> | ||
</Menu.Section> | ||
</Menu> | ||
</Screen> | ||
) | ||
} | ||
} |
70 changes: 70 additions & 0 deletions
70
client/react-native/common/components/Screens/Contacts/DetailPubKey.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 |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import React, { PureComponent } from 'react' | ||
import { Clipboard } from 'react-native' | ||
import { colors } from '../../../constants' | ||
import { | ||
Flex, | ||
Screen, | ||
Header, | ||
Button, | ||
TextInputMultilineFix, | ||
} from '../../Library' | ||
import { | ||
padding, | ||
paddingVertical, | ||
textTiny, | ||
marginTop, | ||
rounded, | ||
} from '../../../styles' | ||
|
||
export default class DetailPublicKey extends PureComponent { | ||
static navigationOptions = ({ navigation }) => ({ | ||
tabBarVisible: false, | ||
header: <Header navigation={navigation} title='Public key' backBtn />, | ||
}) | ||
|
||
render () { | ||
const id = this.props.navigation.getParam('id') | ||
return ( | ||
<Screen style={[{ backgroundColor: colors.white }, paddingVertical]}> | ||
<Flex.Rows style={[padding]} align='center'> | ||
<TextInputMultilineFix | ||
style={[ | ||
{ | ||
width: 330, | ||
height: 330, | ||
backgroundColor: colors.grey7, | ||
color: colors.black, | ||
flexWrap: 'wrap', | ||
}, | ||
textTiny, | ||
padding, | ||
marginTop, | ||
rounded, | ||
]} | ||
multiline | ||
value={id} | ||
selectTextOnFocus | ||
/> | ||
<Flex.Cols align='start'> | ||
<Flex.Rows> | ||
<Button | ||
icon='copy' | ||
background={colors.blue} | ||
margin | ||
padding | ||
rounded={23} | ||
height={24} | ||
medium | ||
middle | ||
center | ||
onPress={() => Clipboard.setString(id)} | ||
> | ||
COPY THE KEY | ||
</Button> | ||
</Flex.Rows> | ||
</Flex.Cols> | ||
</Flex.Rows> | ||
</Screen> | ||
) | ||
} | ||
} |
72 changes: 70 additions & 2 deletions
72
client/react-native/common/components/Screens/Contacts/Edit.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,2 +1,70 @@ | ||
const Edit = () => null | ||
export default Edit | ||
import React, { PureComponent } from 'react' | ||
import { Image } from 'react-native' | ||
import { Header, Menu, Badge } from '../../Library' | ||
import { colors } from '../../../constants' | ||
import { choosePicture } from '../../../helpers/react-native-image-picker' | ||
|
||
export default class Edit extends PureComponent { | ||
static navigationOptions = ({ navigation }) => ({ | ||
header: ( | ||
<Header | ||
navigation={navigation} | ||
title='Contact details' | ||
rightBtnIcon={'save'} | ||
onPressRightBtn={() => console.log('Saved')} | ||
backBtn | ||
/> | ||
), | ||
}) | ||
|
||
state = { | ||
uri: null, | ||
} | ||
|
||
onChoosePicture = async event => this.setState(await choosePicture(event)) | ||
|
||
render () { | ||
const contact = this.props.navigation.getParam('contact') | ||
return ( | ||
<Menu> | ||
<Menu.Header | ||
icon={ | ||
<Badge | ||
background={colors.blue} | ||
icon='camera' | ||
medium | ||
onPress={this.onChoosePicture} | ||
> | ||
<Image | ||
style={{ width: 78, height: 78, borderRadius: 39 }} | ||
source={{ | ||
uri: | ||
this.state.uri || | ||
`https://api.adorable.io/avatars/285/${contact.id}.png`, | ||
}} | ||
/> | ||
</Badge> | ||
} | ||
/> | ||
<Menu.Section title='Firstname'> | ||
<Menu.Input | ||
value={ | ||
(contact.overrideDisplayName || contact.displayName).split( | ||
' ' | ||
)[0] || '' | ||
} | ||
/> | ||
</Menu.Section> | ||
<Menu.Section title='Lastname'> | ||
<Menu.Input | ||
value={ | ||
(contact.overrideDisplayName || contact.displayName).split( | ||
' ' | ||
)[1] || '' | ||
} | ||
/> | ||
</Menu.Section> | ||
</Menu> | ||
) | ||
} | ||
} |
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
6 changes: 4 additions & 2 deletions
6
client/react-native/common/components/Screens/Contacts/index.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
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
6 changes: 3 additions & 3 deletions
6
client/react-native/common/components/Screens/Settings/MyAccount/index.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