File tree Expand file tree Collapse file tree 2 files changed +5
-25
lines changed
packages/create-react-native-library/templates Expand file tree Collapse file tree 2 files changed +5
-25
lines changed Original file line number Diff line number Diff line change 24
24
" ios" ,
25
25
" cpp" ,
26
26
<% if (project.nitro) { -%>
27
- " nitro " ,
27
+ " nitrogen " ,
28
28
<% } -%>
29
29
" *.podspec" ,
30
30
" react-native.config.js" ,
51
51
<% } else { -%>
52
52
"clean" : " del-cli lib" ,
53
53
<% } -%>
54
- <% if (example !== 'expo') { -%>
55
- "nitrogen" : " nitro-codegen" ,
56
- "prepare" : " bob build && yarn nitrogen" ,
57
- <% } else { -%>
58
54
"prepare" : " bob build" ,
55
+ <% if (project.nitro) { -%>
56
+ "nitrogen" : " nitro-codegen" ,
59
57
<% } -%>
60
58
"release" : " release-it"
61
59
},
Original file line number Diff line number Diff line change 1
1
import { NitroModules } from 'react-native-nitro-modules' ;
2
- import { Platform } from 'react-native' ;
3
2
import type { < % - project . name - % > } from './<%- project.name -%>.nitro' ;
4
3
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 =
12
5
NitroModules . createHybridObject << % - project . name - % >> ( '<%- project.name -%>' ) ;
13
6
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
-
25
7
export function multiply ( a : number , b : number ) : number {
26
- return < % - project . name - % > . multiply ( a , b ) ;
8
+ return < % - project . name - % > HybridObject . multiply ( a , b ) ;
27
9
}
You can’t perform that action at this time.
0 commit comments