Skip to content

Commit cc39b41

Browse files
committed
bugfix: update action button item title with setState
1 parent 6f80647 commit cc39b41

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

ActionButton.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,6 @@ class ActionButton extends Component {
3434

3535
if (!props.children) throw new Error("ActionButton must have at least 1 Child.");
3636

37-
if (Array.isArray(props.children)) {
38-
this.state.actionButtons = props.children;
39-
} else {
40-
this.state.actionButtons = [props.children];
41-
}
42-
4337
this.setPositionAndSizeByType();
4438
}
4539

@@ -196,13 +190,19 @@ class ActionButton extends Component {
196190
}
197191

198192
_renderActions() {
199-
if (!this.state.active) return;
193+
if (!this.state.active) return
194+
195+
let actionButtons = this.props.children
196+
197+
if (!Array.isArray(this.props.children)) {
198+
actionButtons = [this.props.children]
199+
}
200200

201201
return (
202202
<Animated.View style={[styles.overlay, { opacity: this.state.anim }]}>
203203
<TouchableOpacity activeOpacity={1} onPress={this.reset.bind(this)}
204204
style={this.getActionsStyle()}>
205-
{this.state.actionButtons.map((ActionButton, iter) => {
205+
{actionButtons.map((ActionButton, iter) => {
206206
return (<ActionButtonItem
207207
key = {iter}
208208
position={this.state.position}
@@ -214,10 +214,10 @@ class ActionButton extends Component {
214214
onPress={() => {
215215
if (this.props.autoInactive){
216216
setTimeout(() => {
217-
this.reset();
218-
}, 400);
217+
this.reset()
218+
}, 400)
219219
}
220-
ActionButton.props.onPress();
220+
ActionButton.props.onPress()
221221
}} />)
222222
})}
223223
</TouchableOpacity>

0 commit comments

Comments
 (0)