Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Expand share dialog on iOS (#250) #278

Merged
merged 2 commits into from
Oct 16, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions App/Screens/ShareScreen/ShareScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@
// along with Sh**t! I Smoke. If not, see <http://www.gnu.org/licenses/>.

import * as Sharing from 'expo-sharing';
import React, { createRef, useEffect } from 'react';
import React, { createRef, useContext, useEffect } from 'react';
import { Platform, Share, StyleSheet, View } from 'react-native';
import { captureRef } from 'react-native-view-shot';
import { NavigationInjectedProps } from 'react-navigation';
import { Button } from '../../components';
import { i18n } from '../../localization';
import { ApiContext } from '../../stores';
import * as theme from '../../util/theme';
import { ShareImage } from './ShareImage';

Expand Down Expand Up @@ -51,6 +52,7 @@ const styles = StyleSheet.create({
});

export function ShareScreen(props: ShareScreenProps) {
const { api } = useContext(ApiContext);
const refViewShot = createRef<View>();

const handleDismiss = () => {
Expand All @@ -67,7 +69,11 @@ export function ShareScreen(props: ShareScreenProps) {

if (Platform.OS === 'ios') {
await Share.share({
url: uri
url: uri,
title: i18n.t('home_share_title'),
message: i18n.t('home_share_message', {
cigarettes: api ? api.shootISmoke.cigarettes.toFixed(2) : 0
})
});
} else {
await Sharing.shareAsync(uri, {
Expand Down