diff --git a/client/react-native/common/components/App.js b/client/react-native/common/components/App.js index 254eb1414c..620e359b4f 100644 --- a/client/react-native/common/components/App.js +++ b/client/react-native/common/components/App.js @@ -1,9 +1,9 @@ import React, { PureComponent } from 'react' import Screens from './Screens' -import { NativeModules } from 'react-native' +import { NativeModules, Platform } from 'react-native' import { subscriptions } from '../graphql' import { SafeAreaView } from 'react-navigation' - +import KeyboardSpacer from 'react-native-keyboard-spacer' const { CoreModule } = NativeModules export default class App extends PureComponent { @@ -38,6 +38,7 @@ export default class App extends PureComponent { return ( + {Platform.OS === 'ios' && } ) } diff --git a/client/react-native/common/components/Library/Button.js b/client/react-native/common/components/Library/Button.js index 33467b529c..f7ba34bc0f 100644 --- a/client/react-native/common/components/Library/Button.js +++ b/client/react-native/common/components/Library/Button.js @@ -1,6 +1,8 @@ import React from 'react' import { Text } from '../Library' -const Button = ({ style, ...props }) => +const Button = ({ style, ...props }) => ( + +) export default Button diff --git a/client/react-native/common/components/Library/CustomTextInput.js b/client/react-native/common/components/Library/CustomTextInput.js index eba4513da8..4f8b2f3937 100644 --- a/client/react-native/common/components/Library/CustomTextInput.js +++ b/client/react-native/common/components/Library/CustomTextInput.js @@ -6,7 +6,7 @@ import { Text, TextInput, TouchableOpacity, - View + View, } from 'react-native' import { Icon } from '.' import { colors, fonts } from '../../constants' @@ -28,11 +28,11 @@ type Props = { borderRight?: number, borderTop?: number, borderLeft?: number, - value?: string + value?: string, } type State = {| - passwordVisible: boolean + passwordVisible: boolean, |} class CustomTextInput extends React.PureComponent { @@ -41,11 +41,11 @@ class CustomTextInput extends React.PureComponent { borderBottom: 0, borderRight: 0, borderTop: 0, - borderLeft: 0 + borderLeft: 0, } state = { - passwordVisible: false + passwordVisible: false, } input: ?TextInput @@ -60,7 +60,7 @@ class CustomTextInput extends React.PureComponent { _togglePasswordVisibility = () => { this.setState(prevState => ({ - passwordVisible: !prevState.passwordVisible + passwordVisible: !prevState.passwordVisible, })) } @@ -81,7 +81,7 @@ class CustomTextInput extends React.PureComponent { const inputPadding = { paddingLeft: renderLeft ? 0 : 18, - paddingRight: renderRight || this.props.secureTextEntry ? 0 : 18 + paddingRight: renderRight || this.props.secureTextEntry ? 0 : 18, } return ( @@ -146,7 +146,7 @@ class CustomTextInput extends React.PureComponent { const styles = StyleSheet.create({ container: { alignItems: 'center', - flexDirection: 'row' + flexDirection: 'row', }, input: { flex: 1, @@ -155,25 +155,25 @@ const styles = StyleSheet.create({ color: colors.textGrey, fontSize: 14, lineHeight: 24, - width: 50 + width: 50, }, eyeIcon: { color: colors.subtleGrey, padding: 15, - fontSize: 16 + fontSize: 16, }, errorContainer: { backgroundColor: colors.error, alignItems: 'flex-start', paddingHorizontal: 6, - paddingVertical: 4 + paddingVertical: 4, }, error: { color: colors.white, fontFamily: fonts.medium, fontSize: 10, - lineHeight: 12 - } + lineHeight: 12, + }, }) export default CustomTextInput diff --git a/client/react-native/common/components/Library/Flex.js b/client/react-native/common/components/Library/Flex.js index 8fc8089db4..37638dfb05 100644 --- a/client/react-native/common/components/Library/Flex.js +++ b/client/react-native/common/components/Library/Flex.js @@ -1,5 +1,5 @@ import React from 'react' -import { View } from 'react-native' +import { View, TouchableOpacity } from 'react-native' const getDirection = (key, directions = { rows: 'column', cols: 'row' }) => directions[key] || null @@ -12,7 +12,7 @@ const getAlign = ( center: 'center', stretch: 'stretch', } -) => align[key] || align['center'] +) => align[key] || align['stretch'] const getJustify = ( key, @@ -35,23 +35,27 @@ export const Block = ({ children, style, ...props -}) => ( - - {children} - -) +}) => { + style = [ + { + flex: size, + flexDirection: direction && getDirection(direction), + alignItems: align && getAlign(align), + alignSelf: self && getAlign(self), + justifyContent: justify && getJustify(justify), + }, + style, + ] + return props.onPress ? ( + + {children} + + ) : ( + + {children} + + ) +} export const Grid = props => diff --git a/client/react-native/common/components/Library/Header.js b/client/react-native/common/components/Library/Header.js index 880f01628e..6dc93dd878 100644 --- a/client/react-native/common/components/Library/Header.js +++ b/client/react-native/common/components/Library/Header.js @@ -12,17 +12,8 @@ import { const [defaultTextColor, defaultBackColor] = [colors.black, colors.white] -const HeaderButton = ({ icon, color, onPress }) => { - return ( - + + + )} ) diff --git a/client/react-native/common/components/Screens/Contacts/Add/Choice.js b/client/react-native/common/components/Screens/Contacts/Add/Choice.js index 3642a4642e..a4ad96d089 100644 --- a/client/react-native/common/components/Screens/Contacts/Add/Choice.js +++ b/client/react-native/common/components/Screens/Contacts/Add/Choice.js @@ -16,31 +16,31 @@ export default class Choice extends PureComponent { @@ -65,10 +65,10 @@ const Item = ({ icon, name, link, navigation }) => ( ]} > - + {name} - + ) diff --git a/client/react-native/common/components/Screens/Contacts/Add/Request.js b/client/react-native/common/components/Screens/Contacts/Add/Request.js index 4bceed9781..bdd394f020 100644 --- a/client/react-native/common/components/Screens/Contacts/Add/Request.js +++ b/client/react-native/common/components/Screens/Contacts/Add/Request.js @@ -42,7 +42,7 @@ class Request extends PureComponent { state={state} retry={retry} subtitle={subtitle} - action='RequestValidation' + action='contacts/add/request-validation' navigation={navigation} /> ) diff --git a/client/react-native/common/components/Screens/Contacts/Add/index.js b/client/react-native/common/components/Screens/Contacts/Add/index.js index 49ca9f6500..ba8bcb830a 100644 --- a/client/react-native/common/components/Screens/Contacts/Add/index.js +++ b/client/react-native/common/components/Screens/Contacts/Add/index.js @@ -11,16 +11,16 @@ import { Header } from '../../../Library' export default createSubStackNavigator( { - Request, - ByQRCode, - ByPublicKey, - ByBump, - Invite, - RequestValidation, - Choice, + 'contacts/add/request': Request, + 'contacts/add/by-qr-code': ByQRCode, + 'contacts/add/by-public-key': ByPublicKey, + 'contacts/add/by-bump': ByBump, + 'contacts/add/invite': Invite, + 'contacts/add/request-validation': RequestValidation, + 'contacts/add/choice': Choice, }, { - initialRouteName: 'Choice', + initialRouteName: 'contacts/add/choice', navigationOptions: ({ navigation }) => ({ header: (
navigation.push('Add')} + onPressRightBtn={() => navigation.push('contacts/add')} searchBar searchHandler={navigation.getParam('searchHandler')} /> @@ -86,7 +86,7 @@ class ContactListWrapper extends PureComponent { state={state} retry={retry} subtitle='Last seen 3 hours ago ...' // Placeholder - action='Detail' + action='contacts/detail' navigation={navigation} /> ) diff --git a/client/react-native/common/components/Screens/Contacts/index.js b/client/react-native/common/components/Screens/Contacts/index.js index 2b526953f4..b8f6f7f556 100644 --- a/client/react-native/common/components/Screens/Contacts/index.js +++ b/client/react-native/common/components/Screens/Contacts/index.js @@ -6,13 +6,13 @@ import List from './List' export default createSubStackNavigator( { - List, - Add, - Detail, - Edit, + 'contacts/list': List, + 'contacts/add': Add, + 'contacts/detail': Detail, + 'contacts/edit': Edit, }, { - initialRouteName: 'List', + initialRouteName: 'contacts/list', hedaer: null, } ) diff --git a/client/react-native/common/components/Screens/Settings/List.js b/client/react-native/common/components/Screens/Settings/List.js index 7cd1ce1374..64e9090bb4 100644 --- a/client/react-native/common/components/Screens/Settings/List.js +++ b/client/react-native/common/components/Screens/Settings/List.js @@ -46,7 +46,7 @@ export default class List extends PureComponent { navigation.push('Devtools')} + onPress={() => navigation.push('settings/devtools')} /> ({ header: (
diff --git a/client/react-native/common/components/Screens/index.js b/client/react-native/common/components/Screens/index.js index ee78c18782..87a3b1e36d 100644 --- a/client/react-native/common/components/Screens/index.js +++ b/client/react-native/common/components/Screens/index.js @@ -7,12 +7,12 @@ import { borderTop, shadow } from '../../styles' export default createTabNavigator( { - Contacts, - Chats, - Settings, + contacts: Contacts, + chats: Chats, + settings: Settings, }, { - initialRouteName: 'Chats', + initialRouteName: 'chats', swipeEnabled: true, animationEnabled: true, tabBarPosition: 'bottom', diff --git a/client/react-native/common/constants/colors.js b/client/react-native/common/constants/colors.js index ade5949d36..bfb5753ca1 100644 --- a/client/react-native/common/constants/colors.js +++ b/client/react-native/common/constants/colors.js @@ -31,4 +31,6 @@ export default { success: '#15D09D', warning: '#FFD665', error: '#F00062', + + background: '#FAFAFE', } diff --git a/client/react-native/common/graphql/mutations/ConversationInvite.js b/client/react-native/common/graphql/mutations/ConversationInvite.js new file mode 100644 index 0000000000..5043109d77 --- /dev/null +++ b/client/react-native/common/graphql/mutations/ConversationInvite.js @@ -0,0 +1,54 @@ +import { graphql } from 'react-relay' +import { commit } from '../../relay' + +const ConversationInviteMutation = graphql` + mutation ConversationInviteMutation($input: ConversationInviteInput!) { + ConversationInvite(input: $input) { + clientMutationId + bertyEntityConversation { + id + createdAt + updatedAt + deletedAt + title + topic + members { + id + createdAt + updatedAt + deletedAt + status + contact { + id + createdAt + updatedAt + deletedAt + sigchain + status + devices { + id + createdAt + updatedAt + deletedAt + name + status + apiVersion + contactId + } + displayName + displayStatus + overrideDisplayName + overrideDisplayStatus + } + conversationId + contactId + } + } + } + } +` + +export default { + commit: input => + commit(ConversationInviteMutation, 'ConversationInvite', input), +} diff --git a/client/react-native/common/graphql/mutations/index.js b/client/react-native/common/graphql/mutations/index.js index 33dab9134e..0d72598f6b 100644 --- a/client/react-native/common/graphql/mutations/index.js +++ b/client/react-native/common/graphql/mutations/index.js @@ -2,3 +2,4 @@ export contactRequest from './ContactRequest' export contactAcceptRequest from './ContactAcceptRequest' export conversationCreate from './ConversationCreate' export conversationAddMessage from './ConversationAddMessage' +export conversationInvite from './ConversationInvite' diff --git a/client/react-native/common/relay/commit.js b/client/react-native/common/relay/commit.js index 3ba6ac2938..6c3dfdd8ac 100644 --- a/client/react-native/common/relay/commit.js +++ b/client/react-native/common/relay/commit.js @@ -1,8 +1,8 @@ import { commitMutation } from 'react-relay' import environment from './environment' -export default (mutation, clientMutationId, input = {}) => - new Promise((resolve, reject) => +export default (mutation, clientMutationId, input = {}, configs) => { + return new Promise((resolve, reject) => commitMutation(environment, { mutation, variables: { input: { clientMutationId, ...input } }, @@ -14,5 +14,7 @@ export default (mutation, clientMutationId, input = {}) => resolve(res) }, onError: reject, + ...configs, }) ) +} diff --git a/client/react-native/common/relay/environment.js b/client/react-native/common/relay/environment.js index 5d510163c9..5aeeed6305 100644 --- a/client/react-native/common/relay/environment.js +++ b/client/react-native/common/relay/environment.js @@ -106,7 +106,6 @@ const setupSubscription = async (config, variables, cacheConfig, observer) => { ) const onNext = result => { - console.log(result) observer.onNext(result) } diff --git a/client/react-native/common/styles.js b/client/react-native/common/styles.js index 4a5e7729fd..8c37f0f39b 100644 --- a/client/react-native/common/styles.js +++ b/client/react-native/common/styles.js @@ -51,31 +51,26 @@ const styles = StyleSheet.create({ lineHeight: 14, fontSize: 10, textAlign: 'center', - color: colors.textGrey, }, smallText: { lineHeight: 20, fontSize: 14, textAlign: 'center', - color: colors.textGrey, }, mediumText: { lineHeight: 20, fontSize: 16, textAlign: 'center', - color: colors.textGrey, }, bigText: { lineHeight: 30, fontSize: 25, textAlign: 'center', - color: colors.textGrey, }, largeText: { lineHeight: 23, fontSize: 18, textAlign: 'center', - color: colors.textGrey, }, textGrey: { color: colors.textGrey, diff --git a/client/react-native/common/utils/conversation.js b/client/react-native/common/utils/conversation.js new file mode 100644 index 0000000000..77d0fa271b --- /dev/null +++ b/client/react-native/common/utils/conversation.js @@ -0,0 +1,13 @@ +export const getTitle = ({ title, members } = this.props) => + title || + members + .map((m, index) => { + const displayName = + m.contact.status === 'Myself' + ? m.contact.status + : m.contact.overrideDisplayName || m.contact.displayName + const before = + index === 0 ? '' : index === members.length - 1 ? ' and ' : ', ' + return `${before}${displayName}` + }) + .join('') diff --git a/client/react-native/common/utils/index.js b/client/react-native/common/utils/index.js new file mode 100644 index 0000000000..cc7659d972 --- /dev/null +++ b/client/react-native/common/utils/index.js @@ -0,0 +1 @@ +export * as conversation from './conversation' diff --git a/client/react-native/package.json b/client/react-native/package.json index 006606220f..ff6f628155 100644 --- a/client/react-native/package.json +++ b/client/react-native/package.json @@ -13,6 +13,7 @@ "react-art": "^16.4.2", "react-dom": "^16.4.2", "react-native": "^0.55.4", + "react-native-keyboard-spacer": "^0.4.1", "react-native-network-info": "^3.2.2", "react-native-vector-icons": "^5.0.0", "react-native-web": "^0.8.9", diff --git a/client/react-native/web/public/index.html b/client/react-native/web/public/index.html index 2dbdc50225..f51f0b7407 100644 --- a/client/react-native/web/public/index.html +++ b/client/react-native/web/public/index.html @@ -12,7 +12,14 @@ diff --git a/client/react-native/yarn.lock b/client/react-native/yarn.lock index 46ece64e7a..d8f3ee36b0 100644 --- a/client/react-native/yarn.lock +++ b/client/react-native/yarn.lock @@ -5210,6 +5210,10 @@ react-native-drawer-layout@1.3.2: dependencies: react-native-dismiss-keyboard "1.0.0" +react-native-keyboard-spacer@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/react-native-keyboard-spacer/-/react-native-keyboard-spacer-0.4.1.tgz#46f18a320432098a25ea9fa89f5143dd254d332d" + react-native-network-info@^3.2.2: version "3.2.2" resolved "https://registry.yarnpkg.com/react-native-network-info/-/react-native-network-info-3.2.2.tgz#93625587ab5ae31b7c853f37ec2b75a0af6c936d"