Browse Source

Use bound functions in OptionsScreen.js

Guy Carmeli 6 years ago
parent
commit
05354fd2ae
1 changed files with 12 additions and 24 deletions
  1. 12
    24
      playground/src/screens/OptionsScreen.js

+ 12
- 24
playground/src/screens/OptionsScreen.js View File

@@ -90,20 +90,6 @@ class OptionsScreen extends Component {
90 90
     };
91 91
   }
92 92
 
93
-  constructor(props) {
94
-    super(props);
95
-    this.onClickDynamicOptions = this.onClickDynamicOptions.bind(this);
96
-    this.onClickShowTopBar = this.onClickShowTopBar.bind(this);
97
-    this.onClickHideTopBar = this.onClickHideTopBar.bind(this);
98
-    this.onClickScrollViewScreen = this.onClickScrollViewScreen.bind(this);
99
-    this.onClickTopBarTransparent = this.onClickTopBarTransparent.bind(this);
100
-    this.onClickTopBarOpaque = this.onClickTopBarOpaque.bind(this);
101
-    this.onClickCustomTranstition = this.onClickCustomTranstition.bind(this);
102
-    this.onClickShowOverlay = this.onClickShowOverlay.bind(this);
103
-    this.onClickPushDefaultOptionsScreen = this.onClickPushDefaultOptionsScreen.bind(this);
104
-    this.onClickFab = this.onClickFab.bind(this);
105
-  }
106
-
107 93
   render() {
108 94
     return (
109 95
       <View style={styles.root}>
@@ -167,7 +153,7 @@ class OptionsScreen extends Component {
167 153
     }
168 154
   }
169 155
 
170
-  onClickDynamicOptions() {
156
+  onClickDynamicOptions = () => {
171 157
     Navigation.setOptions(this.props.componentId, {
172 158
       topBar: {
173 159
         title: {
@@ -182,7 +168,7 @@ class OptionsScreen extends Component {
182 168
     });
183 169
   }
184 170
 
185
-  onClickScrollViewScreen() {
171
+  onClickScrollViewScreen = () => {
186 172
     Navigation.push(this.props.componentId, {
187 173
       component: {
188 174
         name: 'navigation.playground.ScrollViewScreen'
@@ -190,7 +176,7 @@ class OptionsScreen extends Component {
190 176
     });
191 177
   }
192 178
 
193
-  onClickCustomTranstition() {
179
+  onClickCustomTranstition = () => {
194 180
     Navigation.push(this.props.componentId, {
195 181
       component: {
196 182
         name: 'navigation.playground.CustomTransitionOrigin'
@@ -198,21 +184,23 @@ class OptionsScreen extends Component {
198 184
     });
199 185
   }
200 186
 
201
-  onClickTopBarTransparent() {
187
+  onClickTopBarTransparent = () => {
202 188
     Navigation.setOptions(this.props.componentId, {
203 189
       topBar: {
204 190
         transparent: true
205 191
       }
206 192
     });
207 193
   }
208
-  onClickTopBarOpaque() {
194
+  
195
+  onClickTopBarOpaque = () => {
209 196
     Navigation.setOptions(this.props.componentId, {
210 197
       topBar: {
211 198
         transparent: false
212 199
       }
213 200
     });
214 201
   }
215
-  onClickShowTopBar() {
202
+  
203
+  onClickShowTopBar = () => {
216 204
     Navigation.setOptions(this.props.componentId, {
217 205
       topBar: {
218 206
         visible: true,
@@ -221,7 +209,7 @@ class OptionsScreen extends Component {
221 209
     });
222 210
   }
223 211
 
224
-  onClickHideTopBar() {
212
+  onClickHideTopBar = () => {
225 213
     Navigation.setOptions(this.props.componentId, {
226 214
       topBar: {
227 215
         visible: false,
@@ -230,7 +218,7 @@ class OptionsScreen extends Component {
230 218
     });
231 219
   }
232 220
 
233
-  onClickFab() {
221
+  onClickFab = () => {
234 222
     Navigation.setOptions(this.props.componentId, {
235 223
       fab: {
236 224
         id: FAB,
@@ -240,7 +228,7 @@ class OptionsScreen extends Component {
240 228
     });
241 229
   }
242 230
 
243
-  onClickShowOverlay(interceptTouchOutside) {
231
+  onClickShowOverlay = (interceptTouchOutside) => {
244 232
     Navigation.showOverlay({
245 233
       component: {
246 234
         name: 'navigation.playground.CustomDialog',
@@ -253,7 +241,7 @@ class OptionsScreen extends Component {
253 241
     });
254 242
   }
255 243
 
256
-  onClickPushDefaultOptionsScreen() {
244
+  onClickPushDefaultOptionsScreen = () => {
257 245
     Navigation.setDefaultOptions({
258 246
       topBar: {
259 247
         visible: false,