fix: Fix Touchable with href is still clickable if disabled#2299
fix: Fix Touchable with href is still clickable if disabled#2299rnike wants to merge 2 commits intonecolas:masterfrom
Conversation
|
The issue is because the href is still followed by the browser, so ideally there'd be no href set when the element is disabled. However, that does either require each Touchable/Pressable component to put some conditional logic around If we go with the |
|
@necolas I'm letting |
4c84fdf to
e8bc59a
Compare
|
This patch is included in the latest canary release: |
fix #2298
According to the implementation of
Viewreact-native-web/packages/react-native-web/src/exports/View/index.js
Lines 106 to 107 in dc9ecfb
divwill be changed toaifprops.hrefis provided, theawill be clickable no matter ifprops.disabledis true or not.TouchableHighlightandTouchableOpacityare both usingViewas a base componentreact-native-web/packages/react-native-web/src/exports/TouchableHighlight/index.js
Lines 164 to 165 in dc9ecfb
react-native-web/packages/react-native-web/src/exports/TouchableOpacity/index.js
Lines 123 to 124 in dc9ecfb
This PR will add
pointerEvents="none"to the component ifprops.disabledistrueinTouchableHighlightandTouchableOpacityto make them actually disabled.Tested on the example app and also our app.