nativescript-community / ui-material-components

Monorepo that contains all of the NativeScript Material Design plugins.
https://nativescript-community.github.io/ui-material-components/
Apache License 2.0
218 stars 80 forks source link

Error after updating to 7.2.13 (probably Tabs) #454

Closed guillemc23 closed 12 months ago

guillemc23 commented 1 year ago

Which platform(s) does your issue occur on?

Please, provide the following version numbers that your issue occurs with:

"@nativescript-community/ui-material-cardview": "7.2.13",
"@nativescript-community/ui-material-core": "7.2.13",
"@nativescript-community/ui-material-dialogs": "7.2.13",
"@nativescript-community/ui-material-slider": "7.2.13",
"@nativescript-community/ui-material-snackbar": "7.2.13",
"@nativescript-community/ui-material-tabs": "7.2.13",

Please, tell us how to recreate the issue in as much detail as possible.

I have just updated from 7.1.3 to 7.2.13 and I'm seeing this error when navigating to a page. This page contains several ui-material components but I believe this error is related to Material Tabs, cause it's happening in all of the pages that have Tabs. The following error gets printed in the console:

System.err: An uncaught Exception occurred on "main" thread.
System.err: Unable to pause activity {org.nativescript.TestApp/com.tns.NativeScriptActivity}: com.tns.NativeScriptException: Calling js method onCreateView failed
System.err: TypeError: Cannot read property 'extend' of undefined

The full StackTrace:

  System.err:
  System.err: StackTrace:
  System.err: java.lang.RuntimeException: Unable to pause activity {org.nativescript.TestApp/com.tns.NativeScriptActivity}: com.tns.NativeScriptException: Calling js method onCreateView failed
  System.err: TypeError: Cannot read property 'extend' of undefined
  System.err:   at android.app.ActivityThread.performPauseActivityIfNeeded(ActivityThread.java:5210)
  System.err:   at android.app.ActivityThread.performPauseActivity(ActivityThread.java:5161)
  System.err:   at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:5113)
  System.err:   at android.app.servertransaction.PauseActivityItem.execute(PauseActivityItem.java:47)
  System.err:   at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
  System.err:   at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
  System.err:   at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
  System.err:   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2325)
  System.err:   at android.os.Handler.dispatchMessage(Handler.java:106)
  System.err:   at android.os.Looper.loopOnce(Looper.java:210)
  System.err:   at android.os.Looper.loop(Looper.java:299)
  System.err:   at android.app.ActivityThread.main(ActivityThread.java:8280)
  System.err:   at java.lang.reflect.Method.invoke(Native Method)
  System.err:   at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:576)
  System.err:   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1073)
  System.err: Caused by: com.tns.NativeScriptException: Calling js method onCreateView failed
  System.err: TypeError: Cannot read property 'extend' of undefined
  System.err:   at com.tns.Runtime.callJSMethodNative(Native Method)
  System.err:   at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1302)
  System.err:   at com.tns.Runtime.callJSMethodImpl(Runtime.java:1188)
  System.err:   at com.tns.Runtime.callJSMethod(Runtime.java:1175)
  System.err:   at com.tns.Runtime.callJSMethod(Runtime.java:1153)
  System.err:   at com.tns.Runtime.callJSMethod(Runtime.java:1149)
  System.err:   at com.tns.FragmentClass.onCreateView(FragmentClass.java:55)
  System.err:   at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2995)
  System.err:   at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:523)
  System.err:   at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:261)
  System.err:   at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1840)
  System.err:   at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1758)
  System.err:   at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1701)
  System.err:   at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:2849)
  System.err:   at androidx.fragment.app.FragmentManager.dispatchPause(FragmentManager.java:2802)
  System.err:   at androidx.fragment.app.FragmentController.dispatchPause(FragmentController.java:295)
  System.err:   at androidx.fragment.app.FragmentActivity.onPause(FragmentActivity.java:366)
  System.err:   at android.app.Activity.performPause(Activity.java:8374)
  System.err:   at android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1530)
  System.err:   at android.app.ActivityThread.performPauseActivityIfNeeded(ActivityThread.java:5200)
  System.err:   ... 14 more

I have also noticed this in my package-lock.json, I feel like the name shouldn't be like that (not sure why it repeats node_modules/...):

"node_modules/@nativescript-community/ui-material-core-tabs/node_modules/@nativescript-community/ui-material-core": {
        "version": "7.2.13",
        "resolved": "https://registry.npmjs.org/@nativescript-community/ui-material-core/-/ui-material-core-7.2.13.tgz",
        "integrity": "sha512-kb4Ykejb6iEl5AW7s1DK47uiyIc3IwtuizFOYWQNdHBhhr+xZN4fUnP9ZdFFDLJgdgKLpCZzd84maScrdbdV1Q=="
        },

This This is my node_modules folder. What I mean is that I'm not sure if there should be another node_modules inside the plugin folder

farfromrefug commented 1 year ago

@guillemc23 sorry for that and thank you for the report I will look at it

guillemc23 commented 1 year ago

@farfromrefug no problem, I edited the issue and added some extra info :)

farfromrefug commented 1 year ago

@guillemc23 please try latest version. I tested on my side and all components are working

guillemc23 commented 1 year ago

