mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
6152763398
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/35163 # What This diff contains all the changes from D40333083 (https://github.com/facebook/react-native/commit/0fac9817df403e31d8256befe52409c948614706) (aka https://github.com/facebook/react-native/pull/34964), **except** the change to `setUpReactDevTools.js`, which actually uses the new files. # Why * We want to ship the Buck, C++, etc. changes before the JavaScript changes that depend on those files. * Otherwise, apps can fail at startup with the message: ``` `TurboModuleRegistry.getEnforcing(...): '${name}' could not be found. ` + 'Verify that a module by this name is registered in the native binary.', ``` * Note that this only occurs if you are using a previously-built version of the C++, Obj C, etc. files in RN, but a more recent version of the JavaScript files. If you are building from matching sources, this does not occur. * After a few days, we can land the JS files. ## Changelog Changelog [General][Added] Add, but don't use, DevTools Settings Manager. Reviewed By: NickGerleman Differential Revision: D40873390 fbshipit-source-id: c7bac6ae65f85666b8616443db278ebb175b691b
34 lines
887 B
JavaScript
34 lines
887 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 {Spec} from './NativeDevToolsSettingsManager';
|
|
|
|
import Settings from '../Settings/Settings';
|
|
|
|
const CONSOLE_PATCH_SETTINGS_KEY = 'ReactDevTools::ConsolePatchSettings';
|
|
|
|
const DevToolsSettingsManager = {
|
|
setConsolePatchSettings: (newConsolePatchSettings: string) => {
|
|
Settings.set({
|
|
[CONSOLE_PATCH_SETTINGS_KEY]: newConsolePatchSettings,
|
|
});
|
|
},
|
|
getConsolePatchSettings: () => {
|
|
const value = Settings.get(CONSOLE_PATCH_SETTINGS_KEY);
|
|
if (typeof value === 'string') {
|
|
// $FlowFixMe[unclear-type]
|
|
return ((value: any): string);
|
|
}
|
|
return null;
|
|
},
|
|
};
|
|
|
|
module.exports = (DevToolsSettingsManager: Spec);
|