1 line
4.0 KiB
Plaintext
1 line
4.0 KiB
Plaintext
|
{"version":3,"sources":["ResourceSavingScene.tsx"],"names":["React","Platform","StyleSheet","View","Screen","screensEnabled","shouldUseActivityState","FAR_FAR_AWAY","ResourceSavingScene","Component","render","OS","isVisible","rest","props","children","style","styles","container","display","attached","detached","create","flex","overflow","top"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,QAAT,EAAmBC,UAAnB,EAA+BC,IAA/B,QAA2C,cAA3C;AACA,SACEC,MADF,EAEEC,cAFF,CAGE;AAHF,EAIEC,sBAJF,QAKO,sBALP;AAcA,MAAMC,YAAY,GAAG,KAArB,C,CAA4B;;AAE5B,eAAe,MAAMC,mBAAN,SAAkCR,KAAK,CAACS,SAAxC,CAAyD;AACtEC,EAAAA,MAAM,GAAG;AACP;AACA,QAAI,CAAAL,cAAc,SAAd,IAAAA,cAAc,WAAd,YAAAA,cAAc,OAAQJ,QAAQ,CAACU,EAAT,KAAgB,KAA1C,EAAiD;AAC/C,YAAM;AAAEC,QAAAA,SAAF;AAAa,WAAGC;AAAhB,UAAyB,KAAKC,KAApC;;AAEA,UAAIR,sBAAJ,EAA4B;AAC1B;AAAA;AACE;AACA,8BAAC,MAAD;AAAQ,YAAA,aAAa,EAAEM,SAAS,GAAG,CAAH,GAAO;AAAvC,aAA8CC,IAA9C;AAFF;AAID,OALD,MAKO;AACL;AAAA;AACE;AACA,8BAAC,MAAD;AAAQ,YAAA,MAAM,EAAED,SAAS,GAAG,CAAH,GAAO;AAAhC,aAAuCC,IAAvC;AAFF;AAID;AACF;;AAED,UAAM;AAAED,MAAAA,SAAF;AAAaG,MAAAA,QAAb;AAAuBC,MAAAA,KAAvB;AAA8B,SAAGH;AAAjC,QAA0C,KAAKC,KAArD;AAEA,wBACE,oBAAC,IAAD;AACE,MAAA,KAAK,EAAE,CACLG,MAAM,CAACC,SADF,EAELjB,QAAQ,CAACU,EAAT,KAAgB,KAAhB,GACI;AAAEQ,QAAAA,OAAO,EAAEP,SAAS,GAAG,MAAH,GAAY;AAAhC,OADJ,GAEI,IAJC,EAKLI,KALK,CADT;AAQE,MAAA,WAAW,EAAE,KARf;AASE,MAAA,qBAAqB,EACnB;AACA;AACAf,MAAAA,QAAQ,CAACU,EAAT,KAAgB,KAAhB,GAAwB,CAACC,SAAzB,GAAqC,IAZzC;AAcE,MAAA,aAAa,EAAEA,SAAS,GAAG,MAAH,GAAY;AAdtC,OAeMC,IAfN,gBAiBE,oBAAC,IAAD;AAAM,MAAA,KAAK,EAAED,SAAS,GAAGK,MAAM,CAACG,QAAV,GAAqBH,MAAM,CAACI;AAAlD,OACGN,QADH,CAjBF,CADF;AAuBD;;AA5CqE;AA+CxE,MAAME,MAAM,GAAGf,UAAU,CAACoB,MAAX,CAAkB;AAC/BJ,EAAAA,SAAS,EAAE;AACTK,IAAAA,IAAI,EAAE,CADG;AAETC,IAAAA,QAAQ,EAAE;AAFD,GADoB;AAK/BJ,EAAAA,QAAQ,EAAE;AACRG,IAAAA,IAAI,EAAE;AADE,GALqB;AAQ/BF,EAAAA,QAAQ,EAAE;AACRE,IAAAA,IAAI,EAAE,CADE;AAERE,IAAAA,GAAG,EAAElB;AAFG;AARqB,CAAlB,CAAf","sourcesContent":["import * as React from 'react';\nimport { Platform, StyleSheet, View } from 'react-native';\nimport {\n Screen,\n screensEnabled,\n // @ts-ignore\n shouldUseActivityState,\n} from 'react-native-screens';\n\ntype Props = {\n isVisible: boolean;\n children: React.ReactNode;\n enabled: boolean;\n style?: any;\n};\n\nconst FAR_FAR_AWAY = 30000; // this should be big enough to move the whole view out of its container\n\nexport default class ResourceSavingScene extends React.Component<Props> {\n render() {\n // react-native-screens is buggy on web\n if (screensEnabled?.() && Platform.OS !== 'web') {\n const { isVisible, ...rest } = this.props;\n\n if (shouldUseActivityState) {\n return (\n // @ts-expect-error: there was an `active` prop and no `activityState` in older version and stackPresentation was required\n <Screen activityState={isVisible ? 2 : 0} {...rest} />\n );\n } else {\n return (\n // @ts-expect-error: there was an `active` prop and no `activityState` in older version and stackPresentation was required\n <Screen active={isVisible ? 1 : 0} {...rest} />\n );\n }\n }\n\n const { isVisible, children, style, ...rest } = this.props;\n\n return (\n <View\n style={[\n styles.container,\n Platform.OS === 'web'\n ? { display: isVisible ? 'flex' : 'none' }\n : null,\n style,\n ]}\n collapsable={false}\n removeClippedSubviews={\n // On iOS, set removeClippedSubviews to true only when not focused\n // This is an workaround for a bug where the clipped view never re-appears\n Platform.OS === 'ios' ? !isVisible : true\n }\n pointerEvents={isVisible ? 'auto' : 'none'}\n {...rest}\n >\n <View style={isVisible ? styles.attached : styles.detached}>\n {children}\n </View>\n </View>\n );\n }\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n overflow: 'hidden',\n },\n attached: {\n flex: 1,\n },\n detached: {\n flex: 1,\n top: FAR_FAR_AWAY,\n },\n})
|