1
- import { App , createApp } from 'nativescript-vue' ;
1
+ import { createNativeView } from 'nativescript-vue' ;
2
2
import { Frame , View , ViewBase } from '@nativescript/core' ;
3
3
import { BottomSheetOptions } from '../bottomsheet' ;
4
4
import { ComponentCustomProperties } from '@vue/runtime-core' ;
@@ -34,18 +34,17 @@ const showSheet = (component, options: VueBottomSheetOptions) =>
34
34
let navEntryInstance = createNativeView (
35
35
component ,
36
36
Object . assign (
37
- {
38
- props : options . props
39
- } ,
37
+ options . props ?? { } ,
40
38
listeners
41
39
)
42
- ) . mount ( ) ;
40
+ ) ;
41
+ navEntryInstance . mount ( ) ;
43
42
44
43
const viewAttached = ( options . view as View ) ?? Frame . topmost ( ) . currentPage ;
45
44
46
45
viewAttached . showBottomSheet (
47
46
Object . assign ( { } , options , {
48
- view : navEntryInstance . $el . nativeView ,
47
+ view : navEntryInstance . nativeView ,
49
48
closeCallback : ( ...args ) => {
50
49
if ( resolved ) {
51
50
return ;
@@ -54,10 +53,8 @@ const showSheet = (component, options: VueBottomSheetOptions) =>
54
53
if ( navEntryInstance && navEntryInstance ) {
55
54
options . closeCallback && options . closeCallback . apply ( undefined , args ) ;
56
55
resolve ( ...args ) ;
57
- navEntryInstance . $emit ( 'bottomsheet:close' ) ;
58
- navEntryInstance . $el = null ;
59
- navEntryInstance = null ;
60
- modalStack . splice ( modalStack . length , 1 ) ;
56
+ navEntryInstance . unmount ( ) ;
57
+ modalStack . pop ( ) ;
61
58
}
62
59
}
63
60
} )
@@ -67,7 +64,7 @@ const showSheet = (component, options: VueBottomSheetOptions) =>
67
64
const closeSheet = ( ...args ) => {
68
65
const modalPageInstanceInfo = modalStack [ modalStack . length - 1 ] ;
69
66
if ( modalPageInstanceInfo ) {
70
- modalPageInstanceInfo . $el . nativeView . closeBottomSheet ( args ) ;
67
+ modalPageInstanceInfo . nativeView . closeBottomSheet ( args ) ;
71
68
}
72
69
} ;
73
70
@@ -80,9 +77,6 @@ const BottomSheetPlugin = {
80
77
}
81
78
} ;
82
79
83
- const createNativeView = ( component : any , props ?: any ) : App => createApp ( component , props ) ;
84
-
85
-
86
80
interface VueBottomSheetOptions extends Partial < BottomSheetOptions > {
87
81
view ?: string | View ;
88
82
props ?: any ;
0 commit comments