Skip to content

Commit 520c2e8

Browse files
committed
Fix misuse of new event emitter API in useOrientation hook (#1661)
* Fix misue of new event emitter API in useOrientation hook * keep listener inside clouser instead of using ref * Fix lint error
1 parent 4a2859f commit 520c2e8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/hooks/useOrientation/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ const useOrientation = ({onOrientationChange}: UseOrientationProps = {}) => {
1414
}, []);
1515

1616
useEffect(() => {
17-
Constants.addDimensionsEventListener(orientationChangeListener);
18-
return () => Constants.removeDimensionsEventListener(orientationChangeListener);
17+
const listener = Constants.addDimensionsEventListener(orientationChangeListener);
18+
return () => Constants.removeDimensionsEventListener(listener);
1919
}, []);
2020

2121
useDidUpdate(() => {

0 commit comments

Comments
 (0)