git ssb

1+

Daan Patchwork / manyverse



Commit a2aeaf3987d8da62974964fcab5948ef6deef6ae

dx: [ios] fix ToggleButton's touchables

Andre Staltz committed on 1/4/2020, 2:37:13 PM
Parent: 422ca0486fe96d4d967d40fdeb5944843152e4f4

Files changed

src/frontend/components/ToggleButton.tschanged
src/frontend/components/ToggleButton.tsView
@@ -12,14 +12,21 @@
1212 StyleProp,
1313 ViewStyle,
1414 StyleSheet,
1515 TextStyle,
16+ Platform,
17+ TouchableOpacity,
1618 } from 'react-native';
1719 import {Palette} from '../global-styles/palette';
1820 import {h} from '@cycle/react';
1921 import {Typography} from '../global-styles/typography';
2022 import {Dimensions} from '../global-styles/dimens';
2123
24+const Touchable = Platform.select<any>({
25+ android: TouchableNativeFeedback,
26+ default: TouchableOpacity,
27+});
28+
2229 export const baseContainerStyle = {
2330 borderTopLeftRadius: 3,
2431 borderTopRightRadius: 3,
2532 borderBottomLeftRadius: 3,
@@ -118,14 +125,16 @@
118125 if (toggled === 'maybe' || toggled === 'yes') {
119126 textStyle = styles.textToggled;
120127 }
121128
122- const touchableProps = {
123- background: TouchableNativeFeedback.SelectableBackground(),
129+ const touchableProps: any = {
124130 onPress: () => this._onPress(),
125131 };
132+ if (Platform.OS === 'android') {
133+ touchableProps.background = TouchableNativeFeedback.SelectableBackground();
134+ }
126135
127- return h(TouchableNativeFeedback, touchableProps, [
136+ return h(Touchable, touchableProps, [
128137 h(View, {style: [containerStyle, style]}, [
129138 h(Text, {style: textStyle}, text),
130139 ]),
131140 ]);

Built with git-ssb-web