Closed NachmanRoss closed 2 years ago
@NachmanRoss thanks for the report. It is weird nothing has changed in this code. Plus the disposing works fine here with latest. I will need more info on your app.
My app is a pure typescript app and I didn't make any changes other than updating the plugin. However on the page's onNavigatingTo function I do register the page's viewModel for an OrientationChange event which updates the observables on the page. Maybe that's triggering something although the error is thrown when the app is displaying for the first time on the emulator before I rotate the emulator. The page itself has the following:
<StackLayout width="100%" height="100%">
<GridLayout rows="*" columns="*, *, *" width="100%" height="{{ cardWidth }}"
visibility="{{ logoVisibility }}">
<Label row="0" col="1" class="image-background" textWrap="true" textAlignment="center"
backgroundImage="{{ logo }}" width="{{ cardWidth }}"/>
</GridLayout>
<GridLayout width="100%" height="100%" rows="*">
<cv:CollectionView id="list-view" items="{{ menu }} " marginTop="10" marginBottom="30"
colWidth="{{ colWidth }}" rowHeight="200" marginLeft="1%" itemTap="{{ onTap }}">
<cv:CollectionView.itemTemplate>
<StackLayout orientation="horizontal">
<StackLayout orientation="vertical" width="97%" marginTop="2">
<Label class="image-background" textWrap="true" textAlignment="center"
backgroundImage="{{ background }}"
height="85%" style="border-radius: 15;border-width: 0;">
</Label>
<Label text="{{ title }}" class="body-text" color="white" textAlignment="center" />
</StackLayout>
</StackLayout>
</cv:CollectionView.itemTemplate>
</cv:CollectionView>
</GridLayout>
</StackLayout>
@NachmanRoss there is an issue there. The bug you have is caused by disposeNativeView
which means destroying the collectionview. It should not be called while opening the app.
I am not sure what s going on but from here i cant help as i cant reproduce. If you can create a simple repro example then i can help
I’m not doing anything that explicitly destroys the collection view but maybe the orientation change event is. I’ll see if I can debug first by pulling out the OrientationChange event and see if the error goes away with the new release of the plugin. It is weird because my code hasn’t changed at all and the previous release of the plugin works perfectly.
Nachman Beinish Ross On Nov 25, 2021, 7:18 AM -0500, farfromrefuge @.***>, wrote:
@NachmanRoss there is an issue there. The bug you have is caused by disposeNativeView which means destroying the collectionview. It should not be called while opening the app. I am not sure what s going on but from here i cant help as i cant reproduce. If you can create a simple repro example then i can help
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/nativescript-community/ui-collectionview/issues/36#issuecomment-979163333 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AKUWSSYHD5UE4S7HTWW3373UNYSRVANCNFSM5IYIFRDQ . https://github.com/notifications/beacon/AKUWSS7MF4LBUHLOAZNH6A3UNYSRVA5CNFSM5IYIFRD2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOHJONRRI.gif
I retested with the new release and the page is working again after doing another clean and rebuild. I'm not sure what the issue was since I did more than one clean and rebuild but it is working now so close this issue.
I updated to the latest version 4.0.48 and it throws the following error on my android eulator:
JS: TypeError: Cannot read property 'scrollListener' of undefined JS: disposeNativeView(file: app/webpack:/com.benalterdevelopment.kavohr/node_modules/@nativescript-community/ui-collectionview/index.android.js:278:0) JS: at _tearDownUI(file: app/webpack:/com.benalterdevelopment.kavohr/node_modules/@nativescript/core/ui/core/view-base/index.js:657:0) JS: at (file: app/webpack:/com.benalterdevelopment.kavohr/node_modules/@nativescript/core/ui/core/view-base/index.js:632:0) JS: at eachChildView(file: app/webpack:/com.benalterdevelopment.kavohr/node_modules/@nativescript/core/ui/layouts/layout-base-common.js:101:0) JS: at eachChild(file: app/webpack:/com.benalterdevelopment.kavohr/node_modules/@nativescript/core/ui/core/view/view-common.js:759:0) JS: at _tearDownUI(file: app/webpack:/com.benalterdevelopment.kavohr/node_modules/@nativescript/core/ui/core/view-base/index.js:631:0) JS: at (file: app/webpack:/com.benalterdevelopment.kavohr/node_modules/@nativescript/core/ui/core/view-base/index.js:632:0) JS: at eachChildView(file: app/webpack:/com.benalterdevelopment.kavohr/node_modules/@nativescript/core/ui/layouts/layout-base-common.js:101:0) JS: at eachChild(file: app/webpack:/com.benalterdevelopment.kavohr/node_modules/@nativescript/core/ui/core/view/view-common.js:759:0) JS: at _tearDownUI(file: app/webpack:/com.benalterdevelopment.kavohr/node_modules/@nativescript/core/ui/core/view-base/index.js:631:0) JS: at (file: app/webpack:/com.benalterdevelopment.kavohr/node_modules/@nativescript/core/ui/core/view-base/index.js:632:0) JS: at eachChi... JS: com.tns.NativeScriptException: Calling js method run failed
When I rollback to the 4.0.47 version and do a clean and then rebuild everything is ok again.
My nativescript is up to date with the latest versions of core and android.