Skip to content

Commit

Permalink
v4.1.2 #68
Browse files Browse the repository at this point in the history
  • Loading branch information
iRoachie authored Sep 29, 2019
2 parents 72e1bff + b93f4ae commit e7648e0
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ node_modules
.vscode
.idea/
build
coverage
coverage
.jest-cache
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-material-tabs",
"version": "4.1.1",
"version": "4.1.2",
"description": "Material Design implementation of Tabs",
"keywords": [
"react",
Expand Down
2 changes: 1 addition & 1 deletion src/components/MaterialTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const MaterialTabs: React.FC<Props> = ({
const bar = React.createRef<View>();

const getTabWidth = useCallback(
(width: number) => {
(width: number = 0) => {
if (!scrollable) {
setTabWidth(width / items.length);
}
Expand Down
1 change: 0 additions & 1 deletion src/components/Tab/Tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ const Tab = ({

Tab.defaultProps = {
active: false,
onPress: () => null,
};

export default Tab;
31 changes: 31 additions & 0 deletions src/components/__tests__/Touchable.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import React from 'react';
import { View } from 'react-native';
import { create } from 'react-test-renderer';

import Touchable from '../Touchable';

describe('Touchable', () => {
it('works on iOS', () => {
const tree = create(
<Touchable onPress={() => null}>
<View />
</Touchable>
).toJSON();

expect(tree).toMatchSnapshot();
});

it('works on android', () => {
jest.mock('Platform', () => ({
OS: 'android',
}));

const tree = create(
<Touchable onPress={() => null}>
<View />
</Touchable>
).toJSON();

expect(tree).toMatchSnapshot();
});
});
52 changes: 52 additions & 0 deletions src/components/__tests__/__snapshots__/Touchable.test.tsx.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Touchable works on android 1`] = `
<View
style={
Array [
Object {
"alignItems": "center",
"backgroundColor": "#ffbcbc",
"borderColor": "red",
"borderWidth": 1,
"height": 100,
"justifyContent": "center",
"margin": 10,
"width": 300,
},
undefined,
]
}
>
<Text
style={
Object {
"color": "#333333",
"margin": 20,
}
}
>
TouchableNativeFeedback is not supported on this platform!
</Text>
</View>
`;

exports[`Touchable works on iOS 1`] = `
<View
accessible={true}
isTVSelectable={true}
onResponderGrant={[Function]}
onResponderMove={[Function]}
onResponderRelease={[Function]}
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={
Object {
"opacity": 1,
}
}
>
<View />
</View>
`;

0 comments on commit e7648e0

Please sign in to comment.