Skip to content
Merged
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
5 changes: 0 additions & 5 deletions .github/workflows/build-templates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,6 @@ jobs:
working-directory: ${{ env.work_dir }}
run: yarn nitrogen

- name: Generate codegen native code
if: matrix.type.language == 'cpp'
working-directory: ${{ env.work_dir }}
run: yarn bob build --target codegen

- name: Cache turborepo
if: env.android_build == 1 || env.ios_build == 1
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
Expand Down
2 changes: 0 additions & 2 deletions docs/pages/create.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,5 +95,3 @@ Once the project is created, you can follow the official React Native docs to le
- [Fabric Components](https://reactnative.dev/docs/fabric-native-components-introduction)

Turbo Modules and Fabric components don't have native support for Swift. If you want to write the iOS implementation in Swift for a Turbo Module or Fabric View, see [Swift with Turbo Modules and Fabric](./swift-new-architecture.md).

> Note: The C++ template is currently experimental and only works with `includesGeneratedCode: true`. This can make it incompatible with React Native versions other than the one used to generate the codegen files. See [Including Generated Code into Libraries](https://reactnative.dev/docs/the-new-architecture/codegen-cli#including-generated-code-into-libraries) in the React Native docs for more details.
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ import sortObjectKeys from '../utils/sortObjectKeys.ts';

type PackageJson = {
devDependencies?: Record<string, string>;
'react-native-builder-bob'?: {
targets?: (string | [string, unknown])[];
};
};

export async function alignDependencyVersionsWithExampleApp(
Expand All @@ -24,15 +21,6 @@ export async function alignDependencyVersionsWithExampleApp(
'@react-native/babel-preset',
];

const usesCodegen =
pkg['react-native-builder-bob']?.targets?.some((target) =>
Array.isArray(target) ? target[0] === 'codegen' : target === 'codegen'
) ?? false;

if (usesCodegen) {
PACKAGES_TO_COPY.push('@react-native-community/cli');
}

const devDependencies: Record<string, string> = {};

PACKAGES_TO_COPY.forEach((name) => {
Expand Down
4 changes: 2 additions & 2 deletions packages/create-react-native-library/src/prompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const LANGUAGE_CHOICES: {
types: ['turbo-module', 'fabric-view'],
},
{
title: 'C++ (Experimental)',
title: 'C++',
value: 'cpp',
types: ['turbo-module'],
},
Expand Down Expand Up @@ -364,7 +364,7 @@ export const prompt = create(['[name]'], {
const answers = prompt.read();

if (answers.languages === 'cpp') {
return choice.value !== 'vanilla';
return choice.value === 'test-app';
}

return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,6 @@ jobs:
- name: Generate nitrogen code
run: yarn nitrogen
<% } -%>
<% if (project.cpp) { -%>

- name: Generate codegen native code
run: yarn bob build --target codegen
<% } -%>

- name: Cache turborepo for Android
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
Expand Down Expand Up @@ -157,11 +152,6 @@ jobs:
- name: Generate nitrogen code
run: yarn nitrogen
<% } -%>
<% if (project.cpp) { -%>

- name: Generate codegen native code
run: yarn bob build --target codegen
<% } -%>

- name: Cache turborepo for iOS
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,6 @@
"registry": "https://registry.npmjs.org/"
},
"devDependencies": {
<% if (project.cpp) { -%>
"@react-native-community/cli": "20.2.0",
<% } -%>
"@react-native/babel-preset": "0.88.0",
"@types/react": "^19.2.0",
"del-cli": "^8.0.1",
Expand Down Expand Up @@ -125,22 +122,14 @@
{
"project": "tsconfig.build.json"
}
]<% if (project.cpp) { -%>,
"codegen"
<% } -%>
]
]
<% if (project.moduleConfig === 'turbo-modules' || project.viewConfig === 'fabric-view') { -%>
},
"codegenConfig": {
"name": "<%- project.name -%><%- project.viewConfig !== null ? 'View': '' -%>Spec",
"type": "<%- project.viewConfig !== null ? 'all': 'modules' -%>",
"jsSrcsDir": "src",
<% if (project.cpp) { -%>
"outputDir": {
"ios": "ios/generated",
"android": "android/generated"
},
<% } -%>
"android": {
"javaPackageName": "com.<%- project.package %>"
<% if (project.viewConfig === 'fabric-view') { -%>
Expand All @@ -153,9 +142,6 @@
}
<% } -%>
}
<% if (project.cpp) { -%>,
"includesGeneratedCode": true
<% } -%>
<% } -%>
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,6 @@ To invoke **Nitrogen**, use the following command:
yarn nitrogen
```

<% } -%>
<% if (project.cpp) { -%>
You need to run React Native Codegen to generate the native scaffolding for the C++ Turbo Module. The example app will not build without these generated files.

Run **Codegen** in following cases:

- When you make changes to `src/Native<%- project.name -%>.ts`.
- When running the project for the first time (since the generated files are not committed to the repository).

To invoke **Codegen**, use the following command:

```sh
yarn bob build --target codegen
```

<% } -%>
The [example app](/example/) demonstrates usage of the library. You need to run it to test any changes you make.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ module.exports = {
dependency: {
platforms: {
android: {
cmakeListsPath: 'generated/jni/CMakeLists.txt',
cxxModuleCMakeListsModuleName: '<%- project.identifier -%>',
cxxModuleCMakeListsPath: 'CMakeLists.txt',
cxxModuleHeaderName: '<%- project.name -%>Impl',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Pod::Spec.new do |s|
s.platforms = { :ios => min_ios_version_supported }
s.source = { :git => "<%- repo -%>.git", :tag => "#{s.version}" }

s.source_files = "ios/**/*.{h,m,mm}", "cpp/**/*.{hpp,cpp,c,h}", "ios/generated/*.{h,cpp,mm}"
s.source_files = "ios/**/*.{h,m,mm}", "cpp/**/*.{hpp,cpp,c,h}"
s.private_header_files = "ios/**/*.h"

install_modules_dependencies(s)
Expand Down
Loading