1 line
1.5 KiB
Plaintext
1 line
1.5 KiB
Plaintext
![]() |
{"version":3,"file":"styleToBarStyle.js","sourceRoot":"","sources":["../src/styleToBarStyle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAmB,MAAM,cAAc,CAAC;AAI3D,SAAS,cAAc;IACrB,IAAI,UAAU,EAAE;QACd,OAAO,UAAU,CAAC,cAAc,EAAE,CAAC;KACpC;SAAM;QACL,OAAO,OAAO,CAAC;KAChB;AACH,CAAC;AAED,MAAM,CAAC,OAAO,UAAU,eAAe,CACrC,QAAwB,MAAM,EAC9B,cAA+B,cAAc,EAAE;IAE/C,IAAI,CAAC,WAAW,EAAE;QAChB,WAAW,GAAG,OAAO,CAAC;KACvB;IAED,IAAI,aAAa,GAAG,KAAK,CAAC;IAC1B,IAAI,KAAK,KAAK,MAAM,EAAE;QACpB,aAAa,GAAG,WAAW,KAAK,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;KAC5D;SAAM,IAAI,KAAK,KAAK,UAAU,EAAE;QAC/B,aAAa,GAAG,WAAW,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC;KAC5D;IAED,OAAO,aAAa,KAAK,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,cAAc,CAAC;AACtE,CAAC","sourcesContent":["import { Appearance, ColorSchemeName } from 'react-native';\n\nimport { StatusBarStyle } from './StatusBar.types';\n\nfunction getColorScheme() {\n if (Appearance) {\n return Appearance.getColorScheme();\n } else {\n return 'light';\n }\n}\n\nexport default function styleToBarStyle(\n style: StatusBarStyle = 'auto',\n colorScheme: ColorSchemeName = getColorScheme()\n): 'light-content' | 'dark-content' {\n if (!colorScheme) {\n colorScheme = 'light';\n }\n\n let resolvedStyle = style;\n if (style === 'auto') {\n resolvedStyle = colorScheme === 'light' ? 'dark' : 'light';\n } else if (style === 'inverted') {\n resolvedStyle = colorScheme === 'light' ? 'light' : 'dark';\n }\n\n return resolvedStyle === 'light' ? 'light-content' : 'dark-content';\n}\n"]}
|