GT2/Ejectable/node_modules/@react-navigation/native/lib/commonjs/useBackButton.js.map

1 line
1.3 KiB
Plaintext

{"version":3,"sources":["useBackButton.tsx"],"names":["useBackButton","ref","React","useEffect","subscription","BackHandler","addEventListener","navigation","current","canGoBack","goBack","remove"],"mappings":";;;;;;;AAAA;;AACA;;;;;;AAGe,SAASA,aAAT,CACbC,GADa,EAEb;AACAC,EAAAA,KAAK,CAACC,SAAN,CAAgB,MAAM;AACpB,UAAMC,YAAY,GAAGC,yBAAYC,gBAAZ,CACnB,mBADmB,EAEnB,MAAM;AACJ,YAAMC,UAAU,GAAGN,GAAG,CAACO,OAAvB;;AAEA,UAAID,UAAU,IAAI,IAAlB,EAAwB;AACtB,eAAO,KAAP;AACD;;AAED,UAAIA,UAAU,CAACE,SAAX,EAAJ,EAA4B;AAC1BF,QAAAA,UAAU,CAACG,MAAX;AAEA,eAAO,IAAP;AACD;;AAED,aAAO,KAAP;AACD,KAhBkB,CAArB;;AAmBA,WAAO,MAAMN,YAAY,CAACO,MAAb,EAAb;AACD,GArBD,EAqBG,CAACV,GAAD,CArBH;AAsBD","sourcesContent":["import * as React from 'react';\nimport { BackHandler } from 'react-native';\nimport type { NavigationContainerRef } from '@react-navigation/core';\n\nexport default function useBackButton(\n ref: React.RefObject<NavigationContainerRef>\n) {\n React.useEffect(() => {\n const subscription = BackHandler.addEventListener(\n 'hardwareBackPress',\n () => {\n const navigation = ref.current;\n\n if (navigation == null) {\n return false;\n }\n\n if (navigation.canGoBack()) {\n navigation.goBack();\n\n return true;\n }\n\n return false;\n }\n );\n\n return () => subscription.remove();\n }, [ref]);\n}\n"]}