Skip to content

Commit

Permalink
合并分支3的feature,修复lazy不传递props的BUG
Browse files Browse the repository at this point in the history
  • Loading branch information
RubyLouvre committed Oct 11, 2019
1 parent ac74cd6 commit 580536e
Show file tree
Hide file tree
Showing 14 changed files with 32 additions and 35 deletions.
14 changes: 6 additions & 8 deletions dist/React.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* by 司徒正美 Copyright 2019-09-19
* by 司徒正美 Copyright 2019-10-11
* IE9+
*/

Expand Down Expand Up @@ -831,7 +831,7 @@
component: null,
resolved: false
};
var promise = props.render();
var promise = props.children();
if (!promise || !isFn(promise.then)) {
throw "lazy必须返回一个thenable对象";
}
Expand All @@ -853,14 +853,12 @@
throw "lazy组件必须包一个Suspense组件";
},
render: function f2() {
return this.state.resolved ? createElement(this.state.component) : this.fallback();
return this.state.resolved ? createElement(this.state.component, this.props) : this.fallback();
}
});
function lazy(fn) {
return function () {
return createElement(LazyComponent, {
render: fn
});
function lazy(render) {
return function (props) {
return createElement(LazyComponent, props, render);
};
}

Expand Down
4 changes: 2 additions & 2 deletions dist/ReactAli.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* 运行于支付宝小程序的React by 司徒正美 Copyright 2019-10-09
* 运行于支付宝小程序的React by 司徒正美 Copyright 2019-10-11
*/

var arrayPush = Array.prototype.push;
Expand Down Expand Up @@ -2867,7 +2867,7 @@ var React = getWindow().React = {
findDOMNode: function findDOMNode() {
console.log("小程序不支持findDOMNode");
},
version: "1.5.10",
version: "1.6.0",
render: render$1,
hydrate: render$1,
webview: webview,
Expand Down
4 changes: 2 additions & 2 deletions dist/ReactBu.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* 运行于支付宝小程序的React by 司徒正美 Copyright 2019-10-09
* 运行于支付宝小程序的React by 司徒正美 Copyright 2019-10-11
*/

var arrayPush = Array.prototype.push;
Expand Down Expand Up @@ -2731,7 +2731,7 @@ var React = getWindow().React = {
findDOMNode: function findDOMNode() {
console.log("小程序不支持findDOMNode");
},
version: "1.5.10",
version: "1.6.0",
render: render$1,
hydrate: render$1,
webview: webview,
Expand Down
4 changes: 2 additions & 2 deletions dist/ReactH5.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* 运行于webview的React by 司徒正美 Copyright 2019-10-09T07
* 运行于webview的React by 司徒正美 Copyright 2019-10-11T06
* IE9+
*/

Expand Down Expand Up @@ -5549,7 +5549,7 @@
var MAX_PAGE_STACK_NUM = 10;
var React$2 = getWindow().React = {
findDOMNode: findDOMNode,
version: '1.5.10',
version: '1.6.0',
render: render$2,
hydrate: render$2,
Fragment: Fragment,
Expand Down
14 changes: 6 additions & 8 deletions dist/ReactIE.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* IE6+,有问题请加QQ 370262116 by 司徒正美 Copyright 2019-09-19
* IE6+,有问题请加QQ 370262116 by 司徒正美 Copyright 2019-10-11
*/

(function (global, factory) {
Expand Down Expand Up @@ -3171,7 +3171,7 @@
component: null,
resolved: false
};
var promise = props.render();
var promise = props.children();
if (!promise || !isFn(promise.then)) {
throw "lazy必须返回一个thenable对象";
}
Expand All @@ -3193,14 +3193,12 @@
throw "lazy组件必须包一个Suspense组件";
},
render: function f2() {
return this.state.resolved ? createElement(this.state.component) : this.fallback();
return this.state.resolved ? createElement(this.state.component, this.props) : this.fallback();
}
});
function lazy(fn) {
return function () {
return createElement(LazyComponent, {
render: fn
});
function lazy(render) {
return function (props) {
return createElement(LazyComponent, props, render);
};
}

Expand Down
4 changes: 2 additions & 2 deletions dist/ReactQuick.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* 运行于快应用的React by 司徒正美 Copyright 2019-10-09
* 运行于快应用的React by 司徒正美 Copyright 2019-10-11
*/

var arrayPush = Array.prototype.push;
Expand Down Expand Up @@ -3566,7 +3566,7 @@ var React = getWindow().React = {
findDOMNode: function findDOMNode() {
console.log("小程序不支持findDOMNode");
},
version: "1.5.10",
version: "1.6.0",
render: render$1,
hydrate: render$1,
Fragment: Fragment,
Expand Down
2 changes: 1 addition & 1 deletion dist/ReactWX.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* 运行于微信小程序的React by 司徒正美 Copyright 2019-10-09T07
* 运行于微信小程序的React by 司徒正美 Copyright 2019-10-11T06
* IE9+
*/

Expand Down
1 change: 1 addition & 0 deletions packages/cli/consts/alias.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const cwd = process.cwd();
exports.default = (platform) => {
const baseAlias = {
'react': './source/' + index_1.REACT_LIB_MAP[platform],
'react-dom': './source/' + index_1.REACT_LIB_MAP[platform],
'@react': './source/' + index_1.REACT_LIB_MAP[platform],
'@components': './source/components'
};
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/lib/ReactAli.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* 运行于支付宝小程序的React by 司徒正美 Copyright 2019-10-09
* 运行于支付宝小程序的React by 司徒正美 Copyright 2019-10-11
*/

var arrayPush = Array.prototype.push;
Expand Down Expand Up @@ -2867,7 +2867,7 @@ var React = getWindow().React = {
findDOMNode: function findDOMNode() {
console.log("小程序不支持findDOMNode");
},
version: "1.5.10",
version: "1.6.0",
render: render$1,
hydrate: render$1,
webview: webview,
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/lib/ReactBu.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* 运行于支付宝小程序的React by 司徒正美 Copyright 2019-10-09
* 运行于支付宝小程序的React by 司徒正美 Copyright 2019-10-11
*/

var arrayPush = Array.prototype.push;
Expand Down Expand Up @@ -2731,7 +2731,7 @@ var React = getWindow().React = {
findDOMNode: function findDOMNode() {
console.log("小程序不支持findDOMNode");
},
version: "1.5.10",
version: "1.6.0",
render: render$1,
hydrate: render$1,
webview: webview,
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/lib/ReactH5.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* 运行于webview的React by 司徒正美 Copyright 2019-10-09T07
* 运行于webview的React by 司徒正美 Copyright 2019-10-11T06
* IE9+
*/

Expand Down Expand Up @@ -5549,7 +5549,7 @@
var MAX_PAGE_STACK_NUM = 10;
var React$2 = getWindow().React = {
findDOMNode: findDOMNode,
version: '1.5.10',
version: '1.6.0',
render: render$2,
hydrate: render$2,
Fragment: Fragment,
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/lib/ReactQuick.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* 运行于快应用的React by 司徒正美 Copyright 2019-10-09
* 运行于快应用的React by 司徒正美 Copyright 2019-10-11
*/

var arrayPush = Array.prototype.push;
Expand Down Expand Up @@ -3566,7 +3566,7 @@ var React = getWindow().React = {
findDOMNode: function findDOMNode() {
console.log("小程序不支持findDOMNode");
},
version: "1.5.10",
version: "1.6.0",
render: render$1,
hydrate: render$1,
Fragment: Fragment,
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/lib/ReactWX.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* 运行于微信小程序的React by 司徒正美 Copyright 2019-10-09T07
* 运行于微信小程序的React by 司徒正美 Copyright 2019-10-11T06
* IE9+
*/

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/test/ReactWX.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* 运行于微信小程序的React by 司徒正美 Copyright 2019-10-09T07
* 运行于微信小程序的React by 司徒正美 Copyright 2019-10-11T06
* IE9+
*/

Expand Down

0 comments on commit 580536e

Please sign in to comment.