react-native-ui-lib 7.43.0-snapshot.7172 → 7.43.0-snapshot.7189
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 +1 -1
- package/src/components/checkbox/index.d.ts +0 -1
- package/src/components/checkbox/index.js +2 -4
- package/src/components/pageControl/index.js +6 -1
- package/src/components/radioButton/index.js +6 -8
- package/src/utils/styleUtils.d.ts +1 -0
- package/src/utils/styleUtils.js +3 -0
package/package.json
CHANGED
|
@@ -120,7 +120,6 @@ declare class Checkbox extends Component<CheckboxProps, CheckboxState> {
|
|
|
120
120
|
getLabelStyle: () => {
|
|
121
121
|
color: string;
|
|
122
122
|
};
|
|
123
|
-
getAccessibleHitSlop(size: number): number;
|
|
124
123
|
renderCheckbox(): React.JSX.Element;
|
|
125
124
|
render(): React.JSX.Element;
|
|
126
125
|
validate: () => boolean;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { Component } from 'react';
|
|
2
2
|
import { Animated, Easing, StyleSheet } from 'react-native';
|
|
3
3
|
import { Colors, Spacings } from "../../style";
|
|
4
|
+
import { StyleUtils } from "../../utils";
|
|
4
5
|
//@ts-ignore
|
|
5
6
|
import Assets from "../../assets";
|
|
6
7
|
import { asBaseComponent } from "../../commons/new";
|
|
@@ -146,9 +147,6 @@ class Checkbox extends Component {
|
|
|
146
147
|
color: this.props.disabled ? Colors.$textDisabled : this.state.showError ? Colors.$textDangerLight : Colors.$textDefault
|
|
147
148
|
};
|
|
148
149
|
};
|
|
149
|
-
getAccessibleHitSlop(size) {
|
|
150
|
-
return Math.max(0, (48 - size) / 2);
|
|
151
|
-
}
|
|
152
150
|
renderCheckbox() {
|
|
153
151
|
const {
|
|
154
152
|
selectedIcon,
|
|
@@ -161,7 +159,7 @@ class Checkbox extends Component {
|
|
|
161
159
|
} = this.props;
|
|
162
160
|
return (
|
|
163
161
|
//@ts-ignore
|
|
164
|
-
<TouchableOpacity {...this.getAccessibilityProps()} activeOpacity={1} testID={testID} {...others} style={[this.getBorderStyle(), style, !label && containerStyle]} onPress={this.onPress} hitSlop={
|
|
162
|
+
<TouchableOpacity {...this.getAccessibilityProps()} activeOpacity={1} testID={testID} {...others} style={[this.getBorderStyle(), style, !label && containerStyle]} onPress={this.onPress} hitSlop={StyleUtils.getAccessibleHitSlop(this.props.size || DEFAULT_SIZE)}>
|
|
165
163
|
{<Animated.View style={[this.styles.container, {
|
|
166
164
|
opacity: this.animationStyle.opacity
|
|
167
165
|
}, {
|
|
@@ -5,6 +5,7 @@ import React, { PureComponent } from 'react';
|
|
|
5
5
|
import { StyleSheet, LayoutAnimation } from 'react-native';
|
|
6
6
|
import { asBaseComponent } from "../../commons/new";
|
|
7
7
|
import { Colors } from "../../style";
|
|
8
|
+
import { StyleUtils } from "../../utils";
|
|
8
9
|
import TouchableOpacity from "../touchableOpacity";
|
|
9
10
|
import View from "../view";
|
|
10
11
|
const MAX_SHOWN_PAGES = 7;
|
|
@@ -135,9 +136,13 @@ class PageControl extends PureComponent {
|
|
|
135
136
|
onPagePress,
|
|
136
137
|
spacing = PageControl.DEFAULT_SPACING
|
|
137
138
|
} = this.props;
|
|
139
|
+
const hitSlopValue = StyleUtils.getAccessibleHitSlop(size);
|
|
138
140
|
return <TouchableOpacity customValue={index} onPress={onPagePress && this.onPagePress} key={index} style={[styles.pageIndicator, {
|
|
139
141
|
marginHorizontal: spacing / 2
|
|
140
|
-
}, getColorStyle(index === currentPage, color, inactiveColor), getSizeStyle(size, index, currentPage, enlargeActive)]}
|
|
142
|
+
}, getColorStyle(index === currentPage, color, inactiveColor), getSizeStyle(size, index, currentPage, enlargeActive)]} hitSlop={{
|
|
143
|
+
top: hitSlopValue,
|
|
144
|
+
bottom: hitSlopValue
|
|
145
|
+
}} />;
|
|
141
146
|
}
|
|
142
147
|
renderDifferentSizeIndicators() {
|
|
143
148
|
const {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { PureComponent } from 'react';
|
|
2
2
|
import { StyleSheet, Animated, Easing } from 'react-native';
|
|
3
3
|
import { Colors } from "../../style";
|
|
4
|
+
import { StyleUtils } from "../../utils";
|
|
4
5
|
import { asBaseComponent, forwardRef } from "../../commons/new";
|
|
5
6
|
import TouchableOpacity from "../touchableOpacity";
|
|
6
7
|
import View from "../view";
|
|
@@ -179,13 +180,6 @@ class RadioButton extends PureComponent {
|
|
|
179
180
|
}]} />
|
|
180
181
|
</View>;
|
|
181
182
|
}
|
|
182
|
-
getAccessibleHitSlop(size) {
|
|
183
|
-
const verticalPadding = Math.max(0, (48 - size) / 2);
|
|
184
|
-
return {
|
|
185
|
-
top: verticalPadding,
|
|
186
|
-
bottom: verticalPadding
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
183
|
render() {
|
|
190
184
|
const {
|
|
191
185
|
onPress,
|
|
@@ -195,9 +189,13 @@ class RadioButton extends PureComponent {
|
|
|
195
189
|
...others
|
|
196
190
|
} = this.props;
|
|
197
191
|
const Container = onPress || onValueChange ? TouchableOpacity : View;
|
|
192
|
+
const hitSlopValue = StyleUtils.getAccessibleHitSlop(this.props.size || DEFAULT_SIZE);
|
|
198
193
|
return (
|
|
199
194
|
// @ts-ignore
|
|
200
|
-
<Container row centerV activeOpacity={1} {...others} style={containerStyle} onPress={this.onPress} {...this.getAccessibilityProps()} hitSlop={
|
|
195
|
+
<Container row centerV activeOpacity={1} {...others} style={containerStyle} onPress={this.onPress} {...this.getAccessibilityProps()} hitSlop={{
|
|
196
|
+
top: hitSlopValue,
|
|
197
|
+
bottom: hitSlopValue
|
|
198
|
+
}}>
|
|
201
199
|
{!contentOnLeft && this.renderButton()}
|
|
202
200
|
{this.props.iconOnRight ? this.renderLabel() : this.renderIcon()}
|
|
203
201
|
{this.props.iconOnRight ? this.renderIcon() : this.renderLabel()}
|
package/src/utils/styleUtils.js
CHANGED