Skip to content

Commit e7648e0

Browse files
authored
v4.1.2 #68
2 parents 72e1bff + b93f4ae commit e7648e0

File tree

6 files changed

+87
-4
lines changed

6 files changed

+87
-4
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ node_modules
33
.vscode
44
.idea/
55
build
6-
coverage
6+
coverage
7+
.jest-cache

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-material-tabs",
3-
"version": "4.1.1",
3+
"version": "4.1.2",
44
"description": "Material Design implementation of Tabs",
55
"keywords": [
66
"react",

src/components/MaterialTabs.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ const MaterialTabs: React.FC<Props> = ({
5858
const bar = React.createRef<View>();
5959

6060
const getTabWidth = useCallback(
61-
(width: number) => {
61+
(width: number = 0) => {
6262
if (!scrollable) {
6363
setTabWidth(width / items.length);
6464
}

src/components/Tab/Tab.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ const Tab = ({
5656

5757
Tab.defaultProps = {
5858
active: false,
59-
onPress: () => null,
6059
};
6160

6261
export default Tab;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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 numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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+
`;

0 commit comments

Comments
 (0)