Not luck. In the latest version the error has changed and now it's pointing to the tabs directly. I don't know if it's relevant but I'm at @nativescript/android ~8.3.1:

  System.err: An uncaught Exception occurred on "main" thread.
  System.err: Calling js method onCreateView failed
  System.err: TypeError: Cannot read property 'extend' of undefined
  System.err:
  System.err: StackTrace:
  System.err: __extends(/data/data/org.nativescript.TestApp/files/internal/ts_helpers.js:51:36)
  System.err:   at (file: src/webpack:/test-app/node_modules/@nativescript-community/ui-material-tabs/index.android.js:14:0)
  System.err:   at initializeNativeClasses(file: src/webpack:/test-app/node_modules/@nativescript-community/ui-material-tabs/index.android.js:35:1)
  System.err:   at createNativeTabBar(file: src/webpack:/test-app/node_modules/@nativescript-community/ui-material-tabs/index.android.js:59:0)
  System.err:   at handleTabStripChanged(file: src/webpack:/test-app/node_modules/@nativescript-community/ui-material-core-tabs/tab-navigation/index.android.js:204:0)
  System.err:   at createNativeView(file: src/webpack:/test-app/node_modules/@nativescript-community/ui-material-core-tabs/tab-navigation/index.android.js:190:0)
  System.err:   at createNativeView(file: src/webpack:/test-app/node_modules/@nativescript-community/ui-material-tabs/index.android.js:40:0)
  System.err:   at _setupUI(file: src/webpack:/test-app/node_modules/@nativescript/core/ui/core/view-base/index.js:557:0)
  System.err:   at (file: src/webpack:/test-app/node_modules/@nativescript/core/ui/core/view-base/index.js:603:0)
  System.err:   at eachChildView(file: src/webpack:/test-app/node_modules/@nativescript/core/ui/layouts/layout-base-common.js:101:0)
  System.err:   at eachChild(file: src/webpack:/test-app/node_modules/@nativescript/core/ui/core/view/view-common.js:772:0)
  System.err:   at _setupUI(file: src/webpack:/test-app/node_modules/@nativescript/core/ui/core/view-base/index.js:602:0)
  System.err:   at (file: src/webpack:/test-app/node_modules/@nativescript/core/ui/core/view-base/index.js:603:0)
  System.err:   at eachChildView(file: src/webpack:/test-app/node_modules/@nativescript/core/ui/layouts/layout-base-common.js:101:0)
  System.err:   at eachChild(file: src/webpack:/test-app/node_modules/@nativescript/core/ui/core/view/view-common.js:772:0)
  System.err:   at _setupUI(file: src/webpack:/test-app/node_modules/@nativescript/core/ui/core/view-base/index.js:602:0)
  System.err:   at _setupUI(file: src/webpack:/test-app/node_modules/@nativescript/core/ui/proxy-view-container/index.js:60:0)
  System.err:   at (file: src/webpack:/test-app/node_modules/@nativescript/core/ui/core/view-base/index.js:603:0)
  System.err:   at eachChildView(file: src/webpack:/test-app/node_modules/@nativescript/core/ui/content-view/index.js:65:0)
  System.err:   at eachChildView(file: src/webpack:/test-app/node_modules/@nativescript/core/ui/page/page-common.js:106:0)
  System.err:   at eachChild(file: src/webpack:/test-app/node_modules/@nativescript/core/ui/core/view/view-common.js:772:0)
  System.err:   at _setupUI(file: src/webpack:/test-app/node_modules/@nativescript/core/ui/core/view-base/index.js:602:0)
  System.err:   at _addViewCore(file: src/webpack:/test-app/node_modules/@nativescript/core/ui/core/view-base/index.js:450:0)
  System.err:   at _addView(file: src/webpack:/test-app/node_modules/@nativescript/core/ui/core/view-base/index.js:439:0)
  System.err:   at onCreateView(file: src/webpack:/test-app/node_modules/@nativescript/core/ui/frame/index.android.js:765:18)
  System.err:   at onCreateView(file: src/webpack:/test-app/node_modules/@nativescript/core/ui/frame/fragment.android.js:28:0)
  System.err:   at com.tns.Runtime.callJSMethodNative(Native Method)
  System.err:   at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1302)
  System.err:   at com.tns.Runtime.callJSMethodImpl(Runtime.java:1188)
  System.err:   at com.tns.Runtime.callJSMethod(Runtime.java:1175)
  System.err:   at com.tns.Runtime.callJSMethod(Runtime.java:1153)
  System.err:   at com.tns.Runtime.callJSMethod(Runtime.java:1149)
  System.err:   at com.tns.FragmentClass.onCreateView(FragmentClass.java:55)
  System.err:   at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2995)
  System.err:   at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:523)
  System.err:   at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:261)
  System.err:   at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1840)
  System.err:   at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1758)
  System.err:   at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1701)
  System.err:   at androidx.fragment.app.FragmentManager$4.run(FragmentManager.java:488)
  System.err:   at android.os.Handler.handleCallback(Handler.java:938)
  System.err:   at android.os.Handler.dispatchMessage(Handler.java:99)
  System.err:   at android.os.Looper.loopOnce(Looper.java:210)
  System.err:   at android.os.Looper.loop(Looper.java:299)
  System.err:   at android.app.ActivityThread.main(ActivityThread.java:8280)
  System.err:   at java.lang.reflect.Method.invoke(Native Method)
  System.err:   at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:576)
  System.err:   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1073)
farfromrefug commented 1 year ago

@guillemc23 ok it does not find the native class com.nativescript.material.core.TabsBar which is built with @nativescript-community/ui-material-core-tabs. Could you try a clean build?

guillemc23 commented 12 months ago

@farfromrefug I have migrated my app to NativeScript 8.6 and I can confirm this issue is not happening anymore with the latest version of these plugins (7.2.21). Thank you!