ソースを参照

Fixes sideMenu.animationType (#4198)

Yogev Ben David 6 年 前
コミット
e01837e16e
No account linked to committer's email address

+ 1
- 0
lib/ios/RNNSideMenuController.h ファイルの表示

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

+ 2
- 0
lib/ios/RNNSideMenuOptions.h ファイルの表示

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

+ 1
- 0
lib/ios/RNNSideMenuOptions.m ファイルの表示

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

+ 6
- 0
lib/ios/RNNSideMenuPresenter.m ファイルの表示

@@ -19,6 +19,8 @@
19 19
 	[sideMenuController setAnimationVelocityLeft:[options.sideMenu.left.animationVelocity getWithDefaultValue:840.0f]];
20 20
 	[sideMenuController setAnimationVelocityRight:[options.sideMenu.right.animationVelocity getWithDefaultValue:840.0f]];
21 21
 	
22
+	[sideMenuController setAnimationType:[options.sideMenu.animationType getWithDefaultValue:@"door"]];
23
+
22 24
 	if (options.sideMenu.left.width.hasValue) {
23 25
 		[sideMenuController side:MMDrawerSideLeft width:options.sideMenu.left.width.get];
24 26
 	}
@@ -76,6 +78,10 @@
76 78
 	if (options.sideMenu.right.animationVelocity.hasValue) {
77 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 87
 @end

+ 0
- 1
lib/ios/RNNSideMenuSideOptions.h ファイルの表示

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

+ 0
- 1
lib/ios/RNNSideMenuSideOptions.m ファイルの表示

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

+ 2
- 1
lib/ios/ReactNativeNavigationTests/RNNSideMenuPresenterTest.m ファイルの表示

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

+ 7
- 6
playground/src/screens/PushedScreen.js ファイルの表示

@@ -1,8 +1,8 @@
1 1
 const _ = require('lodash');
2 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 6
 const Button = require('./Button');
7 7
 const testIDs = require('../testIDs');
8 8
 
@@ -21,6 +21,7 @@ class PushedScreen extends Component {
21 21
           testID: testIDs.TOP_BAR_BUTTON
22 22
         },
23 23
         rightButtonColor: 'red',
24
+       noBorder: true
24 25
       },
25 26
       bottomTabs: {
26 27
         visible: false
@@ -40,7 +41,7 @@ class PushedScreen extends Component {
40 41
     this.onClickPopToFirstPosition = this.onClickPopToFirstPosition.bind(this);
41 42
     this.onClickPopToRoot = this.onClickPopToRoot.bind(this);
42 43
     this.onClickSetStackRoot = this.onClickSetStackRoot.bind(this);
43
-    this.state = { disabled: false };
44
+    this.state = {disabled: false};
44 45
   }
45 46
 
46 47
   simulateLongRunningTask() {
@@ -54,7 +55,7 @@ class PushedScreen extends Component {
54 55
     this.listeners.push(
55 56
       Navigation.events().registerComponentDidAppearListener((event) => {
56 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,7 +95,7 @@ class PushedScreen extends Component {
94 95
     );
95 96
   }
96 97
 
97
-  onClickShowPreview = async ({ reactTag }) => {
98
+  onClickShowPreview = async ({reactTag}) => {
98 99
     await Navigation.push(this.props.componentId, {
99 100
       component: {
100 101
         name: 'navigation.playground.PushedScreen',

+ 4
- 1
playground/src/screens/WelcomeScreen.js ファイルの表示

@@ -23,7 +23,10 @@ class WelcomeScreen extends Component {
23 23
           visible: false,
24 24
         },
25 25
         drawBehind: true,
26
-        visible: false,
26
+        background: {
27
+          color: 'transparent'
28
+        },
29
+        visible: true,
27 30
         animate: false
28 31
       }
29 32
     };