xcarpentier / react-native-country-picker-modal

🇦🇶 Country picker provides a modal allowing a user to select a country from a list. It display a flag next to each country name.
https://reactnative.gallery/xcarpentier/country-picker
MIT License
1.08k stars 800 forks source link

Unable to resolve "react-async-hook" #515

Open shessafridi opened 1 year ago

shessafridi commented 1 year ago

Issue Description

Project doesn't build after installing

Web Bundling failed 19319ms Unable to resolve "react-async-hook" from "node_modules\react-native-country-picker-modal\lib\Flag.js"

Steps to Reproduce / Code Snippets

npm i react-native-country-picker-modal world-countries

Expected Results

It should work

Additional Information

shessafridi commented 1 year ago

metro.config.js

const { getDefaultConfig } = require('expo/metro-config');

module.exports = (() => {
  const config = getDefaultConfig(__dirname);

  const { transformer, resolver } = config;

  config.transformer = {
    ...transformer,
    babelTransformerPath: require.resolve('react-native-svg-transformer'),
  };
  config.resolver = {
    ...resolver,
    assetExts: resolver.assetExts.filter(ext => ext !== 'svg'),
    sourceExts: [...resolver.sourceExts, 'svg'],
  };
  config.resolver.sourceExts = [...config.resolver.sourceExts, 'mjs', 'cjs'];

  return config;
})();
prasannjeet commented 1 year ago

any resolution to this issue yet? can we downgrade to a version to fix it?

GibbyBox commented 1 year ago

I currently just patch the modules package json to denote where to find the package and it works fine. This was fixed in later versions of react-async-hook

Run the following and follow the on screen instructions.

yarn patch react-async-hook

If you're using npm, use patch-package

Edit package.json with the following change

-  "module": "react-async-hook.esm.js",
+  "module": "dist/react-async-hook.esm.js",

npm / yarn install once complete to apply the changes to your node_modules.

chidexebere commented 11 months ago

yarn patch react-async-hook did not run in my case....saying Command "patch" not found.

Ibeenoch commented 4 months ago

any solution to this yet? i have tried all the above on react-native expo, still having the same issue

mintaras commented 3 weeks ago

any solution to this yet? i have tried all the above on react-native expo, still having the same issue

@Ibeenoch Any chance you have found solution or alternative for this issue?