how can dismiss alertios prompt? see example code. problem is, when push "cancel" button, "this.newfile()" function called. ideas how fix this.
newfileprompt: function() { alertios.prompt( 'new file', 'new file', [ {text: 'cancel'}, {text: 'create', onpress: this.newfile()}, ] ); }, newfile: function() { alert("new file"); }, also interesting: if change code to:
newfileprompt: function() { alertios.prompt( 'new file', 'new file', [ {text: 'cancel', onpress: this.cancel()}, {text: 'create', onpress: this.newfile()}, ] ); }, cancel: function() { alert("irgendwas"); }, newfile: function() { alert("new file"); }, both functions called everytime, regardless of button pressed. @ first "new file" alert appears , after submitting alert, "irgendwas" alert appears.
i've found solution. changed
onpress: this.cancel() to
onpress: () => this.cancel() react native more trial , error else. or quiz game :)
Comments
Post a Comment