Browse Source

Fix navigation tool bar ios (#1941)

* remove unused code from tabStyle

* improve dummy screen ui

* set list screen translucent navigation bar

* make RCCToolBarView to composite the UIRootView inside
Ran Greenberg 7 years ago
parent
commit
e21c8ac718

+ 0
- 5
example/src/app.js View File

34
   animationType: Platform.OS === 'ios' ? 'slide-down' : 'fade',
34
   animationType: Platform.OS === 'ios' ? 'slide-down' : 'fade',
35
   tabsStyle: {
35
   tabsStyle: {
36
     tabBarBackgroundColor: '#003a66',
36
     tabBarBackgroundColor: '#003a66',
37
-    navBarButtonColor: '#ffffff',
38
     tabBarButtonColor: '#ffffff',
37
     tabBarButtonColor: '#ffffff',
39
-    navBarTextColor: '#ffffff',
40
     tabBarSelectedButtonColor: '#ff505c',
38
     tabBarSelectedButtonColor: '#ff505c',
41
-    navigationBarColor: '#003a66',
42
-    navBarBackgroundColor: '#003a66',
43
-    statusBarColor: '#002b4c',
44
     tabFontFamily: 'BioRhyme-Bold',
39
     tabFontFamily: 'BioRhyme-Bold',
45
   },
40
   },
46
   appStyle: {
41
   appStyle: {

+ 29
- 3
example/src/screens/types/DummyScreen.js View File

6
   Dimensions,
6
   Dimensions,
7
   Text,
7
   Text,
8
   StyleSheet,
8
   StyleSheet,
9
-  Button
9
+  Button,
10
+  PixelRatio
10
 } from 'react-native';
11
 } from 'react-native';
12
+import {NavigationToolBarIOS} from 'react-native-navigation';
11
 
13
 
14
+const {width} = Dimensions.get('window');
12
 
15
 
13
-class ListScreen extends Component {
16
+
17
+class DummyScreen extends Component {
18
+
19
+  static navigatorStyle = {
20
+    drawUnderNavBar: true,
21
+    navBarTranslucent:true,
22
+    navBarNoBorder: true,
23
+    navBarTextColor: 'black',
24
+    navBarButtonColor: 'black',
25
+
26
+  };
14
 
27
 
15
   render(){
28
   render(){
16
     return (
29
     return (
20
         <Text>🤗</Text>
33
         <Text>🤗</Text>
21
         <Text>{this.props.text}</Text>
34
         <Text>{this.props.text}</Text>
22
 
35
 
36
+        <NavigationToolBarIOS key='segmented' translucent={true} style={styles.toolBarStyle}>
37
+          <Button title={"I Am NavigationToolBarIOS, Press Me"} onPress={() => alert('Thank You')}/>
38
+        </NavigationToolBarIOS>
39
+
23
 
40
 
24
       </View>
41
       </View>
25
     );
42
     );
30
   cellContainer: {
47
   cellContainer: {
31
     flex: 1,
48
     flex: 1,
32
     paddingVertical: 30,
49
     paddingVertical: 30,
50
+  },
51
+  toolBarStyle: {
52
+    top: 64,
53
+    width: width,
54
+    position: 'absolute',
55
+    borderTopWidth: 0,
56
+    height: 66,
57
+    backgroundColor: 'transparent'
58
+
33
   }
59
   }
34
 });
60
 });
35
 
61
 
36
 
62
 
37
 
63
 
38
-module.exports = ListScreen;
64
+module.exports = DummyScreen;

+ 11
- 3
example/src/screens/types/ListScreen.js View File

31
   "#bdc3c7",
31
   "#bdc3c7",
32
   "#7f8c8d"
32
   "#7f8c8d"
33
 ];
33
 ];
34
-const {height, width} = Dimensions.get('window');
35
 
34
 
36
 class ListScreen extends Component {
35
 class ListScreen extends Component {
36
+  static navigatorStyle = {
37
+    drawUnderNavBar: true,
38
+    navBarTranslucent:true,
39
+    navBarButtonColor: 'black',
40
+    navBarTextColor: 'black'
41
+
42
+  };
43
+
37
   constructor(props){
44
   constructor(props){
38
     super(props);
45
     super(props);
39
     this.data = [];
46
     this.data = [];
57
   render(){
64
   render(){
58
     return (
65
     return (
59
       <ScrollView
66
       <ScrollView
60
-        style={[{flex: 1, backgroundColor: 'transparent',}]}
67
+        style={[{flex: 1, backgroundColor: 'transparent'}]}
61
         scrollEnabled={true}
68
         scrollEnabled={true}
62
         scrollsToTop={false}
69
         scrollsToTop={false}
63
         scrollEventThrottle={100}
70
         scrollEventThrottle={100}
64
         automaticallyAdjustContentInsets={false}
71
         automaticallyAdjustContentInsets={false}
65
         directionalLockEnabled={true}
72
         directionalLockEnabled={true}
66
         showsHorizontalScrollIndicator={false}
73
         showsHorizontalScrollIndicator={false}
67
-        showsVerticalScrollIndicator={false}>
74
+        showsVerticalScrollIndicator={false}
75
+        contentOffset={{y: -64}}>
68
 
76
 
69
 
77
 
70
         {_.map(this.data, (o, i) => {
78
         {_.map(this.data, (o, i) => {

+ 14
- 4
ios/RCCToolBar/RCCToolBar.m View File

8
 
8
 
9
 #import "RCCToolBar.h"
9
 #import "RCCToolBar.h"
10
 
10
 
11
-@interface RCCToolBarView : UIToolbar
11
+@interface RCCToolBarView : UIView
12
 
12
 
13
 @property (nonatomic) BOOL toolBarTranslucent;
13
 @property (nonatomic) BOOL toolBarTranslucent;
14
+@property (nonatomic, strong) UIToolbar *toolbar;
14
 
15
 
15
 @end
16
 @end
16
 
17
 
22
     self = [super init];
23
     self = [super init];
23
     if (self)
24
     if (self)
24
     {
25
     {
25
-        self.toolBarTranslucent = self.translucent;
26
+        self.toolBarTranslucent = self.toolbar.translucent;
27
+        self.backgroundColor = [UIColor clearColor];
28
+        self.toolbar = [[UIToolbar alloc] init];
29
+        [self addSubview:self.toolbar];
26
     }
30
     }
27
     return self;
31
     return self;
28
 }
32
 }
31
 -(void)didMoveToWindow
35
 -(void)didMoveToWindow
32
 {
36
 {
33
     [super didMoveToWindow];
37
     [super didMoveToWindow];
34
-    self.translucent = self.toolBarTranslucent;
38
+    self.toolbar.translucent = self.toolBarTranslucent;
39
+}
40
+
41
+-(void)reactSetFrame:(CGRect)frame {
42
+    [super reactSetFrame:frame];
43
+    
44
+    self.toolbar.frame = self.bounds;
35
 }
45
 }
36
 
46
 
37
 @end
47
 @end
54
 }
64
 }
55
 
65
 
56
 
66
 
57
-@end
67
+@end