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 Choice screen, added Request and RequestValidation an…
…d improved QR Code screen
- Loading branch information
Showing
10 changed files
with
278 additions
and
12 deletions.
There are no files selected for viewing
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
36 changes: 35 additions & 1 deletion
36
client/react-native/common/components/Screens/Contacts/Add/ByQRCode.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,41 @@ | ||
import { PureComponent } from 'react' | ||
import createTabNavigator from 'react-navigation-deprecated-tab-navigator/src/createTabNavigator' | ||
import { colors } from '../../../../constants' | ||
import { | ||
borderBottom, | ||
} from '../../../../styles' | ||
|
||
export default class ByQRCode extends PureComponent { | ||
class ByQRCode extends PureComponent { | ||
render () { | ||
return null | ||
} | ||
} | ||
|
||
export default createTabNavigator( | ||
{ | ||
'Scan a QR code': ByQRCode, | ||
'View my QR code': ByQRCode, | ||
}, | ||
{ | ||
initialRouteName: 'Scan a QR code', | ||
swipeEnabled: true, | ||
animationEnabled: true, | ||
tabBarPosition: 'top', | ||
|
||
tabBarOptions: { | ||
labelStyle: { | ||
color: colors.black, | ||
}, | ||
indicatorStyle: { | ||
backgroundColor: colors.black, | ||
}, | ||
style: [ | ||
{ | ||
backgroundColor: colors.white, | ||
borderTopWidth: 0, | ||
}, | ||
borderBottom, | ||
], | ||
}, | ||
} | ||
) |
81 changes: 79 additions & 2 deletions
81
client/react-native/common/components/Screens/Contacts/Add/Choice.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,84 @@ | ||
import { PureComponent } from 'react' | ||
import React, { PureComponent } from 'react' | ||
import { TouchableOpacity } from 'react-native' | ||
import { Text, Flex } from '../../../Library' | ||
import { colors } from '../../../../constants' | ||
import { | ||
padding, | ||
borderTop, | ||
} from '../../../../styles' | ||
|
||
export default class Choice extends PureComponent { | ||
render () { | ||
return null | ||
const { navigation } = this.props | ||
return ( | ||
<Flex.Cols | ||
size={1} | ||
style={[ | ||
{ backgroundColor: colors.white }, | ||
borderTop, | ||
]} | ||
> | ||
<Flex.Rows | ||
size={1} | ||
align='center' space='evenly' | ||
style={[ | ||
padding, | ||
]} | ||
> | ||
<Item | ||
color={colors.blue} | ||
name='Bump' | ||
link='ByBump' | ||
navigation={navigation} | ||
/> | ||
<Item | ||
color={colors.red} | ||
name='Scan a QR Code' | ||
link='ByQRCode' | ||
navigation={navigation} | ||
/> | ||
<Item | ||
color={colors.orange} | ||
name='Enter a public key' | ||
link='ByPublicKey' | ||
navigation={navigation} | ||
/> | ||
<Item | ||
color={colors.yellow} | ||
name='Pending contact requests' | ||
link='Request' | ||
navigation={navigation} | ||
/> | ||
</Flex.Rows> | ||
</Flex.Cols> | ||
) | ||
} | ||
} | ||
|
||
const Item = ({ | ||
color, | ||
name, | ||
link, | ||
navigation, | ||
}) => ( | ||
<TouchableOpacity | ||
onPress={() => navigation.push(link)} | ||
style={[{ | ||
borderRadius: 8, | ||
height: 100, | ||
width: 300, | ||
backgroundColor: color, | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
}]} | ||
> | ||
<Text | ||
style={[{ | ||
fontSize: 30, | ||
color: colors.white, | ||
}]} | ||
> | ||
{ name } | ||
</Text> | ||
</TouchableOpacity> | ||
) |
77 changes: 77 additions & 0 deletions
77
client/react-native/common/components/Screens/Contacts/Add/Request.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,77 @@ | ||
import React, { PureComponent } from 'react' | ||
import { FlatList, TouchableOpacity, Image } from 'react-native' | ||
import { Screen, Flex, Text, Separator } from '../../../Library' | ||
import { colors } from '../../../../constants' | ||
import { | ||
borderTop, | ||
marginHorizontal, | ||
} from '../../../../styles' | ||
import { QueryReducer } from '../../../../relay' | ||
import { queries } from '../../../../graphql' | ||
|
||
const Item = ({ | ||
data: { id, displayName, overrideDisplayName }, | ||
navigation, | ||
}) => ( | ||
<TouchableOpacity | ||
onPress={() => navigation.push('RequestValidation', { id })} | ||
style={[ | ||
{ | ||
backgroundColor: colors.white, | ||
paddingVertical: 16, | ||
height: 71, | ||
}, | ||
marginHorizontal, | ||
]} | ||
> | ||
<Flex.Cols align='left'> | ||
<Flex.Rows size={1} align='left' style={{ marginLeft: 30 }}> | ||
<Image | ||
style={{ width: 40, height: 40, borderRadius: 50 }} | ||
source={{ | ||
uri: | ||
'https://api.adorable.io/avatars/285/' + | ||
(overrideDisplayName || displayName) + | ||
'.png', | ||
}} | ||
/> | ||
</Flex.Rows> | ||
<Flex.Rows size={6} align='left' style={{ marginLeft: 14 }}> | ||
<Text color={colors.black} left middle> | ||
{overrideDisplayName || displayName} | ||
</Text> | ||
<Text color={colors.subtleGrey} tiny> | ||
Request received 3 hours ago ... | ||
</Text> | ||
</Flex.Rows> | ||
</Flex.Cols> | ||
</TouchableOpacity> | ||
) | ||
|
||
export default class Request extends PureComponent { | ||
render () { | ||
const { navigation } = this.props | ||
return ( | ||
<Screen style={[{ backgroundColor: colors.white }, borderTop]}> | ||
<QueryReducer query={queries.ContactList}> | ||
{(state, retry) => ( | ||
<FlatList | ||
data={([].concat(state.data.ContactList || [])).filter(entry => entry.status === 'RequestedMe')} | ||
ItemSeparatorComponent={({ highlighted }) => ( | ||
<Separator highlighted={highlighted} />)} refreshing={state.type === state.loading} | ||
onRefresh={retry} | ||
renderItem={data => ( | ||
<Item | ||
key={data.id} | ||
data={data.item} | ||
separators={data.separators} | ||
navigation={navigation} | ||
/> | ||
)} | ||
/> | ||
)} | ||
</QueryReducer> | ||
</Screen> | ||
) | ||
} | ||
} |
71 changes: 71 additions & 0 deletions
71
client/react-native/common/components/Screens/Contacts/Add/RequestValidation.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,71 @@ | ||
import React, { PureComponent } from 'react' | ||
import { TouchableOpacity } from 'react-native' | ||
import { Text, Flex } from '../../../Library' | ||
import { colors } from '../../../../constants' | ||
import { | ||
borderTop, | ||
padding, | ||
} from '../../../../styles' | ||
|
||
export default class RequestValidation extends PureComponent { | ||
render () { | ||
return ( | ||
<Flex.Cols | ||
size={1} | ||
style={[ | ||
{ backgroundColor: colors.white }, | ||
borderTop, | ||
]} | ||
> | ||
<Flex.Rows | ||
size={1} | ||
align='center' space='evenly' | ||
style={[ | ||
padding, | ||
]} | ||
> | ||
<TouchableOpacity | ||
onPress={() => console.log('Accept')} | ||
style={[{ | ||
borderRadius: 8, | ||
height: 100, | ||
width: 300, | ||
backgroundColor: colors.blue, | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
}]} | ||
> | ||
<Text | ||
style={[{ | ||
fontSize: 30, | ||
color: colors.white, | ||
}]} | ||
> | ||
Accept | ||
</Text> | ||
</TouchableOpacity> | ||
<TouchableOpacity | ||
onPress={() => console.log('Decline')} | ||
style={[{ | ||
borderRadius: 8, | ||
height: 100, | ||
width: 300, | ||
backgroundColor: colors.red, | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
}]} | ||
> | ||
<Text | ||
style={[{ | ||
fontSize: 30, | ||
color: colors.white, | ||
}]} | ||
> | ||
Decline | ||
</Text> | ||
</TouchableOpacity> | ||
</Flex.Rows> | ||
</Flex.Cols> | ||
) | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,4 +16,3 @@ export default createStackNavigator( | |
}, | ||
{ initialRouteName: '1' } | ||
) | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ export default graphql` | |
id | ||
displayName | ||
overrideDisplayName | ||
status | ||
} | ||
} | ||
` |
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