Skip to content

Commit 1c2cdda

Browse files
christophpurrermeta-codesync[bot]
authored andcommitted
Bring back C++ Turbo Module example in RN Tester (facebook#55988)
Summary: Pull Request resolved: facebook#55988 ## Changelog: [General] [Fixed] - Bring back C++ Turbo Module example in RN Tester The `TurboCxxModuleExample` was accidentally deleted in facebook#54544 (D87082461) which removed the TurboCxxModule C++ class. The JS example file and its RN Tester registrations should have been kept since they wrap `NativeCxxModuleExampleExample` which still exists. This restores: - `TurboCxxModuleExample.js` example file - RNTesterList entries for iOS, Android, macOS, and Windows Reviewed By: shwanton Differential Revision: D95653981 fbshipit-source-id: c8972268aaa95bc57e7f7ee9367b8b10c9d7f029
1 parent fc5cc28 commit 1c2cdda

3 files changed

Lines changed: 38 additions & 0 deletions

File tree

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/**
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*
7+
* @flow
8+
* @format
9+
*/
10+
11+
'use strict';
12+
13+
import type {RNTesterModuleExample} from '../../types/RNTesterTypes';
14+
15+
const NativeCxxModuleExampleExample = require('./NativeCxxModuleExampleExample');
16+
const React = require('react');
17+
18+
exports.displayName = (undefined: ?string);
19+
exports.title = 'Cxx TurboModule';
20+
exports.category = 'Basic';
21+
exports.description = 'Usage of Cxx TurboModule';
22+
exports.examples = [
23+
{
24+
title: 'TurboCxxModuleExample',
25+
render: function (): React.MixedElement {
26+
return <NativeCxxModuleExampleExample />;
27+
},
28+
},
29+
] as Array<RNTesterModuleExample>;

packages/rn-tester/js/utils/RNTesterList.android.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,11 @@ const APIs: Array<RNTesterModuleInfo> = ([
374374
key: 'LegacyModuleExample',
375375
module: require('../examples/TurboModule/LegacyModuleExample'),
376376
},
377+
{
378+
key: 'TurboCxxModuleExample',
379+
category: 'Basic',
380+
module: require('../examples/TurboModule/TurboCxxModuleExample'),
381+
},
377382
// Basic check to detect the availability of the IntersectionObserver API.
378383
// $FlowExpectedError[cannot-resolve-name]
379384
...(typeof IntersectionObserver === 'function'

packages/rn-tester/js/utils/RNTesterList.ios.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,10 @@ const APIs: Array<RNTesterModuleInfo> = ([
331331
key: 'LegacyModuleExample',
332332
module: require('../examples/TurboModule/LegacyModuleExample'),
333333
},
334+
{
335+
key: 'TurboCxxModuleExample',
336+
module: require('../examples/TurboModule/TurboCxxModuleExample'),
337+
},
334338
{
335339
key: 'VibrationExample',
336340
module: require('../examples/Vibration/VibrationExample'),

0 commit comments

Comments
 (0)