diff --git a/client/react-native/android/app/build.gradle b/client/react-native/android/app/build.gradle index 542740cc9c..89d590f044 100644 --- a/client/react-native/android/app/build.gradle +++ b/client/react-native/android/app/build.gradle @@ -168,6 +168,7 @@ android { dependencies { compile project(':lottie-react-native') compile project(':react-native-vector-icons') + compile project(':react-native-view-shot') compile project(':react-native-svg') compile project(':react-native-restart') compile project(':react-native-network-info') diff --git a/client/react-native/android/app/src/main/java/chat/berty/main/MainApplication.java b/client/react-native/android/app/src/main/java/chat/berty/main/MainApplication.java index ef815c74b2..6a861613b7 100644 --- a/client/react-native/android/app/src/main/java/chat/berty/main/MainApplication.java +++ b/client/react-native/android/app/src/main/java/chat/berty/main/MainApplication.java @@ -11,6 +11,7 @@ import com.imagepicker.ImagePickerPackage; import com.masteratul.exceptionhandler.ReactNativeExceptionHandlerPackage; import org.reactnative.camera.RNCameraPackage; +import fr.greweb.reactnativeviewshot.RNViewShotPackage; import org.reactnative.camera.RNCameraPackage; import com.horcrux.svg.SvgPackage; import com.avishayil.rnrestart.ReactNativeRestartPackage; @@ -44,7 +45,8 @@ protected List getPackages() { new CorePackage(), new ImagePickerPackage(), new MainReactPackage(), - new LottiePackage(), + new LottiePackage(), + new RNViewShotPackage(), new RNCameraPackage(), new RNNetworkInfoPackage(), new ReactNativeExceptionHandlerPackage(), diff --git a/client/react-native/android/settings.gradle b/client/react-native/android/settings.gradle index d9ce11a94f..f752281a8e 100644 --- a/client/react-native/android/settings.gradle +++ b/client/react-native/android/settings.gradle @@ -3,6 +3,8 @@ include ':lottie-react-native' project(':lottie-react-native').projectDir = new File(rootProject.projectDir, '../node_modules/lottie-react-native/src/android') include ':react-native-vector-icons' project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android') +include ':react-native-view-shot' +project(':react-native-view-shot').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-view-shot/android') include ':react-native-svg' project(':react-native-svg').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-svg/android') include ':react-native-restart' diff --git a/client/react-native/common/components/Library/ContactIdentity.js b/client/react-native/common/components/Library/ContactIdentity.js new file mode 100644 index 0000000000..92e43bed56 --- /dev/null +++ b/client/react-native/common/components/Library/ContactIdentity.js @@ -0,0 +1,142 @@ +import React from 'react' +import { View, Image, Platform, Text as RNText } from 'react-native' +import Text from './Text' +import { createMaterialTopTabNavigator } from 'react-navigation' +import QRGenerator from './QRGenerator' +import { extractPublicKeyFromId, makeShareableUrl } from '../../helpers/contacts' +import colors from '../../constants/colors' +import Icon from './Icon' +import { formattedFingerprint } from '../../helpers/fingerprint' +import { padding } from '../../styles' +import { withScreenProps } from '../../helpers/views' + +const PublicKey = ({ data: { id } }) => + + {extractPublicKeyFromId(id)} + + + +export const QrCode = ({ data: { id, displayName } }) => + + + +const tabIcon = (iconName) => { + const NamedTabIcon = ({ focused }) => + + return NamedTabIcon +} + +const Fingerprint = ({ data: { id } }) => + + {formattedFingerprint(id)} + + + +const ContactIdentityTabbedContent = createMaterialTopTabNavigator( + { + 'qrcode': { + screen: withScreenProps(QrCode), + navigationOptions: { + title: 'QR Code', + tabBarIcon: tabIcon('material-qrcode'), + }, + }, + 'public-key': { + screen: withScreenProps(PublicKey), + navigationOptions: { + title: 'Public key', + tabBarIcon: tabIcon('material-key-variant'), + }, + }, + 'fingerprint': { + screen: withScreenProps(Fingerprint), + navigationOptions: { + title: 'Fingerprint', + tabBarIcon: tabIcon('material-fingerprint'), + }, + }, + }, + { + initialRouteName: 'qrcode', + swipeEnabled: Platform.OS !== 'android', + animationEnabled: true, + backBehavior: 'none', + tabBarOptions: { + activeTintColor: colors.fakeBlack, + inactiveTintColor: colors.fakeBlack, + showIcon: true, + showLabel: true, + upperCaseLabel: false, + style: { + backgroundColor: colors.white, + marginBottom: 0, + marginTop: 0, + }, + tabStyle: { + marginBottom: 0, + marginTop: 0, + }, + indicatorStyle: { + backgroundColor: colors.blue, + marginBottom: 0, + marginTop: 0, + }, + labelStyle: { + fontSize: 12, + marginBottom: 0, + marginTop: 0, + }, + }, + }, +) + +const ContactIdentity = ({ data }) => <> + + + + {data.displayName} + + {} + + + +export default ContactIdentity diff --git a/client/react-native/common/components/Library/ModalScreen.js b/client/react-native/common/components/Library/ModalScreen.js index a834a678e0..e22183ea37 100644 --- a/client/react-native/common/components/Library/ModalScreen.js +++ b/client/react-native/common/components/Library/ModalScreen.js @@ -1,6 +1,6 @@ import React from 'react' import { View } from 'react-native' -import { StackActions } from 'react-navigation' +import { StackActions, withNavigation } from 'react-navigation' import colors from '../../constants/colors' import Button from './Button' @@ -8,37 +8,69 @@ const ModalScreen = props => { const { children, navigation, + showDismiss, + width, + footer, ...otherProps } = props - return + + top: 0, + left: 0, + right: 0, + bottom: 0, + zIndex: -1, + }}> + + - + + {showDismiss + ? +