@vineyardbovines/react-native-nitro-stylesheet
Version:
Performant, extended StyleSheet for React Native
164 lines (154 loc) • 6.88 kB
TypeScript
import { HybridObject } from 'react-native-nitro-modules';
import { StyleSheet as StyleSheet$1 } from 'react-native';
interface AccessibilitySettings$1 {
isReduceMotionEnabled: boolean | null;
isReduceTransparencyEnabled: boolean | null;
isGrayscaleEnabled: boolean | null;
isBoldTextEnabled: boolean | null;
isVoiceOverEnabled: boolean | null;
isSwitchControlEnabled: boolean | null;
isVideoAutoplayEnabled: boolean | null;
isClosedCaptioningEnabled: boolean | null;
isDarkerSystemColorsEnabled: boolean | null;
isMonoAudioEnabled: boolean | null;
isShakeToUndoEnabled: boolean | null;
isDifferentiateWithoutColorEnabled: boolean | null;
isInvertColorsEnabled: boolean | null;
isShowButtonShapesEnabled: boolean | null;
prefersCrossFadeTransitions: boolean | null;
isSpeakScreenEnabled: boolean | null;
isSpeakSelectionEnabled: boolean | null;
isOnOffSwitchLabelsEnabled: boolean | null;
}
declare function useAccessibilitySettings(): AccessibilitySettings$1;
type ScreenInsets = {
top: number;
left: number;
bottom: number;
right: number;
};
type ScreenDimensions = {
width: number;
height: number;
};
type ColorScheme = "light" | "dark" | "unspecified";
type ScreenOrientation = "portrait" | "landscape";
interface DeviceTraits {
readonly colorScheme: ColorScheme;
readonly screenDimensions: ScreenDimensions;
readonly contentSizeCategory: string;
readonly screenInsets: ScreenInsets;
readonly displayScale: number;
readonly fontScale: number;
readonly isRTL: boolean;
readonly screenOrientation: ScreenOrientation;
readonly pixelRatio: number;
}
type HapticTypes = "select" | "success" | "warning" | "error" | "light" | "medium" | "heavy" | "soft" | "rigid";
interface NitroDeviceModule$1 extends HybridObject<{
ios: "swift";
android: "kotlin";
}> {
getDeviceTraits(): DeviceTraits;
runHaptic(type: HapticTypes): void;
getColorScheme(): ColorScheme;
getScreenDimensions(): ScreenDimensions;
getContentSizeCategory(): string;
getScreenInsets(): ScreenInsets;
getDisplayScale(): number;
getFontScale(): number;
getIsRTL(): boolean;
getScreenOrientation(): ScreenOrientation;
getPixelRatio(): number;
}
type BaseColors = {
bg: string;
fg: string;
success: string;
warning: string;
danger: string;
info: string;
};
interface Theme {
spacing: Record<string, number>;
radius: Record<string, number>;
fonts: Record<string, number>;
fontSizes: Record<string, number>;
colors: BaseColors & {
[key: string]: string;
};
[key: string]: any;
}
type Style<T> = (theme: Theme, insets: ScreenInsets) => T;
type ThemeConfig = Record<Exclude<ColorScheme, "unspecified">, Theme>;
declare const StyleSheet: {
themes: ThemeConfig;
init(themeConfig?: Theme | Record<Exclude<ColorScheme, "unspecified">, Theme>): void;
create<T extends StyleSheet$1.NamedStyles<T>>(styles: T | Style<T>): T;
};
declare const NitroDeviceModule: NitroDeviceModule$1;
interface AccessibilitySettings {
readonly isReduceMotionEnabled: boolean | null;
readonly isReduceTransparencyEnabled: boolean | null;
readonly isDifferentiateWithoutColorEnabled: boolean | null;
readonly isInvertColorsEnabled: boolean | null;
readonly isShowButtonShapesEnabled: boolean | null;
readonly isBoldTextEnabled: boolean | null;
readonly isVoiceOverEnabled: boolean | null;
readonly isSwitchControlEnabled: boolean | null;
readonly isVideoAutoplayEnabled: boolean | null;
readonly isClosedCaptioningEnabled: boolean | null;
readonly prefersCrossFadeTransitions: boolean | null;
readonly isGrayscaleEnabled: boolean | null;
readonly isDarkerSystemColorsEnabled: boolean | null;
readonly isMonoAudioEnabled: boolean | null;
readonly isShakeToUndoEnabled: boolean | null;
readonly isSpeakScreenEnabled: boolean | null;
readonly isSpeakSelectionEnabled: boolean | null;
readonly isOnOffSwitchLabelsEnabled: boolean | null;
}
interface NitroAccessibilityModule$1 extends HybridObject<{
ios: "swift";
android: "kotlin";
}> {
removeListeners(): void;
getAllSettings(): AccessibilitySettings;
getIsReduceMotionEnabled(): boolean | null;
addReduceMotionListener(onChanged: (isEnabled: boolean | null) => void): void;
getIsReduceTransparencyEnabled(): boolean | null;
addReduceTransparencyListener(onChanged: (isEnabled: boolean | null) => void): void;
getIsDifferentiateWithoutColorEnabled(): boolean | null;
addDifferentiateWithoutColorListener(onChanged: (isEnabled: boolean | null) => void): void;
getIsInvertColorsEnabled(): boolean | null;
addInvertColorsListener(onChanged: (isEnabled: boolean | null) => void): void;
getIsShowButtonShapesEnabled(): boolean | null;
addShowButtonShapesListener(onChanged: (isEnabled: boolean | null) => void): void;
getIsBoldTextEnabled(): boolean | null;
addBoldTextListener(onChanged: (isEnabled: boolean | null) => void): void;
getIsVoiceOverEnabled(): boolean | null;
addVoiceOverListener(onChanged: (isEnabled: boolean | null) => void): void;
getIsSwitchControlEnabled(): boolean | null;
addSwitchControlListener(onChanged: (isEnabled: boolean | null) => void): void;
getIsVideoAutoplayEnabled(): boolean | null;
addVideoAutoplayListener(onChanged: (isEnabled: boolean | null) => void): void;
getIsClosedCaptioningEnabled(): boolean | null;
addClosedCaptioningListener(onChanged: (isEnabled: boolean | null) => void): void;
getPrefersCrossFadeTransitionsEnabled(): boolean | null;
addPrefersCrossFadeTransitionsListener(onChanged: (isEnabled: boolean | null) => void): void;
getIsGrayscaleEnabled(): boolean | null;
addGrayscaleListener(onChanged: (isEnabled: boolean | null) => void): void;
getIsDarkerSystemColorsEnabled(): boolean | null;
addDarkerSystemColorsListener(onChanged: (isEnabled: boolean | null) => void): void;
getIsMonoAudioEnabled(): boolean | null;
addMonoAudioListener(onChanged: (isEnabled: boolean | null) => void): void;
getIsShakeToUndoEnabled(): boolean | null;
addShakeToUndoListener(onChanged: (isEnabled: boolean | null) => void): void;
getIsSpeakScreenEnabled(): boolean | null;
addSpeakScreenListener(onChanged: (isEnabled: boolean | null) => void): void;
getIsSpeakSelectionEnabled(): boolean | null;
addSpeakSelectionListener(onChanged: (isEnabled: boolean | null) => void): void;
getIsOnOffSwitchLabelsEnabled(): boolean | null;
addOnOffSwitchLabelsListener(onChanged: (isEnabled: boolean | null) => void): void;
}
declare const NitroAccessibilityModule: NitroAccessibilityModule$1;
export { NitroAccessibilityModule, NitroDeviceModule, StyleSheet, useAccessibilitySettings };