menu icon indicating copy to clipboard operation
menu copied to clipboard

Cant compile 1.1.5

Open marcosrdz opened this issue 1 year ago • 11 comments

menu/menu/android/src/main/java/com/reactnativemenu/MenuViewManager.kt:155:32 Type mismatch: inferred type is Int? but Float was expected

marcosrdz avatar Oct 26 '24 17:10 marcosrdz

Hi,

I have the same error.

For which version of React Native are you building?

laurensk avatar Oct 26 '24 18:10 laurensk

Hi,

I have the same error.

For which version of React Native are you building?

0.75.4

marcosrdz avatar Oct 26 '24 18:10 marcosrdz

Same error. RN 0.75.4

dmk3141618 avatar Oct 27 '24 12:10 dmk3141618

Task :react-native-menu_menu:compileDebugKotlin e: file:///Users/mac/Dev/dev2/MyApp/node_modules/@react-native-menu/menu/android/src/main/java/com/reactnativemenu/MenuViewManager.kt:155:32 Type mismatch: inferred type is Int? but Float was expected e: file:///Users/mac/Dev/dev2/MyApp/node_modules/@react-native-menu/menu/android/src/main/java/com/reactnativemenu/MenuViewManager.kt:155:32 No value passed for parameter 'p2'

Task :react-native-menu_menu:compileDebugKotlin FAILED

dmk3141618 avatar Oct 27 '24 12:10 dmk3141618

Same issue here, using React Native 0.74.5 on the project.

You can either solve it with two work arounds: Putting a resolutions on your package.json so the react-native-menu version will stick to the 1.1.4, like this:

"resolutions": {
  "@react-native-menu/menu": "1.1.4"
},

or even go to the file that is generating the error (MenuViewManager.kt) and override the function to utilize the code from the previous version, so it will stay like this:

fun setBorderColor(view: ReactViewGroup, index: Int, color: Int?) {
  val rgbComponent = if (color == null) YogaConstants.UNDEFINED else (color and 0x00FFFFFF).toFloat()
  val alphaComponent = if (color == null) YogaConstants.UNDEFINED else (color ushr 24).toFloat()
  view.setBorderColor(SPACING_TYPES[index], rgbComponent, alphaComponent)
}

viniciusmoralis1 avatar Oct 27 '24 15:10 viniciusmoralis1

Same here, downgrading to 1.1.4 works for me.

0.74.5 with new arch enabled

gustavo-bonfim avatar Oct 27 '24 19:10 gustavo-bonfim

This issue originated from my previous PR https://github.com/react-native-menu/menu/pull/941, which aimed to update the codebase for React Native 0.76 compatibility. I've now created another PR (#948) to restore backward compatibility with earlier versions. This should help.

dmitry-blackwave avatar Oct 28 '24 12:10 dmitry-blackwave

I tried updating from version 0.75.4 to 0.76.0, and it's giving an error. Does anyone know if it's working with the new RN update to 0.76.0?

FernandoAOborges avatar Oct 28 '24 12:10 FernandoAOborges

I tried updating from version 0.75.4 to 0.76.0, and it's giving an error. Does anyone know if it's working with the new RN update to 0.76.0?

It should work. Make sure you're using version 1.1.5, which includes the necessary signature changes for ReactViewGroup.setBorderColor() introduced in React Native 0.76.

dmitry-blackwave avatar Oct 28 '24 12:10 dmitry-blackwave

should be fixed in 1.1.6

Naturalclar avatar Oct 30 '24 00:10 Naturalclar

No problem. I've upgraded RN version to 0.76. Now no errors. Thank you.

dmk3141618 avatar Oct 30 '24 01:10 dmk3141618

Same issue here, using React Native 0.74.5 on the project.

You can either solve it with two work arounds: Putting a resolutions on your package.json so the react-native-menu version will stick to the 1.1.4, like this:

"resolutions": {
  "@react-native-menu/menu": "1.1.4"
},

or even go to the file that is generating the error (MenuViewManager.kt) and override the function to utilize the code from the previous version, so it will stay like this:

fun setBorderColor(view: ReactViewGroup, index: Int, color: Int?) {
  val rgbComponent = if (color == null) YogaConstants.UNDEFINED else (color and 0x00FFFFFF).toFloat()
  val alphaComponent = if (color == null) YogaConstants.UNDEFINED else (color ushr 24).toFloat()
  view.setBorderColor(SPACING_TYPES[index], rgbComponent, alphaComponent)
}

thanks, this work for me

nhatnguyen24040601 avatar Oct 31 '24 04:10 nhatnguyen24040601