Skip to content

Commit 0fdf81d

Browse files
msaelicesrigor789
authored andcommitted
refactor: more robust checking of boolean values (re nativescript-vue#171) (nativescript-vue#260)
1 parent 33b82b6 commit 0fdf81d

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

platform/nativescript/renderer/ViewNode.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import set from 'set-value'
33
import { getViewMeta, normalizeElementName } from '../element-registry'
44
import * as viewUtil from './utils'
55
import { isAndroid, isIOS } from 'tns-core-modules/platform'
6+
import * as types from 'tns-core-modules/utils/types'
67

78
const XML_ATTRIBUTES = Object.freeze([
89
'style',
@@ -99,7 +100,7 @@ export default class ViewNode {
99100
} else {
100101
// detect expandable attrs for boolean values
101102
// See https://vuejs.org/v2/guide/components-props.html#Passing-a-Boolean
102-
if (typeof this.nativeView[key] === 'boolean' && value === '') {
103+
if (types.isBoolean(this.nativeView[key]) && value === '') {
103104
value = true
104105
}
105106

platform/nativescript/runtime/modules/transition.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,9 @@ export function enter(vnode, toggleDisplay) {
7676

7777
const beforeEnterHook = isAppear ? beforeAppear || beforeEnter : beforeEnter
7878
const enterHook = isAppear
79-
? typeof appear === 'function' ? appear : enter
79+
? typeof appear === 'function'
80+
? appear
81+
: enter
8082
: enter
8183
const afterEnterHook = isAppear ? afterAppear || afterEnter : afterEnter
8284
const enterCancelledHook = isAppear

0 commit comments

Comments
 (0)