1 line
3.0 KiB
Plaintext
1 line
3.0 KiB
Plaintext
|
{"version":3,"sources":["CommonActions.tsx"],"names":["goBack","type","navigate","args","payload","name","params","hasOwnProperty","Error","reset","state","setParams"],"mappings":"AAoCA,OAAO,SAASA,MAAT,GAA0B;AAC/B,SAAO;AAAEC,IAAAA,IAAI,EAAE;AAAR,GAAP;AACD;AASD;AACA,OAAO,SAASC,QAAT,CAAkB,GAAGC,IAArB,EAAwC;AAC7C,MAAI,OAAOA,IAAI,CAAC,CAAD,CAAX,KAAmB,QAAvB,EAAiC;AAC/B,WAAO;AAAEF,MAAAA,IAAI,EAAE,UAAR;AAAoBG,MAAAA,OAAO,EAAE;AAAEC,QAAAA,IAAI,EAAEF,IAAI,CAAC,CAAD,CAAZ;AAAiBG,QAAAA,MAAM,EAAEH,IAAI,CAAC,CAAD;AAA7B;AAA7B,KAAP;AACD,GAFD,MAEO;AACL,UAAMC,OAAO,GAAGD,IAAI,CAAC,CAAD,CAAJ,IAAW,EAA3B;;AAEA,QAAI,CAACC,OAAO,CAACG,cAAR,CAAuB,KAAvB,CAAD,IAAkC,CAACH,OAAO,CAACG,cAAR,CAAuB,MAAvB,CAAvC,EAAuE;AACrE,YAAM,IAAIC,KAAJ,CACJ,uKADI,CAAN;AAGD;;AAED,WAAO;AAAEP,MAAAA,IAAI,EAAE,UAAR;AAAoBG,MAAAA;AAApB,KAAP;AACD;AACF;AAED,OAAO,SAASK,KAAT,CAAeC,KAAf,EAAsD;AAC3D,SAAO;AAAET,IAAAA,IAAI,EAAE,OAAR;AAAiBG,IAAAA,OAAO,EAAEM;AAA1B,GAAP;AACD;AAED,OAAO,SAASC,SAAT,CAAmBL,MAAnB,EAA2C;AAChD,SAAO;AAAEL,IAAAA,IAAI,EAAE,YAAR;AAAsBG,IAAAA,OAAO,EAAE;AAAEE,MAAAA;AAAF;AAA/B,GAAP;AACD","sourcesContent":["import type { NavigationState, PartialState, Route } from './types';\n\ntype ResetState =\n | PartialState<NavigationState>\n | NavigationState\n | (Omit<NavigationState, 'routes'> & {\n routes: Omit<Route<string>, 'key'>[];\n });\n\nexport type Action =\n | {\n type: 'GO_BACK';\n source?: string;\n target?: string;\n }\n | {\n type: 'NAVIGATE';\n payload:\n | { key: string; name?: undefined; params?: object; merge?: boolean }\n | { name: string; key?: string; params?: object; merge?: boolean };\n source?: string;\n target?: string;\n }\n | {\n type: 'RESET';\n payload: ResetState | undefined;\n source?: string;\n target?: string;\n }\n | {\n type: 'SET_PARAMS';\n payload: { params?: object };\n source?: string;\n target?: string;\n };\n\nexport function goBack(): Action {\n return { type: 'GO_BACK' };\n}\n\nexport function navigate(\n route:\n | { key: string; params?: object }\n | { name: string; key?: string; params?: object }\n): Action;\n// eslint-disable-next-line no-redeclare\nexport function navigate(name: string, params?: object): Action;\n// eslint-disable-next-line no-redeclare\nexport function navigate(...args: any): Action {\n if (typeof args[0] === 'string') {\n return { type: 'NAVIGATE', payload: { name: args[0], params: args[1] } };\n } else {\n const payload = args[0] || {};\n\n if (!payload.hasOwnProperty('key') && !payload.hasOwnProperty('name')) {\n throw new Error(\n 'You need to specify name or key when calling navigate with an object as the argument. See https://reactnavigation.org/docs/5.x/navigation-actions#navigate for usage.'\n );\n }\n\n return { type: 'NAVIGATE', payload };\n }\n}\n\nexport function reset(state: ResetState | undefined): Action {\n return { type: 'RESET', payload: state };\n}\n\nexport function setParams(params: object): Action {\n return { type: 'SET_PARAMS', payload: { params } };\n}\n"]}
|