Skip to content

Commit d83bbe2

Browse files
committed
[weex] expose native module getter on sub Vue instances
1 parent d58132e commit d83bbe2

File tree

1 file changed

+5
-18
lines changed

1 file changed

+5
-18
lines changed

src/platforms/weex/runtime/modules/transition.js

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,9 @@ function enter (_, vnode) {
8181
el._enterCb = null
8282
})
8383

84-
// remove pending leave element on enter by injecting an insert hook
85-
// mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'insert', () => {
86-
87-
// }, 'transition-insert')
88-
84+
// We need to wait until the native element has been inserted, but currently
85+
// there's no API to do that. So we have to wait "one frame" - not entirely
86+
// sure if this is guaranteed to be enough (e.g. on slow devices?)
8987
setTimeout(() => {
9088
const parent = el.parentNode
9189
const pendingNode = parent && parent._pending && parent._pending[vnode.key]
@@ -98,7 +96,7 @@ function enter (_, vnode) {
9896
enterHook && enterHook(el, cb)
9997

10098
if (endState) {
101-
const animation = vnode.context.$options.animation
99+
const animation = vnode.context._requireWeexModule('animation')
102100
animation.transition(el.ref, {
103101
styles: endState,
104102
duration: 300,
@@ -107,17 +105,6 @@ function enter (_, vnode) {
107105
} else if (!userWantsControl) {
108106
cb()
109107
}
110-
// if (expectsCSS) {
111-
// animation.transition(el.ref, {
112-
// styles: startState
113-
// }, () => {
114-
// animation.transition(el.ref, {
115-
// styles: endState,
116-
// duration: 300,
117-
// timingFunction: 'ease-in-out'
118-
// }, userWantsControl ? noop : cb)
119-
// })
120-
// }
121108
}, 16)
122109

123110
// start enter transition
@@ -193,7 +180,7 @@ function leave (vnode, rm) {
193180
}
194181

195182
function performLeave () {
196-
const animation = vnode.context.$options.animation
183+
const animation = vnode.context._requireWeexModule('animation')
197184
// the delayed leave may have already been cancelled
198185
if (cb.cancelled) {
199186
return

0 commit comments

Comments
 (0)