Skip to content

Commit 5289083

Browse files
committed
🐛 TypeError: Cannot read property 'options' of undefined
1 parent 4e9210f commit 5289083

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

packages/react-nipple/lib/ReactNipple.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,17 +113,17 @@ var ReactNipple = (_class = function (_Component) {
113113
value: function handleElement(ref) {
114114
this._element = ref;
115115
if (ref) {
116-
this.createJoystick(this.props);
116+
this.createJoystick();
117117
} else if (this._element) {
118118
this.destroyJoystick();
119119
}
120120
}
121121
}, {
122122
key: 'createJoystick',
123-
value: function createJoystick(props) {
123+
value: function createJoystick() {
124124
var options = _extends({
125125
zone: this._element
126-
}, props.options);
126+
}, this.props.options);
127127

128128
if (this.props.static) {
129129
options.mode = 'static';
@@ -145,8 +145,8 @@ var ReactNipple = (_class = function (_Component) {
145145

146146
this.joystick = joystick;
147147

148-
if (props.onCreated) {
149-
props.onCreated(this.joystick);
148+
if (this.props.onCreated) {
149+
this.props.onCreated(this.joystick);
150150
}
151151
}
152152
}, {

packages/react-nipple/src/ReactNipple.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,15 +112,15 @@ export default class ReactNipple extends Component {
112112
handleElement(ref) {
113113
this._element = ref;
114114
if (ref) {
115-
this.createJoystick(this.props);
115+
this.createJoystick();
116116
} else if (this._element) {
117117
this.destroyJoystick();
118118
}
119119
}
120-
createJoystick(props) {
120+
createJoystick() {
121121
const options = {
122122
zone: this._element,
123-
...props.options
123+
...this.props.options
124124
};
125125

126126
if (this.props.static) {
@@ -143,8 +143,8 @@ export default class ReactNipple extends Component {
143143

144144
this.joystick = joystick;
145145

146-
if (props.onCreated) {
147-
props.onCreated(this.joystick);
146+
if (this.props.onCreated) {
147+
this.props.onCreated(this.joystick);
148148
}
149149
}
150150
destroyJoystick() {

0 commit comments

Comments
 (0)