Add sharing button logics

This commit is contained in:
Adolfo Reyna
2023-03-10 20:06:29 -06:00
parent f2a0545f48
commit 21f987a5a5
2 changed files with 28 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
import React, { useState } from 'react';
import { Text, ScrollView, FlatList, StyleSheet, View } from 'react-native';
import { Text, ScrollView, FlatList, StyleSheet, View, Share } from 'react-native';
import Hyperlink from 'react-native-hyperlink'
import { Button, Card, Chip } from 'react-native-paper';
import API from './../API.js';
@@ -12,6 +12,7 @@ import { useSnapshot } from 'valtio';
import GlobalState from '../contexts/GlobalState.js';
import i18n from "../i18nMessages.js";
let Post = (props) => {
const gState = useSnapshot(GlobalState);
const viewer = gState.me;
@@ -90,7 +91,12 @@ let Post = (props) => {
{likes}
</Button>
<Button icon="forum" labelStyle={{ fontSize: 18 }} style={{ flow: 1 }} onPress={() => { changeshowCommentsB(!showCommentsB) }} >{post.comments.length}</Button>
<Button icon="ios-share" style={{ flow: 1 }} labelStyle={{ fontSize: 18 }}></Button>
<Button icon="ios-share" style={{ flow: 1 }} labelStyle={{ fontSize: 18 }} onPress={()=>{
Share.share({
//message: "https://social.emmint.com/post/" + props.post._id,
url: "https://social.emmint.com/feed/post/" + props.post._id
});
}}></Button>
<Button
icon={!bookmarked ? "bookmark-outline" : "bookmark"}
style={{ flow: 1 }}