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

error in android and ios on run time with React Native #174

Open
mhhonline opened this issue Aug 1, 2020 · 2 comments
Open

error in android and ios on run time with React Native #174

mhhonline opened this issue Aug 1, 2020 · 2 comments

Comments

@mhhonline
Copy link

mhhonline commented Aug 1, 2020

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:

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);
    })();
  };
"rss-parser": "^3.9.0"

thanks

@mhhonline mhhonline changed the title error in android and ios on run time error in android and ios on run time with React Native Aug 3, 2020
@mhhonline
Copy link
Author

Greetings,

No input. I need your support

@rbren
Copy link
Owner

rbren commented Aug 6, 2020

You can try the solutions found here: #53

I don't know enough about native React to be very helpful here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants