File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change 4
4
View ,
5
5
TouchableOpacity ,
6
6
StyleSheet ,
7
+ ViewPropTypes ,
7
8
} from 'react-native' ;
8
9
import { RkTab } from './rkTab.component' ;
9
10
@@ -12,6 +13,7 @@ export class RkTabBar extends React.Component {
12
13
children : PropTypes . arrayOf ( PropTypes . instanceOf ( RkTab ) ) . isRequired ,
13
14
selectedIndex : PropTypes . number ,
14
15
onSelect : PropTypes . func ,
16
+ ...ViewPropTypes ,
15
17
} ;
16
18
static defaultProps = {
17
19
selectedIndex : 0 ,
@@ -27,21 +29,24 @@ export class RkTabBar extends React.Component {
27
29
} ;
28
30
29
31
renderChild = ( item , index ) => (
30
- < TouchableOpacity key = { index . toString ( ) } onPress = { ( ) => this . onChildPress ( index ) } >
32
+ < TouchableOpacity
33
+ key = { index . toString ( ) }
34
+ activeOpacity = { 0.5 }
35
+ onPress = { ( ) => this . onChildPress ( index ) } >
31
36
{ React . cloneElement ( item , { isSelected : this . props . selectedIndex === index } ) }
32
37
</ TouchableOpacity >
33
38
) ;
34
39
35
40
renderChildComponents = ( ) => this . props . children . map ( this . renderChild ) ;
36
41
37
42
render = ( ) => (
38
- < View style = { styles . container } > { this . renderChildComponents ( ) } </ View >
43
+ < View style = { [ this . props . style , styles . container ] } > { this . renderChildComponents ( ) } </ View >
39
44
) ;
40
45
}
41
46
42
47
const styles = StyleSheet . create ( {
43
48
container : {
44
49
flexDirection : 'row' ,
45
- justifyContent : 'space-between ' ,
50
+ justifyContent : 'space-around ' ,
46
51
} ,
47
52
} ) ;
You can’t perform that action at this time.
0 commit comments