UNPKG

rn-inkpad

Version:

<img src="https://res.cloudinary.com/fercloudinary/image/upload/v1715452841/packages/inkpad-banner_acl0xl.png" />

40 lines (39 loc) 1.2 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.useTheme = void 0; const react_native_1 = require("react-native"); const theme_1 = require("../theme"); const useTheme = ({ appearance, buttons, personalTheme, theme, icon, }) => { if (!appearance) { appearance = react_native_1.Appearance.getColorScheme(); } const dark = appearance === 'dark'; const personalTextButtonColor = !!personalTheme ? personalTheme.textButtonColor : undefined; let platform = react_native_1.Platform.OS; let textButtonColor = personalTextButtonColor ?? '#4F87FF'; let cancelWeight = '500'; if (!!theme) { if (theme === 'ios') { platform = 'ios'; } else { platform = 'android'; } } if (platform === 'ios') { cancelWeight = '700'; } else { platform = 'android'; textButtonColor = personalTextButtonColor ?? '#00D982'; } return { styles: (0, theme_1.getStyles)(platform, dark, personalTheme, buttons, icon), ios: platform === 'ios', textButtonColor, cancelWeight, }; }; exports.useTheme = useTheme;