From 5151fa54e2cdfa80e5b1764e37f13df820346469 Mon Sep 17 00:00:00 2001 From: Godefroy Ponsinet Date: Thu, 6 Jun 2019 16:13:22 +0200 Subject: [PATCH] fix(rn): add container to contact modals Signed-off-by: Godefroy Ponsinet --- .../view/screen/Contacts/ContactCardModal.js | 29 +++-- .../app/view/screen/Contacts/Detail/Detail.js | 100 +++++++++--------- 2 files changed, 67 insertions(+), 62 deletions(-) diff --git a/client/react-native/app/view/screen/Contacts/ContactCardModal.js b/client/react-native/app/view/screen/Contacts/ContactCardModal.js index 49a3f27eb5..4ee024a288 100644 --- a/client/react-native/app/view/screen/Contacts/ContactCardModal.js +++ b/client/react-native/app/view/screen/Contacts/ContactCardModal.js @@ -7,6 +7,7 @@ import { ModalScreen, } from '@berty/component' import { withNavigation } from 'react-navigation' +import { Store } from '@berty/container' const modalWidth = 320 @@ -23,17 +24,23 @@ class ContactCardModal extends React.Component { } return ( - - - } - > - - - + + {data => ( + + + } + > + + + + )} + ) } } diff --git a/client/react-native/app/view/screen/Contacts/Detail/Detail.js b/client/react-native/app/view/screen/Contacts/Detail/Detail.js index 3bc04588ec..c6b93e88d2 100644 --- a/client/react-native/app/view/screen/Contacts/Detail/Detail.js +++ b/client/react-native/app/view/screen/Contacts/Detail/Detail.js @@ -5,7 +5,7 @@ import React, { PureComponent } from 'react' import { Avatar, Header, Menu, Screen } from '@berty/component' import { colors } from '@berty/common/constants' -import { withRelayContext } from '@berty/relay/context' +import { withStoreContext } from '@berty/store/context' import { Store } from '@berty/container' import { withGoBack } from '@berty/component/BackActionProvider' @@ -56,7 +56,7 @@ class DetailsBase extends PureComponent { deleteContact = async () => { try { - await this.props.context.contactRemove({ + await this.props.context.node.service.contactRemove({ id: this.props.navigation.getParam('id'), }) this.props.goBack(null) @@ -70,61 +70,59 @@ class DetailsBase extends PureComponent { const id = navigation.getParam('id') return ( - {data => - ( - - - } - title={data.overrideDisplayName || data.displayName} + {data => ( + + + } + title={data.overrideDisplayName || data.displayName} + /> + + console.log('Send')} /> - - console.log('Send')} - /> - console.log('Call')} - /> - - - - navigation.navigate('modal/contacts/card', data) - } - /> - - - this.blockConfirm()} - /> - - - - - - - ) - } + console.log('Call')} + /> + + + + navigation.navigate('modal/contacts/card', data) + } + /> + + + this.blockConfirm()} + /> + + + + + + + )} ) } } -const Details = withGoBack(withRelayContext(withNamespaces()(DetailsBase))) +const Details = withGoBack(withStoreContext(withNamespaces()(DetailsBase))) Details.navigationOptions = ({ navigation }) => ({ header: (