import * as rssParser from 'rss-parser';
....
const fetchRssData = async () => {
setIsLoading(true);
// console.log(url);
// TODO check the best solution https://wanago.io/2018/11/05/cors-cross-origin-resource-sharing/
const CORS_PROXY = 'https://cors-anywhere.herokuapp.com/';
let parser = new rssParser();
(async () => {
let feed = await parser.parseURL(CORS_PROXY + url);
// get the title and update the page title
console.log(feed.items?.length);
const l = feed.items?.length;
let data = new Array();
if (l && l > 0) {
setData(feed.items);
}
setIsLoading(false);
setIsRefreshing(false);
})();
};
Greetings,
I am using the lib on react native project. it is working fine on the browser (chrome) on android and ios, it is throwing an error ..
The package at "node_modules/rss-parser/lib/parser.js" attempted to import the Node standard library module "http". It failed because the native React runtime does not include the Node standard library. Read more at https://docs.expo.io/workflow/using-libraries/#using-third-party-libraries
Implementation:
thanks