@react-native/codegen 0.89.0-nightly-20260920-6019ea14b → 0.89.0-nightly-20260923-4b6cd413d

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -23,7 +23,8 @@ ${imports}
23
23
 
24
24
  ${componentConfig}
25
25
  `;
26
- const UIMANAGER_IMPORT = 'const {UIManager} = require("react-native")';
26
+ const UIMANAGER_IMPORT = 'const {UIManager} = require("react-native");';
27
+ const RENDERER_IMPORT = 'const {Renderer} = require("react-native/unstable-internals-do-not-use");';
27
28
  function expression(input) {
28
29
  return core.template.expression(input)();
29
30
  }
@@ -42,15 +43,15 @@ function getReactDiffProcessValue(typeAnnotation) {
42
43
  case 'ReservedPropTypeAnnotation':
43
44
  switch (typeAnnotation.name) {
44
45
  case 'ColorPrimitive':
45
- return expression("require('react-native/Libraries/Components/View/ReactNativeStyleAttributes').colorAttribute");
46
+ return expression("require('react-native/unstable-internals-do-not-use').colorAttribute");
46
47
  case 'ImageSourcePrimitive':
47
- return expression("{ process: ((req) => 'default' in req ? req.default : req)(require('react-native/Libraries/Image/resolveAssetSource')) }");
48
+ return expression("{ process: require('react-native').Image.resolveAssetSource }");
48
49
  case 'ImageRequestPrimitive':
49
50
  throw new Error('ImageRequest should not be used in props');
50
51
  case 'PointPrimitive':
51
- return expression("{ diff: ((req) => 'default' in req ? req.default : req)(require('react-native/Libraries/Utilities/differ/pointsDiffer')) }");
52
+ return expression("{ diff: require('react-native/unstable-internals-do-not-use').pointsDiffer }");
52
53
  case 'EdgeInsetsPrimitive':
53
- return expression("{ diff: ((req) => 'default' in req ? req.default : req)(require('react-native/Libraries/Utilities/differ/insetsDiffer')) }");
54
+ return expression("{ diff: require('react-native/unstable-internals-do-not-use').insetsDiffer }");
54
55
  case 'DimensionPrimitive':
55
56
  return t.booleanLiteral(true);
56
57
  default:
@@ -61,7 +62,7 @@ function getReactDiffProcessValue(typeAnnotation) {
61
62
  if (typeAnnotation.elementType.type === 'ReservedPropTypeAnnotation') {
62
63
  switch (typeAnnotation.elementType.name) {
63
64
  case 'ColorPrimitive':
64
- return expression("{ process: ((req) => 'default' in req ? req.default : req)(require('react-native/Libraries/StyleSheet/processColorArray')) }");
65
+ return expression("{ process: require('react-native/unstable-internals-do-not-use').processColorArray }");
65
66
  case 'ImageSourcePrimitive':
66
67
  case 'PointPrimitive':
67
68
  case 'EdgeInsetsPrimitive':
@@ -116,7 +117,7 @@ function normalizeInputEventName(name) {
116
117
  return name;
117
118
  }
118
119
  function getValidAttributesForEvents(events, imports) {
119
- imports.add("const {ConditionallyIgnoredEventHandlers} = require('react-native/Libraries/NativeComponent/ViewConfigIgnore');");
120
+ imports.add("const {ConditionallyIgnoredEventHandlers} = require('react-native/unstable-internals-do-not-use');");
120
121
  const validAttributes = t.objectExpression(events.map(eventType => {
121
122
  return t.objectProperty(t.identifier(eventType.name), t.booleanLiteral(true));
122
123
  }));
@@ -136,7 +137,7 @@ function buildViewConfig(schema, componentName, component, imports) {
136
137
  case 'ReactNativeBuiltInType':
137
138
  switch (extendProps.knownTypeName) {
138
139
  case 'ReactNativeCoreViewProps':
139
- imports.add("const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/NativeComponentRegistry');");
140
+ imports.add("const {NativeComponentRegistry} = require('react-native');");
140
141
  return;
141
142
  default:
142
143
  extendProps.knownTypeName;
@@ -181,11 +182,11 @@ function buildCommands(schema, componentName, component, imports) {
181
182
  if (commands.length === 0) {
182
183
  return null;
183
184
  }
184
- imports.add('const {dispatchCommand} = require("react-native/Libraries/ReactNative/RendererProxy");');
185
+ imports.add(RENDERER_IMPORT);
185
186
  const commandsObject = t.objectExpression(commands.map(command => {
186
187
  const commandName = command.name;
187
188
  const params = command.typeAnnotation.params;
188
- const dispatchCommandCall = t.callExpression(t.identifier('dispatchCommand'), [t.identifier('ref'), t.stringLiteral(commandName), t.arrayExpression(params.map(param => t.identifier(param.name)))]);
189
+ const dispatchCommandCall = t.callExpression(t.memberExpression(t.identifier('Renderer'), t.identifier('dispatchCommand')), [t.identifier('ref'), t.stringLiteral(commandName), t.arrayExpression(params.map(param => t.identifier(param.name)))]);
189
190
  return t.objectMethod('method', t.identifier(commandName), [t.identifier('ref'), ...params.map(param => t.identifier(param.name))], t.blockStatement([t.expressionStatement(dispatchCommandCall)]));
190
191
  }));
191
192
  return t.exportNamedDeclaration(t.variableDeclaration('const', [t.variableDeclarator(t.identifier('Commands'), commandsObject)]));
@@ -55,7 +55,9 @@ ${componentConfig}
55
55
 
56
56
  // We use this to add to a set. Need to make sure we aren't importing
57
57
  // this multiple times.
58
- const UIMANAGER_IMPORT = 'const {UIManager} = require("react-native")';
58
+ const UIMANAGER_IMPORT = 'const {UIManager} = require("react-native");';
59
+ const RENDERER_IMPORT =
60
+ 'const {Renderer} = require("react-native/unstable-internals-do-not-use");';
59
61
 
60
62
  function expression(input: string) {
61
63
  return core.template.expression(input)();
@@ -77,21 +79,21 @@ function getReactDiffProcessValue(typeAnnotation: PropTypeAnnotation) {
77
79
  switch (typeAnnotation.name) {
78
80
  case 'ColorPrimitive':
79
81
  return expression(
80
- "require('react-native/Libraries/Components/View/ReactNativeStyleAttributes').colorAttribute",
82
+ "require('react-native/unstable-internals-do-not-use').colorAttribute",
81
83
  );
82
84
  case 'ImageSourcePrimitive':
83
85
  return expression(
84
- "{ process: ((req) => 'default' in req ? req.default : req)(require('react-native/Libraries/Image/resolveAssetSource')) }",
86
+ "{ process: require('react-native').Image.resolveAssetSource }",
85
87
  );
86
88
  case 'ImageRequestPrimitive':
87
89
  throw new Error('ImageRequest should not be used in props');
88
90
  case 'PointPrimitive':
89
91
  return expression(
90
- "{ diff: ((req) => 'default' in req ? req.default : req)(require('react-native/Libraries/Utilities/differ/pointsDiffer')) }",
92
+ "{ diff: require('react-native/unstable-internals-do-not-use').pointsDiffer }",
91
93
  );
92
94
  case 'EdgeInsetsPrimitive':
93
95
  return expression(
94
- "{ diff: ((req) => 'default' in req ? req.default : req)(require('react-native/Libraries/Utilities/differ/insetsDiffer')) }",
96
+ "{ diff: require('react-native/unstable-internals-do-not-use').insetsDiffer }",
95
97
  );
96
98
  case 'DimensionPrimitive':
97
99
  return t.booleanLiteral(true);
@@ -106,7 +108,7 @@ function getReactDiffProcessValue(typeAnnotation: PropTypeAnnotation) {
106
108
  switch (typeAnnotation.elementType.name) {
107
109
  case 'ColorPrimitive':
108
110
  return expression(
109
- "{ process: ((req) => 'default' in req ? req.default : req)(require('react-native/Libraries/StyleSheet/processColorArray')) }",
111
+ "{ process: require('react-native/unstable-internals-do-not-use').processColorArray }",
110
112
  );
111
113
  case 'ImageSourcePrimitive':
112
114
  case 'PointPrimitive':
@@ -192,8 +194,10 @@ function getValidAttributesForEvents(
192
194
  events: ReadonlyArray<EventTypeShape>,
193
195
  imports: Set<string>,
194
196
  ) {
197
+ // Generated files can live outside the React Native package, so they cannot
198
+ // use a relative import for this implementation detail.
195
199
  imports.add(
196
- "const {ConditionallyIgnoredEventHandlers} = require('react-native/Libraries/NativeComponent/ViewConfigIgnore');",
200
+ "const {ConditionallyIgnoredEventHandlers} = require('react-native/unstable-internals-do-not-use');",
197
201
  );
198
202
 
199
203
  const validAttributes = t.objectExpression(
@@ -264,7 +268,7 @@ function buildViewConfig(
264
268
  switch (extendProps.knownTypeName) {
265
269
  case 'ReactNativeCoreViewProps':
266
270
  imports.add(
267
- "const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/NativeComponentRegistry');",
271
+ "const {NativeComponentRegistry} = require('react-native');",
268
272
  );
269
273
 
270
274
  return;
@@ -366,9 +370,7 @@ function buildCommands(
366
370
  return null;
367
371
  }
368
372
 
369
- imports.add(
370
- 'const {dispatchCommand} = require("react-native/Libraries/ReactNative/RendererProxy");',
371
- );
373
+ imports.add(RENDERER_IMPORT);
372
374
 
373
375
  const commandsObject = t.objectExpression(
374
376
  commands.map(command => {
@@ -376,7 +378,10 @@ function buildCommands(
376
378
  const params = command.typeAnnotation.params;
377
379
 
378
380
  const dispatchCommandCall = t.callExpression(
379
- t.identifier('dispatchCommand'),
381
+ t.memberExpression(
382
+ t.identifier('Renderer'),
383
+ t.identifier('dispatchCommand'),
384
+ ),
380
385
  [
381
386
  t.identifier('ref'),
382
387
  t.stringLiteral(commandName),
@@ -152,7 +152,7 @@ const FileTemplate = ({
152
152
  #pragma once
153
153
 
154
154
  #include <ReactCommon/TurboModule.h>
155
- #include <react/bridging/Bridging.h>
155
+ #include <React/Bridging.h>
156
156
 
157
157
  namespace facebook::react {
158
158
 
@@ -213,7 +213,7 @@ const FileTemplate = ({
213
213
  #pragma once
214
214
 
215
215
  #include <ReactCommon/TurboModule.h>
216
- #include <react/bridging/Bridging.h>
216
+ #include <React/Bridging.h>
217
217
 
218
218
  namespace facebook::react {
219
219
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native/codegen",
3
- "version": "0.89.0-nightly-20260920-6019ea14b",
3
+ "version": "0.89.0-nightly-20260923-4b6cd413d",
4
4
  "description": "Code generation tools for React Native",
5
5
  "license": "MIT",
6
6
  "repository": {