瀏覽代碼

Use bound function

Guy Carmeli 6 年之前
父節點
當前提交
5a43de8cec
共有 1 個檔案被更改,包括 1 行新增2 行删除
  1. 1
    2
      playground/src/screens/TextScreen.js

+ 1
- 2
playground/src/screens/TextScreen.js 查看文件

23
   constructor(props) {
23
   constructor(props) {
24
     super(props);
24
     super(props);
25
     globalFirstComponentID = (props.text === 'This is tab 1') ? props.componentId : globalFirstComponentID;
25
     globalFirstComponentID = (props.text === 'This is tab 1') ? props.componentId : globalFirstComponentID;
26
-    this.onClickPop = this.onClickPop.bind(this);
27
   }
26
   }
28
 
27
 
29
   render() {
28
   render() {
44
     );
43
     );
45
   }
44
   }
46
 
45
 
47
-  async onClickPop() {
46
+  onClickPop = async () => {
48
     await Navigation.pop(this.props.componentId);
47
     await Navigation.pop(this.props.componentId);
49
   }
48
   }
50
 
49