Skip to content

fix bug when no bbox params are set #72

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

Merged
merged 2 commits into from
Feb 4, 2025
Merged

Conversation

cjohn001
Copy link
Contributor

@cjohn001 cjohn001 commented Feb 3, 2025

Hello together,
attached pull request fixes a bug which stops the object detector from working if no bbox parameters are provided in the MLKitView xml template. Sorry for the inconvenience.

Best regards,
Christoph

@cjohn001
Copy link
Contributor Author

cjohn001 commented Feb 3, 2025

@NathanWalker, @triniwiz
it would be great if you could have a look at the second issue where the native view is null. The fix I provided works, but to my understanding the native view should never be null in the first place. I suspect that the issues is routed in a problem in core. I have seen timing related issues in the past when mixing different transition animations.

I am observing the problem when I am on a page with the MLKitView and than navigate away using the following code

this.navSrv.navigate(
		[
			{
				outlets: {
					primary: [
						'selection',
						'tab-select-diary-item',
						{
							outlets: {
								'outlet-0': ['search-tab'],
								'outlet-1': ['empty-tab1'],
								'outlet-2': ['empty-tab2'],
								'outlet-3': ['empty-tab3']
							}
						}
					]
				}
			}
		],
		{
			transition: { name: 'flipLeft' },
			clearHistory: true
		}
	);

This results in the following exception

***** Fatal JavaScript exception - application has been terminated. *****
NativeScript encountered a fatal error:
Uncaught TypeError: Cannot read properties of null (reading 'bounds')
at
onLayout(file: node_modules/@nativescript/mlkit-core/index.ios.js:422:0)
at layout(file: node_modules/@nativescript/core/ui/core/view/index.ios.js:87:0)
at layoutChild(file: node_modules/@nativescript/core/ui/core/view/view-helper/view-helper-common.js:102:0)
at layoutChild(file: node_modules/@nativescript/core/ui/core/view/view-common.js:804:18)
at onLayout(file: node_modules/@nativescript/core/ui/layouts/grid-layout/index.ios.js:165:20)
at layout(file: node_modules/@nativescript/core/ui/core/view/index.ios.js:87:0)
at layoutChild(file: node_modules/@nativescript/core/ui/core/view/view-helper/view-helper-common.js:102:0)
at layoutChild(file: node_modules/@nativescript/core/ui/core/view/view-common.js:804:18)
at onLayout(file: node_modules/@nativescript/core/ui/layouts/grid-layout/index.ios.js:165:20)
at layout(file: node_modules/@nativescript/core/ui/core/view/index.ios.js:87:0)
at layoutChild(file: node_modules/@nativescript/core/ui/core/view/view-helper/view-helper-common.js:102:0)
at layoutChild(file: node_modules/@nativescript/core/ui/core/view/view-common.js:804:18)
at onLayout(file: node_modules/@nativescript/core/ui/layouts/grid-layout/index.ios.js:165:20)
at layout(file: node_modules/@nativescript/core/ui/core/view/index.ios.js:87:0)
at layoutChild(file: node_modules/@nativescript/core/ui/core/view/view-helper/view-helper-common.js:102:0)
at layoutChild(file: node_modules/@nativescript/core/ui/core/view/view-common.js:804:18)
at onLayout(file: node_modules/@nativescript/core/ui/page/index.ios.js:476:12)
at layout(file: node_modules/@nativescript/core/ui/core/view/index.ios.js:87:0)
at layoutChild(file: node_modules/@nativescript/core/ui/core/view/view-helper/view-helper-common.js:102:0)
at layoutView(file:///app/ve<…>

Or is this a valid situation that the native view can be null before the object is released and the fix I did is simply required?

@NathanWalker
Copy link
Contributor

Yes definitely timing in layout there. Your fix is a good one as layout will reengage afterwards.

@NathanWalker NathanWalker merged commit 39c0cd8 into NativeScript:main Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants