profile
viewpoint

Ask questionsBottomSheetPlugin Error: this.nativeView.showBottomSheet Is Not a Function

Trying to use BottomSheetPlugin in a vue app. I must be calling $showBottomSheet incorrectly, but I'm following the intructions for NativeScript + Vue in the readme.

Which platform(s) does your issue occur on?

  • Android. Not tested on iOS

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

  • CLI: 6.1.2
  • Runtime(s): tns-android: 'rc'

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

Install BottomSheetPlugin like this:

import` Vue from 'nativescript-vue';
import BottomSheetPlugin from 'nativescript-material-bottomsheet/vue';

Vue.use(BottomSheetPlugin);

And then in a .vue file:

import MyComponent from 'MyComponent.vue';

this.$showBottomSheet(MyComponent, {})

I get the following error:

An uncaught Exception occurred on "main" thread.
Calling js method onClick failed
TypeError: this.nativeView.showBottomSheet is not a function

See playground example here: https://play.nativescript.org/?template=play-vue&id=17nhIV&v=3

nativescript-community/ui-material-components

Answer questions tartinesKiller

For anyone using this plugin and sticking with NativeScript 6, when calling this.$showBottomSheet, be sure to provide a context, even an empty one:

this.$showBottomSheet(MyComponent, {
	props: {
		myProp: this.message,
	},
	context: {},
});
useful!

Related questions

No questions were found.
source:https://uonfu.com/
Github User Rank List