From 5930ef375e047de6e21559a33c4c668b81987409 Mon Sep 17 00:00:00 2001 From: kaesonho Date: Tue, 15 Mar 2016 15:39:33 -0700 Subject: [PATCH] only delete i13nModal --- src/mixins/viewport/ViewportMixin.js | 20 +++++++------------- src/utils/createI13nNode.js | 3 --- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/src/mixins/viewport/ViewportMixin.js b/src/mixins/viewport/ViewportMixin.js index 79685505..9db5ffb5 100644 --- a/src/mixins/viewport/ViewportMixin.js +++ b/src/mixins/viewport/ViewportMixin.js @@ -7,6 +7,11 @@ var React = require('react'); var subscribe = require('subscribe-ui-event').subscribe; +var DEFAULT_VIEWPORT_MARGINS = { + usePercent: false, + top: 20, + bottom: 20 +}; /* Viewport mixin assumes you are on browser and already have the scroll lib */ var Viewport = { @@ -30,7 +35,8 @@ var Viewport = { return callback && callback(); } var rect = element.getBoundingClientRect(); - var viewportMargins = this.props.viewport.margins; + var viewportMargins = Object.assign({}, DEFAULT_VIEWPORT_MARGINS, + (this.props.viewport && this.props.viewport.margins) || {}); var margins; if (viewportMargins.usePercent) { margins = { @@ -56,18 +62,6 @@ var Viewport = { self._subComponentsViewportDetection && self._subComponentsViewportDetection(); }, - getDefaultProps: function () { - return { - viewport: { - margins: { - usePercent: false, - top: 20, - bottom: 20 - } - } - }; - }, - subscribeViewportEvents: function () { this.subscription = subscribe('scrollEnd', this._detectViewport); }, diff --git a/src/utils/createI13nNode.js b/src/utils/createI13nNode.js index 7d4056d8..a64d19d6 100644 --- a/src/utils/createI13nNode.js +++ b/src/utils/createI13nNode.js @@ -42,7 +42,6 @@ module.exports = function createI13nNode (Component, defaultProps, options) { */ getDefaultProps: function () { return Object.assign({}, { - model: null, i13nModel: null, isLeafNode: false, bindClickEvent: false, @@ -68,9 +67,7 @@ module.exports = function createI13nNode (Component, defaultProps, options) { } // delete the props that only used in this level - props.model = undefined; props.i13nModel = undefined; - props.viewport = undefined; return React.createElement( Component,