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

Android filename base64 is not working #611

Closed
brunojs02 opened this issue Oct 21, 2019 · 11 comments
Closed

Android filename base64 is not working #611

brunojs02 opened this issue Oct 21, 2019 · 11 comments
Labels
bug stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@brunojs02
Copy link

Steps to reproduce

  1. Create a react native project.
  2. Install react native share lib (yarn add react-native-share).
  3. Write a basic application to share an image in base64.

Expected behaviour

When I call Share.open({ filename: 'myimage', url: '...' }), I want that file exported to gmail with the filename passed to open method.

Actual behaviour

The actual filename is the current timestamp.

image

Environment

  • 0.61.2
  • Android 8.0 (emulator)

react-native-share

2.0.0

code example

// App.js
import React from 'react';
import {View, Button} from 'react-native';
import Share from 'react-native-share';
import {image} from './mock.json'; // image in base64

export default () => (
<View style={{flex: 1, alignItems: 'center', justifyContent: 'center'}}>
<Button title="Share" onPress={() => Share.open({filename: 'myfilename', url: image})} />

);

Link to repo (highly encouraged)

Project

@brunojs02 brunojs02 added the bug label Oct 21, 2019
@brunojs02
Copy link
Author

Looking at the sources, i found the possible problem, in the repo the class ShareIntent has a method called getFileShare

String filename = null;
if (ShareIntent.hasValidKey("filename", options)) {
    filename = options.getString("filename");
}
if (ShareIntent.hasValidKey("type", options)) {
    return new ShareFile(options.getString("url"), options.getString("type"), filename, this.reactContext);
} else {
    return new ShareFile(options.getString("url"), filename, this.reactContext);
}

but on the version published on the npm, the source look like this

if (ShareIntent.hasValidKey("type", options)) {
    return new ShareFile(options.getString("url"), options.getString("type"), this.reactContext);
} else {
    return new ShareFile(options.getString("url"), this.reactContext);
 }

@jgcmarins
Copy link
Member

@brunojs02 thanks for looking deeper.
Does it only happens on Android?

@brunojs02
Copy link
Author

brunojs02 commented Oct 22, 2019

i haven't tested yet, i don't use base64 on iOS.

@brunojs02
Copy link
Author

@jgcmarins when a new release will be available with this feature?

@jgcmarins
Copy link
Member

is it ok on master branch?

@brunojs02
Copy link
Author

Only work on shareSingle method.

@stale
Copy link

stale bot commented Dec 23, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You may also mark this issue as a "discussion" and i will leave this open.

@stale stale bot added the stale There has been a lack of activity on this issue and it may be closed soon. label Dec 23, 2019
@stale
Copy link

stale bot commented Dec 30, 2019

Closing this issue after a prolonged period of inactivity. Fell free to reopen this issue, if this still affecting you.

@stale stale bot closed this as completed Dec 30, 2019
@rrraymonde
Copy link

This issue has not been fixed, I still have the same problem as described in the first message.

@liplylie
Copy link

liplylie commented Mar 28, 2020

version 3.1.1 has a fix for this.

@matheuslimatc
Copy link

3.1.1 and 3.5.0 not working for me in IOs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests

5 participants