Skip to content
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

[Codegen][Fabric][New architecture] Array of array crashes codegen #35062

Closed
evgenusov opened this issue Oct 24, 2022 · 2 comments
Closed

[Codegen][Fabric][New architecture] Array of array crashes codegen #35062

evgenusov opened this issue Oct 24, 2022 · 2 comments
Labels
Needs: Triage 🔍 Stale There has been a lack of activity on this issue and it may be closed soon. Tech: Codegen Related to react-native-codegen Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules)

Comments

@evgenusov
Copy link

evgenusov commented Oct 24, 2022

Description

I have this interface:

export interface NativeProps extends ViewProps {
  data: ReadonlyArray<ReadonlyArray<string>>;
  selectedIndexes: ReadonlyArray<Int32>;
  onChange: DirectEventHandler<Readonly<OnChangeProps>>;
}

When I do codegen I get this:

[Codegen] >>>>> Processing RTNPickerSpecs


[Codegen] Done.
/Users/eugenusov/projects/react-native-picker/example/node_modules/react-native-codegen/lib/parsers/typescript/components/props.js:46
      objectType.typeParameters.params[0].members ||
                                ^

TypeError: Cannot read properties of undefined (reading 'params')
    at getTypeAnnotationForObjectAsArrayElement (/Users/eugenusov/projects/react-native-picker/example/node_modules/react-native-codegen/lib/parsers/typescript/components/props.js:46:33)
    at getTypeAnnotationForArrayOfArrayOfObject (/Users/eugenusov/projects/react-native-picker/example/node_modules/react-native-codegen/lib/parsers/typescript/components/props.js:60:18)
    at getTypeAnnotationForArray (/Users/eugenusov/projects/react-native-picker/example/node_modules/react-native-codegen/lib/parsers/typescript/components/props.js:115:14)
    at getTypeAnnotation (/Users/eugenusov/projects/react-native-picker/example/node_modules/react-native-codegen/lib/parsers/typescript/components/props.js:279:20)
    at buildPropSchema (/Users/eugenusov/projects/react-native-picker/example/node_modules/react-native-codegen/lib/parsers/typescript/components/props.js:586:21)
    at /Users/eugenusov/projects/react-native-picker/example/node_modules/react-native-codegen/lib/parsers/typescript/components/props.js:639:14
    at Array.map (<anonymous>)
    at getProps (/Users/eugenusov/projects/react-native-picker/example/node_modules/react-native-codegen/lib/parsers/typescript/components/props.js:638:6)
    at buildComponentSchema (/Users/eugenusov/projects/react-native-picker/example/node_modules/react-native-codegen/lib/parsers/typescript/components/index.js:237:17)
    at buildSchema (/Users/eugenusov/projects/react-native-picker/example/node_modules/react-native-codegen/lib/parsers/typescript/index.js:146:34)
Error: Command failed: node /Users/eugenusov/projects/react-native-picker/example/node_modules/react-native-codegen/lib/cli/combine/combine-js-to-schema-cli.js /var/folders/z6/44t2nz5j6zn6sb04q3th61kc0000gn/T/RTNPickerSpecsrLeZK5/schema.json /Users/eugenusov/projects/react-native-picker/src
/Users/eugenusov/projects/react-native-picker/example/node_modules/react-native-codegen/lib/parsers/typescript/components/props.js:46
      objectType.typeParameters.params[0].members ||
                                ^

