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.07k stars 795 forks source link

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

Open shessafridi opened 11 months ago

shessafridi commented 11 months 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 11 months 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 10 months ago

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

GibbyBox commented 10 months 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 8 months ago

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

Ibeenoch commented 1 month ago

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