Reading from WordPress

Hello

I have a news website ( WordPress) and I want my ReactNative app to read the posts from the website and show them in the app. For that, I will use WordPress REST APIs but I have some questions if someone can help:

  • Is it a good idea to view the article as HTML ( using WebView), any pros/cons
  • How can I control the aspect ratio of the images?

Thanks

Hi!
I think it will be better to use something like react-native-html-view to show post. Using webView is defeating the purpose of using React Native, react-native-html-view will give you native output but some style adjustments will be required.
You will need to fetch html of content from Wordpress REST API and use react-native-html-view to render it and style.
Maybe there is some better way, I actually never tried wordpress integration.

For controlling aspect ratio there is style property called aspectRatio. It is easy to use.
For example:

aspectRatio: 16/9

Will give you 16/9 aspect ratio.

1 Like