When I am trying to build my React Native (0.71.8 on New Arch) App with npx react-native run-android
or when I am generating code with codegen from my android folder with ./gradlew generateCodegenArtifactsFromSchema --rerun-tasks
I encounter this error :
TypeError: Cannot read properties of undefined (reading 'typeAnnotation')
.
I think this error is coming from this TypeScript who describes my Native Component:
import type {HostComponent} from 'react-native';
import type {ComponentType} from 'react';
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
import React from 'react';
import { Int32 } from 'react-native/Libraries/Types/CodegenTypes';
export interface NativeProps{
filePath? : string;
mapPath?: string;
mapSecretCode?: Int32;
mapHash?: string;
mapServerUrl?: string;
}
export default codegenNativeComponent<NativeProps>(
'RTNMapView'
) as HostComponent<NativeProps>;
interface NativeCommands {
loadMapView: () => void;
loadMapData: () => void;
unloadMapView: () => void;
unloadMapData: () => void;
}
export const Commands: NativeCommands =
codegenNativeCommands<NativeCommands>({
supportedCommands: ['loadMapView','loadMapData','unloadMapView','unloadMapData'],
});
Somehow I am not really sure what is causing this issue. I have only one other typescript file (which is my App), so I think the error is coming from the previous file.
At first I was thinking Int32 was the problem, but changing it didn't remove the issue.
I am not sure what is causing this issue.