question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Latest v2.0.0 issue related to WebView scalesPageToFit and default useWebkit={true} property

See original GitHub issue

Hello, I have found an issue after upgrade to v2.0.0 that we can’t use “react-native-remote-svg” anymore because of WebView update for scalesPageToFit and default useWebkit={true} property.

Latest “react-native-webview” package used internally in “react-native-remote-svg” uses useWebkit={true} prop as default, and when we scalesPageToFit={true} it shows the warning that we can’t scale svg image to fit when useWebkit is true.

As result we can see a bit broken SVG image, because it is not scaled to fit the WebView. And we can’t pass useWebkit or scalesPageToFit to internal WebView to disable Weblit View on iOS for example.

The best solution is to add scalesPageToFit and useWebkit props to remote svg Image component and pass them to WebView internally. Fo example if we pass:

<Image 
  useWebkit={false} 
  scalesPageToFit={true} 
  source={{ uri: 'data:image/svg+xml;utf8,...' }}
/>

then scaling will work correctly on iOS platform.

I use: react-native: 0.59.1 react: 16.8.3 react-native-remote-svg: 2.0.0

MacOS: 10.14.3 Xcode: 10.1

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:14 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
seekshivacommented, Mar 29, 2019

v2.0.3 is out now

1reaction
oleksandr-dziubancommented, Mar 29, 2019

Hi @seekshiva , I have added incorrect useWebkit prop. Found in docs it should be useWebKit. I created another PR https://github.com/seekshiva/react-native-remote-svg/pull/41.

Please check it and publish new npm packages. Thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

WebView - Android Developers
android:alpha, alpha property of the view, as a value between 0 (completely ... Constructs a new WebView with layout parameters and a default...
Read more >
WKWebView equivalent for UIWebView's scalesPageToFit
try this: NSString* js = @"var meta = document.createElement('meta'); " "meta.setAttribute( 'name', 'viewport' ); " "meta.setAttribute( 'content', 'width = ...
Read more >
WKWebView | Apple Developer Documentation
A WKWebView object is a platform-native view that you use to incorporate web content seamlessly into your app's UI. A web view supports...
Read more >
react-native-webview - npm
React Native WebView component for iOS, Android, macOS, and Windows. Latest version: 11.26.0, last published: 24 days ago.
Read more >
WebView - React Native
You can use this component to navigate back and forth in the web view's history and configure various properties for the web content....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found