File tree Expand file tree Collapse file tree 3 files changed +11
-6
lines changed Expand file tree Collapse file tree 3 files changed +11
-6
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @react-native-community/hooks " : minor
3+ ---
4+
5+ dep list on useBackHandler
Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ useBackHandler(() => {
6969 }
7070 // let the default thing happen
7171 return false
72- })
72+ },[shouldBeHandledHere] )
7373```
7474
7575### ` useImageDimensions `
Original file line number Diff line number Diff line change 1- import { useEffect } from "react"
1+ import { DependencyList , useEffect } from "react"
22import { BackHandler } from "react-native"
33
4- export function useBackHandler ( handler : ( ) => boolean ) {
4+ export function useBackHandler ( handler : ( ) => boolean , deps : DependencyList = [ ] ) {
55 useEffect ( ( ) => {
6- const subscription = BackHandler . addEventListener ( "hardwareBackPress" , handler )
6+ const sub = BackHandler . addEventListener ( "hardwareBackPress" , handler )
77
8- return ( ) => subscription . remove ( )
9- } , [ handler ] )
8+ return ( ) => sub . remove ( )
9+ } , [ handler , ... deps ] )
1010}
You can’t perform that action at this time.
0 commit comments