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

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.6285",
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) {
@@ -1,6 +1,21 @@
1
1
  import React from 'react';
2
2
  import { StyleProp, ViewStyle } from 'react-native';
3
3
  import { DialogProps } from '../../incubator/dialog';
4
+ import { ButtonProps } from '../button';
5
+ type ColorPickerHeaderButtonProps = {
6
+ /**
7
+ * Ok (v) button color
8
+ */
9
+ doneButtonColor?: string;
10
+ /**
11
+ * Done button props
12
+ */
13
+ doneButtonProps?: Pick<ButtonProps, 'iconSource' | 'iconStyle'>;
14
+ /**
15
+ * Dismiss button props
16
+ */
17
+ dismissButtonProps?: Pick<ButtonProps, 'iconSource' | 'iconStyle'>;
18
+ };
4
19
  export interface ColorPickerDialogProps extends DialogProps {
5
20
  /**
6
21
  * The initial color to pass the picker dialog
@@ -21,15 +36,21 @@ export interface ColorPickerDialogProps extends DialogProps {
21
36
  /**
22
37
  * Accessibility labels as an object of strings, ex. {addButton: 'add custom color using hex code', dismissButton: 'dismiss', doneButton: 'done', input: 'custom hex color code'}
23
38
  */
24
- /**
25
- * Ok (v) button color
26
- */
27
- doneButtonColor?: string;
28
39
  accessibilityLabels?: {
29
40
  dismissButton?: string;
30
41
  doneButton?: string;
31
42
  input?: string;
32
43
  };
44
+ /**
45
+ * @deprecated
46
+ * Ok (v) button color
47
+ * Pass doneButtonColor via colorPickerHeaderProps
48
+ */
49
+ doneButtonColor?: string;
50
+ /**
51
+ * Color Picker header button props, done and dismiss button customize props
52
+ */
53
+ colorPickerHeaderProps?: ColorPickerHeaderButtonProps;
33
54
  /**
34
55
  * Whether to use the new Slider implementation using Reanimated
35
56
  */
@@ -8,6 +8,9 @@ import { getColorValue, getValidColorString, getTextColor, BORDER_RADIUS } from
8
8
  import ColorPickerDialogHeader from "./ColorPickerDialogHeader";
9
9
  import ColorPickerPreview from "./ColorPickerPreview";
10
10
  import ColorPickerDialogSliders from "./ColorPickerDialogSliders";
11
+
12
+ // TODO: deprecate doneButtonColor prop
13
+
11
14
  const KEYBOARD_HEIGHT = 216;
12
15
  const MODAL_PROPS = {
13
16
  supportedOrientations: ['portrait', 'landscape', 'landscape-left', 'landscape-right'] // iOS only
@@ -27,7 +30,8 @@ const ColorPickerDialog = props => {
27
30
  accessibilityLabels,
28
31
  doneButtonColor,
29
32
  previewInputStyle,
30
- migrate
33
+ migrate,
34
+ colorPickerHeaderProps
31
35
  } = props;
32
36
  const [keyboardHeight, setKeyboardHeight] = useState(KEYBOARD_HEIGHT);
33
37
  const [color, setColor] = useState(Colors.getHSL(initialColor));
@@ -111,7 +115,7 @@ const ColorPickerDialog = props => {
111
115
  }, []);
112
116
  return <Dialog visible={visible} //TODO: pass all Dialog props instead
113
117
  width="100%" bottom centerH onDismiss={onDismiss} containerStyle={styles.dialog} testID={`${testID}.dialog`} modalProps={MODAL_PROPS} {...dialogProps}>
114
- <ColorPickerDialogHeader accessibilityLabels={accessibilityLabels} valid={valid} onDonePressed={onDonePressed} testID={testID} doneButtonColor={doneButtonColor} onDismiss={onDismiss} />
118
+ <ColorPickerDialogHeader accessibilityLabels={accessibilityLabels} valid={valid} onDonePressed={onDonePressed} testID={testID} doneButtonColor={doneButtonColor} onDismiss={onDismiss} colorPickerHeaderProps={colorPickerHeaderProps} />
115
119
  <ColorPickerPreview color={color} text={text} valid={valid} accessibilityLabels={accessibilityLabels} previewInputStyle={previewInputStyle} testID={testID} onFocus={onFocus} onChangeText={onChangeText} />
116
120
  <ColorPickerDialogSliders keyboardHeight={keyboardHeight} color={color} onSliderValueChange={updateColor} migrate={migrate} />
117
121
  </Dialog>;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { ColorPickerDialogProps } from './ColorPickerDialog';
3
- type HeaderProps = Pick<ColorPickerDialogProps, 'doneButtonColor' | 'accessibilityLabels' | 'testID'> & {
3
+ type HeaderProps = Pick<ColorPickerDialogProps, 'doneButtonColor' | 'accessibilityLabels' | 'testID' | 'colorPickerHeaderProps'> & {
4
4
  valid: boolean;
5
5
  onDismiss: () => void;
6
6
  onDonePressed: () => void;
@@ -13,13 +13,19 @@ const ColorPickerDialogHeader = props => {
13
13
  testID,
14
14
  doneButtonColor,
15
15
  valid,
16
- onDonePressed
16
+ onDonePressed,
17
+ colorPickerHeaderProps
17
18
  } = props;
19
+ const {
20
+ doneButtonProps,
21
+ dismissButtonProps,
22
+ doneButtonColor: doneButtonHeaderColorProp
23
+ } = colorPickerHeaderProps || {};
18
24
  return <View row spread bg-$backgroundDefault paddingH-20 style={styles.header}>
19
25
  <Button link iconSource={Assets.icons.x} iconStyle={{
20
26
  tintColor: Colors.$iconDefault
21
- }} onPress={onDismiss} accessibilityLabel={_get(accessibilityLabels, 'dismissButton')} testID={`${testID}.dialog.cancel`} />
22
- <Button color={doneButtonColor} disabled={!valid} link iconSource={Assets.icons.check} onPress={onDonePressed} accessibilityLabel={_get(accessibilityLabels, 'doneButton')} testID={`${testID}.dialog.done`} />
27
+ }} onPress={onDismiss} accessibilityLabel={_get(accessibilityLabels, 'dismissButton')} testID={`${testID}.dialog.cancel`} {...dismissButtonProps} />
28
+ <Button color={doneButtonColor || doneButtonHeaderColorProp} disabled={!valid} link iconSource={Assets.icons.check} onPress={onDonePressed} accessibilityLabel={_get(accessibilityLabels, 'doneButton')} testID={`${testID}.dialog.done`} {...doneButtonProps} />
23
29
  </View>;
24
30
  };
25
31
  export default ColorPickerDialogHeader;
@@ -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 = () => {
@@ -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,