From 91ec6993604912999c57f7f45577a67d7ff3fe2e Mon Sep 17 00:00:00 2001 From: msaelices Date: Wed, 20 Jun 2018 23:39:31 +0200 Subject: [PATCH] chore: More robust checking of the boolean value (see #171) --- platform/nativescript/renderer/ViewNode.js | 3 ++- platform/nativescript/runtime/modules/transition.js | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/platform/nativescript/renderer/ViewNode.js b/platform/nativescript/renderer/ViewNode.js index fe66ef7a..cbec5c95 100644 --- a/platform/nativescript/renderer/ViewNode.js +++ b/platform/nativescript/renderer/ViewNode.js @@ -3,6 +3,7 @@ import set from 'set-value' import { getViewMeta, normalizeElementName } from '../element-registry' import * as viewUtil from './utils' import { isAndroid, isIOS } from 'tns-core-modules/platform' +import * as types from 'tns-core-modules/utils/types' const XML_ATTRIBUTES = Object.freeze([ 'style', @@ -99,7 +100,7 @@ export default class ViewNode { } else { // detect expandable attrs for boolean values // See https://vuejs.org/v2/guide/components-props.html#Passing-a-Boolean - if (typeof this.nativeView[key] === 'boolean' && value === '') { + if (types.isBoolean(this.nativeView[key]) && value === '') { value = true } diff --git a/platform/nativescript/runtime/modules/transition.js b/platform/nativescript/runtime/modules/transition.js index 78fc512a..b101dd38 100644 --- a/platform/nativescript/runtime/modules/transition.js +++ b/platform/nativescript/runtime/modules/transition.js @@ -76,7 +76,9 @@ export function enter(vnode, toggleDisplay) { const beforeEnterHook = isAppear ? beforeAppear || beforeEnter : beforeEnter const enterHook = isAppear - ? typeof appear === 'function' ? appear : enter + ? typeof appear === 'function' + ? appear + : enter : enter const afterEnterHook = isAppear ? afterAppear || afterEnter : afterEnter const enterCancelledHook = isAppear