react-native-ui-lib 7.37.2-snapshot.6173 → 7.37.2-snapshot.6204

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-ui-lib",
3
- "version": "7.37.2-snapshot.6173",
3
+ "version": "7.37.2-snapshot.6204",
4
4
  "main": "src/index.js",
5
5
  "types": "src/index.d.ts",
6
6
  "author": "Ethan Sharabi <ethan.shar@gmail.com>",
@@ -111,13 +111,27 @@ class Switch extends Component {
111
111
  };
112
112
  return <Animated.View style={[this.styles.thumb, thumbPositionStyle, thumbStyle]} />;
113
113
  }
114
+ getAccessibleHitSlop() {
115
+ const {
116
+ width = DEFAULT_WIDTH,
117
+ height = DEFAULT_HEIGHT
118
+ } = this.props;
119
+ const verticalPadding = Math.max(0, (48 - height) / 2);
120
+ const horizontalPadding = Math.max(0, (48 - width) / 2);
121
+ return {
122
+ top: verticalPadding,
123
+ bottom: verticalPadding,
124
+ left: horizontalPadding,
125
+ right: horizontalPadding
126
+ };
127
+ }
114
128
  render() {
115
129
  const {
116
130
  ...others
117
131
  } = this.props;
118
132
  return (
119
133
  // @ts-ignore
120
- <TouchableOpacity {...this.getAccessibilityProps()} activeOpacity={1} {...others} style={this.getSwitchStyle()} onPress={this.onPress}>
134
+ <TouchableOpacity {...this.getAccessibilityProps()} activeOpacity={1} hitSlop={this.getAccessibleHitSlop()} {...others} style={this.getSwitchStyle()} onPress={this.onPress}>
121
135
  {this.renderThumb()}
122
136
  </TouchableOpacity>
123
137
  );