From 022fd75fa5a780b947f6f962a86b5abe165d327f Mon Sep 17 00:00:00 2001 From: Adolfo Reyna Date: Sat, 11 Mar 2023 09:24:20 -0600 Subject: [PATCH] Add sharing for pictures. --- components/Media.js | 22 +++++++++++++++++++--- components/Post.js | 2 +- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/components/Media.js b/components/Media.js index d07c734..63dd901 100644 --- a/components/Media.js +++ b/components/Media.js @@ -1,5 +1,5 @@ import React, { useState, useEffect } from 'react'; -import { View, TouchableHighlight, Image, StyleSheet, FlatList } from 'react-native'; +import { View, TouchableHighlight, Image, StyleSheet, FlatList, TouchableWithoutFeedback, Share } from 'react-native'; import { Button, Text, ProgressBar } from 'react-native-paper'; import API from './../API.js'; import VideoPlayer from './VideoPlayer.js'; @@ -120,7 +120,16 @@ let Media = (props) => { source={{ uri: "https://www.youtube.com/embed/" + youtubeId + "?fs=0" }} /> : <>; const renderImages = (({ item }) => { - return (); + return ( + { + Share.share({ + //message: image[1], + url: item[1], + }); + }}> + + + ); }); let progress = <>; if(viewer.data && viewer.data[props.postId]) { @@ -148,7 +157,14 @@ let Media = (props) => { imagesTag.map((image, i) => { return ( //{post.content} - + { + Share.share({ + //message: image[1], + url: image[1], + }); + }}> + + ) }) } diff --git a/components/Post.js b/components/Post.js index c4b3822..ad7765f 100644 --- a/components/Post.js +++ b/components/Post.js @@ -51,7 +51,7 @@ let Post = (props) => { } else { changeBookmarked(false); post.bookmarks = post.bookmarks.filter(id => id != viewer._id); - API.removePostReaction(post._id) + API.removePostBookmark(post._id) } } const renderComment = ({ item }) => (