Skip to content

Commit 3196786

Browse files
authored
Merge pull request #87 from johakr/master
make compatible with react-native-web
2 parents 37d0a0f + 545441a commit 3196786

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

__tests__/helpers-test.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,24 @@ describe('helpers test', () => {
7070
expect(defaultTouchableProps).to.be.an('object');
7171
});
7272

73+
it('should create TouchableHighlight for web', () => {
74+
Platform.select.mockImplementationOnce(o => {
75+
return o.web;
76+
});
77+
const { Touchable, defaultTouchableProps } = makeTouchable();
78+
expect(Touchable).to.be.equal(TouchableHighlight);
79+
expect(defaultTouchableProps).to.be.an('object');
80+
});
81+
82+
it('should create TouchableHighlight for windows', () => {
83+
Platform.select.mockImplementationOnce(o => {
84+
return o.windows;
85+
});
86+
const { Touchable, defaultTouchableProps } = makeTouchable();
87+
expect(Touchable).to.be.equal(TouchableHighlight);
88+
expect(defaultTouchableProps).to.be.an('object');
89+
});
90+
7391
it('should return passed component', () => {
7492
const MyTouchable = () => null;
7593
const { Touchable, defaultTouchableProps } = makeTouchable(MyTouchable);

src/helpers.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ export const makeName = (function() {
2727
*/
2828
export function makeTouchable(TouchableComponent) {
2929
const Touchable = TouchableComponent || Platform.select({
30-
ios: TouchableHighlight,
3130
android: TouchableNativeFeedback,
31+
ios: TouchableHighlight,
32+
web: TouchableHighlight,
3233
windows:TouchableHighlight,
3334
});
3435
let defaultTouchableProps = {};

0 commit comments

Comments
 (0)