I am new to nativescript, and I am trying to dynamically load a custom component when I tap on button, But I get this error:
Error: Module '/data/data/org.nativescript.DMMobileApp01/files/app/components' not found for element 'components:Test' com.tns.NativeScriptException: Failed to find module:
"/data/data/org.nativescript.DMMobileApp01/files/app/components", > relative to: app//
I have searched a lot but most issues and tutorials that related to dynamically load a custom component are around angular and webpack.
This function which responsible to dynamic loading of the custom component:
function toSettings(args){
const page = args.object.page;
const mainScene = page.getViewById('mainScene');
let settingsCompo = builder.load({
path: '~/components',
name: 'test'
});
}
And this is the app/components/test.xml file
<StackLayout orientation="horizontal">
<Label text="yaaaay!" textWrap="true" />
</StackLayout>
I expect it is an easy task but I don't know why I am getting this error! Where is my missing part?