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

Change library to typescript and react hooks #17

Closed
banarualexandru opened this issue Jan 10, 2020 · 16 comments
Closed

Change library to typescript and react hooks #17

banarualexandru opened this issue Jan 10, 2020 · 16 comments
Assignees
Labels
good first issue Good for newcomers
Milestone

Comments

@banarualexandru
Copy link

Hello
Small and nice library!

Do you have plans to use react hooks in the near future? Because now it gives a warning for classic lifetime methods like ComponentDidMount

Thanks

@gomjellie gomjellie added the good first issue Good for newcomers label Jan 11, 2020
@gomjellie gomjellie pinned this issue Jan 11, 2020
@gomjellie
Copy link
Owner

I don't wanna change whole library into typescript but I think it's good to support typescript using .d.ts. files

@gomjellie
Copy link
Owner

and yeah it's needed to update life cycle methods but recently I'm just too busy to do that.

@guy490
Copy link

guy490 commented Jun 22, 2020

and yeah it's needed to update life cycle methods but recently I'm just too busy to do that.

I will be happy contribute to this tool with change it to React Hooks

@rubycho
Copy link
Collaborator

rubycho commented Dec 3, 2020

Anyone interested on this issue?
I tried to use dts-gen to create .d.ts files, but it doesn't work.
(seems the generator doesn't understands ES6, such as import statement).

@guy490
Copy link

guy490 commented Dec 3, 2020

Anyone interested on this issue?
I tried to use dts-gen to create .d.ts files, but it doesn't work.
(seems the generator doesn't understands ES6, such as import statement).

I'm interested to work on replacing all to React Hooks.
Can start work on it tomorrow.

@rubycho
Copy link
Collaborator

rubycho commented Dec 3, 2020

Anyone interested on this issue?
I tried to use dts-gen to create .d.ts files, but it doesn't work.
(seems the generator doesn't understands ES6, such as import statement).

I'm interested to work on replacing all to React Hooks.
Can start work on it tomorrow.

Thanks for your reply.
Well, I'm not a skilled react-native developer, so could you elaborate about replacing all to React Hooks? or specific plans.
Does it mean replacing Class components to Functional components and converting the states or initial codes to hooks like useState and useEffect?

@guy490
Copy link

guy490 commented Dec 3, 2020

Anyone interested on this issue?
I tried to use dts-gen to create .d.ts files, but it doesn't work.
(seems the generator doesn't understands ES6, such as import statement).

I'm interested to work on replacing all to React Hooks.
Can start work on it tomorrow.

Thanks for your reply.
Well, I'm not a skilled react-native developer, so could you elaborate about replacing all to React Hooks? or specific plans.
Does it mean replacing Class components to Functional components and converting the states or initial codes to hooks like useState and useEffect?

Yes, Exactly.

@rubycho
Copy link
Collaborator

rubycho commented Dec 3, 2020

So the class components in this library are TimeTableView.js and Event.js. Could you convert that both?

@guy490
Copy link

guy490 commented Dec 3, 2020

So the class components in this library are TimeTableView.js and Event.js. Could you convert that both?

Yes

@rubycho
Copy link
Collaborator

rubycho commented Dec 4, 2020

Thanks. I'll wait for the pr.

@rubycho rubycho added this to the v.1.0.5 milestone Dec 4, 2020
@rubycho rubycho mentioned this issue Dec 4, 2020
5 tasks
@guy490
Copy link

guy490 commented Dec 4, 2020

@gomjellie @rubycho
Hey, I have been upgraded it to react hooks, and it seems ok.
but still not tested it and check if there is no bugs.

But i have a problem with runnig the example project ... I got an error:

Module not found: Can't resolve 'react-native' in 'C:\Users\Guy\Desktop\New folder\react-native-timetable\example'

I have installed all the packages but it still not recognizing it, what i'm missing with running it?

@rubycho
Copy link
Collaborator

rubycho commented Dec 4, 2020

Does the error occurs on yarn start?
Have you run yarn install on the example directory?

@guy490
Copy link

guy490 commented Dec 5, 2020

Does the error occurs on yarn start?
Have you run yarn install on the example directory?

I have installed with npm install, it has difference from the yarn install?

@rubycho
Copy link
Collaborator

rubycho commented Dec 5, 2020

@guy490
Both are package managers, and by project convention we are using yarn.
But npm should work too.

If the problem persists, you could just create temporary react native app project, copy codes partially from example and test it.
Be sure to add react-native-timetable dependency with value "<path_to_repo>/src" on package.json.

@Nahoyhp
Copy link

Nahoyhp commented Dec 14, 2020

Hi, I am trying to set up before I try to contribute (I am a first timer to OSS contribution). But I encounter the same problem as @guy490 . Can you share your solution on solving this problem?

Edit: I have tried using npm link and it is still giving me the same problem.
I try to create another application and copy pasted the App.js and events_data.js. Still doesn't work.
But when I try to npm install react-native-timetable on the new project, and copied over the two .js file, it works. When I try to link again, it fails and give the same error (as shown below).

image

@rubycho
Copy link
Collaborator

rubycho commented Dec 16, 2020

Hi, @Nahoyhp
Currently yarn link or npm link seems to fail on react-native projects, cause the packager doesn't support symlinks.
Running yarn add <path_to_repo>/src can be a solution to install package from local source. Though you will need to re-install after having changes on package source files. (and this method is really annoying for cross-developing)

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

No branches or pull requests

5 participants