/*
 * A smart splash screen for react-native apps
 * https://github.com/react-native-component/react-native-smart-splash-screen/
 * Released under the MIT license
 * Copyright (c) 2016 react-native-component <moonsunfall@aliyun.com>
 */

import NativeSplashScreen from './specs/v1/NativeSplashScreen';

const constants = NativeSplashScreen.getConstants();

const SplashScreen = {
  /**
   * @param {import('./specs/v1/NativeSplashScreen').SplashScreenCloseOptions | undefined} options
   */
  close(options = undefined) {
    NativeSplashScreen.close(options);
  },
  animationType: constants.animationType,
};

// Demo/自动化专用,不属于默认导出的业务 API。
// 它复用宿主冷启动时缓存的原生上下文,确保测试能重新创建真实启动屏,
// 而不是在启动屏已关闭后对空窗口调用 close()。
export const __testing = {
  show: () => NativeSplashScreen.showForTesting(),
  isVisible: () => NativeSplashScreen.isVisibleForTesting(),
  setCloseOptions: (options) => NativeSplashScreen.setPendingCloseOptions(options),
};

export default SplashScreen;