mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
7959a63a1a
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/50976 This is the second part of the migration of `rn-tester` package to use root imports. In this diff the `CodegenTypes` namespace is used to define Codegen primitives. Changelog: [Internal] Reviewed By: huntie Differential Revision: D73780584 fbshipit-source-id: c13c2dfcfa4d023978a9463af1d2a3bf7b72476c
35 lines
870 B
JavaScript
35 lines
870 B
JavaScript
/**
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @flow strict-local
|
|
* @format
|
|
*/
|
|
|
|
import type {CodegenTypes, TurboModule} from 'react-native';
|
|
|
|
import {TurboModuleRegistry} from 'react-native';
|
|
|
|
export type ScreenshotManagerOptions = CodegenTypes.UnsafeObject;
|
|
|
|
export interface Spec extends TurboModule {
|
|
+getConstants: () => {};
|
|
takeScreenshot(
|
|
id: string,
|
|
options: ScreenshotManagerOptions,
|
|
): Promise<string>;
|
|
}
|
|
|
|
const NativeModule = TurboModuleRegistry.get<Spec>('ScreenshotManager');
|
|
export function takeScreenshot(
|
|
id: string,
|
|
options: ScreenshotManagerOptions,
|
|
): Promise<string> {
|
|
if (NativeModule != null) {
|
|
return NativeModule.takeScreenshot(id, options);
|
|
}
|
|
return Promise.reject();
|
|
}
|