Browse Source

Fixes sideMenu.animationType (#4198)

Yogev Ben David 6 years ago
parent
commit
e01837e16e
No account linked to committer's email address

+ 1
- 0
lib/ios/RNNSideMenuController.h View File

16
 - (void)side:(MMDrawerSide)side enabled:(BOOL)enabled;
16
 - (void)side:(MMDrawerSide)side enabled:(BOOL)enabled;
17
 - (void)side:(MMDrawerSide)side visible:(BOOL)visible;
17
 - (void)side:(MMDrawerSide)side visible:(BOOL)visible;
18
 - (void)side:(MMDrawerSide)side width:(double)width;
18
 - (void)side:(MMDrawerSide)side width:(double)width;
19
+- (void)setAnimationType:(NSString *)animationType;
19
 
20
 
20
 @end
21
 @end

+ 2
- 0
lib/ios/RNNSideMenuOptions.h View File

6
 @property (nonatomic, strong) RNNSideMenuSideOptions* left;
6
 @property (nonatomic, strong) RNNSideMenuSideOptions* left;
7
 @property (nonatomic, strong) RNNSideMenuSideOptions* right;
7
 @property (nonatomic, strong) RNNSideMenuSideOptions* right;
8
 
8
 
9
+@property (nonatomic, strong) Text* animationType;
10
+
9
 @end
11
 @end

+ 1
- 0
lib/ios/RNNSideMenuOptions.m View File

8
 	
8
 	
9
 	self.left = [[RNNSideMenuSideOptions alloc] initWithDict:dict[@"left"]];
9
 	self.left = [[RNNSideMenuSideOptions alloc] initWithDict:dict[@"left"]];
10
 	self.right = [[RNNSideMenuSideOptions alloc] initWithDict:dict[@"right"]];
10
 	self.right = [[RNNSideMenuSideOptions alloc] initWithDict:dict[@"right"]];
11
+	self.animationType = [TextParser parse:dict key:@"animationType"];
11
 	
12
 	
12
 	return self;
13
 	return self;
13
 }
14
 }

+ 6
- 0
lib/ios/RNNSideMenuPresenter.m View File

19
 	[sideMenuController setAnimationVelocityLeft:[options.sideMenu.left.animationVelocity getWithDefaultValue:840.0f]];
19
 	[sideMenuController setAnimationVelocityLeft:[options.sideMenu.left.animationVelocity getWithDefaultValue:840.0f]];
20
 	[sideMenuController setAnimationVelocityRight:[options.sideMenu.right.animationVelocity getWithDefaultValue:840.0f]];
20
 	[sideMenuController setAnimationVelocityRight:[options.sideMenu.right.animationVelocity getWithDefaultValue:840.0f]];
21
 	
21
 	
22
+	[sideMenuController setAnimationType:[options.sideMenu.animationType getWithDefaultValue:@"door"]];
23
+
22
 	if (options.sideMenu.left.width.hasValue) {
24
 	if (options.sideMenu.left.width.hasValue) {
23
 		[sideMenuController side:MMDrawerSideLeft width:options.sideMenu.left.width.get];
25
 		[sideMenuController side:MMDrawerSideLeft width:options.sideMenu.left.width.get];
24
 	}
26
 	}
76
 	if (options.sideMenu.right.animationVelocity.hasValue) {
78
 	if (options.sideMenu.right.animationVelocity.hasValue) {
77
 		sideMenuController.animationVelocityRight = options.sideMenu.right.animationVelocity.get;
79
 		sideMenuController.animationVelocityRight = options.sideMenu.right.animationVelocity.get;
78
 	}
80
 	}
81
+	
82
+	if (options.sideMenu.animationType.hasValue) {
83
+		[sideMenuController setAnimationType:options.sideMenu.animationType.get];
84
+	}
79
 }
85
 }
80
 
86
 
81
 @end
87
 @end

+ 0
- 1
lib/ios/RNNSideMenuSideOptions.h View File

6
 @property (nonatomic, strong) Bool* visible;
6
 @property (nonatomic, strong) Bool* visible;
7
 @property (nonatomic, strong) Bool* enabled;
7
 @property (nonatomic, strong) Bool* enabled;
8
 @property (nonatomic, strong) Double* width;
8
 @property (nonatomic, strong) Double* width;
9
-@property (nonatomic, strong) Text* animationType;
10
 @property (nonatomic, strong) Bool* shouldStretchDrawer;
9
 @property (nonatomic, strong) Bool* shouldStretchDrawer;
11
 @property (nonatomic, strong) Double* animationVelocity;
10
 @property (nonatomic, strong) Double* animationVelocity;
12
 
11
 

+ 0
- 1
lib/ios/RNNSideMenuSideOptions.m View File

8
 	self.visible = [BoolParser parse:dict key:@"visible"];
8
 	self.visible = [BoolParser parse:dict key:@"visible"];
9
 	self.enabled = [BoolParser parse:dict key:@"enabled"];
