From 522121025590a91326b3dd00b8485f8c326fd10b Mon Sep 17 00:00:00 2001 From: Christoph Purrer Date: Wed, 20 Sep 2023 07:19:55 -0700 Subject: [PATCH 1/2] Extract AppState TM type for react-native-codegen Summary: Changelog: [Internal] Differential Revision: D49436860 fbshipit-source-id: 9c72075ac92bb6594c3ad7096ca4e7341028d256 --- packages/react-native/Libraries/AppState/NativeAppState.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/react-native/Libraries/AppState/NativeAppState.js b/packages/react-native/Libraries/AppState/NativeAppState.js index b4b96d97a7bc..41c204886489 100644 --- a/packages/react-native/Libraries/AppState/NativeAppState.js +++ b/packages/react-native/Libraries/AppState/NativeAppState.js @@ -16,10 +16,12 @@ export type AppStateConstants = {| initialAppState: string, |}; +export type AppState = {|app_state: string|}; + export interface Spec extends TurboModule { +getConstants: () => AppStateConstants; +getCurrentAppState: ( - success: (appState: {|app_state: string|}) => void, + success: (appState: AppState) => void, error: (error: Object) => void, ) => void; From caf3474271ea1613d1b2f0e55370b5336ec08aef Mon Sep 17 00:00:00 2001 From: Christoph Purrer Date: Wed, 20 Sep 2023 07:20:09 -0700 Subject: [PATCH 2/2] Extract SourceCode TM type for react-native-codegen (#39547) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/39547 Changelog: [Internal] Reviewed By: rshest Differential Revision: D49437443 fbshipit-source-id: 585ce973f68cdfedc6f188dd986a9dd126a37aad --- .../NativeModules/specs/NativeSourceCode.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/react-native/Libraries/NativeModules/specs/NativeSourceCode.js b/packages/react-native/Libraries/NativeModules/specs/NativeSourceCode.js index 91778c42636b..8441e21cb87e 100644 --- a/packages/react-native/Libraries/NativeModules/specs/NativeSourceCode.js +++ b/packages/react-native/Libraries/NativeModules/specs/NativeSourceCode.js @@ -12,19 +12,19 @@ import type {TurboModule} from '../../TurboModule/RCTExport'; import * as TurboModuleRegistry from '../../TurboModule/TurboModuleRegistry'; +export type SourceCodeConstants = {| + scriptURL: string, +|}; + export interface Spec extends TurboModule { - +getConstants: () => {| - scriptURL: string, - |}; + +getConstants: () => SourceCodeConstants; } const NativeModule = TurboModuleRegistry.getEnforcing('SourceCode'); let constants = null; const NativeSourceCode = { - getConstants(): {| - scriptURL: string, - |} { + getConstants(): SourceCodeConstants { if (constants == null) { constants = NativeModule.getConstants(); }