Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions Libraries/Core/deviceStorageMethods.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* 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
* @format
*/

'use strict';

import {MMKV} from 'react-native-mmkv';

const storage = new MMKV({
id: 'ReactDevTools',
});

export type DeviceStorageMethods = {
setValueOnDevice: (key: string, value: string) => void,
getValueOnDevice: (key: string) => ?string,
};

const methods: DeviceStorageMethods = {
setValueOnDevice: (key, value) => {
storage.set(key, value);
},
getValueOnDevice: key => {
return storage.getString(key);
},
};

module.exports = methods;
11 changes: 9 additions & 2 deletions Libraries/Core/setUpReactDevTools.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,21 @@ if (__DEV__) {

const ReactNativeStyleAttributes = require('../Components/View/ReactNativeStyleAttributes');

reactDevTools.connectToDevTools({
let connectToDevToolsParams = {
isAppActive,
resolveRNStyle: require('../StyleSheet/flattenStyle'),
nativeStyleEditorValidAttributes: Object.keys(
ReactNativeStyleAttributes,
),
websocket: ws,
});
};

if (__DEV__) {
// $FlowFixMe[prop-missing]
connectToDevToolsParams.deviceStorageMethods = require('./deviceStorageMethods');
}

reactDevTools.connectToDevTools(connectToDevToolsParams);
}
};

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@
"promise": "^8.0.3",
"react-devtools-core": "4.24.0",
"react-native-gradle-plugin": "^0.71.0",
"react-native-mmkv": "^2.4.3",
"react-refresh": "^0.4.0",
"react-shallow-renderer": "^16.15.0",
"regenerator-runtime": "^0.13.2",
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5926,6 +5926,11 @@ react-is@^18.2.0:
resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.2.0.tgz#199431eeaaa2e09f86427efbb4f1473edb47609b"
integrity sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==

react-native-mmkv@^2.4.3:
version "2.4.3"
resolved "https://registry.yarnpkg.com/react-native-mmkv/-/react-native-mmkv-2.4.3.tgz#6bb4c2d5e328513da11faab1371d056a189adbd0"
integrity sha512-0hYNOTbsjJ5j5cpX+qjwReGIxuYE9MWRsyPQ72fTOvzmEjYXCF4Wr2VQoqx8R6W1/Uinekvln7dGvJ4RExmHhQ==

react-refresh@^0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/react-refresh/-/react-refresh-0.4.0.tgz#d421f9bd65e0e4b9822a399f14ac56bda9c92292"
Expand Down