9
 	self.enabled = [BoolParser parse:dict key:@"enabled"];
10
 	self.width = [DoubleParser parse:dict key:@"width"];
10
 	self.width = [DoubleParser parse:dict key:@"width"];
11
-	self.animationType = [TextParser parse:dict key:@"animationType"];
12
 	self.shouldStretchDrawer = [BoolParser parse:dict key:@"shouldStretchDrawer"];
11
 	self.shouldStretchDrawer = [BoolParser parse:dict key:@"shouldStretchDrawer"];
13
 	self.animationVelocity = [DoubleParser parse:dict key:@"animationVelocity"];
12
 	self.animationVelocity = [DoubleParser parse:dict key:@"animationVelocity"];
14
 	
13
 	

+ 2
- 1
lib/ios/ReactNativeNavigationTests/RNNSideMenuPresenterTest.m View File

30
 	[[self.bindedViewController expect] setAnimationVelocityRight:840.0f];
30
 	[[self.bindedViewController expect] setAnimationVelocityRight:840.0f];
31
 	[[self.bindedViewController reject] side:MMDrawerSideLeft width:0];
31
 	[[self.bindedViewController reject] side:MMDrawerSideLeft width:0];
32
 	[[self.bindedViewController reject] side:MMDrawerSideRight width:0];
32
 	[[self.bindedViewController reject] side:MMDrawerSideRight width:0];
33
-	
33
+  [[self.bindedViewController expect] setAnimationType:@"door"];
34
+    
34
 	[self.uut applyOptions:self.options];
35
 	[self.uut applyOptions:self.options];
35
 
36
 
36
 	[self.bindedViewController verify];
37
 	[self.bindedViewController verify];

+ 7
- 6
playground/src/screens/PushedScreen.js View File

1
 const _ = require('lodash');
1
 const _ = require('lodash');
2
 const React = require('react');
2
 const React = require('react');
3
-const { Component } = require('react');
4
-const { View, Text, Platform } = require('react-native');
5
-const { Navigation } = require('react-native-navigation');
3
+const {Component} = require('react');
4
+const {View, Text, Platform} = require('react-native');
5
+const {Navigation} = require('react-native-navigation');
6
 const Button = require('./Button');
6
 const Button = require('./Button');
7
 const testIDs = require('../testIDs');
7
 const testIDs = require('../testIDs');
8
 
8
 
21
           testID: testIDs.TOP_BAR_BUTTON
21
           testID: testIDs.TOP_BAR_BUTTON
22
         },
22
         },
23
         rightButtonColor: 'red',
23
         rightButtonColor: 'red',
24
+       noBorder: true
24
       },
25
       },
25
       bottomTabs: {
26
       bottomTabs: {
26
         visible: false
27
         visible: false
40
     this.onClickPopToFirstPosition = this.onClickPopToFirstPosition.bind(this);
41
     this.onClickPopToFirstPosition = this.onClickPopToFirstPosition.bind(this);
41
     this.onClickPopToRoot = this.onClickPopToRoot.bind(this);
42
     this.onClickPopToRoot = this.onClickPopToRoot.bind(this);
42
     this.onClickSetStackRoot = this.onClickSetStackRoot.bind(this);
43
     this.onClickSetStackRoot = this.onClickSetStackRoot.bind(this);
43
-    this.state = { disabled: false };
44
+    this.state = {disabled: false};
44
   }
45
   }
45
 
46
 
46
   simulateLongRunningTask() {
47
   simulateLongRunningTask() {
54
     this.listeners.push(
55
     this.listeners.push(
55
       Navigation.events().registerComponentDidAppearListener((event) => {
56
       Navigation.events().registerComponentDidAppearListener((event) => {
56
         if (this.state.previewComponentId === event.componentId) {
57
         if (this.state.previewComponentId === event.componentId) {
57
-          this.setState({ disabled: event.type === 'ComponentDidAppear' });
58
+          this.setState({disabled: event.type === 'ComponentDidAppear'});
58
         }
59
         }
59
       })
60
       })
60
     );
61
     );
94
     );
95
     );
95
   }
96
   }
96
 
97
 
97
-  onClickShowPreview = async ({ reactTag }) => {
98
+  onClickShowPreview = async ({reactTag}) => {
98
     await Navigation.push(this.props.componentId, {
99
     await Navigation.push(this.props.componentId, {
99
       component: {
100
       component: {
100
         name: 'navigation.playground.PushedScreen',
101
         name: 'navigation.playground.PushedScreen',

+ 4
- 1
playground/src/screens/WelcomeScreen.js View File

23
           visible: false,
23
           visible: false,
24
         },
24
         },
25
         drawBehind: true,
25
         drawBehind: true,
26
-        visible: false,
26
+        background: {
27
+          color: 'transparent'
28
+        },
29
+        visible: true,
27
         animate: false
30
         animate: false
28
       }
31
       }
29
     };
32
     };