/
githubmirror
/
react-native
Обзор
Документация
Войти
/
githubmirror
/
react-native
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
packages/rn-tester/NativeModuleExample/NativeScreenshotManager.js
34 строки
924 B
Sam Zhou
Redo modern syntax rollout in react-native (#57034)
03 июн 2026, 17:21
03 июн 2026, 17:21
e0ed406
Код
Авторство
О чём код?
/** * 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 { readonly 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(new Error('ScreenshotManager is not defined.')); }