make compatible with react-native-web
This commit is contained in:
parent
37d0a0f8e1
commit
545441a47a
|
@ -70,6 +70,24 @@ describe('helpers test', () => {
|
|||
expect(defaultTouchableProps).to.be.an('object');
|
||||
});
|
||||
|
||||
it('should create TouchableHighlight for web', () => {
|
||||
Platform.select.mockImplementationOnce(o => {
|
||||
return o.web;
|
||||
});
|
||||
const { Touchable, defaultTouchableProps } = makeTouchable();
|
||||
expect(Touchable).to.be.equal(TouchableHighlight);
|
||||
expect(defaultTouchableProps).to.be.an('object');
|
||||
});
|
||||
|
||||
it('should create TouchableHighlight for windows', () => {
|
||||
Platform.select.mockImplementationOnce(o => {
|
||||
return o.windows;
|
||||
});
|
||||
const { Touchable, defaultTouchableProps } = makeTouchable();
|
||||
expect(Touchable).to.be.equal(TouchableHighlight);
|
||||
expect(defaultTouchableProps).to.be.an('object');
|
||||
});
|
||||
|
||||
it('should return passed component', () => {
|
||||
const MyTouchable = () => null;
|
||||
const { Touchable, defaultTouchableProps } = makeTouchable(MyTouchable);
|
||||
|
|
|
@ -27,8 +27,9 @@ export const makeName = (function() {
|
|||
*/
|
||||
export function makeTouchable(TouchableComponent) {
|
||||
const Touchable = TouchableComponent || Platform.select({
|
||||
ios: TouchableHighlight,
|
||||
android: TouchableNativeFeedback,
|
||||
ios: TouchableHighlight,
|
||||
web: TouchableHighlight,
|
||||
windows:TouchableHighlight,
|
||||
});
|
||||
let defaultTouchableProps = {};
|
||||
|
|
Loading…
Reference in New Issue