File tree 6 files changed +87
-4
lines changed
6 files changed +87
-4
lines changed Original file line number Diff line number Diff line change @@ -3,4 +3,5 @@ node_modules
3
3
.vscode
4
4
.idea /
5
5
build
6
- coverage
6
+ coverage
7
+ .jest-cache
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " react-native-material-tabs" ,
3
- "version" : " 4.1.1 " ,
3
+ "version" : " 4.1.2 " ,
4
4
"description" : " Material Design implementation of Tabs" ,
5
5
"keywords" : [
6
6
" react" ,
Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ const MaterialTabs: React.FC<Props> = ({
58
58
const bar = React . createRef < View > ( ) ;
59
59
60
60
const getTabWidth = useCallback (
61
- ( width : number ) => {
61
+ ( width : number = 0 ) => {
62
62
if ( ! scrollable ) {
63
63
setTabWidth ( width / items . length ) ;
64
64
}
Original file line number Diff line number Diff line change @@ -56,7 +56,6 @@ const Tab = ({
56
56
57
57
Tab . defaultProps = {
58
58
active : false ,
59
- onPress : ( ) => null ,
60
59
} ;
61
60
62
61
export default Tab ;
Original file line number Diff line number Diff line change
1
+ import React from 'react' ;
2
+ import { View } from 'react-native' ;
3
+ import { create } from 'react-test-renderer' ;
4
+
5
+ import Touchable from '../Touchable' ;
6
+
7
+ describe ( 'Touchable' , ( ) => {
8
+ it ( 'works on iOS' , ( ) => {
9
+ const tree = create (
10
+ < Touchable onPress = { ( ) => null } >
11
+ < View />
12
+ </ Touchable >
13
+ ) . toJSON ( ) ;
14
+
15
+ expect ( tree ) . toMatchSnapshot ( ) ;
16
+ } ) ;
17
+
18
+ it ( 'works on android' , ( ) => {
19
+ jest . mock ( 'Platform' , ( ) => ( {
20
+ OS : 'android' ,
21
+ } ) ) ;
22
+
23
+ const tree = create (
24
+ < Touchable onPress = { ( ) => null } >
25
+ < View />
26
+ </ Touchable >
27
+ ) . toJSON ( ) ;
28
+
29
+ expect ( tree ) . toMatchSnapshot ( ) ;
30
+ } ) ;
31
+ } ) ;
Original file line number Diff line number Diff line change
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports [` Touchable works on android 1` ] = `
4
+ <View
5
+ style = {
6
+ Array [
7
+ Object {
8
+ " alignItems" : " center" ,
9
+ " backgroundColor" : " #ffbcbc" ,
10
+ " borderColor" : " red" ,
11
+ " borderWidth" : 1 ,
12
+ " height" : 100 ,
13
+ " justifyContent" : " center" ,
14
+ " margin" : 10 ,
15
+ " width" : 300 ,
16
+ },
17
+ undefined ,
18
+ ]
19
+ }
20
+ >
21
+ <Text
22
+ style = {
23
+ Object {
24
+ " color" : " #333333" ,
25
+ " margin" : 20 ,
26
+ }
27
+ }
28
+ >
29
+ TouchableNativeFeedback is not supported on this platform!
30
+ </Text >
31
+ </View >
32
+ ` ;
33
+
34
+ exports [` Touchable works on iOS 1` ] = `
35
+ <View
36
+ accessible = { true }
37
+ isTVSelectable = { true }
38
+ onResponderGrant = { [Function ]}
39
+ onResponderMove = { [Function ]}
40
+ onResponderRelease = { [Function ]}
41
+ onResponderTerminate = { [Function ]}
42
+ onResponderTerminationRequest = { [Function ]}
43
+ onStartShouldSetResponder = { [Function ]}
44
+ style = {
45
+ Object {
46
+ " opacity" : 1 ,
47
+ }
48
+ }
49
+ >
50
+ <View />
51
+ </View >
52
+ ` ;
You can’t perform that action at this time.
0 commit comments