From b2eddd77798a7082df3dc06689a83c2b31ce8f00 Mon Sep 17 00:00:00 2001
From: ykforerlang <1527997464@qq.com>
Date: Mon, 1 Jul 2019 17:38:05 +0800
Subject: [PATCH] =?UTF-8?q?feat(alita):=20=E4=BF=AE=E6=94=B9=E8=BD=AC?=
=?UTF-8?q?=E5=8C=96=E7=9A=84babel=E9=85=8D=E7=BD=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
修改转化的babel配置
---
.../src/a/MyChildComp.comp.js | 22 +-
.../HelloWorldExpoWP/src/a/MyContext.comp.js | 26 +-
.../src/a/MyForceUpdate.comp.js | 22 +-
.../src/a/MyForceUpdateInner.comp.js | 22 +-
.../src/a/MyForceUpdateInnerInner.comp.js | 22 +-
examples/HelloWorldExpoWP/src/a/MyHoc.comp.js | 22 +-
.../HelloWorldExpoWP/src/a/MyModalComp.js | 1 -
.../HelloWorldExpoWP/src/a/MyPropComp.comp.js | 22 +-
.../HelloWorldExpoWP/src/a/MyRefComp.comp.js | 35 +-
.../src/a/MyStyleComp.comp.js | 22 +-
.../src/a/MyStyleCompComp.comp.js | 22 +-
.../src/a/MyStyleCompCompComp.comp.js | 26 +-
.../src/a/PlatformComp.comp.js | 22 +-
.../HelloWorldExpoWP/src/a/decoratorTest.js | 3 +
examples/HelloWorldExpoWP/src/a/index.comp.js | 1448 ++++++++++++-----
examples/HelloWorldExpoWP/src/b/index.comp.js | 166 +-
examples/HelloWorldExpoWP/src/c/index.comp.js | 22 +-
examples/HelloWorldExpoWP/src/d/MyAni.comp.js | 22 +-
examples/HelloWorldExpoWP/src/d/index.comp.js | 282 ++--
examples/HelloWorldExpoWP/src/e/index.comp.js | 22 +-
examples/HelloWorldExpoWP/src/index.js | 59 +-
examples/ReactReposWP/RNApp.js | 28 +-
examples/ReactReposWP/package.json | 6 +-
examples/ReactReposWP/project.config.json | 2 +-
.../src/components/detail/SecBody.comp.js | 28 +-
.../components/detail/SecBodyTemplate.wxml | 2 +-
.../src/components/detail/index.comp.js | 23 +-
.../src/components/detail/indexTemplate.wxml | 4 +-
.../src/components/list/LoadingView.comp.js | 22 +-
.../src/components/list/index.comp.js | 325 ++--
.../src/components/list/indexTemplate.wxml | 4 +-
examples/RoomMobx/src/components/Room.js | 8 +
examples/RoomMobx/src/components/TotalInfo.js | 8 +
examples/RoomMobx/src/components/index.js | 8 +
examples/RoomMobx/src/store/Room.js | 8 +
examples/TodoWP/RNApp.js | 8 +-
examples/TodoWP/package.json | 8 +-
.../TodoWP/src/components/AddTodo.comp.js | 35 +-
examples/TodoWP/src/components/Footer.comp.js | 22 +-
examples/TodoWP/src/components/Todo.comp.js | 22 +-
examples/TodoWP/src/components/index.comp.js | 74 +-
src/util/uast.js | 9 +-
42 files changed, 2050 insertions(+), 914 deletions(-)
create mode 100644 examples/HelloWorldExpoWP/src/a/decoratorTest.js
create mode 100644 examples/RoomMobx/src/components/Room.js
create mode 100644 examples/RoomMobx/src/components/TotalInfo.js
create mode 100644 examples/RoomMobx/src/components/index.js
create mode 100644 examples/RoomMobx/src/store/Room.js
diff --git a/examples/HelloWorldExpoWP/src/a/MyChildComp.comp.js b/examples/HelloWorldExpoWP/src/a/MyChildComp.comp.js
index 36cfc58..5c25df7 100644
--- a/examples/HelloWorldExpoWP/src/a/MyChildComp.comp.js
+++ b/examples/HelloWorldExpoWP/src/a/MyChildComp.comp.js
@@ -1,6 +1,26 @@
+function _defineProperty(obj, key, value) {
+ if (key in obj) {
+ Object.defineProperty(obj, key, {
+ value: value,
+ enumerable: true,
+ configurable: true,
+ writable: true
+ })
+ } else {
+ obj[key] = value
+ }
+ return obj
+}
+
import React, { h } from "@areslabs/wx-react"
import { View } from "@areslabs/wx-react-native"
export default class MyChildComp extends React.Component {
+ constructor(...args) {
+ super(...args)
+
+ _defineProperty(this, "__stateless__", true)
+ }
+
render() {
return h(
"block",
@@ -23,6 +43,4 @@ export default class MyChildComp extends React.Component {
})
)
}
-
- __stateless__ = true
}
diff --git a/examples/HelloWorldExpoWP/src/a/MyContext.comp.js b/examples/HelloWorldExpoWP/src/a/MyContext.comp.js
index 0cfb93a..024c00d 100644
--- a/examples/HelloWorldExpoWP/src/a/MyContext.comp.js
+++ b/examples/HelloWorldExpoWP/src/a/MyContext.comp.js
@@ -1,10 +1,26 @@
+function _defineProperty(obj, key, value) {
+ if (key in obj) {
+ Object.defineProperty(obj, key, {
+ value: value,
+ enumerable: true,
+ configurable: true,
+ writable: true
+ })
+ } else {
+ obj[key] = value
+ }
+ return obj
+}
+
import React, { Component, h } from "@areslabs/wx-react"
import PropTypes from "@areslabs/wx-prop-types"
import { View, Text } from "@areslabs/wx-react-native"
import styles from "./styles"
export default class MyContext extends Component {
- static contextTypes = {
- color: PropTypes.string
+ constructor(...args) {
+ super(...args)
+
+ _defineProperty(this, "__stateless__", true)
}
render() {
@@ -52,6 +68,8 @@ export default class MyContext extends Component {
)
)
}
-
- __stateless__ = true
}
+
+_defineProperty(MyContext, "contextTypes", {
+ color: PropTypes.string
+})
diff --git a/examples/HelloWorldExpoWP/src/a/MyForceUpdate.comp.js b/examples/HelloWorldExpoWP/src/a/MyForceUpdate.comp.js
index 9dc547a..425e740 100644
--- a/examples/HelloWorldExpoWP/src/a/MyForceUpdate.comp.js
+++ b/examples/HelloWorldExpoWP/src/a/MyForceUpdate.comp.js
@@ -1,7 +1,27 @@
+function _defineProperty(obj, key, value) {
+ if (key in obj) {
+ Object.defineProperty(obj, key, {
+ value: value,
+ enumerable: true,
+ configurable: true,
+ writable: true
+ })
+ } else {
+ obj[key] = value
+ }
+ return obj
+}
+
import React, { Component, h } from "@areslabs/wx-react"
import { TouchableOpacity, View } from "@areslabs/wx-react-native"
import MyForceUpdateInner from "./MyForceUpdateInner.comp"
export default class MyForceUpdate extends Component {
+ constructor(...args) {
+ super(...args)
+
+ _defineProperty(this, "__stateless__", false)
+ }
+
shouldComponentUpdate() {
console.log("MyForceUpdate shouldComponentUpdate")
return true
@@ -36,6 +56,4 @@ export default class MyForceUpdate extends Component {
)
)
}
-
- __stateless__ = false
}
diff --git a/examples/HelloWorldExpoWP/src/a/MyForceUpdateInner.comp.js b/examples/HelloWorldExpoWP/src/a/MyForceUpdateInner.comp.js
index 5fe128f..de74efc 100644
--- a/examples/HelloWorldExpoWP/src/a/MyForceUpdateInner.comp.js
+++ b/examples/HelloWorldExpoWP/src/a/MyForceUpdateInner.comp.js
@@ -1,6 +1,26 @@
+function _defineProperty(obj, key, value) {
+ if (key in obj) {
+ Object.defineProperty(obj, key, {
+ value: value,
+ enumerable: true,
+ configurable: true,
+ writable: true
+ })
+ } else {
+ obj[key] = value
+ }
+ return obj
+}
+
import React, { Component, h } from "@areslabs/wx-react"
import MyForceUpdateInnerInner from "./MyForceUpdateInnerInner.comp"
export default class MyForceUpdateInner extends Component {
+ constructor(...args) {
+ super(...args)
+
+ _defineProperty(this, "__stateless__", true)
+ }
+
shouldComponentUpdate() {
console.log("MyForceUpdateInner shouldComponentUpdate")
return true
@@ -12,6 +32,4 @@ export default class MyForceUpdateInner extends Component {
tempName: "ITNP00002"
})
}
-
- __stateless__ = true
}
diff --git a/examples/HelloWorldExpoWP/src/a/MyForceUpdateInnerInner.comp.js b/examples/HelloWorldExpoWP/src/a/MyForceUpdateInnerInner.comp.js
index 3434866..1e75b26 100644
--- a/examples/HelloWorldExpoWP/src/a/MyForceUpdateInnerInner.comp.js
+++ b/examples/HelloWorldExpoWP/src/a/MyForceUpdateInnerInner.comp.js
@@ -1,7 +1,27 @@
+function _defineProperty(obj, key, value) {
+ if (key in obj) {
+ Object.defineProperty(obj, key, {
+ value: value,
+ enumerable: true,
+ configurable: true,
+ writable: true
+ })
+ } else {
+ obj[key] = value
+ }
+ return obj
+}
+
import React, { Component, h } from "@areslabs/wx-react"
import { View, Text } from "@areslabs/wx-react-native"
import styles from "./styles"
export default class MyForceUpdateInnerInner extends Component {
+ constructor(...args) {
+ super(...args)
+
+ _defineProperty(this, "__stateless__", true)
+ }
+
shouldComponentUpdate() {
console.log("MyForceUpdateInnerInner shouldComponentUpdate")
return true
@@ -34,6 +54,4 @@ export default class MyForceUpdateInnerInner extends Component {
)
)
}
-
- __stateless__ = true
}
diff --git a/examples/HelloWorldExpoWP/src/a/MyHoc.comp.js b/examples/HelloWorldExpoWP/src/a/MyHoc.comp.js
index bc1d25d..2288840 100644
--- a/examples/HelloWorldExpoWP/src/a/MyHoc.comp.js
+++ b/examples/HelloWorldExpoWP/src/a/MyHoc.comp.js
@@ -1,3 +1,17 @@
+function _defineProperty(obj, key, value) {
+ if (key in obj) {
+ Object.defineProperty(obj, key, {
+ value: value,
+ enumerable: true,
+ configurable: true,
+ writable: true
+ })
+ } else {
+ obj[key] = value
+ }
+ return obj
+}
+
import React, { Component, h } from "@areslabs/wx-react"
import { View, Text, WXButton } from "@areslabs/wx-react-native"
import Hoc1 from "./Hoc1"
@@ -6,6 +20,12 @@ import styles from "./styles"
let i = 6
class MyHoc extends Component {
+ constructor(...args) {
+ super(...args)
+
+ _defineProperty(this, "__stateless__", true)
+ }
+
componentDidMount() {
console.log("MyHoc componentDidMount")
}
@@ -75,8 +95,6 @@ class MyHoc extends Component {
)
)
}
-
- __stateless__ = true
}
export default Hoc1(Hoc2(MyHoc))
diff --git a/examples/HelloWorldExpoWP/src/a/MyModalComp.js b/examples/HelloWorldExpoWP/src/a/MyModalComp.js
index c027858..2e1cd26 100644
--- a/examples/HelloWorldExpoWP/src/a/MyModalComp.js
+++ b/examples/HelloWorldExpoWP/src/a/MyModalComp.js
@@ -1,5 +1,4 @@
import CompMySelf from "./MyModalComp.comp"
import { WxNormalComp } from "@areslabs/wx-react"
import RNApp from "../../src/index.js"
-
Component(WxNormalComp(CompMySelf, RNApp))
diff --git a/examples/HelloWorldExpoWP/src/a/MyPropComp.comp.js b/examples/HelloWorldExpoWP/src/a/MyPropComp.comp.js
index b853fd6..aff2c78 100644
--- a/examples/HelloWorldExpoWP/src/a/MyPropComp.comp.js
+++ b/examples/HelloWorldExpoWP/src/a/MyPropComp.comp.js
@@ -1,6 +1,26 @@
+function _defineProperty(obj, key, value) {
+ if (key in obj) {
+ Object.defineProperty(obj, key, {
+ value: value,
+ enumerable: true,
+ configurable: true,
+ writable: true
+ })
+ } else {
+ obj[key] = value
+ }
+ return obj
+}
+
import React, { Component, h } from "@areslabs/wx-react"
import { View } from "@areslabs/wx-react-native"
export default class MyPropComp extends Component {
+ constructor(...args) {
+ super(...args)
+
+ _defineProperty(this, "__stateless__", true)
+ }
+
render() {
return h(
"block",
@@ -19,6 +39,4 @@ export default class MyPropComp extends Component {
})
)
}
-
- __stateless__ = true
}
diff --git a/examples/HelloWorldExpoWP/src/a/MyRefComp.comp.js b/examples/HelloWorldExpoWP/src/a/MyRefComp.comp.js
index 4a6cce1..8112982 100644
--- a/examples/HelloWorldExpoWP/src/a/MyRefComp.comp.js
+++ b/examples/HelloWorldExpoWP/src/a/MyRefComp.comp.js
@@ -1,14 +1,35 @@
+function _defineProperty(obj, key, value) {
+ if (key in obj) {
+ Object.defineProperty(obj, key, {
+ value: value,
+ enumerable: true,
+ configurable: true,
+ writable: true
+ })
+ } else {
+ obj[key] = value
+ }
+ return obj
+}
+
import React, { Component, h } from "@areslabs/wx-react"
import { View, Text } from "@areslabs/wx-react-native"
import styles from "./styles"
export default class MyRefComp extends Component {
- state = {
- count: 0
- }
- increCount = () => {
- this.setState({
- count: this.state.count + 1
+ constructor(...args) {
+ super(...args)
+
+ _defineProperty(this, "state", {
+ count: 0
+ })
+
+ _defineProperty(this, "increCount", () => {
+ this.setState({
+ count: this.state.count + 1
+ })
})
+
+ _defineProperty(this, "__stateless__", false)
}
render() {
@@ -37,6 +58,4 @@ export default class MyRefComp extends Component {
)
)
}
-
- __stateless__ = false
}
diff --git a/examples/HelloWorldExpoWP/src/a/MyStyleComp.comp.js b/examples/HelloWorldExpoWP/src/a/MyStyleComp.comp.js
index a004573..2b691d2 100644
--- a/examples/HelloWorldExpoWP/src/a/MyStyleComp.comp.js
+++ b/examples/HelloWorldExpoWP/src/a/MyStyleComp.comp.js
@@ -1,12 +1,30 @@
+function _defineProperty(obj, key, value) {
+ if (key in obj) {
+ Object.defineProperty(obj, key, {
+ value: value,
+ enumerable: true,
+ configurable: true,
+ writable: true
+ })
+ } else {
+ obj[key] = value
+ }
+ return obj
+}
+
import React, { Component, h } from "@areslabs/wx-react"
import MyStyleCompComp from "./MyStyleCompComp.comp"
export default class MyStyleComp extends Component {
+ constructor(...args) {
+ super(...args)
+
+ _defineProperty(this, "__stateless__", true)
+ }
+
render() {
return h(MyStyleCompComp, {
diuu: "DIUU00001",
tempName: "ITNP00002"
})
}
-
- __stateless__ = true
}
diff --git a/examples/HelloWorldExpoWP/src/a/MyStyleCompComp.comp.js b/examples/HelloWorldExpoWP/src/a/MyStyleCompComp.comp.js
index 278dae9..9b83f85 100644
--- a/examples/HelloWorldExpoWP/src/a/MyStyleCompComp.comp.js
+++ b/examples/HelloWorldExpoWP/src/a/MyStyleCompComp.comp.js
@@ -1,12 +1,30 @@
+function _defineProperty(obj, key, value) {
+ if (key in obj) {
+ Object.defineProperty(obj, key, {
+ value: value,
+ enumerable: true,
+ configurable: true,
+ writable: true
+ })
+ } else {
+ obj[key] = value
+ }
+ return obj
+}
+
import React, { Component, h } from "@areslabs/wx-react"
import MyStyleCompCompComp from "./MyStyleCompCompComp.comp"
export default class MyStyleCompComp extends Component {
+ constructor(...args) {
+ super(...args)
+
+ _defineProperty(this, "__stateless__", true)
+ }
+
render() {
return h(MyStyleCompCompComp, {
diuu: "DIUU00001",
tempName: "ITNP00002"
})
}
-
- __stateless__ = true
}
diff --git a/examples/HelloWorldExpoWP/src/a/MyStyleCompCompComp.comp.js b/examples/HelloWorldExpoWP/src/a/MyStyleCompCompComp.comp.js
index b3cc866..f7b73a1 100644
--- a/examples/HelloWorldExpoWP/src/a/MyStyleCompCompComp.comp.js
+++ b/examples/HelloWorldExpoWP/src/a/MyStyleCompCompComp.comp.js
@@ -1,8 +1,28 @@
+function _defineProperty(obj, key, value) {
+ if (key in obj) {
+ Object.defineProperty(obj, key, {
+ value: value,
+ enumerable: true,
+ configurable: true,
+ writable: true
+ })
+ } else {
+ obj[key] = value
+ }
+ return obj
+}
+
import React, { Component, h } from "@areslabs/wx-react"
import { View, Text, WXButton, StyleSheet } from "@areslabs/wx-react-native"
export default class MyStyleCompCompComp extends Component {
- state = {
- bw: 2
+ constructor(...args) {
+ super(...args)
+
+ _defineProperty(this, "state", {
+ bw: 2
+ })
+
+ _defineProperty(this, "__stateless__", false)
}
render() {
@@ -45,8 +65,6 @@ export default class MyStyleCompCompComp extends Component {
})
)
}
-
- __stateless__ = false
}
const styles = StyleSheet.create({
item: {
diff --git a/examples/HelloWorldExpoWP/src/a/PlatformComp.comp.js b/examples/HelloWorldExpoWP/src/a/PlatformComp.comp.js
index be80533..8694484 100644
--- a/examples/HelloWorldExpoWP/src/a/PlatformComp.comp.js
+++ b/examples/HelloWorldExpoWP/src/a/PlatformComp.comp.js
@@ -1,6 +1,26 @@
+function _defineProperty(obj, key, value) {
+ if (key in obj) {
+ Object.defineProperty(obj, key, {
+ value: value,
+ enumerable: true,
+ configurable: true,
+ writable: true
+ })
+ } else {
+ obj[key] = value
+ }
+ return obj
+}
+
import React, { Component, h } from "@areslabs/wx-react"
import { Text, View } from "@areslabs/wx-react-native"
export default class PlatformComp extends Component {
+ constructor(...args) {
+ super(...args)
+
+ _defineProperty(this, "__stateless__", true)
+ }
+
render() {
return h(
"block",
@@ -24,6 +44,4 @@ export default class PlatformComp extends Component {
)
)
}
-
- __stateless__ = true
}
diff --git a/examples/HelloWorldExpoWP/src/a/decoratorTest.js b/examples/HelloWorldExpoWP/src/a/decoratorTest.js
new file mode 100644
index 0000000..731bc09
--- /dev/null
+++ b/examples/HelloWorldExpoWP/src/a/decoratorTest.js
@@ -0,0 +1,3 @@
+export default function logger(value) {
+
+}
diff --git a/examples/HelloWorldExpoWP/src/a/index.comp.js b/examples/HelloWorldExpoWP/src/a/index.comp.js
index b8c6008..3be328c 100644
--- a/examples/HelloWorldExpoWP/src/a/index.comp.js
+++ b/examples/HelloWorldExpoWP/src/a/index.comp.js
@@ -15,6 +15,463 @@ function _extends() {
return _extends.apply(this, arguments)
}
+function _decorate(decorators, factory, superClass, mixins) {
+ var api = _getDecoratorsApi()
+ if (mixins) {
+ for (var i = 0; i < mixins.length; i++) {
+ api = mixins[i](api)
+ }
+ }
+ var r = factory(function initialize(O) {
+ api.initializeInstanceElements(O, decorated.elements)
+ }, superClass)
+ var decorated = api.decorateClass(
+ _coalesceClassElements(r.d.map(_createElementDescriptor)),
+ decorators
+ )
+ api.initializeClassElements(r.F, decorated.elements)
+ return api.runClassFinishers(r.F, decorated.finishers)
+}
+
+function _getDecoratorsApi() {
+ _getDecoratorsApi = function() {
+ return api
+ }
+ var api = {
+ elementsDefinitionOrder: [["method"], ["field"]],
+ initializeInstanceElements: function(O, elements) {
+ ;["method", "field"].forEach(function(kind) {
+ elements.forEach(function(element) {
+ if (element.kind === kind && element.placement === "own") {
+ this.defineClassElement(O, element)
+ }
+ }, this)
+ }, this)
+ },
+ initializeClassElements: function(F, elements) {
+ var proto = F.prototype
+ ;["method", "field"].forEach(function(kind) {
+ elements.forEach(function(element) {
+ var placement = element.placement
+ if (
+ element.kind === kind &&
+ (placement === "static" || placement === "prototype")
+ ) {
+ var receiver = placement === "static" ? F : proto
+ this.defineClassElement(receiver, element)
+ }
+ }, this)
+ }, this)
+ },
+ defineClassElement: function(receiver, element) {
+ var descriptor = element.descriptor
+ if (element.kind === "field") {
+ var initializer = element.initializer
+ descriptor = {
+ enumerable: descriptor.enumerable,
+ writable: descriptor.writable,
+ configurable: descriptor.configurable,
+ value:
+ initializer === void 0
+ ? void 0
+ : initializer.call(receiver)
+ }
+ }
+ Object.defineProperty(receiver, element.key, descriptor)
+ },
+ decorateClass: function(elements, decorators) {
+ var newElements = []
+ var finishers = []
+ var placements = { static: [], prototype: [], own: [] }
+ elements.forEach(function(element) {
+ this.addElementPlacement(element, placements)
+ }, this)
+ elements.forEach(function(element) {
+ if (!_hasDecorators(element)) return newElements.push(element)
+ var elementFinishersExtras = this.decorateElement(
+ element,
+ placements
+ )
+ newElements.push(elementFinishersExtras.element)
+ newElements.push.apply(
+ newElements,
+ elementFinishersExtras.extras
+ )
+ finishers.push.apply(
+ finishers,
+ elementFinishersExtras.finishers
+ )
+ }, this)
+ if (!decorators) {
+ return { elements: newElements, finishers: finishers }
+ }
+ var result = this.decorateConstructor(newElements, decorators)
+ finishers.push.apply(finishers, result.finishers)
+ result.finishers = finishers
+ return result
+ },
+ addElementPlacement: function(element, placements, silent) {
+ var keys = placements[element.placement]
+ if (!silent && keys.indexOf(element.key) !== -1) {
+ throw new TypeError("Duplicated element (" + element.key + ")")
+ }
+ keys.push(element.key)
+ },
+ decorateElement: function(element, placements) {
+ var extras = []
+ var finishers = []
+ for (
+ var decorators = element.decorators, i = decorators.length - 1;
+ i >= 0;
+ i--
+ ) {
+ var keys = placements[element.placement]
+ keys.splice(keys.indexOf(element.key), 1)
+ var elementObject = this.fromElementDescriptor(element)
+ var elementFinisherExtras = this.toElementFinisherExtras(
+ (0, decorators[i])(elementObject) || elementObject
+ )
+ element = elementFinisherExtras.element
+ this.addElementPlacement(element, placements)
+ if (elementFinisherExtras.finisher) {
+ finishers.push(elementFinisherExtras.finisher)
+ }
+ var newExtras = elementFinisherExtras.extras
+ if (newExtras) {
+ for (var j = 0; j < newExtras.length; j++) {
+ this.addElementPlacement(newExtras[j], placements)
+ }
+ extras.push.apply(extras, newExtras)
+ }
+ }
+ return { element: element, finishers: finishers, extras: extras }
+ },
+ decorateConstructor: function(elements, decorators) {
+ var finishers = []
+ for (var i = decorators.length - 1; i >= 0; i--) {
+ var obj = this.fromClassDescriptor(elements)
+ var elementsAndFinisher = this.toClassDescriptor(
+ (0, decorators[i])(obj) || obj
+ )
+ if (elementsAndFinisher.finisher !== undefined) {
+ finishers.push(elementsAndFinisher.finisher)
+ }
+ if (elementsAndFinisher.elements !== undefined) {
+ elements = elementsAndFinisher.elements
+ for (var j = 0; j < elements.length - 1; j++) {
+ for (var k = j + 1; k < elements.length; k++) {
+ if (
+ elements[j].key === elements[k].key &&
+ elements[j].placement === elements[k].placement
+ ) {
+ throw new TypeError(
+ "Duplicated element (" +
+ elements[j].key +
+ ")"
+ )
+ }
+ }
+ }
+ }
+ }
+ return { elements: elements, finishers: finishers }
+ },
+ fromElementDescriptor: function(element) {
+ var obj = {
+ kind: element.kind,
+ key: element.key,
+ placement: element.placement,
+ descriptor: element.descriptor
+ }
+ var desc = { value: "Descriptor", configurable: true }
+ Object.defineProperty(obj, Symbol.toStringTag, desc)
+ if (element.kind === "field") obj.initializer = element.initializer
+ return obj
+ },
+ toElementDescriptors: function(elementObjects) {
+ if (elementObjects === undefined) return
+ return _toArray(elementObjects).map(function(elementObject) {
+ var element = this.toElementDescriptor(elementObject)
+ this.disallowProperty(
+ elementObject,
+ "finisher",
+ "An element descriptor"
+ )
+ this.disallowProperty(
+ elementObject,
+ "extras",
+ "An element descriptor"
+ )
+ return element
+ }, this)
+ },
+ toElementDescriptor: function(elementObject) {
+ var kind = String(elementObject.kind)
+ if (kind !== "method" && kind !== "field") {
+ throw new TypeError(
+ 'An element descriptor\'s .kind property must be either "method" or' +
+ ' "field", but a decorator created an element descriptor with' +
+ ' .kind "' +
+ kind +
+ '"'
+ )
+ }
+ var key = _toPropertyKey(elementObject.key)
+ var placement = String(elementObject.placement)
+ if (
+ placement !== "static" &&
+ placement !== "prototype" &&
+ placement !== "own"
+ ) {
+ throw new TypeError(
+ 'An element descriptor\'s .placement property must be one of "static",' +
+ ' "prototype" or "own", but a decorator created an element descriptor' +
+ ' with .placement "' +
+ placement +
+ '"'
+ )
+ }
+ var descriptor = elementObject.descriptor
+ this.disallowProperty(
+ elementObject,
+ "elements",
+ "An element descriptor"
+ )
+ var element = {
+ kind: kind,
+ key: key,
+ placement: placement,
+ descriptor: Object.assign({}, descriptor)
+ }
+ if (kind !== "field") {
+ this.disallowProperty(
+ elementObject,
+ "initializer",
+ "A method descriptor"
+ )
+ } else {
+ this.disallowProperty(
+ descriptor,
+ "get",
+ "The property descriptor of a field descriptor"
+ )
+ this.disallowProperty(
+ descriptor,
+ "set",
+ "The property descriptor of a field descriptor"
+ )
+ this.disallowProperty(
+ descriptor,
+ "value",
+ "The property descriptor of a field descriptor"
+ )
+ element.initializer = elementObject.initializer
+ }
+ return element
+ },
+ toElementFinisherExtras: function(elementObject) {
+ var element = this.toElementDescriptor(elementObject)
+ var finisher = _optionalCallableProperty(elementObject, "finisher")
+ var extras = this.toElementDescriptors(elementObject.extras)
+ return { element: element, finisher: finisher, extras: extras }
+ },
+ fromClassDescriptor: function(elements) {
+ var obj = {
+ kind: "class",
+ elements: elements.map(this.fromElementDescriptor, this)
+ }
+ var desc = { value: "Descriptor", configurable: true }
+ Object.defineProperty(obj, Symbol.toStringTag, desc)
+ return obj
+ },
+ toClassDescriptor: function(obj) {
+ var kind = String(obj.kind)
+ if (kind !== "class") {
+ throw new TypeError(
+ 'A class descriptor\'s .kind property must be "class", but a decorator' +
+ ' created a class descriptor with .kind "' +
+ kind +
+ '"'
+ )
+ }
+ this.disallowProperty(obj, "key", "A class descriptor")
+ this.disallowProperty(obj, "placement", "A class descriptor")
+ this.disallowProperty(obj, "descriptor", "A class descriptor")
+ this.disallowProperty(obj, "initializer", "A class descriptor")
+ this.disallowProperty(obj, "extras", "A class descriptor")
+ var finisher = _optionalCallableProperty(obj, "finisher")
+ var elements = this.toElementDescriptors(obj.elements)
+ return { elements: elements, finisher: finisher }
+ },
+ runClassFinishers: function(constructor, finishers) {
+ for (var i = 0; i < finishers.length; i++) {
+ var newConstructor = (0, finishers[i])(constructor)
+ if (newConstructor !== undefined) {
+ if (typeof newConstructor !== "function") {
+ throw new TypeError(
+ "Finishers must return a constructor."
+ )
+ }
+ constructor = newConstructor
+ }
+ }
+ return constructor
+ },
+ disallowProperty: function(obj, name, objectType) {
+ if (obj[name] !== undefined) {
+ throw new TypeError(
+ objectType + " can't have a ." + name + " property."
+ )
+ }
+ }
+ }
+ return api
+}
+
+function _createElementDescriptor(def) {
+ var key = _toPropertyKey(def.key)
+ var descriptor
+ if (def.kind === "method") {
+ descriptor = {
+ value: def.value,
+ writable: true,
+ configurable: true,
+ enumerable: false
+ }
+ } else if (def.kind === "get") {
+ descriptor = { get: def.value, configurable: true, enumerable: false }
+ } else if (def.kind === "set") {
+ descriptor = { set: def.value, configurable: true, enumerable: false }
+ } else if (def.kind === "field") {
+ descriptor = { configurable: true, writable: true, enumerable: true }
+ }
+ var element = {
+ kind: def.kind === "field" ? "field" : "method",
+ key: key,
+ placement: def.static
+ ? "static"
+ : def.kind === "field"
+ ? "own"
+ : "prototype",
+ descriptor: descriptor
+ }
+ if (def.decorators) element.decorators = def.decorators
+ if (def.kind === "field") element.initializer = def.value
+ return element
+}
+
+function _coalesceGetterSetter(element, other) {
+ if (element.descriptor.get !== undefined) {
+ other.descriptor.get = element.descriptor.get
+ } else {
+ other.descriptor.set = element.descriptor.set
+ }
+}
+
+function _coalesceClassElements(elements) {
+ var newElements = []
+ var isSameElement = function(other) {
+ return (
+ other.kind === "method" &&
+ other.key === element.key &&
+ other.placement === element.placement
+ )
+ }
+ for (var i = 0; i < elements.length; i++) {
+ var element = elements[i]
+ var other
+ if (
+ element.kind === "method" &&
+ (other = newElements.find(isSameElement))
+ ) {
+ if (
+ _isDataDescriptor(element.descriptor) ||
+ _isDataDescriptor(other.descriptor)
+ ) {
+ if (_hasDecorators(element) || _hasDecorators(other)) {
+ throw new ReferenceError(
+ "Duplicated methods (" +
+ element.key +
+ ") can't be decorated."
+ )
+ }
+ other.descriptor = element.descriptor
+ } else {
+ if (_hasDecorators(element)) {
+ if (_hasDecorators(other)) {
+ throw new ReferenceError(
+ "Decorators can't be placed on different accessors with for " +
+ "the same property (" +
+ element.key +
+ ")."
+ )
+ }
+ other.decorators = element.decorators
+ }
+ _coalesceGetterSetter(element, other)
+ }
+ } else {
+ newElements.push(element)
+ }
+ }
+ return newElements
+}
+
+function _hasDecorators(element) {
+ return element.decorators && element.decorators.length
+}
+
+function _isDataDescriptor(desc) {
+ return (
+ desc !== undefined &&
+ !(desc.value === undefined && desc.writable === undefined)
+ )
+}
+
+function _optionalCallableProperty(obj, name) {
+ var value = obj[name]
+ if (value !== undefined && typeof value !== "function") {
+ throw new TypeError("Expected '" + name + "' to be a function")
+ }
+ return value
+}
+
+function _toPropertyKey(arg) {
+ var key = _toPrimitive(arg, "string")
+ return typeof key === "symbol" ? key : String(key)
+}
+
+function _toPrimitive(input, hint) {
+ if (typeof input !== "object" || input === null) return input
+ var prim = input[Symbol.toPrimitive]
+ if (prim !== undefined) {
+ var res = prim.call(input, hint || "default")
+ if (typeof res !== "object") return res
+ throw new TypeError("@@toPrimitive must return a primitive value.")
+ }
+ return (hint === "string" ? String : Number)(input)
+}
+
+function _toArray(arr) {
+ return _arrayWithHoles(arr) || _iterableToArray(arr) || _nonIterableRest()
+}
+
+function _nonIterableRest() {
+ throw new TypeError("Invalid attempt to destructure non-iterable instance")
+}
+
+function _iterableToArray(iter) {
+ if (
+ Symbol.iterator in Object(iter) ||
+ Object.prototype.toString.call(iter) === "[object Arguments]"
+ )
+ return Array.from(iter)
+}
+
+function _arrayWithHoles(arr) {
+ if (Array.isArray(arr)) return arr
+}
+
import regeneratorRuntime from "@areslabs/wx-react/regeneratorRuntime"
import React, { Component, h } from "@areslabs/wx-react"
import PropTypes from "@areslabs/wx-prop-types"
@@ -38,6 +495,7 @@ import MyForceUpdate from "./MyForceUpdate.comp"
import Hi from "@areslabs/hi-wx"
import Hello from "@areslabs/hello-wx/index.comp"
import { history } from "@areslabs/wx-router"
+import decoratorTest from "./decoratorTest"
const item3 = h(
"view",
{
@@ -62,478 +520,594 @@ const item3 = h(
"item3"
)
)
-export default class A extends Component {
- static wxNavigationOptions = {
- navigationBarTitleText: "WX A"
- }
- static navigationOptions = {
- title: "RN A"
- }
- static childContextTypes = {
- color: PropTypes.string
- }
- static defaultProps = {
- name: "yk"
- }
-
- getChildContext() {
- return {
- color: "purple"
- }
- }
-
- componentWillMount() {
- console.log("A componentWillMount:")
- this.f().then(x => {
- console.log("ASYNC OKOK")
- })
- }
-
- async f() {
- return await 1
- }
- componentDidFocus() {
- console.log("A componentDidFocus")
- }
+let A = _decorate(
+ null,
+ function(_initialize, _Component) {
+ class A extends _Component {
+ constructor(...args) {
+ super(...args)
- componentWillUnfocus() {
- console.log("A componentWillUnfocus")
- }
+ _initialize(this)
+ }
+ }
- componentDidMount() {
- console.log("A componentDidMount:", Platform.OS)
- }
+ return {
+ F: A,
+ d: [
+ {
+ kind: "field",
+ static: true,
+ key: "wxNavigationOptions",
- componentDidUpdate() {
- console.log("A componentDidUpdate:")
- }
+ value() {
+ return {
+ navigationBarTitleText: "WX A"
+ }
+ }
+ },
+ {
+ kind: "field",
+ static: true,
+ key: "navigationOptions",
- state = {
- toggleClicked1: false,
- arr: ["arr1", "arr2", "arr3"],
- user: {
- name: "kk",
- age: 18
- },
- hasZ: false
- }
+ value() {
+ return {
+ title: "RN A"
+ }
+ }
+ },
+ {
+ kind: "field",
+ static: true,
+ key: "childContextTypes",
- getText1() {
- return null
- }
+ value() {
+ return {
+ color: PropTypes.string
+ }
+ }
+ },
+ {
+ kind: "field",
+ static: true,
+ key: "defaultProps",
- getText2(hello) {
- return h(
- "view",
- {
- style: styles.item,
- original: "View",
- diuu: "DIUU00004",
- tempName: "ITNP00006"
- },
- h(
- "view",
+ value() {
+ return {
+ name: "yk"
+ }
+ }
+ },
{
- style: styles.itemText,
- original: "OuterText",
- diuu: "DIUU00005"
+ kind: "method",
+ key: "getChildContext",
+ value: function getChildContext() {
+ return {
+ color: "purple"
+ }
+ }
},
- h("template", {
- datakey: "CTDK00004",
- tempVnode: hello,
- "wx:if": "{{CTDK00004}}",
- is: "CTNP00003",
- data: "{{...CTDK00004}}"
- })
- )
- )
- }
-
- handleIncre = () => {
- this.mrc.increCount()
- }
- item2 = h(
- "view",
- {
- style: styles.item,
- original: "View",
- diuu: "DIUU00007",
- tempName: "ITNP00009"
- },
- h(
- "view",
- {
- style: styles.itemText,
- original: "OuterText",
- diuu: "DIUU00008"
- },
- "item2"
- )
- )
-
- render() {
- const { toggleClicked1, arr, user, count } = this.state
- const item1 = h(
- "view",
- {
- style: styles.item,
- original: "View",
- diuu: "DIUU00010",
- tempName: "ITNP00012"
- },
- h(
- "view",
{
- style: styles.itemText,
- original: "OuterText",
- diuu: "DIUU00011"
+ kind: "method",
+ key: "componentWillMount",
+ value: function componentWillMount() {
+ console.log("A componentWillMount:")
+ this.f().then(x => {
+ console.log("ASYNC OKOK")
+ })
+ }
},
- "item1"
- )
- )
- return h(
- WXScrollView,
- {
- style: {
- flex: 1
+ {
+ kind: "method",
+ decorators: [decoratorTest],
+ key: "decoratorFunc",
+ value: function decoratorFunc() {
+ console.log("decoratorFunc")
+ }
},
- contentContainerStyle: {
- backgroundColor: "#fff"
+ {
+ kind: "method",
+ key: "f",
+ value: async function f() {
+ return await 1
+ }
},
- diuu: "DIUU00013",
- tempName: "ITNP00054"
- },
- h(
- "view",
{
- style: styles.button,
- original: "View",
- diuu: "DIUU00014"
+ kind: "method",
+ key: "componentDidFocus",
+ value: function componentDidFocus() {
+ console.log("A componentDidFocus")
+ }
+ },
+ {
+ kind: "method",
+ key: "componentWillUnfocus",
+ value: function componentWillUnfocus() {
+ console.log("A componentWillUnfocus")
+ }
},
- h(WXButton, {
- color: "#fff",
- title: "PUSH C PAGE",
- onPress: () => {
- history.push("", "C", {
- text: "Alita"
- })
- },
- diuu: "DIUU00015"
- })
- ),
- h(
- "view",
{
- style: styles.item,
- original: "View",
- diuu: "DIUU00016"
+ kind: "method",
+ key: "componentDidMount",
+ value: function componentDidMount() {
+ console.log("A componentDidMount:", Platform.OS)
+ this.decoratorFunc()
+ }
},
- h(
- "view",
- {
- style: {
- fontSize: 16,
- color: "rgb(24, 144, 255)"
- },
- original: "OuterText",
- diuu: "DIUU00017"
- },
- "Platform: ",
- h("template", {
- datakey: "CTDK00013",
- tempVnode: Platform.OS,
- "wx:if": "{{CTDK00013}}",
- is: "CTNP00012",
- data: "{{...CTDK00013}}"
- })
- )
- ),
- h(PlatformComp, {
- style: styles.item,
- diuu: "DIUU00018"
- }),
- h("template", {
- datakey: "CTDK00037",
- tempVnode: item1,
- "wx:if": "{{CTDK00037}}",
- is: "CTNP00036",
- data: "{{...CTDK00037}}"
- }),
- h("template", {
- datakey: "CTDK00038",
- tempVnode: this.item2,
- "wx:if": "{{CTDK00038}}",
- is: "CTNP00036",
- data: "{{...CTDK00038}}"
- }),
- h("template", {
- datakey: "CTDK00039",
- tempVnode: item3,
- "wx:if": "{{CTDK00039}}",
- is: "CTNP00036",
- data: "{{...CTDK00039}}"
- }),
- h(
- "view",
{
- style: styles.button,
- original: "View",
- diuu: "DIUU00019"
+ kind: "method",
+ key: "componentDidUpdate",
+ value: function componentDidUpdate() {
+ console.log("A componentDidUpdate:")
+ }
},
- h(WXButton, {
- title: "CLICK ME",
- color: "#fff",
- onPress: () => {
- this.setState({
- toggleClicked1: !toggleClicked1
- })
- },
- diuu: "DIUU00020"
- })
- ),
- h("template", {
- datakey: "CTDK00040",
- tempVnode:
- toggleClicked1 &&
- h(
- "view",
- {
- style: styles.item,
- original: "View",
- diuu: "DIUU00021",
- tempName: "ITNP00023"
- },
- h(
+ {
+ kind: "field",
+ key: "state",
+
+ value() {
+ return {
+ toggleClicked1: false,
+ arr: ["arr1", "arr2", "arr3"],
+ user: {
+ name: "kk",
+ age: 18
+ },
+ hasZ: false
+ }
+ }
+ },
+ {
+ kind: "method",
+ key: "getText1",
+ value: function getText1() {
+ return null
+ }
+ },
+ {
+ kind: "method",
+ key: "getText2",
+ value: function getText2(hello) {
+ return h(
"view",
{
- style: styles.itemText,
- original: "OuterText",
- diuu: "DIUU00022"
+ style: styles.item,
+ original: "View",
+ diuu: "DIUU00004",
+ tempName: "ITNP00006"
},
- "clicked is true"
+ h(
+ "view",
+ {
+ style: styles.itemText,
+ original: "OuterText",
+ diuu: "DIUU00005"
+ },
+ h("template", {
+ datakey: "CTDK00004",
+ tempVnode: hello,
+ "wx:if": "{{CTDK00004}}",
+ is: "CTNP00003",
+ data: "{{...CTDK00004}}"
+ })
+ )
)
- ),
- "wx:if": "{{CTDK00040}}",
- is: "CTNP00036",
- data: "{{...CTDK00040}}"
- }),
- h("template", {
- datakey: "CTDK00041",
- tempVnode: this.getText1(),
- "wx:if": "{{CTDK00041}}",
- is: "CTNP00036",
- data: "{{...CTDK00041}}"
- }),
- h("template", {
- datakey: "CTDK00042",
- tempVnode: this.getText2("function返回JSX"),
- "wx:if": "{{CTDK00042}}",
- is: "CTNP00036",
- data: "{{...CTDK00042}}"
- }),
- h(
- "view",
+ }
+ },
{
- style: styles.item,
- original: "View",
- diuu: "DIUU00024"
+ kind: "field",
+ key: "handleIncre",
+
+ value() {
+ return () => {
+ this.mrc.increCount()
+ }
+ }
},
- h("template", {
- datakey: "CTDK00022",
- tempVnode: arr.map(ele =>
- h(
+ {
+ kind: "field",
+ key: "item2",
+
+ value() {
+ return h(
"view",
{
- style: styles.itemText,
- key: ele,
- original: "OuterText",
- diuu: "DIUU00025",
- tempName: "ITNP00026"
+ style: styles.item,
+ original: "View",
+ diuu: "DIUU00007",
+ tempName: "ITNP00009"
},
- h("template", {
- datakey: "CTDK00020",
- tempVnode: ele,
- "wx:if": "{{CTDK00020}}",
- is: "CTNP00019",
- data: "{{...CTDK00020}}"
- }),
- ","
+ h(
+ "view",
+ {
+ style: styles.itemText,
+ original: "OuterText",
+ diuu: "DIUU00008"
+ },
+ "item2"
+ )
)
- ),
- "wx:if": "{{CTDK00022}}",
- is: "CTNP00021",
- data: "{{...CTDK00022}}"
- })
- ),
- h(
- MyContext,
- _extends({}, user, {
- diuu: "DIUU00027"
- })
- ),
- h(
- "view",
- {
- style: styles.button,
- original: "View",
- diuu: "DIUU00028"
+ }
},
- h(WXButton, {
- title: "Add One",
- color: "#fff",
- onPress: this.handleIncre,
- diuu: "DIUU00029"
- })
- ),
- h(MyRefComp, {
- ref: mrc => (this.mrc = mrc),
- diuu: "DIUU00030"
- }),
- h(MyPropComp, {
- headerComponent: h(
- "view",
- {
- style: styles.item,
- original: "View",
- diuu: "DIUU00031",
- tempName: "ITNP00033"
- },
- h(
- "view",
- {
- style: styles.itemText,
- original: "OuterText",
- diuu: "DIUU00032"
- },
- "header"
- )
- ),
- footerComponent: () => {
- return h(
- "view",
- {
- style: styles.item,
- original: "View",
- diuu: "DIUU00034",
- tempName: "ITNP00036"
- },
- h(
+ {
+ kind: "method",
+ key: "render",
+ value: function render() {
+ const { toggleClicked1, arr, user, count } = this.state
+ const item1 = h(
"view",
{
- style: styles.itemText,
- original: "OuterText",
- diuu: "DIUU00035"
+ style: styles.item,
+ original: "View",
+ diuu: "DIUU00010",
+ tempName: "ITNP00012"
},
- "footer"
+ h(
+ "view",
+ {
+ style: styles.itemText,
+ original: "OuterText",
+ diuu: "DIUU00011"
+ },
+ "item1"
+ )
)
- )
+ return h(
+ WXScrollView,
+ {
+ style: {
+ flex: 1
+ },
+ contentContainerStyle: {
+ backgroundColor: "#fff"
+ },
+ diuu: "DIUU00013",
+ tempName: "ITNP00054"
+ },
+ h(
+ "view",
+ {
+ style: styles.button,
+ original: "View",
+ diuu: "DIUU00014"
+ },
+ h(WXButton, {
+ color: "#fff",
+ title: "PUSH C PAGE",
+ onPress: () => {
+ history.push("", "C", {
+ text: "Alita"
+ })
+ },
+ diuu: "DIUU00015"
+ })
+ ),
+ h(
+ "view",
+ {
+ style: styles.item,
+ original: "View",
+ diuu: "DIUU00016"
+ },
+ h(
+ "view",
+ {
+ style: {
+ fontSize: 16,
+ color: "rgb(24, 144, 255)"
+ },
+ original: "OuterText",
+ diuu: "DIUU00017"
+ },
+ "Platform: ",
+ h("template", {
+ datakey: "CTDK00013",
+ tempVnode: Platform.OS,
+ "wx:if": "{{CTDK00013}}",
+ is: "CTNP00012",
+ data: "{{...CTDK00013}}"
+ })
+ )
+ ),
+ h(PlatformComp, {
+ style: styles.item,
+ diuu: "DIUU00018"
+ }),
+ h("template", {
+ datakey: "CTDK00037",
+ tempVnode: item1,
+ "wx:if": "{{CTDK00037}}",
+ is: "CTNP00036",
+ data: "{{...CTDK00037}}"
+ }),
+ h("template", {
+ datakey: "CTDK00038",
+ tempVnode: this.item2,
+ "wx:if": "{{CTDK00038}}",
+ is: "CTNP00036",
+ data: "{{...CTDK00038}}"
+ }),
+ h("template", {
+ datakey: "CTDK00039",
+ tempVnode: item3,
+ "wx:if": "{{CTDK00039}}",
+ is: "CTNP00036",
+ data: "{{...CTDK00039}}"
+ }),
+ h(
+ "view",
+ {
+ style: styles.button,
+ original: "View",
+ diuu: "DIUU00019"
+ },
+ h(WXButton, {
+ title: "CLICK ME",
+ color: "#fff",
+ onPress: () => {
+ this.setState({
+ toggleClicked1: !toggleClicked1
+ })
+ },
+ diuu: "DIUU00020"
+ })
+ ),
+ h("template", {
+ datakey: "CTDK00040",
+ tempVnode:
+ toggleClicked1 &&
+ h(
+ "view",
+ {
+ style: styles.item,
+ original: "View",
+ diuu: "DIUU00021",
+ tempName: "ITNP00023"
+ },
+ h(
+ "view",
+ {
+ style: styles.itemText,
+ original: "OuterText",
+ diuu: "DIUU00022"
+ },
+ "clicked is true"
+ )
+ ),
+ "wx:if": "{{CTDK00040}}",
+ is: "CTNP00036",
+ data: "{{...CTDK00040}}"
+ }),
+ h("template", {
+ datakey: "CTDK00041",
+ tempVnode: this.getText1(),
+ "wx:if": "{{CTDK00041}}",
+ is: "CTNP00036",
+ data: "{{...CTDK00041}}"
+ }),
+ h("template", {
+ datakey: "CTDK00042",
+ tempVnode: this.getText2("function返回JSX"),
+ "wx:if": "{{CTDK00042}}",
+ is: "CTNP00036",
+ data: "{{...CTDK00042}}"
+ }),
+ h(
+ "view",
+ {
+ style: styles.item,
+ original: "View",
+ diuu: "DIUU00024"
+ },
+ h("template", {
+ datakey: "CTDK00022",
+ tempVnode: arr.map(ele =>
+ h(
+ "view",
+ {
+ style: styles.itemText,
+ key: ele,
+ original: "OuterText",
+ diuu: "DIUU00025",
+ tempName: "ITNP00026"
+ },
+ h("template", {
+ datakey: "CTDK00020",
+ tempVnode: ele,
+ "wx:if": "{{CTDK00020}}",
+ is: "CTNP00019",
+ data: "{{...CTDK00020}}"
+ }),
+ ","
+ )
+ ),
+ "wx:if": "{{CTDK00022}}",
+ is: "CTNP00021",
+ data: "{{...CTDK00022}}"
+ })
+ ),
+ h(
+ MyContext,
+ _extends({}, user, {
+ diuu: "DIUU00027"
+ })
+ ),
+ h(
+ "view",
+ {
+ style: styles.button,
+ original: "View",
+ diuu: "DIUU00028"
+ },
+ h(WXButton, {
+ title: "Add One",
+ color: "#fff",
+ onPress: this.handleIncre,
+ diuu: "DIUU00029"
+ })
+ ),
+ h(MyRefComp, {
+ ref: mrc => (this.mrc = mrc),
+ diuu: "DIUU00030"
+ }),
+ h(MyPropComp, {
+ headerComponent: h(
+ "view",
+ {
+ style: styles.item,
+ original: "View",
+ diuu: "DIUU00031",
+ tempName: "ITNP00033"
+ },
+ h(
+ "view",
+ {
+ style: styles.itemText,
+ original: "OuterText",
+ diuu: "DIUU00032"
+ },
+ "header"
+ )
+ ),
+ footerComponent: () => {
+ return h(
+ "view",
+ {
+ style: styles.item,
+ original: "View",
+ diuu: "DIUU00034",
+ tempName: "ITNP00036"
+ },
+ h(
+ "view",
+ {
+ style: styles.itemText,
+ original: "OuterText",
+ diuu: "DIUU00035"
+ },
+ "footer"
+ )
+ )
+ },
+ "generic:headerComponentCPT": "ICNPaaaaa",
+ "generic:footerComponentCPT": "ICNPaaaab",
+ diuu: "DIUU00037"
+ }),
+ h(
+ MyFunComp,
+ _extends({}, user, {
+ diuu: "DIUU00038"
+ })
+ ),
+ h(
+ MyChildComp,
+ {
+ "generic:childrenCPT": "ICNPaaaac",
+ diuu: "DIUU00039"
+ },
+ h(
+ "view",
+ {
+ style: styles.item,
+ original: "View",
+ diuu: "DIUU00040",
+ tempName: "ITNP00042"
+ },
+ h(
+ "view",
+ {
+ style: styles.itemText,
+ original: "OuterText",
+ diuu: "DIUU00041"
+ },
+ "a"
+ )
+ ),
+ h(
+ "view",
+ {
+ style: styles.item,
+ original: "View",
+ diuu: "DIUU00043",
+ tempName: "ITNP00045"
+ },
+ h(
+ "view",
+ {
+ style: styles.itemText,
+ original: "OuterText",
+ diuu: "DIUU00044"
+ },
+ "b"
+ )
+ ),
+ h(
+ "view",
+ {
+ style: [
+ styles.item,
+ {
+ borderBottomWidth: 0
+ }
+ ],
+ original: "View",
+ diuu: "DIUU00046",
+ tempName: "ITNP00048"
+ },
+ h(
+ "view",
+ {
+ style: styles.itemText,
+ original: "OuterText",
+ diuu: "DIUU00047"
+ },
+ "c"
+ )
+ )
+ ),
+ h(MyHoc, {
+ txt: "HOC",
+ diuu: "DIUU00049"
+ }),
+ h(MyStyleComp, {
+ diuu: "DIUU00050"
+ }),
+ h(MyForceUpdate, {
+ diuu: "DIUU00051"
+ }),
+ h(Hi, {
+ name: "Yvette",
+ style: styles.item,
+ textStyle: styles.itemText,
+ diuu: "DIUU00052"
+ }),
+ h(Hello, {
+ name: "y5g",
+ style: [
+ styles.item,
+ {
+ borderBottomWidth: 0
+ }
+ ],
+ textStyle: styles.itemText,
+ diuu: "DIUU00053"
+ })
+ )
+ }
},
- "generic:headerComponentCPT": "ICNPaaaaa",
- "generic:footerComponentCPT": "ICNPaaaab",
- diuu: "DIUU00037"
- }),
- h(
- MyFunComp,
- _extends({}, user, {
- diuu: "DIUU00038"
- })
- ),
- h(
- MyChildComp,
{
- "generic:childrenCPT": "ICNPaaaac",
- diuu: "DIUU00039"
- },
- h(
- "view",
- {
- style: styles.item,
- original: "View",
- diuu: "DIUU00040",
- tempName: "ITNP00042"
- },
- h(
- "view",
- {
- style: styles.itemText,
- original: "OuterText",
- diuu: "DIUU00041"
- },
- "a"
- )
- ),
- h(
- "view",
- {
- style: styles.item,
- original: "View",
- diuu: "DIUU00043",
- tempName: "ITNP00045"
- },
- h(
- "view",
- {
- style: styles.itemText,
- original: "OuterText",
- diuu: "DIUU00044"
- },
- "b"
- )
- ),
- h(
- "view",
- {
- style: [
- styles.item,
- {
- borderBottomWidth: 0
- }
- ],
- original: "View",
- diuu: "DIUU00046",
- tempName: "ITNP00048"
- },
- h(
- "view",
- {
- style: styles.itemText,
- original: "OuterText",
- diuu: "DIUU00047"
- },
- "c"
- )
- )
- ),
- h(MyHoc, {
- txt: "HOC",
- diuu: "DIUU00049"
- }),
- h(MyStyleComp, {
- diuu: "DIUU00050"
- }),
- h(MyForceUpdate, {
- diuu: "DIUU00051"
- }),
- h(Hi, {
- name: "Yvette",
- style: styles.item,
- textStyle: styles.itemText,
- diuu: "DIUU00052"
- }),
- h(Hello, {
- name: "y5g",
- style: [
- styles.item,
- {
- borderBottomWidth: 0
+ kind: "field",
+ key: "__stateless__",
+
+ value() {
+ return false
}
- ],
- textStyle: styles.itemText,
- diuu: "DIUU00053"
- })
- )
- }
+ }
+ ]
+ }
+ },
+ Component
+)
- __stateless__ = false
-}
+export { A as default }
diff --git a/examples/HelloWorldExpoWP/src/b/index.comp.js b/examples/HelloWorldExpoWP/src/b/index.comp.js
index 8c88e62..3dd2df6 100644
--- a/examples/HelloWorldExpoWP/src/b/index.comp.js
+++ b/examples/HelloWorldExpoWP/src/b/index.comp.js
@@ -1,3 +1,17 @@
+function _defineProperty(obj, key, value) {
+ if (key in obj) {
+ Object.defineProperty(obj, key, {
+ value: value,
+ enumerable: true,
+ configurable: true,
+ writable: true
+ })
+ } else {
+ obj[key] = value
+ }
+ return obj
+}
+
import React, { Component, h } from "@areslabs/wx-react"
import {
View,
@@ -14,83 +28,91 @@ import {
import styles from "../a/styles"
import base64Img from "./img"
export default class B extends Component {
- componentDidMount() {
- console.log("B componentDidMount:")
- }
+ constructor(...args) {
+ super(...args)
- state = {
- sv: true,
- users: [
- {
- name: parseInt(Math.random() * 10000000)
- },
- {
- name: parseInt(Math.random() * 10000000)
- },
- {
- name: parseInt(Math.random() * 10000000)
- },
- {
- name: parseInt(Math.random() * 10000000)
- }
- ],
- scrollList: [
- {
- id: 1,
- img: "/src/b/imgs/001.jpg"
- },
- {
- id: 2,
- img: "/src/b/imgs/002.jpg"
- },
- {
- id: 3,
- img: "/src/b/imgs/003.jpg"
- },
- {
- id: 4,
- img: "/src/b/imgs/004.jpg"
- },
- {
- id: 5,
- img: "/src/b/imgs/005.jpg"
- },
- {
- id: 6,
- img: "/src/b/imgs/006.jpg"
- }
- ],
- refreshing: false,
- value: "1"
- }
- renderItem = ({ item }) => {
- return h(
- "view",
- {
- style: styles.item,
- original: "View",
- diuu: "DIUU00001",
- tempName: "ITNP00003"
- },
- h(
+ _defineProperty(this, "state", {
+ sv: true,
+ users: [
+ {
+ name: parseInt(Math.random() * 10000000)
+ },
+ {
+ name: parseInt(Math.random() * 10000000)
+ },
+ {
+ name: parseInt(Math.random() * 10000000)
+ },
+ {
+ name: parseInt(Math.random() * 10000000)
+ }
+ ],
+ scrollList: [
+ {
+ id: 1,
+ img: "/src/b/imgs/001.jpg"
+ },
+ {
+ id: 2,
+ img: "/src/b/imgs/002.jpg"
+ },
+ {
+ id: 3,
+ img: "/src/b/imgs/003.jpg"
+ },
+ {
+ id: 4,
+ img: "/src/b/imgs/004.jpg"
+ },
+ {
+ id: 5,
+ img: "/src/b/imgs/005.jpg"
+ },
+ {
+ id: 6,
+ img: "/src/b/imgs/006.jpg"
+ }
+ ],
+ refreshing: false,
+ value: "1"
+ })
+
+ _defineProperty(this, "renderItem", ({ item }) => {
+ return h(
"view",
{
- style: styles.itemText,
- original: "OuterText",
- diuu: "DIUU00002"
+ style: styles.item,
+ original: "View",
+ diuu: "DIUU00001",
+ tempName: "ITNP00003"
},
- h("template", {
- datakey: "CTDK00002",
- tempVnode: item.name,
- "wx:if": "{{CTDK00002}}",
- is: "CTNP00001",
- data: "{{...CTDK00002}}"
- })
+ h(
+ "view",
+ {
+ style: styles.itemText,
+ original: "OuterText",
+ diuu: "DIUU00002"
+ },
+ h("template", {
+ datakey: "CTDK00002",
+ tempVnode: item.name,
+ "wx:if": "{{CTDK00002}}",
+ is: "CTNP00001",
+ data: "{{...CTDK00002}}"
+ })
+ )
)
- )
+ })
+
+ _defineProperty(this, "keyExtractor", item => {
+ return item.name + ""
+ })
+
+ _defineProperty(this, "__stateless__", false)
}
- keyExtractor = item => {
- return item.name + ""
+
+ componentDidMount() {
+ console.log("B componentDidMount:")
}
_onEndReached() {
@@ -449,6 +471,4 @@ export default class B extends Component {
)
)
}
-
- __stateless__ = false
}
diff --git a/examples/HelloWorldExpoWP/src/c/index.comp.js b/examples/HelloWorldExpoWP/src/c/index.comp.js
index 6298125..277bfea 100644
--- a/examples/HelloWorldExpoWP/src/c/index.comp.js
+++ b/examples/HelloWorldExpoWP/src/c/index.comp.js
@@ -1,8 +1,28 @@
+function _defineProperty(obj, key, value) {
+ if (key in obj) {
+ Object.defineProperty(obj, key, {
+ value: value,
+ enumerable: true,
+ configurable: true,
+ writable: true
+ })
+ } else {
+ obj[key] = value
+ }
+ return obj
+}
+
import React, { Component, h } from "@areslabs/wx-react"
import { Text, View, WXButton } from "@areslabs/wx-react-native"
import { history } from "@areslabs/wx-router"
import styles from "../a/styles"
export default class C extends Component {
+ constructor(...args) {
+ super(...args)
+
+ _defineProperty(this, "__stateless__", true)
+ }
+
render() {
return h(
"view",
@@ -103,6 +123,4 @@ export default class C extends Component {
)
)
}
-
- __stateless__ = true
}
diff --git a/examples/HelloWorldExpoWP/src/d/MyAni.comp.js b/examples/HelloWorldExpoWP/src/d/MyAni.comp.js
index 5de06ec..d8bcbdb 100644
--- a/examples/HelloWorldExpoWP/src/d/MyAni.comp.js
+++ b/examples/HelloWorldExpoWP/src/d/MyAni.comp.js
@@ -1,8 +1,28 @@
+function _defineProperty(obj, key, value) {
+ if (key in obj) {
+ Object.defineProperty(obj, key, {
+ value: value,
+ enumerable: true,
+ configurable: true,
+ writable: true
+ })
+ } else {
+ obj[key] = value
+ }
+ return obj
+}
+
import React, { Component, h } from "@areslabs/wx-react"
import { View, Image, Text } from "@areslabs/wx-react-native"
import { AnimationEnable } from "@areslabs/wx-animated"
class MyAni extends Component {
+ constructor(...args) {
+ super(...args)
+
+ _defineProperty(this, "__stateless__", true)
+ }
+
render() {
return h(
"block",
@@ -36,8 +56,6 @@ class MyAni extends Component {
)
)
}
-
- __stateless__ = true
}
export default AnimationEnable(MyAni)
diff --git a/examples/HelloWorldExpoWP/src/d/index.comp.js b/examples/HelloWorldExpoWP/src/d/index.comp.js
index 2b41f17..8abd0b8 100644
--- a/examples/HelloWorldExpoWP/src/d/index.comp.js
+++ b/examples/HelloWorldExpoWP/src/d/index.comp.js
@@ -1,3 +1,17 @@
+function _defineProperty(obj, key, value) {
+ if (key in obj) {
+ Object.defineProperty(obj, key, {
+ value: value,
+ enumerable: true,
+ configurable: true,
+ writable: true
+ })
+ } else {
+ obj[key] = value
+ }
+ return obj
+}
+
import React, { Component, h } from "@areslabs/wx-react"
import { StyleSheet, Text, View, Dimensions } from "@areslabs/wx-react-native"
import {
@@ -8,151 +22,163 @@ import {
const { width } = Dimensions.get("window")
import MyAni from "./MyAni.comp"
export default class C extends Component {
- state = {
- ani1: null,
- ani2: null,
- ani3: null,
- ani4: null,
- ani5: null,
- ani6: null,
- ani7: null,
- ani8: null
- }
-
- componentDidFocus() {
- console.log("C componentDidFocus")
- this.unfocus = false
- this.handleAni1()
- this.handleAni2()
- this.handleLoading1()
- this.handleLoading2()
- this.handleAni7()
- this.handleAni8()
- }
-
- componentWillUnfocus() {
- this.unfocus = true
- }
+ constructor(...args) {
+ super(...args)
- handleAni1 = () => {
- if (this.unfocus) return
- const ani = createAnimation({
- duration: 1000,
- timingFunction: "ease"
+ _defineProperty(this, "state", {
+ ani1: null,
+ ani2: null,
+ ani3: null,
+ ani4: null,
+ ani5: null,
+ ani6: null,
+ ani7: null,
+ ani8: null
})
- ani.opacity(0.5)
- .step()
- .opacity(1)
- .step()
- this.setState({
- ani1: ani.export(() => {
- this.handleAni1()
+
+ _defineProperty(this, "handleAni1", () => {
+ if (this.unfocus) return
+ const ani = createAnimation({
+ duration: 1000,
+ timingFunction: "ease"
})
- })
- }
- handleAni2 = () => {
- if (this.unfocus) return
- const ani = createAnimation({
- duration: 1500,
- timingFunction: "linear"
- })
- ani.translateX(width - 100)
- .rotateZ(180)
- .scale(0.5, 0.5)
- .step()
- .translateX(0)
- .rotateZ(0)
- .scale(1, 1)
- .step()
- console.log("handleAni2")
- this.setState({
- ani2: ani.export(() => {
- this.handleAni2()
+ ani.opacity(0.5)
+ .step()
+ .opacity(1)
+ .step()
+ this.setState({
+ ani1: ani.export(() => {
+ this.handleAni1()
+ })
})
})
- }
- count = 0
- handleLoading1 = () => {
- if (this.unfocus) return
- const ani = createAnimation({
- duration: 800,
- timingFunction: "linear"
- })
- ani.rotateZ(360 * this.count++).step()
- this.setState({
- ani3: ani.export(() => {
- this.handleLoading1()
+
+ _defineProperty(this, "handleAni2", () => {
+ if (this.unfocus) return
+ const ani = createAnimation({
+ duration: 1500,
+ timingFunction: "linear"
+ })
+ ani.translateX(width - 100)
+ .rotateZ(180)
+ .scale(0.5, 0.5)
+ .step()
+ .translateX(0)
+ .rotateZ(0)
+ .scale(1, 1)
+ .step()
+ console.log("handleAni2")
+ this.setState({
+ ani2: ani.export(() => {
+ this.handleAni2()
+ })
})
})
- }
- handleLoading2 = () => {
- if (this.unfocus) return
- const ani = createAnimation({
- duration: 150,
- timingFunction: "linear"
+
+ _defineProperty(this, "count", 0)
+
+ _defineProperty(this, "handleLoading1", () => {
+ if (this.unfocus) return
+ const ani = createAnimation({
+ duration: 800,
+ timingFunction: "linear"
+ })
+ ani.rotateZ(360 * this.count++).step()
+ this.setState({
+ ani3: ani.export(() => {
+ this.handleLoading1()
+ })
+ })
})
- ani.scale(1.5, 1.5)
- .step({
- delay: 0
+
+ _defineProperty(this, "handleLoading2", () => {
+ if (this.unfocus) return
+ const ani = createAnimation({
+ duration: 150,
+ timingFunction: "linear"
})
- .scale(1, 1)
- .step()
- const ani4 = ani.export()
- ani.scale(1.5, 1.5)
- .step({
- delay: 400
+ ani.scale(1.5, 1.5)
+ .step({
+ delay: 0
+ })
+ .scale(1, 1)
+ .step()
+ const ani4 = ani.export()
+ ani.scale(1.5, 1.5)
+ .step({
+ delay: 400
+ })
+ .scale(1, 1)
+ .step()
+ const ani5 = ani.export()
+ ani.scale(1.5, 1.5)
+ .step({
+ delay: 800
+ })
+ .scale(1, 1)
+ .step()
+ const ani6 = ani.export(() => {
+ this.handleLoading2()
})
- .scale(1, 1)
- .step()
- const ani5 = ani.export()
- ani.scale(1.5, 1.5)
- .step({
- delay: 800
+ this.setState({
+ ani4,
+ ani5,
+ ani6
})
- .scale(1, 1)
- .step()
- const ani6 = ani.export(() => {
- this.handleLoading2()
- })
- this.setState({
- ani4,
- ani5,
- ani6
- })
- }
- handleAni7 = () => {
- if (this.unfocus) return
- const ani = createAnimation({
- duration: 800,
- timingFunction: "ease"
})
- ani.scale(0, 0)
- .step()
- .scale(1, 1)
- .step()
- this.setState({
- ani7: ani.export(() => {
- this.handleAni7()
+
+ _defineProperty(this, "handleAni7", () => {
+ if (this.unfocus) return
+ const ani = createAnimation({
+ duration: 800,
+ timingFunction: "ease"
+ })
+ ani.scale(0, 0)
+ .step()
+ .scale(1, 1)
+ .step()
+ this.setState({
+ ani7: ani.export(() => {
+ this.handleAni7()
+ })
})
})
- }
- handleAni8 = () => {
- if (this.unfocus) return
- const ani = createAnimation({
- duration: 800,
- timingFunction: "ease"
- })
- ani.backgroundColor("#EEDC82").step()
- this.setState({
- ani8: ani.export(() => {
- ani.backgroundColor("#fff").step()
- this.setState({
- ani8: ani.export(() => {
- this.handleAni8()
+
+ _defineProperty(this, "handleAni8", () => {
+ if (this.unfocus) return
+ const ani = createAnimation({
+ duration: 800,
+ timingFunction: "ease"
+ })
+ ani.backgroundColor("#EEDC82").step()
+ this.setState({
+ ani8: ani.export(() => {
+ ani.backgroundColor("#fff").step()
+ this.setState({
+ ani8: ani.export(() => {
+ this.handleAni8()
+ })
})
})
})
})
+
+ _defineProperty(this, "__stateless__", false)
+ }
+
+ componentDidFocus() {
+ console.log("C componentDidFocus")
+ this.unfocus = false
+ this.handleAni1()
+ this.handleAni2()
+ this.handleLoading1()
+ this.handleLoading2()
+ this.handleAni7()
+ this.handleAni8()
+ }
+
+ componentWillUnfocus() {
+ this.unfocus = true
}
render() {
@@ -316,8 +342,6 @@ export default class C extends Component {
)
)
}
-
- __stateless__ = false
}
const styles = StyleSheet.create({
section: {
diff --git a/examples/HelloWorldExpoWP/src/e/index.comp.js b/examples/HelloWorldExpoWP/src/e/index.comp.js
index e6a16e5..6361270 100644
--- a/examples/HelloWorldExpoWP/src/e/index.comp.js
+++ b/examples/HelloWorldExpoWP/src/e/index.comp.js
@@ -1,7 +1,27 @@
+function _defineProperty(obj, key, value) {
+ if (key in obj) {
+ Object.defineProperty(obj, key, {
+ value: value,
+ enumerable: true,
+ configurable: true,
+ writable: true
+ })
+ } else {
+ obj[key] = value
+ }
+ return obj
+}
+
import React, { Component, h } from "@areslabs/wx-react"
import { Text, View, WXButton } from "@areslabs/wx-react-native"
import { history } from "@areslabs/wx-router"
export default class C extends Component {
+ constructor(...args) {
+ super(...args)
+
+ _defineProperty(this, "__stateless__", true)
+ }
+
getPush() {
return h(
"view",
@@ -111,6 +131,4 @@ export default class C extends Component {
})
)
}
-
- __stateless__ = true
}
diff --git a/examples/HelloWorldExpoWP/src/index.js b/examples/HelloWorldExpoWP/src/index.js
index 829e086..fd7bc1b 100644
--- a/examples/HelloWorldExpoWP/src/index.js
+++ b/examples/HelloWorldExpoWP/src/index.js
@@ -1,13 +1,11 @@
+var _class, _temp;
+
+function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
+
import React, { PureComponent, h } from "@areslabs/wx-react";
import PropTypes from "@areslabs/wx-prop-types";
import { Router, Route, TabRouter } from "@areslabs/wx-router";
-const RNAppClass = class App extends PureComponent {
- static childContextTypes = {
- txt: PropTypes.string,
- test: PropTypes.string,
- store: PropTypes.object
- };
-
+const RNAppClass = (_temp = _class = class App extends PureComponent {
getChildContext() {
return {
txt: '6666',
@@ -15,8 +13,47 @@ const RNAppClass = class App extends PureComponent {
};
}
+ render() {
+ return h(Router, {
+ navigationOptions: {
+ title: 'HelloWorld'
+ },
+ diuu: "DIUU00001"
+ }, h(TabRouter, {
+ diuu: "DIUU00002"
+ }, h(Route, {
+ diuu: "DIUU00003"
+ }), h(Route, {
+ diuu: "DIUU00004"
+ }), h(Route, {
+ diuu: "DIUU00005"
+ })), h(TabRouter, {
+ diuu: "DIUU00006"
+ }, h(Route, {
+ diuu: "DIUU00007"
+ })), h(TabRouter, {
+ diuu: "DIUU00008"
+ }, h(Route, {
+ diuu: "DIUU00009"
+ })));
+ }
+
+}, _defineProperty(_class, "childContextTypes", {
+ txt: PropTypes.string,
+ test: PropTypes.string,
+ store: PropTypes.object
+}), _temp);
+React.render(h(RNAppClass, {
+ diuu: React.rootUuid
+}), null, {});
+const rootContext = React.getRootContext();
+export default {
+ childContext: rootContext
};
-const RNApp = new RNAppClass({});
-RNApp.childContext = RNApp.getChildContext ? RNApp.getChildContext() : {};
-export default RNApp;
-wx._historyConfig = {...(wx._historyConfig || {}), ...{"A":"/src/a/index","C":"/src/c/index","E":"/src/e/index","B":"/src/b/index","D":"/src/d/index"}};
\ No newline at end of file
+wx._historyConfig = Object.assign({}, wx._historyConfig || {}, {
+ "A": "/src/a/index",
+ "C": "/src/c/index",
+ "E": "/src/e/index",
+ "B": "/src/b/index",
+ "D": "/src/d/index"
+});
\ No newline at end of file
diff --git a/examples/ReactReposWP/RNApp.js b/examples/ReactReposWP/RNApp.js
index 60b4a8d..062becd 100644
--- a/examples/ReactReposWP/RNApp.js
+++ b/examples/ReactReposWP/RNApp.js
@@ -1,7 +1,25 @@
import React, { Component, h } from "@areslabs/wx-react";
import { Router, Route } from "@areslabs/wx-router";
-const RNAppClass = class App extends Component {};
-const RNApp = new RNAppClass({});
-RNApp.childContext = RNApp.getChildContext ? RNApp.getChildContext() : {};
-export default RNApp;
-wx._historyConfig = {...(wx._historyConfig || {}), ...{"ReactReposlist":"/src/components/list/index","ReactReposdetail":"/src/components/detail/index"}};
\ No newline at end of file
+const RNAppClass = class App extends Component {
+ render() {
+ return h(Router, {
+ diuu: "DIUU00001"
+ }, h(Route, {
+ diuu: "DIUU00002"
+ }), h(Route, {
+ diuu: "DIUU00003"
+ }));
+ }
+
+};
+React.render(h(RNAppClass, {
+ diuu: React.rootUuid
+}), null, {});
+const rootContext = React.getRootContext();
+export default {
+ childContext: rootContext
+};
+wx._historyConfig = Object.assign({}, wx._historyConfig || {}, {
+ "ReactReposlist": "/src/components/list/index",
+ "ReactReposdetail": "/src/components/detail/index"
+});
\ No newline at end of file
diff --git a/examples/ReactReposWP/package.json b/examples/ReactReposWP/package.json
index 0fbe505..fbebbf3 100644
--- a/examples/ReactReposWP/package.json
+++ b/examples/ReactReposWP/package.json
@@ -2,9 +2,9 @@
"name": "ReactRepos",
"version": "0.0.1",
"dependencies": {
- "@areslabs/wx-router": "^1.0.0",
+ "@areslabs/wx-router": "beta",
"@areslabs/wx-animated": "^1.0.3",
- "@areslabs/wx-react": "^1.0.0",
+ "@areslabs/wx-react": "beta",
"@areslabs/wx-react-native": "^1.0.0"
}
-}
\ No newline at end of file
+}
diff --git a/examples/ReactReposWP/project.config.json b/examples/ReactReposWP/project.config.json
index 41b2ebc..8d57045 100644
--- a/examples/ReactReposWP/project.config.json
+++ b/examples/ReactReposWP/project.config.json
@@ -14,7 +14,7 @@
"compileType": "miniprogram",
"libVersion": "2.2.2",
"appid": "wx67a52214b440b81b",
- "projectname": "RRWP",
+ "projectname": "tmptmp",
"isGameTourist": false,
"condition": {
"search": {
diff --git a/examples/ReactReposWP/src/components/detail/SecBody.comp.js b/examples/ReactReposWP/src/components/detail/SecBody.comp.js
index 23bc36c..edfb780 100644
--- a/examples/ReactReposWP/src/components/detail/SecBody.comp.js
+++ b/examples/ReactReposWP/src/components/detail/SecBody.comp.js
@@ -1,3 +1,17 @@
+function _defineProperty(obj, key, value) {
+ if (key in obj) {
+ Object.defineProperty(obj, key, {
+ value: value,
+ enumerable: true,
+ configurable: true,
+ writable: true
+ })
+ } else {
+ obj[key] = value
+ }
+ return obj
+}
+
import { fetch } from "@areslabs/wx-react-native/index"
import React, { Component, h } from "@areslabs/wx-react"
import { View, Image } from "@areslabs/wx-react-native"
@@ -5,8 +19,14 @@ import { AnimationEnable } from "@areslabs/wx-animated"
import { token } from "../../util/index"
class SecBody extends Component {
- state = {
- users: []
+ constructor(...args) {
+ super(...args)
+
+ _defineProperty(this, "state", {
+ users: []
+ })
+
+ _defineProperty(this, "__stateless__", false)
}
componentDidMount() {
@@ -49,7 +69,7 @@ class SecBody extends Component {
height: 70,
marginLeft: 5
},
- mode: "cover",
+ mode: "aspectFill",
diuu: "DIUU00002",
tempName: "ITNP00003"
})
@@ -60,8 +80,6 @@ class SecBody extends Component {
})
)
}
-
- __stateless__ = false
}
export default AnimationEnable(SecBody)
diff --git a/examples/ReactReposWP/src/components/detail/SecBodyTemplate.wxml b/examples/ReactReposWP/src/components/detail/SecBodyTemplate.wxml
index 6f18605..d13908f 100644
--- a/examples/ReactReposWP/src/components/detail/SecBodyTemplate.wxml
+++ b/examples/ReactReposWP/src/components/detail/SecBodyTemplate.wxml
@@ -18,7 +18,7 @@
-
+
diff --git a/examples/ReactReposWP/src/components/detail/index.comp.js b/examples/ReactReposWP/src/components/detail/index.comp.js
index 78a41d5..4a72ccf 100644
--- a/examples/ReactReposWP/src/components/detail/index.comp.js
+++ b/examples/ReactReposWP/src/components/detail/index.comp.js
@@ -1,3 +1,17 @@
+function _defineProperty(obj, key, value) {
+ if (key in obj) {
+ Object.defineProperty(obj, key, {
+ value: value,
+ enumerable: true,
+ configurable: true,
+ writable: true
+ })
+ } else {
+ obj[key] = value
+ }
+ return obj
+}
+
import React, { Component, h } from "@areslabs/wx-react"
import {
StyleSheet,
@@ -12,6 +26,9 @@ const down = "/src/assets/arrow_down.png"
export default class Detail extends Component {
constructor(props) {
super(props)
+
+ _defineProperty(this, "__stateless__", false)
+
const {
stargazers_url,
contributors_url,
@@ -71,7 +88,7 @@ export default class Detail extends Component {
src: {
uri: owner.avatar_url
},
- mode: "cover",
+ mode: "aspectFill",
diuu: "DIUU00003"
}),
h(
@@ -152,7 +169,7 @@ export default class Detail extends Component {
width: 15
},
src: down,
- mode: "cover",
+ mode: "aspectFill",
diuu: "DIUU00008"
})
),
@@ -170,8 +187,6 @@ export default class Detail extends Component {
})
)
}
-
- __stateless__ = false
}
const styles = StyleSheet.create({
sections: {
diff --git a/examples/ReactReposWP/src/components/detail/indexTemplate.wxml b/examples/ReactReposWP/src/components/detail/indexTemplate.wxml
index e7f3f47..b1f4819 100644
--- a/examples/ReactReposWP/src/components/detail/indexTemplate.wxml
+++ b/examples/ReactReposWP/src/components/detail/indexTemplate.wxml
@@ -53,7 +53,7 @@
-
+
@@ -62,7 +62,7 @@
-
+
diff --git a/examples/ReactReposWP/src/components/list/LoadingView.comp.js b/examples/ReactReposWP/src/components/list/LoadingView.comp.js
index 9ea9948..b90bb59 100644
--- a/examples/ReactReposWP/src/components/list/LoadingView.comp.js
+++ b/examples/ReactReposWP/src/components/list/LoadingView.comp.js
@@ -1,6 +1,26 @@
+function _defineProperty(obj, key, value) {
+ if (key in obj) {
+ Object.defineProperty(obj, key, {
+ value: value,
+ enumerable: true,
+ configurable: true,
+ writable: true
+ })
+ } else {
+ obj[key] = value
+ }
+ return obj
+}
+
import React, { Component, h } from "@areslabs/wx-react"
import { StyleSheet, Text, View } from "@areslabs/wx-react-native"
export default class LoadingView extends Component {
+ constructor(...args) {
+ super(...args)
+
+ _defineProperty(this, "__stateless__", true)
+ }
+
render() {
return h(
"block",
@@ -20,8 +40,6 @@ export default class LoadingView extends Component {
)
)
}
-
- __stateless__ = true
}
const styles = StyleSheet.create({
loading: {
diff --git a/examples/ReactReposWP/src/components/list/index.comp.js b/examples/ReactReposWP/src/components/list/index.comp.js
index 4456e12..ee681ec 100644
--- a/examples/ReactReposWP/src/components/list/index.comp.js
+++ b/examples/ReactReposWP/src/components/list/index.comp.js
@@ -1,3 +1,17 @@
+function _defineProperty(obj, key, value) {
+ if (key in obj) {
+ Object.defineProperty(obj, key, {
+ value: value,
+ enumerable: true,
+ configurable: true,
+ writable: true
+ })
+ } else {
+ obj[key] = value
+ }
+ return obj
+}
+
import React, { Component, h } from "@areslabs/wx-react"
import {
StyleSheet,
@@ -14,193 +28,201 @@ import { formatK, token, fetchRepos } from "../../util/index"
const { width } = Dimensions.get("window")
const reposUrl = `https://api.github.com/search/repositories?q=react&sort=stars&per_page=20&access_token=${token}`
export default class List extends Component {
- static navigationOptions = {
- title: "ReactRepos"
- }
- static wxNavigationOptions = {
- navigationBarTitleText: "ReactRepos"
- }
- state = {
- repos: [],
- refreshing: false
- }
- page = 1
- getReposUrl = (page = 1) => {
- return `${reposUrl}&page=${page}`
- }
+ constructor(...args) {
+ super(...args)
- componentDidMount() {
- fetchRepos(this.page, 20).then(res => {
- this.setState({
- repos: res.items
- })
+ _defineProperty(this, "state", {
+ repos: [],
+ refreshing: false
})
- }
- renderItem = ({ item }) => {
- return h(
- "view",
- {
- style: styles.itemOut,
- onPress: () => {
- history.push("ReactRepos", "detail", item)
- },
- original: "TouchableOpacity",
- diuu: "DIUU00001",
- tempName: "ITNP00011"
- },
- h("image", {
- style: styles.picStyle,
- src: {
- uri: item.owner.avatar_url
- },
- mode: "cover",
- diuu: "DIUU00002"
- }),
- h(
+ _defineProperty(this, "page", 1)
+
+ _defineProperty(this, "getReposUrl", (page = 1) => {
+ return `${reposUrl}&page=${page}`
+ })
+
+ _defineProperty(this, "renderItem", ({ item }) => {
+ return h(
"view",
{
- style: {
- flex: 1
+ style: styles.itemOut,
+ onPress: () => {
+ history.push("ReactRepos", "detail", item)
},
- original: "View",
- diuu: "DIUU00003"
+ original: "TouchableOpacity",
+ diuu: "DIUU00001",
+ tempName: "ITNP00011"
},
+ h("image", {
+ style: styles.picStyle,
+ src: {
+ uri: item.owner.avatar_url
+ },
+ mode: "aspectFill",
+ diuu: "DIUU00002"
+ }),
h(
"view",
{
- style: styles.intro,
+ style: {
+ flex: 1
+ },
original: "View",
- diuu: "DIUU00004"
+ diuu: "DIUU00003"
},
h(
"view",
{
- numberOfLines: 1,
- style: styles.name,
- original: "OuterText",
- diuu: "DIUU00005"
- },
- h("template", {
- datakey: "CTDK00003",
- tempVnode: item.name,
- "wx:if": "{{CTDK00003}}",
- is: "CTNP00002",
- data: "{{...CTDK00003}}"
- })
- ),
- h(
- "view",
- {
- style: styles.star,
+ style: styles.intro,
original: "View",
- diuu: "DIUU00006"
+ diuu: "DIUU00004"
},
- h("image", {
- style: {
- height: 15,
- width: 15
- },
- src: "/src/assets/stars.jpg",
- mode: "cover",
- diuu: "DIUU00007"
- }),
h(
"view",
{
+ numberOfLines: 1,
+ style: styles.name,
original: "OuterText",
- diuu: "DIUU00008"
+ diuu: "DIUU00005"
},
h("template", {
- datakey: "CTDK00006",
- tempVnode: formatK(item.watchers),
- "wx:if": "{{CTDK00006}}",
- is: "CTNP00005",
- data: "{{...CTDK00006}}"
+ datakey: "CTDK00003",
+ tempVnode: item.name,
+ "wx:if": "{{CTDK00003}}",
+ is: "CTNP00002",
+ data: "{{...CTDK00003}}"
})
+ ),
+ h(
+ "view",
+ {
+ style: styles.star,
+ original: "View",
+ diuu: "DIUU00006"
+ },
+ h("image", {
+ style: {
+ height: 15,
+ width: 15
+ },
+ src: "/src/assets/stars.jpg",
+ mode: "aspectFill",
+ diuu: "DIUU00007"
+ }),
+ h(
+ "view",
+ {
+ original: "OuterText",
+ diuu: "DIUU00008"
+ },
+ h("template", {
+ datakey: "CTDK00006",
+ tempVnode: formatK(item.watchers),
+ "wx:if": "{{CTDK00006}}",
+ is: "CTNP00005",
+ data: "{{...CTDK00006}}"
+ })
+ )
)
+ ),
+ h(
+ "view",
+ {
+ numberOfLines: 2,
+ style: styles.des,
+ original: "OuterText",
+ diuu: "DIUU00009"
+ },
+ h("template", {
+ datakey: "CTDK00010",
+ tempVnode: item.description,
+ "wx:if": "{{CTDK00010}}",
+ is: "CTNP00009",
+ data: "{{...CTDK00010}}"
+ })
+ ),
+ h(
+ "view",
+ {
+ style: styles.license,
+ original: "OuterText",
+ diuu: "DIUU00010"
+ },
+ h("template", {
+ datakey: "CTDK00012",
+ tempVnode: item.license
+ ? item.license.spdx_id
+ : "ISC",
+ "wx:if": "{{CTDK00012}}",
+ is: "CTNP00011",
+ data: "{{...CTDK00012}}"
+ })
)
- ),
- h(
- "view",
- {
- numberOfLines: 2,
- style: styles.des,
- original: "OuterText",
- diuu: "DIUU00009"
+ )
+ )
+ })
+
+ _defineProperty(this, "keyExtractor", (item, index) => item.id + "")
+
+ _defineProperty(this, "onEndReached", () => {
+ console.log("onEndReached:")
+ this.page++
+ fetchRepos(this.page, 20).then(res => {
+ this.setState({
+ repos: this.state.repos.concat(res.items)
+ })
+ })
+ })
+
+ _defineProperty(this, "lfc", () => {
+ if (this.state.repos.length === 0) {
+ return null
+ }
+
+ return h(
+ "view",
+ {
+ style: {
+ flexDirection: "row",
+ justifyContent: "center",
+ alignItems: "center"
},
- h("template", {
- datakey: "CTDK00010",
- tempVnode: item.description,
- "wx:if": "{{CTDK00010}}",
- is: "CTNP00009",
- data: "{{...CTDK00010}}"
- })
- ),
+ original: "View",
+ diuu: "DIUU00012",
+ tempName: "ITNP00014"
+ },
h(
"view",
{
- style: styles.license,
original: "OuterText",
- diuu: "DIUU00010"
+ diuu: "DIUU00013"
},
- h("template", {
- datakey: "CTDK00012",
- tempVnode: item.license ? item.license.spdx_id : "ISC",
- "wx:if": "{{CTDK00012}}",
- is: "CTNP00011",
- data: "{{...CTDK00012}}"
- })
+ "\u52A0\u8F7D\u4E2D..."
)
)
- )
- }
- keyExtractor = (item, index) => item.id + ""
- onEndReached = () => {
- console.log("onEndReached:")
- this.page++
- fetchRepos(this.page, 20).then(res => {
+ })
+
+ _defineProperty(this, "onRefresh", () => {
this.setState({
- repos: this.state.repos.concat(res.items)
+ refreshing: true
})
+ setTimeout(() => {
+ this.setState({
+ refreshing: false
+ })
+ }, 4000)
})
- }
- lfc = () => {
- if (this.state.repos.length === 0) {
- return null
- }
- return h(
- "view",
- {
- style: {
- flexDirection: "row",
- justifyContent: "center",
- alignItems: "center"
- },
- original: "View",
- diuu: "DIUU00012",
- tempName: "ITNP00014"
- },
- h(
- "view",
- {
- original: "OuterText",
- diuu: "DIUU00013"
- },
- "\u52A0\u8F7D\u4E2D..."
- )
- )
+ _defineProperty(this, "__stateless__", false)
}
- onRefresh = () => {
- this.setState({
- refreshing: true
- })
- setTimeout(() => {
+
+ componentDidMount() {
+ fetchRepos(this.page, 20).then(res => {
this.setState({
- refreshing: false
+ repos: res.items
})
- }, 4000)
+ })
}
render() {
@@ -243,9 +265,16 @@ export default class List extends Component {
})
)
}
-
- __stateless__ = false
}
+
+_defineProperty(List, "navigationOptions", {
+ title: "ReactRepos"
+})
+
+_defineProperty(List, "wxNavigationOptions", {
+ navigationBarTitleText: "ReactRepos"
+})
+
const styles = StyleSheet.create({
fr: {
flexDirection: "row"
diff --git a/examples/ReactReposWP/src/components/list/indexTemplate.wxml b/examples/ReactReposWP/src/components/list/indexTemplate.wxml
index 8d723c7..beb9c0c 100644
--- a/examples/ReactReposWP/src/components/list/indexTemplate.wxml
+++ b/examples/ReactReposWP/src/components/list/indexTemplate.wxml
@@ -84,14 +84,14 @@
-
+
-
+
diff --git a/examples/RoomMobx/src/components/Room.js b/examples/RoomMobx/src/components/Room.js
new file mode 100644
index 0000000..bb912e9
--- /dev/null
+++ b/examples/RoomMobx/src/components/Room.js
@@ -0,0 +1,8 @@
+/**
+ * Copyright (c) Areslabs.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ *
+ */
+
diff --git a/examples/RoomMobx/src/components/TotalInfo.js b/examples/RoomMobx/src/components/TotalInfo.js
new file mode 100644
index 0000000..bb912e9
--- /dev/null
+++ b/examples/RoomMobx/src/components/TotalInfo.js
@@ -0,0 +1,8 @@
+/**
+ * Copyright (c) Areslabs.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ *
+ */
+
diff --git a/examples/RoomMobx/src/components/index.js b/examples/RoomMobx/src/components/index.js
new file mode 100644
index 0000000..bb912e9
--- /dev/null
+++ b/examples/RoomMobx/src/components/index.js
@@ -0,0 +1,8 @@
+/**
+ * Copyright (c) Areslabs.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ *
+ */
+
diff --git a/examples/RoomMobx/src/store/Room.js b/examples/RoomMobx/src/store/Room.js
new file mode 100644
index 0000000..bb912e9
--- /dev/null
+++ b/examples/RoomMobx/src/store/Room.js
@@ -0,0 +1,8 @@
+/**
+ * Copyright (c) Areslabs.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ *
+ */
+
diff --git a/examples/TodoWP/RNApp.js b/examples/TodoWP/RNApp.js
index 3439bb9..e30fa1b 100644
--- a/examples/TodoWP/RNApp.js
+++ b/examples/TodoWP/RNApp.js
@@ -26,8 +26,6 @@ const rootContext = React.getRootContext();
export default {
childContext: rootContext
};
-wx._historyConfig = { ...(wx._historyConfig || {}),
- ...{
- "Todoinit": "/src/components/index"
- }
-};
\ No newline at end of file
+wx._historyConfig = Object.assign({}, wx._historyConfig || {}, {
+ "Todoinit": "/src/components/index"
+});
\ No newline at end of file
diff --git a/examples/TodoWP/package.json b/examples/TodoWP/package.json
index a176c00..b5d8638 100644
--- a/examples/TodoWP/package.json
+++ b/examples/TodoWP/package.json
@@ -2,15 +2,15 @@
"name": "Todo",
"version": "0.0.1",
"dependencies": {
- "@areslabs/wx-router": "beta",
+ "@areslabs/wx-router": "^1.0.0",
"@areslabs/wx-animated": "^1.0.1",
- "@areslabs/wx-react": "beta",
+ "@areslabs/wx-react": "^1.0.0",
"@areslabs/wx-react-native": "^1.0.0",
"@areslabs/wx-prop-types": "^1.0.0",
- "@areslabs/wx-react-redux": "beta",
+ "@areslabs/wx-react-redux": "^1.0.0",
"@areslabs/wx-redux": "^1.0.0",
"@areslabs/wx-redux-actions": "^1.0.0",
"@areslabs/wx-redux-promise": "^1.0.0",
"@areslabs/wx-redux-thunk": "^1.0.0"
}
-}
+}
\ No newline at end of file
diff --git a/examples/TodoWP/src/components/AddTodo.comp.js b/examples/TodoWP/src/components/AddTodo.comp.js
index 868b9e3..3d7d02b 100644
--- a/examples/TodoWP/src/components/AddTodo.comp.js
+++ b/examples/TodoWP/src/components/AddTodo.comp.js
@@ -1,3 +1,17 @@
+function _defineProperty(obj, key, value) {
+ if (key in obj) {
+ Object.defineProperty(obj, key, {
+ value: value,
+ enumerable: true,
+ configurable: true,
+ writable: true
+ })
+ } else {
+ obj[key] = value
+ }
+ return obj
+}
+
import React, { h } from "@areslabs/wx-react"
import {
View,
@@ -9,13 +23,20 @@ import { addTodo } from "../actions/index"
import { connect } from "@areslabs/wx-react-redux"
class AddTodo extends React.Component {
- state = {
- v: "What needs to be done?"
- }
- handleFocus = () => {
- this.setState({
- v: ""
+ constructor(...args) {
+ super(...args)
+
+ _defineProperty(this, "state", {
+ v: "What needs to be done?"
})
+
+ _defineProperty(this, "handleFocus", () => {
+ this.setState({
+ v: ""
+ })
+ })
+
+ _defineProperty(this, "__stateless__", false)
}
render() {
@@ -69,8 +90,6 @@ class AddTodo extends React.Component {
})
)
}
-
- __stateless__ = false
}
const styles = StyleSheet.create({
diff --git a/examples/TodoWP/src/components/Footer.comp.js b/examples/TodoWP/src/components/Footer.comp.js
index dfa49f0..cb24b3c 100644
--- a/examples/TodoWP/src/components/Footer.comp.js
+++ b/examples/TodoWP/src/components/Footer.comp.js
@@ -1,3 +1,17 @@
+function _defineProperty(obj, key, value) {
+ if (key in obj) {
+ Object.defineProperty(obj, key, {
+ value: value,
+ enumerable: true,
+ configurable: true,
+ writable: true
+ })
+ } else {
+ obj[key] = value
+ }
+ return obj
+}
+
import React, { h } from "@areslabs/wx-react"
import {
View,
@@ -9,6 +23,12 @@ import actions from "../actions/visibilityFilter"
import { connect } from "@areslabs/wx-react-redux"
class Footer extends React.Component {
+ constructor(...args) {
+ super(...args)
+
+ _defineProperty(this, "__stateless__", true)
+ }
+
render() {
const {
setVisibilityFilter,
@@ -132,8 +152,6 @@ class Footer extends React.Component {
)
)
}
-
- __stateless__ = true
}
const styles = StyleSheet.create({
diff --git a/examples/TodoWP/src/components/Todo.comp.js b/examples/TodoWP/src/components/Todo.comp.js
index 02eb91e..fd53758 100644
--- a/examples/TodoWP/src/components/Todo.comp.js
+++ b/examples/TodoWP/src/components/Todo.comp.js
@@ -1,3 +1,17 @@
+function _defineProperty(obj, key, value) {
+ if (key in obj) {
+ Object.defineProperty(obj, key, {
+ value: value,
+ enumerable: true,
+ configurable: true,
+ writable: true
+ })
+ } else {
+ obj[key] = value
+ }
+ return obj
+}
+
import React, { PureComponent, h } from "@areslabs/wx-react"
import {
View,
@@ -6,6 +20,12 @@ import {
StyleSheet
} from "@areslabs/wx-react-native"
export default class Todo extends PureComponent {
+ constructor(...args) {
+ super(...args)
+
+ _defineProperty(this, "__stateless__", true)
+ }
+
render() {
const { onClick, completed, text } = this.props
return h(
@@ -46,8 +66,6 @@ export default class Todo extends PureComponent {
)
)
}
-
- __stateless__ = true
}
const styles = StyleSheet.create({
item: {
diff --git a/examples/TodoWP/src/components/index.comp.js b/examples/TodoWP/src/components/index.comp.js
index 9c60806..8fa03a0 100644
--- a/examples/TodoWP/src/components/index.comp.js
+++ b/examples/TodoWP/src/components/index.comp.js
@@ -15,6 +15,20 @@ function _extends() {
return _extends.apply(this, arguments)
}
+function _defineProperty(obj, key, value) {
+ if (key in obj) {
+ Object.defineProperty(obj, key, {
+ value: value,
+ enumerable: true,
+ configurable: true,
+ writable: true
+ })
+ } else {
+ obj[key] = value
+ }
+ return obj
+}
+
import React, { PureComponent, h } from "@areslabs/wx-react"
import { WXFlatList, StyleSheet, Text, View } from "@areslabs/wx-react-native"
import { toggleTodo } from "../actions/index"
@@ -24,31 +38,43 @@ import Todo from "./Todo.comp"
import Footer from "./Footer.comp"
class Index extends PureComponent {
- LHC = h(
- "view",
- {
- style: styles.header,
- original: "OuterText",
- diuu: "DIUU00001",
- tempName: "ITNP00002"
- },
- "TodoList\u6837\u4F8B\u5217\u8868"
- )
- renderItem = ({ item }) => {
- const { onTodoClick } = this.props
- return h(
- Todo,
- _extends({}, item, {
- onClick: () => {
- onTodoClick(item.id)
+ constructor(...args) {
+ super(...args)
+
+ _defineProperty(
+ this,
+ "LHC",
+ h(
+ "view",
+ {
+ style: styles.header,
+ original: "OuterText",
+ diuu: "DIUU00001",
+ tempName: "ITNP00002"
},
- diuu: "DIUU00003",
- tempName: "ITNP00004"
- })
+ "TodoList\u6837\u4F8B\u5217\u8868"
+ )
)
- }
- keyExtractor = item => {
- return item.id + ""
+
+ _defineProperty(this, "renderItem", ({ item }) => {
+ const { onTodoClick } = this.props
+ return h(
+ Todo,
+ _extends({}, item, {
+ onClick: () => {
+ onTodoClick(item.id)
+ },
+ diuu: "DIUU00003",
+ tempName: "ITNP00004"
+ })
+ )
+ })
+
+ _defineProperty(this, "keyExtractor", item => {
+ return item.id + ""
+ })
+
+ _defineProperty(this, "__stateless__", true)
}
render() {
@@ -84,8 +110,6 @@ class Index extends PureComponent {
})
)
}
-
- __stateless__ = true
}
const styles = StyleSheet.create({
diff --git a/src/util/uast.js b/src/util/uast.js
index 3872490..ee54265 100644
--- a/src/util/uast.js
+++ b/src/util/uast.js
@@ -35,10 +35,10 @@ export function geneCode(ast) {
}
const babelTransformJSX = babel.createConfigItem(require("../misc/transformJSX"), {type: 'plugin'})
-const babelRestSpread = babel.createConfigItem(require("@babel/plugin-syntax-object-rest-spread"))
-const babelClassProperties = babel.createConfigItem(require("@babel/plugin-syntax-class-properties"))
-const babelOptionalChaining = babel.createConfigItem(require("@babel/plugin-syntax-optional-chaining"))
-
+const babelRestSpread = babel.createConfigItem([require("@babel/plugin-proposal-object-rest-spread"), { "loose": true, "useBuiltIns": true }])
+const babelClassProperties = babel.createConfigItem(require("@babel/plugin-proposal-class-properties"))
+const babelOptionalChaining = babel.createConfigItem(require("@babel/plugin-proposal-optional-chaining"))
+const babelDecorators = babel.createConfigItem([require("@babel/plugin-proposal-decorators"), {decoratorsBeforeExport: false}])
export async function geneReactCode(ast) {
let code = geneCode(ast)
@@ -46,6 +46,7 @@ export async function geneReactCode(ast) {
babelrc: false,
configFile: false,
plugins: [
+ babelDecorators,
babelRestSpread,
babelClassProperties,
babelOptionalChaining,