UNPKG

repoweaver

Version:

A GitHub App that skillfully weaves multiple templates together to create and update repositories with intelligent merge strategies

1 lines 2.81 kB
{"ast":null,"code":"\"use strict\";\n\nimport * as React from 'react';\nexport function useDocumentTitle(ref, {\n enabled = true,\n formatter = (options, route) => options?.title ?? route?.name\n} = {}) {\n React.useEffect(() => {\n if (!enabled) {\n return;\n }\n const navigation = ref.current;\n if (navigation) {\n const title = formatter(navigation.getCurrentOptions(), navigation.getCurrentRoute());\n document.title = title;\n }\n return navigation?.addListener('options', e => {\n const title = formatter(e.data.options, navigation?.getCurrentRoute());\n document.title = title;\n });\n });\n}","map":{"version":3,"names":["React","useDocumentTitle","ref","enabled","formatter","options","route","title","name","useEffect","navigation","current","getCurrentOptions","getCurrentRoute","document","addListener","e","data"],"sources":["/Users/pmouli/Documents/GitHub.nosync/boots-strapper/mobile/node_modules/@react-navigation/native/src/useDocumentTitle.tsx"],"sourcesContent":["import type {\n NavigationContainerRef,\n ParamListBase,\n} from '@react-navigation/core';\nimport * as React from 'react';\n\nimport type { DocumentTitleOptions } from './types';\n\n/**\n * Set the document title for the active screen\n */\nexport function useDocumentTitle(\n ref: React.RefObject<NavigationContainerRef<ParamListBase> | null>,\n {\n enabled = true,\n formatter = (options, route) => options?.title ?? route?.name,\n }: DocumentTitleOptions = {}\n) {\n React.useEffect(() => {\n if (!enabled) {\n return;\n }\n\n const navigation = ref.current;\n\n if (navigation) {\n const title = formatter(\n navigation.getCurrentOptions(),\n navigation.getCurrentRoute()\n );\n\n document.title = title;\n }\n\n return navigation?.addListener('options', (e) => {\n const title = formatter(e.data.options, navigation?.getCurrentRoute());\n\n document.title = title;\n });\n });\n}\n"],"mappings":";;AAIA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAO9B,OAAO,SAASC,gBAAgBA,CAC9BC,GAAkE,EAClE;EACEC,OAAO,GAAG,IAAI;EACdC,SAAS,GAAGA,CAACC,OAAO,EAAEC,KAAK,KAAKD,OAAO,EAAEE,KAAK,IAAID,KAAK,EAAEE;AACrC,CAAC,GAAG,CAAC,CAAC,EAC5B;EACAR,KAAK,CAACS,SAAS,CAAC,MAAM;IACpB,IAAI,CAACN,OAAO,EAAE;MACZ;IACF;IAEA,MAAMO,UAAU,GAAGR,GAAG,CAACS,OAAO;IAE9B,IAAID,UAAU,EAAE;MACd,MAAMH,KAAK,GAAGH,SAAS,CACrBM,UAAU,CAACE,iBAAiB,CAAC,CAAC,EAC9BF,UAAU,CAACG,eAAe,CAAC,CAC7B,CAAC;MAEDC,QAAQ,CAACP,KAAK,GAAGA,KAAK;IACxB;IAEA,OAAOG,UAAU,EAAEK,WAAW,CAAC,SAAS,EAAGC,CAAC,IAAK;MAC/C,MAAMT,KAAK,GAAGH,SAAS,CAACY,CAAC,CAACC,IAAI,CAACZ,OAAO,EAAEK,UAAU,EAAEG,eAAe,CAAC,CAAC,CAAC;MAEtEC,QAAQ,CAACP,KAAK,GAAGA,KAAK;IACxB,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ","ignoreList":[]},"metadata":{"hasCjsExports":false},"sourceType":"module","externalDependencies":[]}