Skip to content

Commit 0de7e02

Browse files
rubennortemeta-codesync[bot]
authored andcommitted
Remove SceneTracker module and its use in AppRegistry
Summary: `SceneTracker` was a small helper in `Libraries/Utilities` that tracked the active navigation scene. It was only ever consumed through a deep import and was never part of the public API. This removes it from the React Native package and moves scene tracking to the application layer that actually depends on it. As part of this, `AppRegistry.runApplication` no longer sets the active scene to the app key. To let the application layer preserve that behavior for surfaces launched by app key, `WrapperComponentProvider` now receives the app key as an optional second argument. Changelog: [General][Breaking] - Remove the `SceneTracker` module from `Libraries/Utilities`, stop setting the active scene from `AppRegistry.runApplication`, and pass the app key as an optional second argument to `WrapperComponentProvider` Differential Revision: D110471317
1 parent 6b45e57 commit 0de7e02

6 files changed

Lines changed: 8 additions & 77 deletions

File tree

packages/react-native/Libraries/ReactNative/AppRegistry.flow.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,6 @@ export type Registry = {
4444
};
4545
export type WrapperComponentProvider = (
4646
appParameters: Object,
47+
appKey?: string,
4748
) => React.ComponentType<any>;
4849
export type RootViewStyleProvider = (appParameters: Object) => ViewStyleProp;

packages/react-native/Libraries/ReactNative/AppRegistryImpl.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import type {
2222
WrapperComponentProvider,
2323
} from './AppRegistry.flow';
2424

25-
import SceneTracker from '../Utilities/SceneTracker';
2625
import DeprecatedPerformanceLoggerStub from './DeprecatedPerformanceLoggerStub';
2726
import {coerceDisplayMode} from './DisplayMode';
2827
import HeadlessJsTaskError from './HeadlessJsTaskError';
@@ -105,7 +104,8 @@ export function registerComponent(
105104
initialProps: appParameters.initialProps,
106105
rootTag: appParameters.rootTag,
107106
WrapperComponent:
108-
wrapperComponentProvider && wrapperComponentProvider(appParameters),
107+
wrapperComponentProvider &&
108+
wrapperComponentProvider(appParameters, appKey),
109109
rootViewStyle:
110110
rootViewStyleProvider && rootViewStyleProvider(appParameters),
111111
isLogBox: appKey === 'LogBox',
@@ -212,7 +212,6 @@ export function runApplication(
212212
"* A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called.",
213213
);
214214

215-
SceneTracker.setActiveScene({name: appKey});
216215
runnables[appKey](appParameters, coerceDisplayMode(displayMode));
217216
}
218217

packages/react-native/Libraries/Utilities/SceneTracker.js

Lines changed: 0 additions & 42 deletions
This file was deleted.

packages/react-native/Libraries/Utilities/__tests__/SceneTracker-itest.js

Lines changed: 0 additions & 28 deletions
This file was deleted.

packages/react-native/ReactNativeApi.d.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<67eb674c33870c82986054f0cee48385>>
7+
* @generated SignedSource<<7182d8669bdc02b7ac879b3f178bb1c1>>
88
*
99
* This file was generated by scripts/js-api/build-types/index.js.
1010
*/
@@ -5883,6 +5883,7 @@ declare function Wrapper_default(
58835883
): React.ReactNode
58845884
declare type WrapperComponentProvider = (
58855885
appParameters: Object,
5886+
appKey?: string,
58865887
) => React.ComponentType<any>
58875888
export {
58885889
AccessibilityActionEvent, // a0d4daa0
@@ -5905,7 +5906,7 @@ export {
59055906
AndroidKeyboardEvent, // e03becc8
59065907
Animated, // 91a7b171
59075908
AppConfig, // 35c0ca70
5908-
AppRegistry, // 7ef8e53a
5909+
AppRegistry, // 1e8c5a00
59095910
AppState, // 12012be5
59105911
AppStateEvent, // 80f034c3
59115912
AppStateStatus, // 447e5ef2
@@ -6184,7 +6185,7 @@ export {
61846185
VirtualizedSectionList, // 9fd9cd61
61856186
VirtualizedSectionListInstance, // 12b706d5
61866187
VirtualizedSectionListProps, // 12a58a4f
6187-
WrapperComponentProvider, // 4b8c7962
6188+
WrapperComponentProvider, // 9ef54e61
61886189
codegenNativeCommands, // 628a7c0a
61896190
codegenNativeComponent, // 32a1bca6
61906191
findNodeHandle, // 93f80214

packages/virtualized-lists/Lists/FillRateHelper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ let _sampleRate = DEBUG ? 1 : null;
4343
* samples (e.g. to log them), make sure to call `FillRateHelper.setSampleRate(0.0-1.0)`.
4444
*
4545
* Listeners and sample rate are global for all `VirtualizedList`s - typical usage will combine with
46-
* `SceneTracker.getActiveScene` to determine the context of the events.
46+
* the active scene/route to determine the context of the events.
4747
*/
4848
class FillRateHelper {
4949
_anyBlankStartTime: ?number = null;

0 commit comments

Comments
 (0)