TypeError: Cannot read properties of undefined (reading 'params')
    at getTypeAnnotationForObjectAsArrayElement (/Users/eugenusov/projects/react-native-picker/example/node_modules/react-native-codegen/lib/parsers/typescript/components/props.js:46:33)
    at getTypeAnnotationForArrayOfArrayOfObject (/Users/eugenusov/projects/react-native-picker/example/node_modules/react-native-codegen/lib/parsers/typescript/components/props.js:60:18)
    at getTypeAnnotationForArray (/Users/eugenusov/projects/react-native-picker/example/node_modules/react-native-codegen/lib/parsers/typescript/components/props.js:115:14)
    at getTypeAnnotation (/Users/eugenusov/projects/react-native-picker/example/node_modules/react-native-codegen/lib/parsers/typescript/components/props.js:279:20)
    at buildPropSchema (/Users/eugenusov/projects/react-native-picker/example/node_modules/react-native-codegen/lib/parsers/typescript/components/props.js:586:21)
    at /Users/eugenusov/projects/react-native-picker/example/node_modules/react-native-codegen/lib/parsers/typescript/components/props.js:639:14
    at Array.map (<anonymous>)
    at getProps (/Users/eugenusov/projects/react-native-picker/example/node_modules/react-native-codegen/lib/parsers/typescript/components/props.js:638:6)
    at buildComponentSchema (/Users/eugenusov/projects/react-native-picker/example/node_modules/react-native-codegen/lib/parsers/typescript/components/index.js:237:17)
    at buildSchema (/Users/eugenusov/projects/react-native-picker/example/node_modules/react-native-codegen/lib/parsers/typescript/index.js:146:34)

    at checkExecSyncError (node:child_process:828:11)
    at execSync (node:child_process:902:15)
    at executeNodeScript (/Users/eugenusov/projects/react-native-picker/example/node_modules/react-native/scripts/codegen/generate-artifacts-executor.js:38:3)
    at generateSchema (/Users/eugenusov/projects/react-native-picker/example/node_modules/react-native/scripts/codegen/generate-artifacts-executor.js:314:3)
    at /Users/eugenusov/projects/react-native-picker/example/node_modules/react-native/scripts/codegen/generate-artifacts-executor.js:373:26
    at Array.forEach (<anonymous>)
    at generateNativeCodegenFiles (/Users/eugenusov/projects/react-native-picker/example/node_modules/react-native/scripts/codegen/generate-artifacts-executor.js:362:13)
    at Object.execute (/Users/eugenusov/projects/react-native-picker/example/node_modules/react-native/scripts/codegen/generate-artifacts-executor.js:532:5)
    at Object.<anonymous> (/Users/eugenusov/projects/react-native-picker/example/node_modules/react-native/scripts/generate-artifacts.js:64:10)
    at Module._compile (node:internal/modules/cjs/loader:1103:14) {
  status: 1,
  signal: null,
  output: [
    null,
    <Buffer f0 9f 9a 80 20 7e 20 66 69 6c 65 3a 20 70 72 6f 70 73 2e 6a 73 20 7e 20 6c 69 6e 65 20 34 32 20 7e 20 67 65 74 54 79 70 65 41 6e 6e 6f 74 61 74 69 6f ... 297 more bytes>,
    <Buffer 2f 55 73 65 72 73 2f 65 75 67 65 6e 75 73 6f 76 2f 70 72 6f 6a 65 63 74 73 2f 72 65 61 63 74 2d 6e 61 74 69 76 65 2d 70 69 63 6b 65 72 2f 65 78 61 6d ... 1760 more bytes>
  ],
  pid: 90321,
  stdout: <Buffer f0 9f 9a 80 20 7e 20 66 69 6c 65 3a 20 70 72 6f 70 73 2e 6a 73 20 7e 20 6c 69 6e 65 20 34 32 20 7e 20 67 65 74 54 79 70 65 41 6e 6e 6f 74 61 74 69 6f ... 297 more bytes>,
  stderr: <Buffer 2f 55 73 65 72 73 2f 65 75 67 65 6e 75 73 6f 76 2f 70 72 6f 6a 65 63 74 73 2f 72 65 61 63 74 2d 6e 61 74 69 76 65 2d 70 69 63 6b 65 72 2f 65 78 61 6d ... 1760 more bytes>
}
.

 #  from /Users/eugenusov/projects/react-native-picker/example/ios/Podfile:13
 #  -------------------------------------------
 #  
 >    use_react_native!(
 #      :path => config[:reactNativePath],
 #  -------------------------------------------

Version

0.70.3

Output of npx react-native info

System:
OS: macOS 12.6
CPU: (8) arm64 Apple M1
Memory: 129.92 MB / 16.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.14.2 - /usr/local/bin/node
Yarn: 1.22.18 - /opt/homebrew/bin/yarn
npm: 8.5.0 - /usr/local/bin/npm
Watchman: Not Found
Managers:
CocoaPods: 1.11.3 - /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.4, iOS 15.4, macOS 12.3, tvOS 15.4, watchOS 8.5
Android SDK: Not Found
IDEs:
Android Studio: 2021.1 AI-211.7628.21.2111.8309675
Xcode: 13.3/13E113 - /usr/bin/xcodebuild
Languages:
Java: 18.0.1 - /opt/homebrew/opt/openjdk/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 18.1.0 => 18.1.0
react-native: 0.70.3 => 0.70.3
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found

Steps to reproduce

Just try to create native UI with fabric and make one props as an array of array

Snack, code example, screenshot, or link to a repository

import type { HostComponent, ViewProps } from 'react-native';
// @ts-ignore
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
import type {
  Int32,
  DirectEventHandler,
  // @ts-ignore TODO: remove once there is a .d.ts file with definitions
} from 'react-native/Libraries/Types/CodegenTypes';

export interface OnChangeProps {
  nextRow: number;
  nextComponent: number;
}

export interface NativeProps extends ViewProps {
  data: ReadonlyArray<ReadonlyArray<string>>;
  selectedIndexes: ReadonlyArray<Int32>;
  onChange: DirectEventHandler<Readonly<OnChangeProps>>;
}

export default codegenNativeComponent<NativeProps>(
  'RTNPickerView'
) as HostComponent<NativeProps>;
@evgenusov evgenusov added Needs: Triage 🔍 Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules) labels Oct 24, 2022
@cortinico cortinico added the Tech: Codegen Related to react-native-codegen label Oct 24, 2022
@github-actions
Copy link

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Apr 22, 2023
@github-actions
Copy link

This issue was closed because it has been stalled for 7 days with no activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Triage 🔍 Stale There has been a lack of activity on this issue and it may be closed soon. Tech: Codegen Related to react-native-codegen Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules)
Projects
None yet
Development

No branches or pull requests

2 participants