GT2/Ejectable/node_modules/react-native-safe-area-context/lib/commonjs/SafeAreaView.js.map

1 line
5.1 KiB
Plaintext

{"version":3,"sources":["SafeAreaView.tsx"],"names":["TOP","RIGHT","BOTTOM","LEFT","ALL","edgeBitmaskMap","top","right","bottom","left","SafeAreaView","style","mode","edges","rest","insets","edgeBitmask","reduce","accum","edge","appliedStyle","React","useMemo","insetTop","insetRight","insetBottom","insetLeft","flatStyle","StyleSheet","flatten","margin","marginVertical","marginHorizontal","marginTop","marginRight","marginBottom","marginLeft","marginStyle","padding","paddingVertical","paddingHorizontal","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingStyle"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;;;;;;;;;AAGA;AACA,MAAMA,GAAG,GAAM,MAAf;AAAA,MACMC,KAAK,GAAI,MADf;AAAA,MAEMC,MAAM,GAAG,MAFf;AAAA,MAGMC,IAAI,GAAK,MAHf;AAAA,MAIMC,GAAG,GAAM,MAJf;AAMA;;AAEA,MAAMC,cAAoC,GAAG;AAC3CC,EAAAA,GAAG,EAAEN,GADsC;AAE3CO,EAAAA,KAAK,EAAEN,KAFoC;AAG3CO,EAAAA,MAAM,EAAEN,MAHmC;AAI3CO,EAAAA,IAAI,EAAEN;AAJqC,CAA7C;;AAOO,SAASO,YAAT,OAKqB;AAAA,MALC;AAC3BC,IAAAA,KAAK,GAAG,EADmB;AAE3BC,IAAAA,IAF2B;AAG3BC,IAAAA;AAH2B,GAKD;AAAA,MADvBC,IACuB;;AAC1B,QAAMC,MAAM,GAAG,yCAAf;AAEA,QAAMC,WAAW,GACfH,KAAK,IAAI,IAAT,GACIA,KAAK,CAACI,MAAN,CAAa,CAACC,KAAD,EAAQC,IAAR,KAAiBD,KAAK,GAAGb,cAAc,CAACc,IAAD,CAApD,EAA4D,CAA5D,CADJ,GAEIf,GAHN;AAKA,QAAMgB,YAAY,GAAGC,KAAK,CAACC,OAAN,CAAc,MAAM;AACvC,UAAMC,QAAQ,GAAGP,WAAW,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ARJ;AAUA,YAAMkB,YAAY,GAAG;AACnBJ,QAAAA,UAAU,EAAEA,UAAU,GAAGlB,QADN;AAEnBmB,QAAAA,YAAY,EAAEA,YAAY,GAAGlB,UAFV;AAGnBmB,QAAAA,aAAa,EAAEA,aAAa,GAAGlB,WAHZ;AAInBmB,QAAAA,WAAW,EAAEA,WAAW,GAAGlB;AAJR,OAArB;AAOA,aAAO,CAACf,KAAD,EAAQkC,YAAR,CAAP;AACD;AACF,GA/CoB,EA+ClB,CAAClC,KAAD,EAAQI,MAAR,EAAgBH,IAAhB,EAAsBI,WAAtB,CA/CkB,CAArB;AAiDA,sBAAO,oBAAC,iBAAD;AAAM,IAAA,KAAK,EAAEI;AAAb,KAA+BN,IAA/B,EAAP;AACD","sourcesContent":["import * as React from 'react';\nimport { View, StyleSheet } from 'react-native';\nimport { useSafeAreaInsets } from './SafeAreaContext';\nimport { Edge, NativeSafeAreaViewProps } from './SafeArea.types';\n\n// prettier-ignore\nconst TOP = 0b1000,\n RIGHT = 0b0100,\n BOTTOM = 0b0010,\n LEFT = 0b0001,\n ALL = 0b1111;\n\n/* eslint-disable no-bitwise */\n\nconst edgeBitmaskMap: Record<Edge, number> = {\n top: TOP,\n right: RIGHT,\n bottom: BOTTOM,\n left: LEFT,\n};\n\nexport function SafeAreaView({\n style = {},\n mode,\n edges,\n ...rest\n}: NativeSafeAreaViewProps) {\n const insets = useSafeAreaInsets();\n\n const edgeBitmask =\n edges != null\n ? edges.reduce((accum, edge) => accum | edgeBitmaskMap[edge], 0)\n : ALL;\n\n const appliedStyle = React.useMemo(() => {\n const insetTop = edgeBitmask & TOP ? insets.top : 0;\n const insetRight = edgeBitmask & RIGHT ? insets.right : 0;\n const insetBottom = edgeBitmask & BOTTOM ? insets.bottom : 0;\n const insetLeft = edgeBitmask & LEFT ? insets.left : 0;\n\n const flatStyle = StyleSheet.flatten(style) as Record<string, number>;\n\n if (mode === 'margin') {\n const {\n margin = 0,\n marginVertical = margin,\n marginHorizontal = margin,\n marginTop = marginVertical,\n marginRight = marginHorizontal,\n marginBottom = marginVertical,\n marginLeft = marginHorizontal,\n } = flatStyle;\n\n const marginStyle = {\n marginTop: marginTop + insetTop,\n marginRight: marginRight + insetRight,\n marginBottom: marginBottom + insetBottom,\n marginLeft: marginLeft + insetLeft,\n };\n\n return [style, marginStyle];\n } else {\n const {\n padding = 0,\n paddingVertical = padding,\n paddingHorizontal = padding,\n paddingTop = paddingVertical,\n paddingRight = paddingHorizontal,\n paddingBottom = paddingVertical,\n paddingLeft = paddingHorizontal,\n } = flatStyle;\n\n const paddingStyle = {\n paddingTop: paddingTop + insetTop,\n paddingRight: paddingRight + insetRight,\n paddingBottom: paddingBottom + insetBottom,\n paddingLeft: paddingLeft + insetLeft,\n };\n\n return [style, paddingStyle];\n }\n }, [style, insets, mode, edgeBitmask]);\n\n return <View style={appliedStyle} {...rest} />;\n}\n"]}