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

FileReader .readAsDataURL not working after upgrade to RN 0.57 #21098

Closed
3 tasks done
witalobenicio opened this issue Sep 13, 2018 · 8 comments
Closed
3 tasks done

FileReader .readAsDataURL not working after upgrade to RN 0.57 #21098

witalobenicio opened this issue Sep 13, 2018 · 8 comments
Labels
Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.

Comments

@witalobenicio
Copy link

witalobenicio commented Sep 13, 2018

Environment

React Native Environment Info:
System:
OS: macOS High Sierra 10.13.6
CPU: x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
Memory: 593.19 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 8.11.3 - /usr/local/bin/node
Yarn: 1.0.2 - /usr/local/bin/yarn
npm: 5.6.0 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 11.4, macOS 10.13, tvOS 11.4, watchOS 4.3
Android SDK:
Build Tools: 21.1.2, 23.0.1, 23.0.2, 23.0.3, 24.0.2, 24.0.3, 25.0.0, 25.0.1, 25.0.2, 25.0.3, 26.0.0, 26.0.1, 26.0.2, 26.0.3, 27.0.2, 27.0.3, 28.0.0
API Levels: 22, 23, 24, 25, 26, 27, 28
IDEs:
Android Studio: 3.0 AI-171.4443003
Xcode: 9.4.1/9F2000 - /usr/bin/xcodebuild
npmPackages:
@storybook/react-native: ^3.4.8 => 3.4.10
@types/react: ^16.4.1 => 16.4.12
react: 16.3.1 => 16.3.1
react-native: ^0.57.0 => 0.57.0
npmGlobalPackages:
create-react-native-app: 1.0.0
react-native-cli: 2.0.1
react-native-create-library: 3.1.2
react-native-rename: 2.2.2

Description

I need to parse an image that receive from a fetch request into an base64 string. When I as using RN 0.55.4 my code worked properly, but after upgrading to RN0.57 (and RN0.56) it didn't worked anymore.
I've logged my base64 string after upgrade, and I get:
IMAGE64 data:application/octet-stream;base64,77+977+977+977+9AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...(a bunch of "A"s)

in RN0.55.4, my base64 string was totally different.

Reproducible Demo

That's how I do the request and parsing:

const reader = new FileReader();
fetch(`${ENDPOINT}/tudo/v2/services/person/profileimage`, {
          method: 'GET',
          headers: {
            Authorization: `Bearer ${token}`,
          },
        }).then((res) => res.blob())
          .then((blob) => {
            reader.readAsDataURL(blob);
            reader.onloadend = function () {
              const base64data = reader.result;
              if (base64data.length > 500) {
                AsyncStorage.setItem(`@Profile:imageBase64-${document}`, base64data);
                callback(base64data);
              }
            };
          }).catch((err) => { /* onsole.log('IMAGE ERROR', err, arguments); */ });
@react-native-bot
Copy link
Collaborator

It looks like you are using an older version of React Native. Please update to the latest release, v0.57 and verify if the issue still exists.

The ":rewind:Old Version" label will be removed automatically once you edit your original post with the results of running react-native info on a project using the latest release.

@zeh
Copy link

zeh commented Sep 13, 2018

@react-native-bot the original post already states that this is on the latest version of RN. This automatic tag might have been added because RN 0.55/0.56 are mentioned but this is a false positive.

@react-native-bot react-native-bot added the Ran Commands One of our bots successfully processed a command. label Sep 28, 2018
@react-native-bot
Copy link
Collaborator

I am closing this issue because it does not appear to have been verified on the latest release, and there has been no followup in a while.

If you found this thread after encountering the same issue in the latest release, please feel free to create a new issue with up-to-date information by clicking here.

@witalobenicio
Copy link
Author

@react-native-bot It's not an older version. I've tested in the latest release. Please, reopen.

@ivan-navarro-75
Copy link

is there any advance in the resolution of this issue? any workaround known? this issue is blocking my migration to 0.57

@DongMing0103
Copy link

is there any advance in the resolution of this issue? any workaround known?

@NickGeek
Copy link

Is there any way we can re-open this issue?

@amarjeet89
Copy link

Is there any fix for this issue?

@facebook facebook locked as resolved and limited conversation to collaborators Sep 28, 2019
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Sep 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

7 participants