i'm keep getting following error when executing react native code below.
i've tried various ways define actionenum object nothing seems work. please help!
import react "react"; import { view, text, stylesheet, textinput, button, asyncstorage } "react-native"; class additem extends react.component { static navigationoptions = { title: "add item" }; static actionenum = { init: 1, add: 2, update: 3, delete: 4, set: 5 }; constructor(props) { super(props); this.setstatehandler(this.actionenum.add); }
.....
javascript doesn't have static variables, static methods. can work around exporting enum object module instead of making part of class, if need part of class can use get
accessor.
class additem extends react.component { static navigationoptions() { return { title: "add item" }; } static actionenum() { return { init: 1, add: 2, update: 3, delete: 4, set: 5 }; } constructor(props) { super(props); this.setstatehandler(this.actionenum.add); }
Comments
Post a Comment