[Solved] Issue when using listenOrientationChange in hooks
See original GitHub issueSolved:
const [ state, setstate ] = React.useState(null);
React.useEffect(() => {
listenOrientationChange(setstate);
return () => {
removeOrientationListener();
};}, []);
And Package:
if (that.setState == null) {
that(screenWidth < screenHeight ? 'portrait' : 'landscape');
} else {
that.setState({
orientation: screenWidth < screenHeight ? 'portrait' : 'landscape'
});}
Hope it helps everyone
Issue Analytics
- State:
- Created 4 years ago
- Reactions:5
- Comments:6
Top Results From Across the Web
React native with typescript passing useState as props
I have responsive.tsx file and I want to take an useState hook as props that contains orientation mode for app from app.tsx. I...
Read more >React.useEffect Hook – Common Problems and How to Fix ...
The first and probably most obvious option is to remove the dependency from the useEffect dependency array, ignore the ESLint rule, and move...
Read more >react-native-responsive-screen-hooks: Docs & more | Openbase
section. There are 2 more methods to use if you want to support responsiveness along with orientation change. These are listenOrientationChange and ...
Read more >Build responsive React Native views for any device ... - Medium
The goal of this article is to show a complete solution that scales RN UI to all sizes and types of screens (phones,...
Read more >Understanding common frustrations with React Hooks
Learn about some of the drawbacks to using React Hooks. ... What problems do React Hooks solve? What was wrong with class components?...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@anisharya16 I forked it and added the change.
https://github.com/Marzdor/react-native-responsive-screen I plan to just use the fork until he merges the change
@EzeMortal yes i did it