Skip to content

Commit 0cb91ed

Browse files
committed
fix: correct the nitro paths
1 parent a791437 commit 0cb91ed

File tree

2 files changed

+5
-25
lines changed

2 files changed

+5
-25
lines changed

packages/create-react-native-library/templates/common/$package.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"ios",
2525
"cpp",
2626
<% if (project.nitro) { -%>
27-
"nitro",
27+
"nitrogen",
2828
<% } -%>
2929
"*.podspec",
3030
"react-native.config.js",
@@ -51,11 +51,9 @@
5151
<% } else { -%>
5252
"clean": "del-cli lib",
5353
<% } -%>
54-
<% if (example !== 'expo') { -%>
55-
"nitrogen": "nitro-codegen",
56-
"prepare": "bob build && yarn nitrogen",
57-
<% } else { -%>
5854
"prepare": "bob build",
55+
<% if (project.nitro) { -%>
56+
"nitrogen": "nitro-codegen",
5957
<% } -%>
6058
"release": "release-it"
6159
},
Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,9 @@
11
import { NitroModules } from 'react-native-nitro-modules';
2-
import { Platform } from 'react-native';
32
import type { <%- project.name -%> } from './<%- project.name -%>.nitro';
43

5-
const LINKING_ERROR =
6-
`The package '<%- project.slug -%>' doesn't seem to be linked. Make sure: \n\n` +
7-
Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
8-
'- You rebuilt the app after installing the package\n' +
9-
'- You are not using Expo Go\n';
10-
11-
export const <%- project.name -%>HybridObject =
4+
const <%- project.name -%>HybridObject =
125
NitroModules.createHybridObject<<%- project.name -%>>('<%- project.name -%>');
136

14-
const <%- project.name -%> = <%- project.name -%>HybridObject
15-
? <%- project.name -%>HybridObject
16-
: (new Proxy(
17-
{},
18-
{
19-
get() {
20-
throw new Error(LINKING_ERROR);
21-
},
22-
}
23-
) as <%- project.name -%>);
24-
257
export function multiply(a: number, b: number): number {
26-
return <%- project.name -%>.multiply(a, b);
8+
return <%- project.name -%>HybridObject.multiply(a, b);
279
}

0 commit comments

Comments
 (0)