Fix Option modal items tap effect off center (#2109)
* Fix Option modal items tap effect off center * Add snapshot
This commit is contained in:
parent
f71ea2814b
commit
a873640e41
4 changed files with 2844 additions and 14 deletions
File diff suppressed because it is too large
Load diff
43
app/screens/options_modal/option_modal_list.test.js
Normal file
43
app/screens/options_modal/option_modal_list.test.js
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
import React from 'react';
|
||||
import {shallow} from 'enzyme';
|
||||
|
||||
import OptionModalListIOS from './options_modal_list.ios';
|
||||
import OptionModalListAndroid from './options_modal_list.android';
|
||||
|
||||
describe('OptionModalList', () => {
|
||||
const baseProps = {
|
||||
items: [{
|
||||
action: jest.fn(),
|
||||
text: {
|
||||
id: 'mobile.file_upload.camera',
|
||||
defaultMessage: 'Take Photo or Video',
|
||||
},
|
||||
icon: 'camera',
|
||||
}, {
|
||||
action: jest.fn(),
|
||||
text: {
|
||||
id: 'mobile.file_upload.library',
|
||||
defaultMessage: 'Photo Library',
|
||||
},
|
||||
icon: 'photo',
|
||||
}],
|
||||
onCancelPress: jest.fn(),
|
||||
title: 'test',
|
||||
};
|
||||
|
||||
test('should match snapshot for iOS', async () => {
|
||||
const wrapper = shallow(
|
||||
<OptionModalListIOS {...baseProps}/>,
|
||||
);
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('should match snapshot for Android', async () => {
|
||||
const wrapper = shallow(
|
||||
<OptionModalListAndroid {...baseProps}/>,
|
||||
);
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
|
@ -43,20 +43,24 @@ export default class OptionsModalList extends PureComponent {
|
|||
}
|
||||
|
||||
return (
|
||||
<TouchableOpacity
|
||||
<View
|
||||
key={index}
|
||||
onPress={preventDoubleTap(item.action)}
|
||||
style={[style.option, style.optionBorder]}
|
||||
style={style.optionBorder}
|
||||
>
|
||||
{textComponent}
|
||||
{item.icon &&
|
||||
<TouchableOpacity
|
||||
onPress={preventDoubleTap(item.action)}
|
||||
style={style.option}
|
||||
>
|
||||
{textComponent}
|
||||
{item.icon &&
|
||||
<IconFont
|
||||
name={item.icon}
|
||||
size={18}
|
||||
style={style.optionIcon}
|
||||
/>
|
||||
}
|
||||
</TouchableOpacity>
|
||||
}
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
);
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -47,20 +47,24 @@ export default class OptionsModalList extends PureComponent {
|
|||
}
|
||||
|
||||
return (
|
||||
<TouchableOpacity
|
||||
<View
|
||||
key={index}
|
||||
onPress={preventDoubleTap(item.action)}
|
||||
style={[style.option, (index < items.length - 1 && style.optionBorder)]}
|
||||
style={(index < items.length - 1 && style.optionBorder)}
|
||||
>
|
||||
{textComponent}
|
||||
{item.icon &&
|
||||
<TouchableOpacity
|
||||
onPress={preventDoubleTap(item.action)}
|
||||
style={style.option}
|
||||
>
|
||||
{textComponent}
|
||||
{item.icon &&
|
||||
<IconFont
|
||||
name={item.icon}
|
||||
size={18}
|
||||
style={style.optionIcon}
|
||||
/>
|
||||
}
|
||||
</TouchableOpacity>
|
||||
}
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
);
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue