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

Canvas type missmatch in Android SDK 34 #864

Open
1 of 2 tasks
peter-stocks opened this issue Jun 27, 2023 · 5 comments
Open
1 of 2 tasks

Canvas type missmatch in Android SDK 34 #864

peter-stocks opened this issue Jun 27, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@peter-stocks
Copy link

Current behavior

Android build fails with the following error when using Android compileSdkVersion = 34

The issue seems similar to this one - software-mansion/react-native-screens#1795

`

Task :shopify_flash-list:compileReleaseKotlin FAILED
e: /Users/peter.igov/projects/stocks/stocksapp/node_modules/@shopify/flash-list/android/src/main/kotlin/com/shopify/reactnative/flash_list/AutoLayoutView.kt: (29, 5): 'dispatchDraw' overrides nothing
e: /Users/peter.igov/projects/stocks/stocksapp/node_modules/@shopify/flash-list/android/src/main/kotlin/com/shopify/reactnative/flash_list/AutoLayoutView.kt: (32, 28): Type mismatch: inferred type is Canvas? but Canvas was expected
`

To Reproduce

Change compileSdkVersion to 34 and gradle version to 8.0.1

Platform:

  • iOS
  • Android

Environment

"react-native": "0.71.8"
"@shopify/flash-list": "1.4.3"

@peter-stocks peter-stocks added the bug Something isn't working label Jun 27, 2023
@siyahulhaq
Copy link

i am also facing issue

@siyahulhaq
Copy link

fixed issue by paching

diff --git a/node_modules/@shopify/flash-list/android/src/main/kotlin/com/shopify/reactnative/flash_list/AutoLayoutView.kt b/node_modules/@shopify/flash-list/android/src/main/kotlin/com/shopify/reactnative/flash_list/AutoLayoutView.kt
index 6b78bd9..4571798 100644
--- a/node_modules/@shopify/flash-list/android/src/main/kotlin/com/shopify/reactnative/flash_list/AutoLayoutView.kt
+++ b/node_modules/@shopify/flash-list/android/src/main/kotlin/com/shopify/reactnative/flash_list/AutoLayoutView.kt
@@ -26,7 +26,7 @@ class AutoLayoutView(context: Context) : ReactViewGroup(context) {
 
     /** Overriding draw instead of onLayout. RecyclerListView uses absolute positions for each and every item which means that changes in child layouts may not trigger onLayout on this container. The same layout
      * can still cause views to overlap. Therefore, it makes sense to override draw to do correction. */
-    override fun dispatchDraw(canvas: Canvas?) {
+    override fun dispatchDraw(canvas: Canvas) {
         fixLayout()
         fixFooter()
         super.dispatchDraw(canvas)

@RKowalczykOnPoint
Copy link

Is there any way to make it work with expo eas build?
"react-native": "0.72.3",
"@shopify/flash-list": "1.4.3"

@davidcort
Copy link

Is there any way to make it work with expo eas build? "react-native": "0.72.3", "@shopify/flash-list": "1.4.3"

Hi, you could try change the kotlinVersion to: kotlinVersion = '1.8.10'

That works for me in Expo SDK 49 :)

"react-native": "0.72.3",
"@shopify/flash-list": "1.4.3"

@nicolascavallin
Copy link

diff --git a/node_modules/@shopify/flash-list/android/src/main/kotlin/com/shopify/reactnative/flash_list/AutoLayoutView.kt b/node_modules/@shopify/flash-list/android/src/main/kotlin/com/shopify/reactnative/flash_list/AutoLayoutView.kt
index 6b78bd9..4571798 100644
--- a/node_modules/@shopify/flash-list/android/src/main/kotlin/com/shopify/reactnative/flash_list/AutoLayoutView.kt
+++ b/node_modules/@shopify/flash-list/android/src/main/kotlin/com/shopify/reactnative/flash_list/AutoLayoutView.kt
@@ -26,7 +26,7 @@ class AutoLayoutView(context: Context) : ReactViewGroup(context) {

 /** Overriding draw instead of onLayout. RecyclerListView uses absolute positions for each and every item which means that changes in child layouts may not trigger onLayout on this container. The same layout
  * can still cause views to overlap. Therefore, it makes sense to override draw to do correction. */
  • override fun dispatchDraw(canvas: Canvas?) {
  • override fun dispatchDraw(canvas: Canvas) {
    fixLayout()
    fixFooter()
    super.dispatchDraw(canvas)

Working, thanks @siyahulhaq

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants