ソースを参照

Feature/set drawer enabled ios (#1347)

* setDrawerEnabled with params side and enabled

* Tweak docs, small RCCDrawerController fix

* Correct indents

* Correct indents
Kyle Johnson 7 年 前
コミット
0381fd0f98
共有4 個のファイルを変更した25 個の追加2 個の削除を含む
  1. 1
    1
      docs/screen-api.md
  2. 15
    1
      ios/RCCDrawerController/RCCDrawerController.m
  3. 3
    0
      src/deprecated/controllers/index.js
  4. 6
    0
      src/deprecated/platformSpecificDeprecated.ios.js

+ 1
- 1
docs/screen-api.md ファイルの表示

173
 });
173
 });
174
 ```
174
 ```
175
 
175
 
176
-## setDrawerEnabled(params = {}) (Android only)
176
+## setDrawerEnabled(params = {})
177
 
177
 
178
 Enables or disables the side menu drawer assuming you have one in your app. Both drawers are enabled by default.
178
 Enables or disables the side menu drawer assuming you have one in your app. Both drawers are enabled by default.
179
 
179
 

+ 15
- 1
ios/RCCDrawerController/RCCDrawerController.m ファイルの表示

13
 
13
 
14
 @synthesize drawerStyle = _drawerStyle;
14
 @synthesize drawerStyle = _drawerStyle;
15
 
15
 
16
+UIViewController *leftViewController = nil;
17
+UIViewController *rightViewController = nil;
18
+
16
 -(UIInterfaceOrientationMask)supportedInterfaceOrientations {
19
 -(UIInterfaceOrientationMask)supportedInterfaceOrientations {
17
     return [self supportedControllerOrientations];
20
     return [self supportedControllerOrientations];
18
 }
21
 }
124
         
127
         
125
         return;
128
         return;
126
     }
129
     }
127
-    
130
+
131
+    // setDrawerEnabled
132
+    if ([performAction isEqualToString:@"setDrawerEnabled"])
133
+    {
134
+        bool enabled = [actionParams[@"enabled"] boolValue];
135
+        if ([actionParams[@"side"] isEqualToString:@"left"]) {
136
+            [super setLeftDrawerViewController: enabled ? rightViewController : nil];
137
+        } else if ([actionParams[@"side"] isEqualToString:@"right"]) {
138
+            [super setRightDrawerViewController: enabled ? rightViewController : nil];
139
+        }
140
+    }
141
+
128
     // toggle
142
     // toggle
129
     if ([performAction isEqualToString:@"toggle"])
143
     if ([performAction isEqualToString:@"toggle"])
130
     {
144
     {

+ 3
- 0
src/deprecated/controllers/index.js ファイルの表示

161
       popToRoot: function (params) {
161
       popToRoot: function (params) {
162
         RCCManager.NavigationControllerIOS(id, "popToRoot", params);
162
         RCCManager.NavigationControllerIOS(id, "popToRoot", params);
163
       },
163
       },
164
+      setDrawerEnabled: function (params) {
165
+        RCCManager.DrawerControllerIOS(id, "setDrawerEnabled", params);
166
+      },
164
       setTitle: function (params) {
167
       setTitle: function (params) {
165
         if (params['style']) {
168
         if (params['style']) {
166
           params['style'] = Object.assign({}, params['style']);
169
           params['style'] = Object.assign({}, params['style']);

+ 6
- 0
src/deprecated/platformSpecificDeprecated.ios.js ファイルの表示

301
   });
301
   });
302
 }
302
 }
303
 
303
 
304
+function navigatorSetDrawerEnabled(navigator, params) {
305
+    const controllerID = navigator.navigatorID.split('_')[0];
306
+    Controllers.NavigationControllerIOS(controllerID + '_drawer').setDrawerEnabled(params)
307
+}
308
+
304
 function navigatorSetTitle(navigator, params) {
309
 function navigatorSetTitle(navigator, params) {
305
   Controllers.NavigationControllerIOS(navigator.navigatorID).setTitle({
310
   Controllers.NavigationControllerIOS(navigator.navigatorID).setTitle({
306
     title: params.title,
311
     title: params.title,
622
   showInAppNotification,
627
   showInAppNotification,
623
   dismissInAppNotification,
628
   dismissInAppNotification,
624
   navigatorSetButtons,
629
   navigatorSetButtons,
630
+  navigatorSetDrawerEnabled,
625
   navigatorSetTitle,
631
   navigatorSetTitle,
626
   navigatorSetSubtitle,
632
   navigatorSetSubtitle,
627
   navigatorSetStyle,
633
   navigatorSetStyle,