diff --git a/packages/rn-tester/js/examples/Performance/PerformanceApiExample.js b/packages/rn-tester/js/examples/Performance/PerformanceApiExample.js
new file mode 100644
index 00000000000..34ac57f847a
--- /dev/null
+++ b/packages/rn-tester/js/examples/Performance/PerformanceApiExample.js
@@ -0,0 +1,82 @@
+/**
+ * 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.
+ *
+ * @format
+ * @flow strict-local
+ * @oncall react_native
+ */
+
+'use strict';
+
+import * as React from 'react';
+import {StyleSheet, View, Text, Button} from 'react-native';
+import RNTesterPage from '../../components/RNTesterPage';
+
+const {useState} = React;
+
+function MemoryExample(): React.Node {
+ // Memory API testing
+ const [memoryInfo, setMemoryInfo] = useState<{
+ jsHeapSizeLimit?: ?number,
+ totalJSHeapSize?: ?number,
+ usedJSHeapSize?: ?number,
+ }>({});
+ const onGetMemoryInfo = () => {
+ // performance.memory is not included in bom.js yet.
+ // Once we release the change in flow this can be removed.
+ // $FlowFixMe[prop-missing]
+ // $FlowFixMe[incompatible-call]
+ setMemoryInfo(performance.memory);
+ };
+ return (
+
+
+
+
+
+ {`jsHeapSizeLimit: ${
+ memoryInfo.jsHeapSizeLimit == null
+ ? 'N/A'
+ : memoryInfo.jsHeapSizeLimit
+ } bytes`}
+
+
+ {`totalJSHeapSize: ${
+ memoryInfo.totalJSHeapSize == null
+ ? 'N/A'
+ : memoryInfo.totalJSHeapSize
+ } bytes`}
+
+
+ {`usedJSHeapSize: ${
+ memoryInfo.usedJSHeapSize == null
+ ? 'N/A'
+ : memoryInfo.usedJSHeapSize
+ } bytes`}
+
+
+
+
+ );
+}
+
+const styles = StyleSheet.create({
+ container: {
+ padding: 10,
+ },
+});
+
+exports.title = 'Performance API Examples';
+exports.category = 'Basic';
+exports.description = 'Shows the performance API provided in React Native';
+exports.examples = [
+ {
+ title: 'performance.memory',
+ render: function (): React.Element {
+ return ;
+ },
+ },
+];
diff --git a/packages/rn-tester/js/utils/RNTesterList.android.js b/packages/rn-tester/js/utils/RNTesterList.android.js
index c76ba8c5db3..152f0344146 100644
--- a/packages/rn-tester/js/utils/RNTesterList.android.js
+++ b/packages/rn-tester/js/utils/RNTesterList.android.js
@@ -297,6 +297,11 @@ const APIs: Array = [
category: 'Basic',
module: require('../examples/TurboModule/TurboCxxModuleExample'),
},
+ {
+ key: 'PerformanceApiExample',
+ category: 'Basic',
+ module: require('../examples/Performance/PerformanceApiExample'),
+ },
];
if (ReactNativeFeatureFlags.shouldEmitW3CPointerEvents()) {
diff --git a/packages/rn-tester/js/utils/RNTesterList.ios.js b/packages/rn-tester/js/utils/RNTesterList.ios.js
index 7676a8831f4..019887eb9e0 100644
--- a/packages/rn-tester/js/utils/RNTesterList.ios.js
+++ b/packages/rn-tester/js/utils/RNTesterList.ios.js
@@ -278,6 +278,11 @@ const APIs: Array = [
key: 'XHRExample',
module: require('../examples/XHR/XHRExample'),
},
+ {
+ key: 'PerformanceApiExample',
+ category: 'Basic',
+ module: require('../examples/Performance/PerformanceApiExample'),
+ },
];
if (ReactNativeFeatureFlags.shouldEmitW3CPointerEvents()) {