Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1d3ac78

Browse files
FiberJWMicheleBertoli
authored andcommitted
Fix: Hoist statics from child inwithStateMachine HOC (#76)
* add "hoist-non-react-statics" dependency* hoist static properties when generating state machine HOC
1 parentefaa63f commit1d3ac78

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

‎package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
},
6161
"dependencies": {
6262
"glob-to-regexp":"^0.4.0",
63+
"hoist-non-react-statics":"^3.0.1",
6364
"invariant":"^2.2.4",
6465
"memoize-one":"^4.0.0",
6566
"prop-types":"^15.6.1",

‎src/withStateMachine.js‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import memoize from 'memoize-one'
44
importPropTypesfrom'prop-types'
55
importReactfrom'react'
66
import{Machine,State,StateNode}from'xstate'
7+
importhoistStaticsfrom'hoist-non-react-statics'
78
importContextfrom'./context'
89
import{
910
DEFAULT_CHANNEL,
@@ -214,6 +215,8 @@ const withStateMachine = (statechart, options = {}) => Component => {
214215
}
215216
}
216217

218+
hoistStatics(Automata,Component)
219+
217220
returnAutomata
218221
}
219222

‎yarn.lock‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3186,6 +3186,12 @@ hoist-non-react-statics@^2.5.0:
31863186
version "2.5.0"
31873187
resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-2.5.0.tgz#d2ca2dfc19c5a91c5a6615ce8e564ef0347e2a40"
31883188

3189+
hoist-non-react-statics@^3.0.1:
3190+
version "3.0.1"
3191+
resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-3.0.1.tgz#fba3e7df0210eb9447757ca1a7cb607162f0a364"
3192+
dependencies:
3193+
react-is "^16.3.2"
3194+
31893195
home-or-tmp@^2.0.0:
31903196
version "2.0.0"
31913197
resolved "https://registry.yarnpkg.com/home-or-tmp/-/home-or-tmp-2.0.0.tgz#e36c3f2d2cae7d746a857e38d18d5f32a7882db8"
@@ -5547,6 +5553,10 @@ react-hot-loader@4.3.4:
55475553
react-lifecycles-compat "^3.0.4"
55485554
shallowequal "^1.0.2"
55495555

5556+
react-is@^16.3.2:
5557+
version "16.5.2"
5558+
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.5.2.tgz#e2a7b7c3f5d48062eb769fcb123505eb928722e3"
5559+
55505560
react-is@^16.4.2:
55515561
version "16.4.2"
55525562
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.4.2.tgz#84891b56c2b6d9efdee577cc83501dfc5ecead88"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp