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

1 line
1.4 KiB
Plaintext
Raw Normal View History

2021-08-16 00:14:59 +00:00
{"version":3,"sources":["useBackButton.tsx"],"names":["React","BackHandler","useBackButton","ref","useEffect","subscription","addEventListener","navigation","current","canGoBack","goBack","remove"],"mappings":"AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,WAAT,QAA4B,cAA5B;AAGA,eAAe,SAASC,aAAT,CACbC,GADa,EAEb;AACAH,EAAAA,KAAK,CAACI,SAAN,CAAgB,MAAM;AACpB,UAAMC,YAAY,GAAGJ,WAAW,CAACK,gBAAZ,CACnB,mBADmB,EAEnB,MAAM;AACJ,YAAMC,UAAU,GAAGJ,GAAG,CAACK,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,MAAML,YAAY,CAACM,MAAb,EAAb;AACD,GArBD,EAqBG,CAACR,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"]}