0

I'm trying to write an application to my phone. I use the code from the react-native-rss-parser example.

    import * as rssParser from 'react-native-rss-parser';
 
return fetch('http://www.kbgau.ru/rss.php')
  .then((response) => response.text())
  .then((responseData) => rssParser.parse(responseData))
  .then((rss) => {
    console.log(rss.title);
    console.log(rss.items.length);
  });

how to correctly display text from rss to Text from View Need display item.title, item.link, item,enclosure url image Help plz!!!

Gy9vin
  • 13
  • 2

1 Answers1

0

What's the value of the response? Try to console it

I think it's because you fetch data from http

Try to fetch data from site that using https

Or you can try to set this on DEBUG mode

https://github.com/facebook/react-native/issues/24408#issuecomment-537081276

But, this settings isn't recommended for RELEASE mode, because it's a risk for security

i p
  • 24
  • 4
  • Sorry, i use https. But questions was, how i can display information from rss, in components – Gy9vin Dec 23 '20 at 20:54
  • Sorry, I don't understand what you mean. I have tried this library, and it show all the data on console – i p Dec 24 '20 at 02:15
  • Or don't you know how to set it to state? – i p Dec 24 '20 at 02:18
  • `function News({ navigation }) { return fetch('https://kbgau.ru/rss.php') .then((response) => response.text()) .then((responseData) => rssParser.parse(responseData)) .then((rss) => { console.log(rss.items[0].description); }); } ` – Gy9vin Dec 24 '20 at 08:35
  • Error: Objects are not valid as a React child (found: object with keys {_U, _V, _W, _X}). If you meant to render a collection of children, use an array instead. – Gy9vin Dec 24 '20 at 08:35