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

[0.62.0] Image with data:image/png;base64 crashing on iOS #28469

Closed
organom opened this issue Mar 31, 2020 · 24 comments
Closed

[0.62.0] Image with data:image/png;base64 crashing on iOS #28469

organom opened this issue Mar 31, 2020 · 24 comments
Labels
Component: Image Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@organom
Copy link

organom commented Mar 31, 2020

Description

Following the official example in the documentation https://reactnative.dev/docs/images#uri-data-images, the loading of an image using data:image/png;base64 is currently crashing when starting in the iOS emulator and no error can be seen (in the shells or in the react native debugger).
On Android it works correctly.

React Native version:

16:21 $ npx react-native info
info Fetching system and libraries information...
System:
    OS: macOS 10.15.4
    CPU: (8) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
    Memory: 56.48 MB / 16.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 12.13.1 - ~/.n/bin/node
    Yarn: 1.19.2 - /usr/local/bin/yarn
    npm: 6.14.4 - ~/.n/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.9.0 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 13.4, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
    Android SDK: Not Found
  IDEs:
    Android Studio: Not Found
    Xcode: 11.4/11E146 - /usr/bin/xcodebuild
  Languages:
    Python: 2.7.16 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.11.0 => 16.11.0
    react-native: 0.62.0 => 0.62.0
  npmGlobalPackages:
    *react-native*: Not Found

Emulator:

iPhone 11 with ios 13.4

Steps To Reproduce

  1. Create a new project based on the typescript template npx react-native init Test --template react-native-template-typescript
  2. Just in case cd ios && pod install && cd ..
  3. Add to App.tsx (from https://reactnative.dev/docs/images#uri-data-images)
<Image 
  style={{
    width: 51,
    height: 51,
    resizeMode: 'contain',
  }}
  source={{
    uri:
      'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADMAAAAzCAYAAAA6oTAqAAAAEXRFWHRTb2Z0d2FyZQBwbmdjcnVzaEB1SfMAAABQSURBVGje7dSxCQBACARB+2/ab8BEeQNhFi6WSYzYLYudDQYGBgYGBgYGBgYGBgYGBgZmcvDqYGBgmhivGQYGBgYGBgYGBgYGBgYGBgbmQw+P/eMrC5UTVAAAAABJRU5ErkJggg==',
  }}
/>

And the Image element import to from 'react-native'

  1. yarn start and yarn ios

Expected Results

Image should load, or at least display an error.

@martijngerrits
Copy link

Image seems to load, but crashes somewhere in Flipper.

@ncuillery
Copy link
Contributor

Seems to be the same as #28454

@xsephtion
Copy link

+1

@folowing
Copy link

folowing commented Apr 4, 2020

update to 0.62.1, still crash

@martijngerrits
Copy link

update to 0.62.1, still crash

That’s because the update is only regarding the YellowBox which has been changed to use normal images, other than solving the base64 images in general.

@developer-sen
Copy link

+1

@Skullcan
Copy link

Skullcan commented Apr 8, 2020

+1
Having the same issue.

@safaiyeh safaiyeh added Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. and removed Needs: Triage 🔍 labels Apr 8, 2020
@safaiyeh safaiyeh added Component: Image and removed Needs: Author Feedback Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. labels Apr 8, 2020
@facebook facebook deleted a comment from github-actions bot Apr 8, 2020
@Skullcan
Copy link

Skullcan commented Apr 9, 2020

Still happening here even after upgrading to 0.62.2.
The issue that this PR fixes is about network plugin on flipper. I don't think this has anything todo with data:image problem.

@rfischer
Copy link

rfischer commented Apr 9, 2020

This pull request facebook/flipper#978 fixes the issue for me. The problem is, it isn't released yet and, therefore, not fixed with the react-native 0.62.2 update. Please correct me if I am wrong.

@whaus7
Copy link

whaus7 commented Apr 17, 2020

@rfischer This appears to be accurate as far as I can tell. Anyway to just turn off this Flipper business for now?

Answered my own question, as simple as commenting out
InitializeFlipper(application);

in the AppDelegate.m file. I'm rocking smooth as butter now. I'll Flip it back on when that fix is released

@masa7351
Copy link

Having the same issue.
Thanks. This article helped me.

@wzahedi
Copy link

wzahedi commented Apr 19, 2020

@rfischer This appears to be accurate as far as I can tell. Anyway to just turn off this Flipper business for now?

Answered my own question, as simple as commenting out
InitializeFlipper(application);

in the AppDelegate.m file. I'm rocking smooth as butter now. I'll Flip it back on when that fix is released

I was also having this issue. The app crashes when Image Picker returns data. Seems like commenting InitializeFlipper(application); resolves the crashes for now.

@everfire130
Copy link
Contributor

+1

1 similar comment
@hamzaouhssain1993
Copy link

+1

@AtanasChachev
Copy link

+1.

As an alternative until this issue gets fixed you can use WebView (react-native-webview) and it's html's source.

In my case

 <WebView source={{ html: `
    <img src=${`data:image/jpeg;base64,${capturedImage}`} style="max-width: 100%; height: auto;" />
 ` }}/>

is working fine.

@yosukapro
Copy link

+1

@FarazzShaikh
Copy link

Is there a permanent solution to this issue?

@masa7351
Copy link

+1

1 similar comment
@RacardoL
Copy link

RacardoL commented Jul 6, 2020

+1

@organom
Copy link
Author

organom commented Jul 7, 2020

Is there a permanent solution to this issue?

In lottie-react-native/lottie-react-native#638 they seem to have 2 possible workarounds detailed (update flipper or commenting InitializeFlipper).

In my case, I decided to load the images from a file in the meanwhile. Hope this gets the official fix soon :)

@FarazzShaikh
Copy link

Commenting out the initialization function doesn’t seem to break my app, what is flipper used for? Can I just remove it entirely?

In my case, I decided to load the images from a file in the meanwhile. Hope this gets the official fix soon :)

In my use case, I’m converting a canvas image to a dataURL in base64 format so, I too hope it gets fixed fairly soon.

@thobiasn
Copy link

thobiasn commented Aug 6, 2020

+1.

As an alternative until this issue gets fixed you can use WebView (react-native-webview) and it's html's source.

In my case

 <WebView source={{ html: `
    <img src=${`data:image/jpeg;base64,${capturedImage}`} style="max-width: 100%; height: auto;" />
 ` }}/>

is working fine.

This is working for me aswell. I am sticking to this solution for now, to avoid messing too much with the underlying ios code. Great find, thank you!

@stale
Copy link

stale bot commented Dec 26, 2020

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Dec 26, 2020
@github-actions
Copy link

This issue was closed because it has been stalled for 7 days with no activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Image 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