marudy / react-native-responsive-screen

Make React Native views responsive for all devices with the use of 2 simple methods
MIT License
1.55k stars 141 forks source link

How to use the lor() method in the function component #99

Open codthing opened 3 years ago

gregfenton commented 3 years ago

In my PR for supporting functional components, I modified listenOrientationChange() to support being called via hooks/functional or class components.

vankhoa01 commented 3 years ago

Thank @gregfenton Your PR was still not merged, so how can I use your changes ?

gregfenton commented 3 years ago

I've been successfully using my PR in production since Sep 2020.

I think you can install my PR with the command

npm install git+https://github.com/gregfenton/react-native-responsive-screen.git

??

In my package.json I end up with the "dependencies" containing:

"react-native-responsive-screen": "github:gregfenton/react-native-responsive-screen"
vankhoa01 commented 3 years ago

Hi @gregfenton : Thank for your reply I already installed your package, but I can not resolved currentOrientation Could you give me some hint to fix them ?

Screen Shot 2021-07-06 at 11 21 31

Thank you so much

gregfenton commented 3 years ago

Have you tried running any of the examples that ship with the project?

That's where I would start. Those projects each have a README telling you how to set up and run them. If you get the example working, then you can compare your project with the example project to determine what is different.

Maybe start with the example that I added as part of the PR.

vankhoa01 commented 3 years ago

@gregfenton : Thank for your supporting Let me try with your solution Thank you so much

swalahamani commented 3 years ago

@marudy @gregfenton Still not merged?

swalahamani commented 3 years ago

@gregfenton Typescript support pending?

Argument of type '{ setStateHook: React.Dispatch<React.SetStateAction<undefined>>; }' is not assignable to parameter of type 'Component<any, any, any>'. Object literal may only specify known properties, and 'setStateHook' does not exist in type 'Component<any, any, any>'.ts(2345) (property) setStateHook: React.Dispatch<React.SetStateAction<undefined>> No quick fixes available

swalahamani commented 3 years ago

@gregfenton Kindly check https://github.com/gregfenton/react-native-responsive-screen/pull/1

gregfenton commented 3 years ago

Sorry, I'm unable to maintain this project fork at this time.

swalahamani commented 3 years ago

@gregfenton No worries, thanks for the response and the patch!