react-native-ui-lib 7.38.0-snapshot.6272 → 7.38.0-snapshot.6282

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/.eslintrc.js CHANGED
@@ -8,13 +8,6 @@ module.exports = {
8
8
  'no-undef': 'off',
9
9
  /* Other Rules */
10
10
  'no-unused-expressions': 'off',
11
- 'no-restricted-syntax': [
12
- 'error',
13
- {
14
- selector: `CallExpression[callee.object.name='console'][callee.property.name='error']`,
15
- message: 'Using console.error is not allowed as it is sent to Sentry, please use LogService.error instead'
16
- }
17
- ],
18
11
  'arrow-parens': 'off',
19
12
  // TODO: remove after migration of legacy lifecycle methods
20
13
  camelcase: 'off',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-ui-lib",
3
- "version": "7.38.0-snapshot.6272",
3
+ "version": "7.38.0-snapshot.6282",
4
4
  "main": "src/index.js",
5
5
  "types": "src/index.d.ts",
6
6
  "author": "Ethan Sharabi <ethan.shar@gmail.com>",
@@ -15,7 +15,6 @@ import { BlurViewPackage } from "../../optionalDependencies";
15
15
  import Assets from "../../assets";
16
16
  import CardContext from "./CardContext";
17
17
  import * as CardPresenter from "./CardPresenter";
18
- import { LogService } from "../../services";
19
18
  const BlurView = BlurViewPackage?.BlurView;
20
19
  const DEFAULT_BORDER_RADIUS = BorderRadiuses.br40;
21
20
  const DEFAULT_SELECTION_PROPS = {
@@ -48,8 +47,7 @@ class Card extends PureComponent {
48
47
  };
49
48
  this.styles = createStyles(this.props);
50
49
  if (props.enableBlur && !BlurView) {
51
- // eslint-disable-next-line max-len
52
- LogService.error(`RNUILib Card's "enableBlur" prop requires installing "@react-native-community/blur" dependency`);
50
+ console.error(`RNUILib Card's "enableBlur" prop requires installing "@react-native-community/blur" dependency`);
53
51
  }
54
52
  }
55
53
  componentDidUpdate(prevProps) {
@@ -117,6 +117,7 @@ declare class Checkbox extends Component<CheckboxProps, CheckboxState> {
117
117
  getLabelStyle: () => {
118
118
  color: string;
119
119
  };
120
+ getAccessibleHitSlop(size: number): number;
120
121
  renderCheckbox(): React.JSX.Element;
121
122
  render(): React.JSX.Element;
122
123
  validate: () => void;
@@ -144,6 +144,9 @@ class Checkbox extends Component {
144
144
  color: this.props.disabled ? Colors.$textDisabled : this.state.showError ? Colors.$textDangerLight : Colors.$textDefault
145
145
  };
146
146
  };
147
+ getAccessibleHitSlop(size) {
148
+ return Math.max(0, (48 - size) / 2);
149
+ }
147
150
  renderCheckbox() {
148
151
  const {
149
152
  selectedIcon,
@@ -156,7 +159,7 @@ class Checkbox extends Component {
156
159
  } = this.props;
157
160
  return (
158
161
  //@ts-ignore
159
- <TouchableOpacity {...this.getAccessibilityProps()} activeOpacity={1} testID={testID} {...others} style={[this.getBorderStyle(), style, !label && containerStyle]} onPress={this.onPress}>
162
+ <TouchableOpacity {...this.getAccessibilityProps()} activeOpacity={1} testID={testID} {...others} style={[this.getBorderStyle(), style, !label && containerStyle]} onPress={this.onPress} hitSlop={this.getAccessibleHitSlop(this.props.size || DEFAULT_SIZE)}>
160
163
  {<Animated.View style={[this.styles.container, {
161
164
  opacity: this.animationStyle.opacity
162
165
  }, {
@@ -7,7 +7,6 @@ import { Colors, Typography } from "../../style";
7
7
  import TouchableOpacity from "../touchableOpacity";
8
8
  import View from "../view";
9
9
  import { Constants, asBaseComponent } from "../../commons/new";
10
- import { LogService } from "../../services";
11
10
  import { ConnectionStatusBarProps, DEFAULT_PROPS } from "./types";
12
11
  export { ConnectionStatusBarProps };
13
12
 
@@ -37,8 +36,7 @@ class ConnectionStatusBar extends PureComponent {
37
36
  if (NetInfo) {
38
37
  this.getInitialConnectionState();
39
38
  } else {
40
- // eslint-disable-next-line max-len
41
- LogService.error(`RNUILib ConnectionStatusBar component requires installing "@react-native-community/netinfo" dependency`);
39
+ console.error(`RNUILib ConnectionStatusBar component requires installing "@react-native-community/netinfo" dependency`);
42
40
  }
43
41
  }
44
42
  generateStyles() {
@@ -11,7 +11,6 @@ import Button from "../button";
11
11
  import ExpandableOverlay from "../../incubator/expandableOverlay";
12
12
  import useOldApi from "./useOldApi";
13
13
  import { isSameDate, isSameHourAndMinute } from "../../utils/dateUtils";
14
- import { LogService } from "../../services";
15
14
  /*eslint-disable*/
16
15
  /**
17
16
  * @description: Date and Time Picker Component that wraps RNDateTimePicker for date and time modes.
@@ -65,7 +64,7 @@ const DateTimePicker = forwardRef((props, ref) => {
65
64
  useEffect(() => {
66
65
  if (!RNDateTimePicker) {
67
66
  // eslint-disable-next-line max-len
68
- LogService.error(`RNUILib DateTimePicker component requires installing "@react-native-community/datetimepicker" dependency`);
67
+ console.error(`RNUILib DateTimePicker component requires installing "@react-native-community/datetimepicker" dependency`);
69
68
  }
70
69
  }, []);
71
70
  useDidUpdate(() => {
@@ -1,7 +1,6 @@
1
1
  // TODO: delete whole file in v8
2
2
  import { useEffect } from 'react';
3
3
  import { MomentPackage as moment } from "../../optionalDependencies";
4
- import { LogService } from "../../services";
5
4
 
6
5
  // This file will be deleted in the next major version,
7
6
  // duplicating these here will make this less complicated
@@ -16,8 +15,7 @@ const useOldApi = props => {
16
15
  } = props;
17
16
  useEffect(() => {
18
17
  if (!moment && (dateFormat || timeFormat)) {
19
- // eslint-disable-next-line max-len
20
- LogService.error(`RNUILib DateTimePicker component with date/time format requires installing "moment" dependency`);
18
+ console.error(`RNUILib DateTimePicker component with date/time format requires installing "moment" dependency`);
21
19
  }
22
20
  }, [dateFormat, timeFormat]);
23
21
  const getStringValue = (value, mode) => {
@@ -6,7 +6,6 @@ import { BlurViewPackage } from "../../optionalDependencies";
6
6
  import { Constants, asBaseComponent } from "../../commons/new";
7
7
  import TopBar, { ModalTopBarProps } from "./TopBar";
8
8
  import View from "../../components/view";
9
- import { LogService } from "../../services";
10
9
  const BlurView = BlurViewPackage?.BlurView;
11
10
  export { ModalTopBarProps };
12
11
  /**
@@ -21,8 +20,7 @@ class Modal extends Component {
21
20
  constructor(props) {
22
21
  super(props);
23
22
  if (props.enableModalBlur && !BlurView) {
24
- // eslint-disable-next-line max-len
25
- LogService.error(`RNUILib Modal's "enableModalBlur" prop requires installing "@react-native-community/blur" dependency`);
23
+ console.error(`RNUILib Modal's "enableModalBlur" prop requires installing "@react-native-community/blur" dependency`);
26
24
  }
27
25
  }
28
26
  renderTouchableOverlay() {
@@ -6,7 +6,6 @@ const {
6
6
  Svg,
7
7
  Path
8
8
  } = SvgPackage;
9
- import { LogService } from "../../services";
10
9
  const DEFAULT_DIAMETER = 144;
11
10
  const PieChart = props => {
12
11
  const {
@@ -15,7 +14,7 @@ const PieChart = props => {
15
14
  ...others
16
15
  } = props;
17
16
  if (!Svg || !Path) {
18
- LogService.error(`RNUILib PieChart requires installing "@react-native-svg" dependency`);
17
+ console.error(`RNUILib PieChart requires installing "@react-native-svg" dependency`);
19
18
  return null;
20
19
  }
21
20
  const renderPieSegments = () => {
@@ -179,6 +179,13 @@ class RadioButton extends PureComponent {
179
179
  }]} />
180
180
  </View>;
181
181
  }
182
+ getAccessibleHitSlop(size) {
183
+ const verticalPadding = Math.max(0, (48 - size) / 2);
184
+ return {
185
+ top: verticalPadding,
186
+ bottom: verticalPadding
187
+ };
188
+ }
182
189
  render() {
183
190
  const {
184
191
  onPress,
@@ -190,7 +197,7 @@ class RadioButton extends PureComponent {
190
197
  const Container = onPress || onValueChange ? TouchableOpacity : View;
191
198
  return (
192
199
  // @ts-ignore
193
- <Container row centerV activeOpacity={1} {...others} style={containerStyle} onPress={this.onPress} {...this.getAccessibilityProps()}>
200
+ <Container row centerV activeOpacity={1} {...others} style={containerStyle} onPress={this.onPress} {...this.getAccessibilityProps()} hitSlop={this.getAccessibleHitSlop(this.props.size || DEFAULT_SIZE)}>
194
201
  {!contentOnLeft && this.renderButton()}
195
202
  {this.props.iconOnRight ? this.renderLabel() : this.renderIcon()}
196
203
  {this.props.iconOnRight ? this.renderIcon() : this.renderLabel()}
@@ -9,7 +9,6 @@ import { BorderRadiuses, Colors, Dividers, Spacings } from "../../style";
9
9
  import { createShimmerPlaceholder, LinearGradientPackage } from "../../optionalDependencies";
10
10
  import View from "../view";
11
11
  import { Constants } from "../../commons/new";
12
- import { LogService } from "../../services";
13
12
  const LinearGradient = LinearGradientPackage?.default;
14
13
  let ShimmerPlaceholder;
15
14
  const ANIMATION_DURATION = 400;
@@ -63,9 +62,9 @@ class SkeletonView extends Component {
63
62
  opacity: new Animated.Value(0)
64
63
  };
65
64
  if (_isUndefined(LinearGradientPackage?.default)) {
66
- LogService.error(`RNUILib SkeletonView's requires installing "react-native-linear-gradient" dependency`);
65
+ console.error(`RNUILib SkeletonView's requires installing "react-native-linear-gradient" dependency`);
67
66
  } else if (_isUndefined(createShimmerPlaceholder)) {
68
- LogService.error(`RNUILib SkeletonView's requires installing "react-native-shimmer-placeholder" dependency`);
67
+ console.error(`RNUILib SkeletonView's requires installing "react-native-shimmer-placeholder" dependency`);
69
68
  } else if (ShimmerPlaceholder === undefined) {
70
69
  ShimmerPlaceholder = createShimmerPlaceholder(LinearGradient);
71
70
  }
@@ -1,7 +1,6 @@
1
1
  import React from 'react';
2
2
  import { isSvg, isSvgUri } from "../../utils/imageUtils";
3
3
  import { SvgPackage, SvgCssUri } from "../../optionalDependencies";
4
- import { LogService } from "../../services";
5
4
  const SvgXml = SvgPackage?.SvgXml;
6
5
  // const SvgProps = SvgPackage?.SvgProps; TODO: not sure how (or if) we can use their props
7
6
 
@@ -15,7 +14,7 @@ function SvgImage(props) {
15
14
  } = props;
16
15
  if (!SvgXml) {
17
16
  // eslint-disable-next-line max-len
18
- LogService.error(`RNUILib Image "svg" prop requires installing "react-native-svg" and "react-native-svg-transformer" dependencies`);
17
+ console.error(`RNUILib Image "svg" prop requires installing "react-native-svg" and "react-native-svg-transformer" dependencies`);
19
18
  return null;
20
19
  }
21
20
  if (isSvgUri(data)) {
@@ -1,5 +1,4 @@
1
1
  import { interpolate } from 'react-native-reanimated';
2
- import { LogService } from "../../services";
3
2
  export function getOffsetForValue(value, span, minimumValue = 0, maximumValue = 1) {
4
3
  const range = maximumValue - minimumValue;
5
4
  const relativeValue = minimumValue - value;
@@ -44,21 +43,15 @@ export function validateValues(props) {
44
43
  initialMaximumValue
45
44
  } = props;
46
45
  if (minimumValue > maximumValue || useRange && initialMinimumValue && initialMaximumValue && initialMinimumValue > initialMaximumValue) {
47
- LogService.forwardError({
48
- message: 'Your passed values are invalid. Please check if minimum values are not higher than maximum values'
49
- });
46
+ console.error('Your passed values are invalid. Please check if minimum values are not higher than maximum values');
50
47
  }
51
48
  if (value !== undefined && minimumValue && maximumValue && !inRange(value, minimumValue, maximumValue)) {
52
- LogService.forwardError({
53
- message: `Your passed value (${value}) is invalid.
54
- Please check that it is in range of the minimum (${minimumValue}) and maximum (${maximumValue}) values`
55
- });
49
+ console.error(`Your passed value (${value}) is invalid.
50
+ Please check that it is in range of the minimum (${minimumValue}) and maximum (${maximumValue}) values`);
56
51
  }
57
52
  if (useRange && initialMinimumValue && initialMaximumValue) {
58
53
  if (!inRange(initialMinimumValue, minimumValue, maximumValue) || !inRange(initialMaximumValue, minimumValue, maximumValue)) {
59
- LogService.forwardError({
60
- message: 'Your passed values are invalid. Please check that they are in range of the minimum and maximum values'
61
- });
54
+ console.error('Your passed values are invalid. Please check that they are in range of the minimum and maximum values');
62
55
  }
63
56
  }
64
57
  }
@@ -1,5 +1,4 @@
1
1
  import { HapticFeedbackPackage } from "../optionalDependencies";
2
- import { LogService } from "./";
3
2
  const options = {
4
3
  enableVibrateFallback: false,
5
4
  ignoreAndroidSystemSettings: false
@@ -18,7 +17,7 @@ function triggerHaptic(hapticType, componentName) {
18
17
  if (HapticFeedbackPackage) {
19
18
  HapticFeedbackPackage.trigger(hapticType, options);
20
19
  } else {
21
- LogService.error(`RNUILib ${componentName}'s requires installing "react-native-haptic-feedback" dependency`);
20
+ console.error(`RNUILib ${componentName}'s requires installing "react-native-haptic-feedback" dependency`);
22
21
  }
23
22
  }
24
23
  export default {
@@ -1,15 +1,12 @@
1
1
  interface BILogger {
2
2
  log: (event: any) => void;
3
3
  }
4
- declare class LogService<ErrorInfo extends {
5
- message: string;
6
- }> {
4
+ declare class LogService {
7
5
  private biLogger;
8
6
  injectBILogger: (biLogger: BILogger) => void;
9
7
  logBI: (event: any) => void;
10
8
  warn: (message?: any, ...optionalParams: any[]) => void;
11
9
  error: (message?: any, ...optionalParams: any[]) => void;
12
- forwardError: (errorInfo: ErrorInfo) => void;
13
10
  deprecationWarn: ({ component, oldProp, newProp }: {
14
11
  component: string;
15
12
  oldProp: string;
@@ -29,7 +26,5 @@ declare class LogService<ErrorInfo extends {
29
26
  newComponent: string;
30
27
  }) => void;
31
28
  }
32
- declare const _default: LogService<{
33
- message: string;
34
- }>;
29
+ declare const _default: LogService;
35
30
  export default _default;
@@ -12,14 +12,9 @@ class LogService {
12
12
  };
13
13
  error = (message, ...optionalParams) => {
14
14
  if (__DEV__) {
15
- // eslint-disable-next-line no-restricted-syntax
16
15
  console.error(message, ...optionalParams);
17
16
  }
18
17
  };
19
- forwardError = errorInfo => {
20
- // eslint-disable-next-line no-restricted-syntax
21
- console.error(errorInfo.message);
22
- };
23
18
  deprecationWarn = ({
24
19
  component,
25
20
  oldProp,