@teknyo/react-native-splash-generator
Version:
Automatically generate splash screens for React Native projects across iOS, Android, and Web platforms with support for dark mode, branding, and custom configurations.
148 lines (143 loc) • 5.03 kB
text/typescript
declare class FlavorHelper {
private flavor?;
private androidResFolder;
private iOSFlavorName;
constructor(flavor?: string);
get flavorName(): string | undefined;
get androidMainResFolder(): string;
get androidDrawableFolder(): string;
get androidDrawableNightFolder(): string;
get androidDrawableMdpiFolder(): string;
get androidDrawableHdpiFolder(): string;
get androidDrawableXhdpiFolder(): string;
get androidDrawableXxhdpiFolder(): string;
get androidDrawableXxxhdpiFolder(): string;
get androidLaunchBackgroundFile(): string;
get androidLaunchDarkBackgroundFile(): string;
get androidStylesFile(): string;
get androidStylesNightFile(): string;
get androidStylesV31File(): string;
get androidStylesV31NightFile(): string;
get androidManifestFile(): string;
get iOSAssetsLaunchImageFolder(): string;
get iOSAssetsBrandingImageFolder(): string;
get iOSLaunchScreenStoryboardFile(): string;
get iOSLaunchScreenStoryboardName(): string;
get iOSInfoPlistFile(): string;
get iOSAssetsLaunchBackgroundFolder(): string;
get iOSLaunchImageName(): string;
get iOSBrandingImageName(): string;
get iOSLaunchBackgroundName(): string;
get webIndexFile(): string;
get webSplashFolder(): string;
get webSplashImagesFolder(): string;
private capitalize;
static isValidFlavorConfigFileName(fileName: string): boolean;
static getFlavorNameFromFileName(fileName: string): string;
}
interface ImageConfig {
image?: string;
imageAndroid?: string;
imageIos?: string;
imageWeb?: string;
darkImage?: string;
darkImageAndroid?: string;
darkImageIos?: string;
darkImageWeb?: string;
}
interface BrandingConfig {
branding?: string;
brandingAndroid?: string;
brandingIos?: string;
brandingWeb?: string;
brandingDark?: string;
brandingDarkAndroid?: string;
brandingDarkIos?: string;
brandingDarkWeb?: string;
brandingBottomPadding?: number;
brandingBottomPaddingAndroid?: number;
brandingBottomPaddingIos?: number;
brandingMode?: 'bottom' | 'bottomLeft' | 'bottomRight' | 'center';
}
interface ColorConfig {
color?: string;
colorAndroid?: string;
colorIos?: string;
colorWeb?: string;
darkColor?: string;
darkColorAndroid?: string;
darkColorIos?: string;
darkColorWeb?: string;
}
interface BackgroundConfig {
backgroundImage?: string;
backgroundImageAndroid?: string;
backgroundImageIos?: string;
backgroundImageWeb?: string;
darkBackgroundImage?: string;
darkBackgroundImageAndroid?: string;
darkBackgroundImageIos?: string;
darkBackgroundImageWeb?: string;
}
interface Android12Config {
image?: string;
darkImage?: string;
iconBackgroundColor?: string;
iconBackgroundColorDark?: string;
color?: string;
darkColor?: string;
branding?: string;
brandingDark?: string;
}
interface PlatformConfig {
android?: boolean;
ios?: boolean;
web?: boolean;
}
interface SplashConfig extends ImageConfig, BrandingConfig, ColorConfig, BackgroundConfig, PlatformConfig {
androidGravity?: 'center' | 'fill' | 'clip_horizontal' | 'clip_vertical';
androidScreenOrientation?: 'portrait' | 'landscape' | 'sensorPortrait' | 'sensorLandscape' | 'userPortrait' | 'userLandscape';
android12?: Android12Config;
iosContentMode?: 'center' | 'scaleToFill' | 'scaleAspectFit' | 'scaleAspectFill';
iosBrandingContentMode?: 'bottom' | 'bottomLeft' | 'bottomRight';
infoPlistFiles?: string[];
webImageMode?: 'center' | 'contain' | 'stretch' | 'cover';
fullscreen?: boolean;
flavor?: string;
}
interface FlavorConfig extends SplashConfig {
flavorName: string;
}
declare class SplashScreenController {
private static instance;
private isPreserved;
private splashModule;
private constructor();
static getInstance(): SplashScreenController;
private isReactNative;
/**
* Preserve the splash screen during app initialization
*/
preserve(): void;
/**
* Remove the splash screen
*/
remove(): void;
/**
* Show the splash screen (useful for certain transitions)
*/
show(): void;
}
declare const SplashScreen: SplashScreenController;
declare class SplashGenerator {
private androidPlatform;
private iosPlatform;
private webPlatform;
constructor(flavorHelper: FlavorHelper);
generate(config: SplashConfig): Promise<void>;
remove(): Promise<void>;
}
declare function generateSplash(config?: string | SplashConfig, flavor?: string): Promise<void>;
declare function removeSplash(flavor?: string): Promise<void>;
declare function generateFlavorSplashes(): Promise<void>;
export { type Android12Config, type BackgroundConfig, type BrandingConfig, type ColorConfig, type FlavorConfig, type ImageConfig, type PlatformConfig, type SplashConfig, SplashGenerator, SplashScreen, generateFlavorSplashes, generateSplash, removeSplash };