From 8380fb9a3d8176dacfa7a87819412db327a338a6 Mon Sep 17 00:00:00 2001 From: Arnaud Vergnet Date: Thu, 2 Apr 2020 19:38:39 +0200 Subject: [PATCH] Used other image modal lib as the previous one broke back button on android --- components/Home/FeedItem.js | 19 +++++++--- package.json | 2 +- screens/Amicale/ClubDisplayScreen.js | 43 +++++++++-------------- screens/HomeScreen.js | 7 ---- screens/Planning/PlanningDisplayScreen.js | 31 ++++++++-------- 5 files changed, 46 insertions(+), 56 deletions(-) diff --git a/components/Home/FeedItem.js b/components/Home/FeedItem.js index 1734c36..513a954 100644 --- a/components/Home/FeedItem.js +++ b/components/Home/FeedItem.js @@ -1,9 +1,9 @@ import * as React from 'react'; import {Avatar, Button, Card, withTheme} from 'react-native-paper'; -import {TouchableOpacity, View} from "react-native"; +import {View} from "react-native"; import Autolink from "react-native-autolink"; import i18n from "i18n-js"; - +import ImageModal from 'react-native-image-modal'; const ICON_AMICALE = require('../../assets/amicale.png'); @@ -35,9 +35,18 @@ function FeedItem(props) { left={getAvatar} /> {props.full_picture !== '' && props.full_picture !== undefined ? - - - : } + + : } {props.message !== undefined ? { this.props.navigation.setOptions({title: this.displayData.name}) } - showImageModal = () => { - this.setState({imageModalVisible: true}); - }; - - hideImageModal = () => { - this.setState({imageModalVisible: false}); - }; - getResponsiblesRender(resp: Array) { let final = []; for (let i = 0; i < resp.length; i++) { @@ -63,7 +55,7 @@ class ClubDisplayScreen extends React.Component { left={(props) => } + icon="account-tie"/>} /> {final} @@ -76,12 +68,18 @@ class ClubDisplayScreen extends React.Component { return ( {this.displayData.logo !== null ? - - - + + : } {this.displayData.description !== null ? @@ -96,15 +94,6 @@ class ClubDisplayScreen extends React.Component { : } {this.getResponsiblesRender(this.displayData.responsibles)} - - - ); } diff --git a/screens/HomeScreen.js b/screens/HomeScreen.js index 4a8e4b0..8aebb63 100644 --- a/screens/HomeScreen.js +++ b/screens/HomeScreen.js @@ -436,12 +436,6 @@ class HomeScreen extends React.Component { */ getFeedItem(item: Object) { const onOutLinkPress = this.openLink.bind(this, item.permalink_url); - const imageList = [ - { - uri: item.full_picture, - } - ]; - const onPress = this.showImageModal.bind(this, imageList); return ( { full_picture={item.full_picture} message={item.message} onOutLinkPress={onOutLinkPress} - onImagePress={onPress} /> ); } diff --git a/screens/Planning/PlanningDisplayScreen.js b/screens/Planning/PlanningDisplayScreen.js index 0dc5944..4a32cd8 100644 --- a/screens/Planning/PlanningDisplayScreen.js +++ b/screens/Planning/PlanningDisplayScreen.js @@ -1,13 +1,13 @@ // @flow import * as React from 'react'; -import {Image, ScrollView, TouchableOpacity, View} from 'react-native'; +import {ScrollView, View} from 'react-native'; import HTML from "react-native-render-html"; import {Linking} from "expo"; import {getDateOnlyString, getFormattedEventTime} from '../../utils/Planning'; -import {Card, Portal, withTheme} from 'react-native-paper'; +import {Card, withTheme} from 'react-native-paper'; import DateManager from "../../managers/DateManager"; -import ImageView from "react-native-image-viewing"; +import ImageModal from 'react-native-image-modal'; type Props = { navigation: Object, @@ -62,10 +62,18 @@ class PlanningDisplayScreen extends React.Component { subtitle={subtitle} /> {this.displayData.logo !== null ? - - - + + : } {this.displayData.description !== null ? @@ -79,15 +87,6 @@ class PlanningDisplayScreen extends React.Component { onLinkPress={openWebLink}/> : } - - - ); }