-
Notifications
You must be signed in to change notification settings - Fork 24.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make codegenNativeComponent show warning and not error #43070
Conversation
This pull request was exported from Phabricator. Differential Revision: D53761805 |
d7db18b
to
8301bf9
Compare
Summary: **Context** The `codegenNativeComponent` function is a hint for the codegen that the file that contains it is a Native Component spec. Static ViewConfig codegen overwrites this function call by the generated ViewConfig. If this function is not overwritten by the codegen, it has runtime behaviour that falls back to `requireNativeComponent`. At the time when this system was built `requireNativeComponent` was not supported in Bridgeless mode because it is relied on some Bridge-only functionality. That's why it outputs error in Bridgeless mode. --- This is not the case any more, we now have interop layers which provide the functionality needed by `requireNativeComponent`. The SVC codegen is implemented as [Babel plugin](https://github.com/facebook/react-native/tree/main/packages/babel-plugin-codegen). The are scenarios when it is not run for the native component specs: - If the plugin is not used for whatever reason. - If Babel is not used for whatever reason. In order to not to regress the DevX for such cases, we've turned the error into the warning. **Note:** we use `console.info('⚠️ ...` instead of `console.warn('...`. That's because `console.warn` also prints a stack trace in the console, and we didn't want to create too much noise. Changelog: [General][Changed] - codegenNativeComponent show warning and not error if not code generated at build time. Reviewed By: fkgozali Differential Revision: D53761805
This pull request was exported from Phabricator. Differential Revision: D53761805 |
Summary: **Context** The `codegenNativeComponent` function is a hint for the codegen that the file that contains it is a Native Component spec. Static ViewConfig codegen overwrites this function call by the generated ViewConfig. If this function is not overwritten by the codegen, it has runtime behaviour that falls back to `requireNativeComponent`. At the time when this system was built `requireNativeComponent` was not supported in Bridgeless mode because it is relied on some Bridge-only functionality. That's why it outputs error in Bridgeless mode. --- This is not the case any more, we now have interop layers which provide the functionality needed by `requireNativeComponent`. The SVC codegen is implemented as [Babel plugin](https://github.com/facebook/react-native/tree/main/packages/babel-plugin-codegen). The are scenarios when it is not run for the native component specs: - If the plugin is not used for whatever reason. - If Babel is not used for whatever reason. In order to not to regress the DevX for such cases, we've turned the error into the warning. **Note:** we use `console.info('⚠️ ...` instead of `console.warn('...`. That's because `console.warn` also prints a stack trace in the console, and we didn't want to create too much noise. Changelog: [General][Changed] - codegenNativeComponent show warning and not error if not code generated at build time. Reviewed By: fkgozali Differential Revision: D53761805
8301bf9
to
1b7786e
Compare
This pull request was exported from Phabricator. Differential Revision: D53761805 |
1 similar comment
This pull request was exported from Phabricator. Differential Revision: D53761805 |
1b7786e
to
840a238
Compare
Summary: **Context** The `codegenNativeComponent` function is a hint for the codegen that the file that contains it is a Native Component spec. Static ViewConfig codegen overwrites this function call by the generated ViewConfig. If this function is not overwritten by the codegen, it has runtime behaviour that falls back to `requireNativeComponent`. At the time when this system was built `requireNativeComponent` was not supported in Bridgeless mode because it is relied on some Bridge-only functionality. That's why it outputs error in Bridgeless mode. --- This is not the case any more, we now have interop layers which provide the functionality needed by `requireNativeComponent`. The SVC codegen is implemented as [Babel plugin](https://github.com/facebook/react-native/tree/main/packages/babel-plugin-codegen). The are scenarios when it is not run for the native component specs: - If the plugin is not used for whatever reason. - If Babel is not used for whatever reason. In order to not to regress the DevX for such cases, we've turned the error into the warning. **Note:** we use `console.info('⚠️ ...` instead of `console.warn('...`. That's because `console.warn` also prints a stack trace in the console, and we didn't want to create too much noise. Changelog: [General][Changed] - codegenNativeComponent show warning and not error if not code generated at build time. Reviewed By: rshest Differential Revision: D53761805
This pull request was exported from Phabricator. Differential Revision: D53761805 |
Summary: **Context** The `codegenNativeComponent` function is a hint for the codegen that the file that contains it is a Native Component spec. Static ViewConfig codegen overwrites this function call by the generated ViewConfig. If this function is not overwritten by the codegen, it has runtime behaviour that falls back to `requireNativeComponent`. At the time when this system was built `requireNativeComponent` was not supported in Bridgeless mode because it is relied on some Bridge-only functionality. That's why it outputs error in Bridgeless mode. --- This is not the case any more, we now have interop layers which provide the functionality needed by `requireNativeComponent`. The SVC codegen is implemented as [Babel plugin](https://github.com/facebook/react-native/tree/main/packages/babel-plugin-codegen). The are scenarios when it is not run for the native component specs: - If the plugin is not used for whatever reason. - If Babel is not used for whatever reason. In order to not to regress the DevX for such cases, we've turned the error into the warning. **Note:** we use `console.info('⚠️ ...` instead of `console.warn('...`. That's because `console.warn` also prints a stack trace in the console, and we didn't want to create too much noise. Changelog: [General][Changed] - codegenNativeComponent show warning and not error if not code generated at build time. Reviewed By: huntie, rshest Differential Revision: D53761805
840a238
to
6f4f290
Compare
This pull request was exported from Phabricator. Differential Revision: D53761805 |
Summary: **Context** The `codegenNativeComponent` function is a hint for the codegen that the file that contains it is a Native Component spec. Static ViewConfig codegen overwrites this function call by the generated ViewConfig. If this function is not overwritten by the codegen, it has runtime behaviour that falls back to `requireNativeComponent`. At the time when this system was built `requireNativeComponent` was not supported in Bridgeless mode because it is relied on some Bridge-only functionality. That's why it outputs error in Bridgeless mode. --- This is not the case any more, we now have interop layers which provide the functionality needed by `requireNativeComponent`. The SVC codegen is implemented as [Babel plugin](https://github.com/facebook/react-native/tree/main/packages/babel-plugin-codegen). The are scenarios when it is not run for the native component specs: - If the plugin is not used for whatever reason. - If Babel is not used for whatever reason. In order to not to regress the DevX for such cases, we've turned the error into the warning. **Note:** we use `console.info('⚠️ ...` instead of `console.warn('...`. That's because `console.warn` also prints a stack trace in the console, and we didn't want to create too much noise. Changelog: [General][Changed] - codegenNativeComponent show warning and not error if not code generated at build time. Reviewed By: huntie, rshest Differential Revision: D53761805
6f4f290
to
35e9439
Compare
This pull request was exported from Phabricator. Differential Revision: D53761805 |
Summary: **Context** The `codegenNativeComponent` function is a hint for the codegen that the file that contains it is a Native Component spec. Static ViewConfig codegen overwrites this function call by the generated ViewConfig. If this function is not overwritten by the codegen, it has runtime behaviour that falls back to `requireNativeComponent`. At the time when this system was built `requireNativeComponent` was not supported in Bridgeless mode because it is relied on some Bridge-only functionality. That's why it outputs error in Bridgeless mode. --- This is not the case any more, we now have interop layers which provide the functionality needed by `requireNativeComponent`. The SVC codegen is implemented as [Babel plugin](https://github.com/facebook/react-native/tree/main/packages/babel-plugin-codegen). The are scenarios when it is not run for the native component specs: - If the plugin is not used for whatever reason. - If Babel is not used for whatever reason. In order to not to regress the DevX for such cases, we've turned the error into the warning. **Note:** we use `console.info('⚠️ ...` instead of `console.warn('...`. That's because `console.warn` also prints a stack trace in the console, and we didn't want to create too much noise. Changelog: [General][Changed] - codegenNativeComponent show warning and not error if not code generated at build time. Reviewed By: huntie, rshest Differential Revision: D53761805
35e9439
to
81bbc6e
Compare
This pull request was exported from Phabricator. Differential Revision: D53761805 |
This pull request was successfully merged by @dmytrorykun in de5619e. When will my fix make it into a release? | Upcoming Releases |
This pull request has been merged in de5619e. |
Summary:
Context
The
codegenNativeComponent
function is a hint for the codegen that the file that contains it is a Native Component spec. Static ViewConfig codegen overwrites this function call by the generated ViewConfig.If this function is not overwritten by the codegen, it has runtime behaviour that falls back to
requireNativeComponent
. At the time when this system was builtrequireNativeComponent
was not supported in Bridgeless mode because it is relied on some Bridge-only functionality. That's why it outputs error in Bridgeless mode.This is not the case any more, we now have interop layers which provide the functionality needed by
requireNativeComponent
.The SVC codegen is implemented as Babel plugin. The are scenarios when it is not run for the native component specs:
In order to not to regress the DevX for such cases, we've turned the error into the warning.
Note: we use
console.info('⚠️...
instead ofconsole.warn('...
. That's becauseconsole.warn
also prints a stack trace in the console, and we didn't want to create too much noise.Changelog: [General][Changed] - codegenNativeComponent show warning and not error if not code generated at build time.
Differential Revision: D53761805