dorkyboi / react-native-calendar-timetable

Timetable (schedule) component for React Native applications
MIT License
58 stars 10 forks source link

Unable to resolve module ./src/Timetable #5

Closed caolong0204 closed 2 years ago

caolong0204 commented 2 years ago

i don't know why, but i always get this error when building app after install lib. error: Error: Unable to resolve module ./src/Timetable from /Users/.../node_modules/react-native-calendar-timetable/index.js:

Screen Shot 2022-05-05 at 10 09 31

How to implement your lib?

GeorgeHop commented 2 years ago

Hi @caolong0204 thank you for using our lib! May I ask you about screenshots of code where you using our library, with imports?! It will give us possibility to resolve your issue so fast as we can!

dorkyboi commented 2 years ago

Hey @caolong0204, I have tested it in a new app made with expo init and found no issues. We could really use more info on how your project is setup (ideally, an expo snack, but i think steps-to-reproduce would also work).

Here's how i did it:

// components/MyPage.jsx
import Timetable from "react-native-calendar-timetable";

function MyPage() {
    return <Timetable date={new Date()}/>;
}

export default MyPage;
// App.js
import {View} from "react-native";
import MyPage from "./components/MyPage";

export default function App() {
  return (
    <View>
      <MyPage/>
    </View>
  );
}
NatakuZ commented 2 years ago

Hi , when i installed the library , i found this error. The problem is that : metro can't resolve the jsx file in default config. to fix this you have to add in metro.config.js this lines

`module.exports = { resolver: {

sourceExts: ['jsx','js','ts','tsx'] },` after this I cleaned the cache and the app worked.

GeorgeHop commented 2 years ago

We will prepare fix for this shortly.

GeorgeHop commented 2 years ago

Fix for this issue -> https://github.com/dorkyboi/react-native-calendar-timetable/commit/d6c1f72185ab6670b7d991b4f714085d138d5bae