@ray-js/runtime 1.3.21 → 1.3.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +9 -0
- package/lib/PageInstance.js +39 -58
- package/lib/PageInstanceContext.js +1 -1
- package/lib/current.d.ts +1 -1
- package/lib/current.js +1 -1
- package/lib/index.js +10 -16
- package/lib/lifecycle.js +25 -47
- package/lib/useAppEvent/index.js +2 -1
- package/lib/usePageEvent/index.js +1 -1
- package/lib/withPageLifecycle/index.js +41 -80
- package/lib/withPageLifecycle/index.jsx +63 -0
- package/package.json +5 -5
package/LICENSE.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
Copyright © 2014-2022 Tuya.inc
|
|
2
|
+
|
|
3
|
+
MIT License
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/lib/PageInstance.js
CHANGED
|
@@ -1,78 +1,59 @@
|
|
|
1
|
-
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
|
-
import "core-js/modules/es.array.splice.js";
|
|
5
|
-
import "core-js/modules/es.array.index-of.js";
|
|
6
|
-
import "core-js/modules/es.object.to-string.js";
|
|
7
|
-
import "core-js/modules/web.dom-collections.for-each.js";
|
|
8
|
-
|
|
9
1
|
/**
|
|
10
2
|
* 管理 web 页面生命周期的调用
|
|
11
3
|
* 小程序端
|
|
12
4
|
* TODO: 支持 RN
|
|
13
5
|
*/
|
|
14
|
-
|
|
15
|
-
|
|
6
|
+
|
|
7
|
+
let UniqueId = 0;
|
|
8
|
+
export const generateUniqueId = () => {
|
|
16
9
|
return UniqueId += 1;
|
|
17
10
|
};
|
|
18
|
-
export
|
|
11
|
+
export const generatePageKey = uniqueId => {
|
|
19
12
|
return 'Page-' + uniqueId;
|
|
20
13
|
};
|
|
21
|
-
export
|
|
22
|
-
|
|
23
|
-
_classCallCheck(this, PageInstance);
|
|
24
|
-
|
|
14
|
+
export class PageInstance {
|
|
15
|
+
constructor(uniqueId) {
|
|
25
16
|
this.uniqueId = uniqueId !== null && uniqueId !== void 0 ? uniqueId : generateUniqueId();
|
|
26
17
|
this.lifecycleCallback = {};
|
|
27
18
|
}
|
|
19
|
+
|
|
28
20
|
/**
|
|
29
21
|
* 注册生命周期事件, 页面运行底层实例
|
|
30
22
|
* @param lifecycleName - 事件名
|
|
31
23
|
* @param context - fn 上下文
|
|
32
24
|
* @param fn - 回调函数
|
|
33
25
|
*/
|
|
26
|
+
registerLifecycle(lifecycleName, context, fn) {
|
|
27
|
+
this.lifecycleCallback[lifecycleName] = this.lifecycleCallback[lifecycleName] || [];
|
|
28
|
+
const fnObj = {
|
|
29
|
+
context,
|
|
30
|
+
fn
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
// 先注册的函数先调用
|
|
34
|
+
this.lifecycleCallback[lifecycleName].push(fnObj);
|
|
35
|
+
return () => {
|
|
36
|
+
this.lifecycleCallback[lifecycleName].splice(this.lifecycleCallback[lifecycleName].indexOf(fnObj), 1);
|
|
37
|
+
};
|
|
38
|
+
}
|
|
34
39
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* 触发生命周期函数
|
|
54
|
-
* @param lifecycleName
|
|
55
|
-
* @param args
|
|
56
|
-
*/
|
|
57
|
-
|
|
58
|
-
}, {
|
|
59
|
-
key: "callLifecycle",
|
|
60
|
-
value: function callLifecycle(params) {
|
|
61
|
-
var callbacks = this.lifecycleCallback[params.name] || [];
|
|
62
|
-
var result;
|
|
63
|
-
|
|
64
|
-
_toConsumableArray(callbacks).forEach(function (_ref) {
|
|
65
|
-
var _ref$context = _ref.context,
|
|
66
|
-
context = _ref$context === void 0 ? null : _ref$context,
|
|
67
|
-
fn = _ref.fn;
|
|
68
|
-
result = fn.apply(context, Array.isArray(params.args) ? params.args : [params.args]);
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
if (result) {
|
|
72
|
-
return result;
|
|
73
|
-
}
|
|
40
|
+
/**
|
|
41
|
+
* 触发生命周期函数
|
|
42
|
+
* @param lifecycleName
|
|
43
|
+
* @param args
|
|
44
|
+
*/
|
|
45
|
+
callLifecycle(params) {
|
|
46
|
+
const callbacks = this.lifecycleCallback[params.name] || [];
|
|
47
|
+
let result;
|
|
48
|
+
[...callbacks].forEach(_ref => {
|
|
49
|
+
let {
|
|
50
|
+
context = null,
|
|
51
|
+
fn
|
|
52
|
+
} = _ref;
|
|
53
|
+
result = fn.apply(context, Array.isArray(params.args) ? params.args : [params.args]);
|
|
54
|
+
});
|
|
55
|
+
if (result) {
|
|
56
|
+
return result;
|
|
74
57
|
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
return PageInstance;
|
|
78
|
-
}();
|
|
58
|
+
}
|
|
59
|
+
}
|
package/lib/current.d.ts
CHANGED
package/lib/current.js
CHANGED
package/lib/index.js
CHANGED
|
@@ -2,26 +2,20 @@ import * as runtime from '@ray-core/runtime';
|
|
|
2
2
|
export { lifecycle } from './lifecycle';
|
|
3
3
|
export { PageInstance } from './PageInstance';
|
|
4
4
|
export { PageInstanceContext } from './PageInstanceContext';
|
|
5
|
-
export { useAppEvent } from './useAppEvent';
|
|
6
|
-
|
|
5
|
+
export { useAppEvent } from './useAppEvent';
|
|
6
|
+
// 页面事件
|
|
7
7
|
export { usePageEvent } from './usePageEvent';
|
|
8
8
|
export { withPageLifecycle } from './withPageLifecycle';
|
|
9
9
|
export { getCurrent } from './current';
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export var useQuery = function () {
|
|
14
|
-
console.warn("// TODO \u6682\u672A\u5B9E\u73B0\u94A9\u5B50 'useQuery'");
|
|
10
|
+
export const useNativeEffect = () => console.warn(`// TODO 暂未实现钩子 'useNativeEffect'`);
|
|
11
|
+
export const useQuery = () => {
|
|
12
|
+
console.warn(`// TODO 暂未实现钩子 'useQuery'`);
|
|
15
13
|
return null;
|
|
16
14
|
};
|
|
17
|
-
export
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
export
|
|
21
|
-
|
|
22
|
-
};
|
|
23
|
-
export var createPortal = runtime.createPortal;
|
|
24
|
-
export var useModal = function () {
|
|
25
|
-
console.warn("// TODO \u6682\u672A\u5B9E\u73B0\u94A9\u5B50 'useModal'");
|
|
15
|
+
export const usePageInstance = () => console.warn(`// TODO 暂未实现钩子 'usePageInstance'`);
|
|
16
|
+
export const useComponentInstance = () => console.warn(`// TODO 暂未实现钩子 'useComponentInstance'`);
|
|
17
|
+
export const createPortal = runtime.createPortal;
|
|
18
|
+
export const useModal = () => {
|
|
19
|
+
console.warn(`// TODO 暂未实现钩子 'useModal'`);
|
|
26
20
|
return undefined;
|
|
27
21
|
};
|
package/lib/lifecycle.js
CHANGED
|
@@ -1,58 +1,36 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
-
import "core-js/modules/es.array.iterator.js";
|
|
4
|
-
import "core-js/modules/es.map.js";
|
|
5
|
-
import "core-js/modules/es.object.to-string.js";
|
|
6
|
-
import "core-js/modules/es.string.iterator.js";
|
|
7
|
-
import "core-js/modules/web.dom-collections.iterator.js";
|
|
8
1
|
import { generatePageKey } from './PageInstance';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
function Lifecycle() {
|
|
12
|
-
_classCallCheck(this, Lifecycle);
|
|
13
|
-
|
|
2
|
+
class Lifecycle {
|
|
3
|
+
constructor() {
|
|
14
4
|
this.instanceMap = new Map();
|
|
15
5
|
}
|
|
6
|
+
|
|
16
7
|
/**
|
|
17
8
|
* 增加一个 PageWrapper 实例
|
|
18
9
|
*
|
|
19
10
|
* @param uniqueId - 页面的 ID
|
|
20
11
|
* @param ins - 示例对象
|
|
21
12
|
*/
|
|
13
|
+
addInstance(ins) {
|
|
14
|
+
const key = generatePageKey(ins.uniqueId);
|
|
15
|
+
this.instanceMap.set(key, ins);
|
|
16
|
+
}
|
|
22
17
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
key: "removeInstance",
|
|
39
|
-
value: function removeInstance(ins) {
|
|
40
|
-
var key = generatePageKey(ins.uniqueId);
|
|
41
|
-
this.instanceMap.delete(key);
|
|
42
|
-
}
|
|
43
|
-
}, {
|
|
44
|
-
key: "emit",
|
|
45
|
-
value: function emit(params) {
|
|
46
|
-
var key = generatePageKey(params.uniqueId);
|
|
47
|
-
var $instance = this.instanceMap.get(key);
|
|
48
|
-
|
|
49
|
-
if ($instance) {
|
|
50
|
-
$instance.callLifecycle(params);
|
|
51
|
-
}
|
|
18
|
+
/**
|
|
19
|
+
* 删除一个 PageWrapper 实例
|
|
20
|
+
*
|
|
21
|
+
* @param uniqueId - 页面的 ID
|
|
22
|
+
* @param ins - 示例对象
|
|
23
|
+
*/
|
|
24
|
+
removeInstance(ins) {
|
|
25
|
+
const key = generatePageKey(ins.uniqueId);
|
|
26
|
+
this.instanceMap.delete(key);
|
|
27
|
+
}
|
|
28
|
+
emit(params) {
|
|
29
|
+
const key = generatePageKey(params.uniqueId);
|
|
30
|
+
const $instance = this.instanceMap.get(key);
|
|
31
|
+
if ($instance) {
|
|
32
|
+
$instance.callLifecycle(params);
|
|
52
33
|
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}();
|
|
57
|
-
|
|
58
|
-
export var lifecycle = new Lifecycle();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
export const lifecycle = new Lifecycle();
|
package/lib/useAppEvent/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { PageInstanceContext } from '../PageInstanceContext';
|
|
3
3
|
export function usePageEvent(event, fn) {
|
|
4
|
-
|
|
4
|
+
const $instance = React.useContext(PageInstanceContext).$instance;
|
|
5
5
|
$instance.registerLifecycle(event, null, fn);
|
|
6
6
|
}
|
|
@@ -1,93 +1,54 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
|
|
4
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
5
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
6
|
-
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
|
|
7
|
-
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
8
|
-
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
9
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
10
|
-
var _excluded = ["forwardedRef"];
|
|
11
|
-
import "core-js/modules/es.array.concat.js";
|
|
12
|
-
import "core-js/modules/es.object.to-string.js";
|
|
13
|
-
import "core-js/modules/web.dom-collections.for-each.js";
|
|
14
|
-
import "core-js/modules/es.object.keys.js";
|
|
3
|
+
const _excluded = ["forwardedRef"];
|
|
15
4
|
import React from 'react';
|
|
16
5
|
import { pageLifecycles } from '@ray-js/types';
|
|
17
6
|
import { PageInstanceContext } from '../PageInstanceContext';
|
|
18
7
|
export function withPageLifecycle(Component) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
function WithPageLifeCycle() {
|
|
27
|
-
var _this;
|
|
28
|
-
|
|
29
|
-
_classCallCheck(this, WithPageLifeCycle);
|
|
30
|
-
|
|
31
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
32
|
-
args[_key] = arguments[_key];
|
|
8
|
+
const displayName = `WithPageLifecycle(${Component.displayName || Component.name})`;
|
|
9
|
+
class WithPageLifeCycle extends React.Component {
|
|
10
|
+
static displayName = displayName;
|
|
11
|
+
refHandle = ref => {
|
|
12
|
+
const forwardedRef = this.props.forwardedRef;
|
|
13
|
+
if (ref) {
|
|
14
|
+
this.additionToLifecycle(ref);
|
|
33
15
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
if (ref) {
|
|
41
|
-
_this.additionToLifecycle(ref);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
if (forwardedRef) {
|
|
45
|
-
if (typeof forwardedRef === 'function') {
|
|
46
|
-
forwardedRef(ref);
|
|
47
|
-
} else if (_typeof(forwardedRef) === 'object') {
|
|
48
|
-
forwardedRef.current = ref;
|
|
49
|
-
}
|
|
16
|
+
if (forwardedRef) {
|
|
17
|
+
if (typeof forwardedRef === 'function') {
|
|
18
|
+
forwardedRef(ref);
|
|
19
|
+
} else if (typeof forwardedRef === 'object') {
|
|
20
|
+
forwardedRef.current = ref;
|
|
50
21
|
}
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
render() {
|
|
25
|
+
const _this$props = this.props,
|
|
26
|
+
{
|
|
27
|
+
forwardedRef
|
|
28
|
+
} = _this$props,
|
|
29
|
+
rest = _objectWithoutProperties(_this$props, _excluded);
|
|
30
|
+
return /*#__PURE__*/React.createElement(PageInstanceContext.Consumer, null, context => {
|
|
31
|
+
const {
|
|
32
|
+
$instance
|
|
33
|
+
} = context;
|
|
34
|
+
// 挂载页面事件
|
|
35
|
+
this.additionToLifecycle = function (ins) {
|
|
36
|
+
Object.keys(pageLifecycles).forEach(event => {
|
|
37
|
+
if (typeof ins[event] === 'function') {
|
|
38
|
+
$instance.registerLifecycle(event, ins, ins[event]);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
return /*#__PURE__*/React.createElement(Component
|
|
43
|
+
// fixed: 坑货,不能直接一个匿名函数,因为每次渲染匿名函数都是个新的,导致每次渲染都会调用一次
|
|
44
|
+
// 进而导致生命周期函数重复添加
|
|
45
|
+
, _extends({
|
|
46
|
+
ref: this.refHandle
|
|
47
|
+
}, rest));
|
|
51
48
|
});
|
|
52
|
-
|
|
53
|
-
return _this;
|
|
54
49
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
key: "render",
|
|
58
|
-
value: function render() {
|
|
59
|
-
var _this2 = this;
|
|
60
|
-
|
|
61
|
-
var _this$props = this.props,
|
|
62
|
-
forwardedRef = _this$props.forwardedRef,
|
|
63
|
-
rest = _objectWithoutProperties(_this$props, _excluded);
|
|
64
|
-
|
|
65
|
-
return /*#__PURE__*/React.createElement(PageInstanceContext.Consumer, null, function (context) {
|
|
66
|
-
var $instance = context.$instance; // 挂载页面事件
|
|
67
|
-
|
|
68
|
-
_this2.additionToLifecycle = function (ins) {
|
|
69
|
-
Object.keys(pageLifecycles).forEach(function (event) {
|
|
70
|
-
if (typeof ins[event] === 'function') {
|
|
71
|
-
$instance.registerLifecycle(event, ins, ins[event]);
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
return /*#__PURE__*/React.createElement(Component // fixed: 坑货,不能直接一个匿名函数,因为每次渲染匿名函数都是个新的,导致每次渲染都会调用一次
|
|
77
|
-
// 进而导致生命周期函数重复添加
|
|
78
|
-
, _extends({
|
|
79
|
-
ref: _this2.refHandle
|
|
80
|
-
}, rest));
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
}]);
|
|
84
|
-
|
|
85
|
-
return WithPageLifeCycle;
|
|
86
|
-
}(React.Component);
|
|
87
|
-
|
|
88
|
-
_defineProperty(WithPageLifeCycle, "displayName", displayName);
|
|
89
|
-
|
|
90
|
-
var forwardRef = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
50
|
+
}
|
|
51
|
+
const forwardRef = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
91
52
|
return /*#__PURE__*/React.createElement(WithPageLifeCycle, _extends({}, props, {
|
|
92
53
|
forwardedRef: ref
|
|
93
54
|
}));
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import { pageLifecycles } from '@ray-js/types';
|
|
14
|
+
import { PageInstanceContext } from '../PageInstanceContext';
|
|
15
|
+
export function withPageLifecycle(Component) {
|
|
16
|
+
const displayName = `WithPageLifecycle(${Component.displayName || Component.name})`;
|
|
17
|
+
class WithPageLifeCycle extends React.Component {
|
|
18
|
+
constructor() {
|
|
19
|
+
super(...arguments);
|
|
20
|
+
this.refHandle = (ref) => {
|
|
21
|
+
const forwardedRef = this.props.forwardedRef;
|
|
22
|
+
if (ref) {
|
|
23
|
+
this.additionToLifecycle(ref);
|
|
24
|
+
}
|
|
25
|
+
if (forwardedRef) {
|
|
26
|
+
if (typeof forwardedRef === 'function') {
|
|
27
|
+
forwardedRef(ref);
|
|
28
|
+
}
|
|
29
|
+
else if (typeof forwardedRef === 'object') {
|
|
30
|
+
forwardedRef.current = ref;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
render() {
|
|
36
|
+
const _a = this.props, { forwardedRef } = _a, rest = __rest(_a, ["forwardedRef"]);
|
|
37
|
+
return (<PageInstanceContext.Consumer>
|
|
38
|
+
{(context) => {
|
|
39
|
+
const { $instance } = context;
|
|
40
|
+
// 挂载页面事件
|
|
41
|
+
this.additionToLifecycle = function additionToLifecycle(ins) {
|
|
42
|
+
Object.keys(pageLifecycles).forEach((event) => {
|
|
43
|
+
if (typeof ins[event] === 'function') {
|
|
44
|
+
;
|
|
45
|
+
$instance.registerLifecycle(event, ins, ins[event]);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
return (<Component
|
|
50
|
+
// fixed: 坑货,不能直接一个匿名函数,因为每次渲染匿名函数都是个新的,导致每次渲染都会调用一次
|
|
51
|
+
// 进而导致生命周期函数重复添加
|
|
52
|
+
ref={this.refHandle} {...rest}/>);
|
|
53
|
+
}}
|
|
54
|
+
</PageInstanceContext.Consumer>);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
WithPageLifeCycle.displayName = displayName;
|
|
58
|
+
const forwardRef = React.forwardRef((props, ref) => {
|
|
59
|
+
return <WithPageLifeCycle {...props} forwardedRef={ref}/>;
|
|
60
|
+
});
|
|
61
|
+
forwardRef.displayName = displayName;
|
|
62
|
+
return forwardRef;
|
|
63
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ray-js/runtime",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.23",
|
|
4
4
|
"description": "Ray cross runtime",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ray"
|
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
"watch": "tsc -p ./tsconfig.build.json --module esnext --outDir lib --watch"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@ray-core/runtime": "^0.3.
|
|
24
|
+
"@ray-core/runtime": "^0.3.9"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@ray-js/cli": "1.3.
|
|
28
|
-
"@ray-js/types": "1.3.
|
|
27
|
+
"@ray-js/cli": "1.3.23",
|
|
28
|
+
"@ray-js/types": "1.3.23"
|
|
29
29
|
},
|
|
30
30
|
"maintainers": [
|
|
31
31
|
{
|
|
@@ -33,6 +33,6 @@
|
|
|
33
33
|
"email": "tuyafe@tuya.com"
|
|
34
34
|
}
|
|
35
35
|
],
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "04708bb394d817a7a522fcde178f19f170d5d364",
|
|
37
37
|
"repository": {}
|
|
38
38
|
}
|