roto93 / react-native-neat-date-picker

An easy to use date picker for react native.
MIT License
52 stars 33 forks source link

Unable to resolve module ./src/components/NeatDatePicker #4

Closed rahmanharoon closed 3 years ago

rahmanharoon commented 3 years ago

Followed the documentation and getting this error

Error: Unable to resolve module ./src/components/NeatDatePicker from /Users/rahmanharoon/Desktop/nextport-sub-contractor-mobile/node_modules/react-native-neat-date-picker/index.js:
None of these files exist:
  * node_modules/react-native-neat-date-picker/src/components/NeatDatePicker(.native|.ios.js|.native.js|.js|.ios.json|.native.json|.json|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx|.ios.svg|.native.svg|.svg)
  * node_modules/react-native-neat-date-picker/src/components/NeatDatePicker/index(.native|.ios.js|.native.js|.js|.ios.json|.native.json|.json|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx|.ios.svg|.native.svg|.svg)
> 1 | import DatePicker from './src/components/NeatDatePicker'
    |                         ^
  2 |
  3 | export default DatePicker

Tried removing node_modules, package-lock.json, pod files and pod.lock and still getting this issue

roto93 commented 3 years ago

Hi, thank you for reporting this issue. Unfortunately, I don't see any possible reason to cause this error. I tried this package early today from a brand new RN project but it seems ok. Could you provide more information like the version and environment you're using. A minimum reproduction code would be great.

btw, I found a serious mistake in my README example code. I've already fixed it. Maybe you can try it out.

nescroft commented 3 years ago

Looks cool. I have the same error though. Hmmm. @roto93 I think it might have to do with the .jsx extension. https://stackoverflow.com/questions/50311473/how-to-allow-react-native-to-enable-support-for-jsx-extension-files

roto93 commented 3 years ago

Intresting. Thanks for the advise @nescroft . I didn't think about this possibility. I thought that .jsx and .js are totally the same :P Seems like either I change all the .jsx extension to .js or users modify their config like this will fix it. Could you try out the latter to see if it works? Since I can not encounter this error. If the error persists, I'll change the extensions.

nescroft commented 3 years ago

Intresting. Thanks for the advise @nescroft . I didn't think about this possibility. I thought that .jsx and .js are totally the same :P Seems like either I change all the .jsx extension to .js or users modify their config like this will fix it. Could you try out the latter to see if it works? Since I can not encounter this error. If the error persists, I'll change the extensions.

@roto93 nice! maybe @rahmanharoon can try it. I decided to use a different repo and I'm trying to meet a deadline at the moment. If it is not a big deal to change to .js that is probably the best solution.

roto93 commented 3 years ago

You're right! It should be quite quick. I'll do this later.

roto93 commented 3 years ago

Hi @nescroft @rahmanharoon Just to let you know that I have change the extension to .js and update the package. Feel free to test it when you have time, and let me know if the error still exists.

rahmanharoon commented 3 years ago

Yea sure, I will check this and give you an update on this asap..

rahmanharoon commented 3 years ago

When i try again its showing

 Error: Unable to resolve module @expo/vector-icons from /AwesomeTSProject/node_modules/react-native-neat-date-picker/src/components/NeatDatePicker.js: @expo/vector-icons could not be found within the project or in these directories

we don't want to install @expo/vector-icons right?

Here is the repo i created.Feel free to check that https://github.com/rahmanharoon/neat-date-picker-demo

roto93 commented 3 years ago

Oh! Seems like I missed this dependency. Can a react-native-cli project use @expo/vector-icons? I made this package from a expo project so there are some @expo packages in it. Or maybe I should change another library like react-native-vector-icon

rahmanharoon commented 3 years ago

Yes react native cli can use expo packages

roto93 commented 3 years ago

Great! Then I will add this dependency in README After installing @expo/vector-icons, there should be no error.

rahmanharoon commented 3 years ago

I was getting module not found error one by one here is the list of dependency i have added

expo-font,
@unimodules/core,
expo-constants,
expo-asset ,
@unimodules/react-native-adapter,
expo-file-system 

After that app loaded and after clicking on button the calendar modal is not opening..I can confirm state of showDatePicker is changing whenever i click on button..

Also am getting 5 warning on console you can find them on here https://github.com/rahmanharoon/neat-date-picker-demo

rahmanharoon commented 3 years ago

I'm closing this issue coz mentioned is not showing anymore

roto93 commented 3 years ago

Okay now I can reproduce the issue. Working on it.

roto93 commented 3 years ago

Hi, I've just update the package to v1.1.1. Now it should work. What I have done is removing all the expo-related packages and using react-native-vector-icons instead. I've checked that react-native-cli project can use it with no error. Could you reinstall it again to see if it works?

roto93 commented 3 years ago

Also, no need to manually install any dependency now.