Please take a minute to read our NativeScript Code of Conduct before proceeding with posting issues or discussing. The purpose of this guide is to make communication and cooperation within our forums a pleasure for you and the other members.
Yes
The application throws a NativeScriptException if I set hidden="true" on a property within a DataForm. This behavior was working with 3.6.4, but after updating, it has begun to crash.
Below is the exception being thrown:
An uncaught Exception occurred on "main" thread.
com.tns.NativeScriptException:
Calling js method onCreateView failedTypeError: Cannot read property 'parent' of undefined
File: "file:///data/data/org.nativescript.myblankng/files/app/tns_modules/nativescript-ui-dataform/ui-dataform.js, line: 793, column: 69StackTrace:
Frame: function:'RadDataForm._syncEditorsWithNativeEditors', file:'file:///data/data/org.nativescript.myblankng/files/app/tns_modules/nativescript-ui-dataform/ui-dataform.js', line: 793, column: 70
Frame: function:'RadDataForm.reload', file:'file:///data/data/org.nativescript.myblankng/files/app/tns_modules/nativescript-ui-dataform/ui-dataform.js', line: 706, column: 22
Frame: function:'RadDataForm._updateSource', file:'file:///data/data/org.nativescript.myblankng/files/app/tns_modules/nativescript-ui-dataform/ui-dataform.js', line: 542, column: 14
Frame: function:'RadDataForm.createNativeView', file:'file:///data/data/org.nativescript.myblankng/files/app/tns_modules/nativescript-ui-dataform/ui-dataform.js', line: 482, column: 14
Frame: function:'ViewBase._setupUI', file:'file:///data/data/org.nativescript.myblankng/files/app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js', line: 491, column: 31
Frame: function:'', file:'file:///data/data/org.nativescript.myblankng/files/app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js', line: 533, column: 19
Frame: function:'LayoutBaseCommon.eachChildView', file:'file:///data/data/org.nativescript.myblankng/files/app/tns_modules/tns-core-modules/ui/layouts/layout-base-common.js', line: 125, column: 26
Frame: function:'ViewCommon.eachChild', file:'file:///data/data/org.nativescript.myblankng/files/app/tns_modules/tns-core-modules/ui/core/view/view-common.js', line: 884, column: 14
Frame: function:'ViewBase._setupUI', file:'file:///data/data/org.nativescript.myblankng/files/app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js', line: 532, column: 14
Frame: function:'', file:'file:///data/data/org.nativescript.myblankng/files/app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js', line: 533, column: 19
Frame: function:'LayoutBaseCommon.eachChildView', file:'file:///data/data/org.nativescript.myblankng/files/app/tns_modules/tns-core-modules/ui/layouts/layout-base-common.js', line: 125, column: 26
Frame: function:'ViewCommon.eachChild', file:'file:///data/data/org.nativescript.myblankng/files/app/tns_modules/tns-core-modules/ui/core/view/view-common.js', line: 884, column: 14
Frame: function:'ViewBase._setupUI', file:'file:///data/data/org.nativescript.myblankng/files/app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js', line: 532, column: 14
Frame: function:'', file:'file:///data/data/org.nativescript.myblankng/files/app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js', line: 533, column: 19
Frame: function:'ContentView.eachChildView', file:'file:///data/data/org.nativescript.myblankng/files/app/tns_modules/tns-core-modules/ui/content-view/content-view.js', line: 70, column: 13
Frame: function:'PageBase.eachChildView', file:'file:///data/data/org.nativescript.myblankng/files/app/tns_modules/tns-core-modules/ui/page/page-common.js', line: 120, column: 40
Frame: function:'ViewCommon.eachChild', file:'file:///data/data/org.nativescript.myblankng/files/app/tns_modules/tns-core-modules/ui/core/view/view-common.js', line: 884, column: 14
Frame: function:'ViewBase._setupUI', file:'file:///data/data/org.nativescript.myblankng/files/app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js', line: 532, column: 14
Frame: function:'ViewBase._addViewCore', file:'file:///data/data/org.nativescript.myblankng/files/app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js', line: 431, column: 18
Frame: function:'ViewBase._addView', file:'file:///data/data/org.nativescript.myblankng/files/app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js', line: 420, column: 14
Frame: function:'FragmentCallbacksImplementation.onCreateView', file:'file:///data/data/org.nativescript.myblankng/files/app/tns_modules/tns-core-modules/ui/frame/frame.js', line: 653, column: 19
Frame: function:'FragmentClass.onCreateView', file:'file:///data/data/org.nativescript.myblankng/files/app/tns_modules/tns-core-modules/ui/frame/fragment.js', line: 26, column: 38at com.tns.Runtime.callJSMethodNative(Native Method)
at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1120)
at com.tns.Runtime.callJSMethodImpl(Runtime.java:1000)
at com.tns.Runtime.callJSMethod(Runtime.java:987)
at com.tns.Runtime.callJSMethod(Runtime.java:967)
at com.tns.Runtime.callJSMethod(Runtime.java:959)
at com.tns.FragmentClass.onCreateView(FragmentClass.java:45)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:2439)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1460)
at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1784)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1852)
at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:802)
at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2625)
at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2411)
at android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2366)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2273)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:733)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Android 28
home.component.html
<ActionBar class="action-bar">
<Label class="action-bar-title" text="Home"></Label>
</ActionBar>
<GridLayout class="page">
<RadDataForm [source]="formData">
<TKEntityProperty tkDataFormProperty displayName="Email" name="email" index=0 required="true">
</TKEntityProperty>
<TKEntityProperty tkDataFormProperty displayName="Password" name="secret" index=1 required="true">
</TKEntityProperty>
<TKEntityProperty tkDataFormProperty hidden="true" name="secretConfirm"></TKEntityProperty>
</RadDataForm>
</GridLayout>
home.component.ts
import { Component, OnInit } from "@angular/core";
@Component({
selector: "Home",
moduleId: module.id,
templateUrl: "./home.component.html"
})
export class HomeComponent implements OnInit {
formData: any;
constructor() {
this.formData = {
email: "[email protected]",
secret: "itsasecret",
secretConfirm: "itsasecret"
}
}
ngOnInit(): void {
// Init your component properties here.
}
}
Hi @mdshaner,
Thank you for the provided sample project.
I was able to recreate the issue on my side. I will mark this one as a bug and we will investigate further the issue.
Hi @mdshaner
For now as a workaround, you can add an explicit editor for property you want to hide. This way you should be able to avoid the crash:
<TKEntityProperty tkDataFormProperty name="secretConfirm" hidden="true">
<TKPropertyEditor tkEntityPropertyEditor type="Text"></TKPropertyEditor>
</TKEntityProperty>
@tgpetrov it didn't work for me, I am getting a different error: TypeError: Cannot set property '_ngcontent-c3' of undefined.
Thank you for the workaround, and I apologize for missing the existing ticket on the issue. Similar to @ogix, the workaround did result in another error regarding ngcontent. I have updated the minimum reproduction sample in the repo. The difference appears to be having a component with styleUrls specified
The fix is released in [email protected].
I have the same problem again in 6.1.0.
Reverting the dependency back to 6.0.0 fixed the problem.
I also faced this error with version 6.1.0. Version 6.0.0 works fine.
System.err: TypeError: Cannot set property '_ngcontent-c9' of undefined