[MOO-2205] Update RN version to 0.78.2#160
[MOO-2205] Update RN version to 0.78.2#160NikolaSimsic wants to merge 4 commits intomendix:masterfrom
Conversation
...rator-widget/generators/app/templates/packages/__tests__/outputs/package_native.json-ts.json
Outdated
Show resolved
Hide resolved
LEGIO-SEXTA-FERRATA
left a comment
There was a problem hiding this comment.
First round of review is done. 👍
| widgetPackageJson.devDependencies["@mendix/pluggable-widgets-tools"] = toolsPackagePath; | ||
|
|
||
| // Adds compatibility to new React 18 and React native 0.72 | ||
| fixPackageJson(widgetPackageJson); |
There was a problem hiding this comment.
This removes the last call to fixPackageJson() which is now unused, but has changes in this PR. Should we remove the method entirely?
|
|
||
| // React 19 + RN 0.78.x: RN's built-in types still expect legacy component typings (e.g. `refs`). | ||
| // We return and assert `ReactNode` here to avoid JSX element type errors until upstream types align. | ||
| render(): ReactNode { |
There was a problem hiding this comment.
Based on the other files, shouldn't this return type be removed or changed to JSX.Element as well?
| @@ -14,7 +14,7 @@ export interface BadgeProps { | |||
| export function Badge({ value, style, onClick }: BadgeProps): ReactElement { | |||
There was a problem hiding this comment.
I think the return type should be JSX.Element
|
|
||
| export class HelloWorldSample extends Component<HelloWorldSampleProps> { | ||
| render(): ReactNode { | ||
| render(): React.JSX.Element { |
There was a problem hiding this comment.
Can we add JSX to the import of React, and skip the React prefix?
| private readonly onClickHandler = this.onClick.bind(this); | ||
|
|
||
| render(): ReactNode { | ||
| render(): React.JSX.Element | null { |
There was a problem hiding this comment.
Why do we need to include null here?
| _writeCompilerOptions() { | ||
| if (this.widget.isLanguageTS) { | ||
| this._copyFile("commons/tsconfig.json", "tsconfig.json"); | ||
| this._copyFile("commons/react-jsx.d.ts", "typings/react-jsx.d.ts"); |
There was a problem hiding this comment.
Maybe we can limit this to just native widgets?
| "module": "esnext", | ||
| "target": "es6", | ||
| "lib": ["esnext", "dom"], | ||
| "types": ["jest", "node"], |
There was a problem hiding this comment.
Why are these removed?
| { name: "react-native", ...reactNativePackage }, | ||
| { name: "@types/react", ...reactPackage }, | ||
| { name: "@types/react-dom", ...reactDomPackage }, | ||
| { name: "@types/react-native", ...reactNativePackage } |
There was a problem hiding this comment.
Don't we need to maintain these resolutions for the types?
| "react": "^19.0.0", | ||
| "react-dom": "^19.0.0", | ||
| "react-native": "0.78.2", | ||
| "mendix": { |
There was a problem hiding this comment.
If this override is truly needed, shouldn't we add it to the dependency migration for existing widgets as well? This generator change only affects new widgets.
| import "react"; | ||
|
|
||
| // React Native 0.78.x types expect a `refs` property on class components. | ||
| // React 19 removed `refs` from the Component instance type, so we re-add it here |
There was a problem hiding this comment.
Are there specific dependencies that refer to this.refs? Won't it "explode" in runtime when code assuming this.refs is available tries to call it?
Maybe to ensure widget developers don't accidentally use it we can mark it @deprecated
✅ Web TypeScript (8.0, 8.6, 8.9, latest) - full & empty
✅ Web JavaScript (8.7, latest) - full & empty
✅ Native TypeScript (8.6, 8.9, latest) - full & empty
✅ Native JavaScript (latest) - full & empty
Every test passed including:
Widget generation
Build commands
Release commands
Dependencies files
npm start (watch mode)
Native dependency management