/
githubmr
/
facebook-react-native
Обзор
Документация
Войти
/
githubmr
/
facebook-react-native
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
main
packages/rn-tester/NativeModuleExample/NativeScreenshotManager.js
34 строки
870 B
Dawid Małecki
Migrate `rn-tester` codegen types imports to use root exported `CodegenTypes` namespace (#50976)
29 апр 2025, 16:06
29 апр 2025, 16:06
7959a63
Код
Авторство
О чём код?
/** * 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(); }