secullum-react-native-ui 4.7.1-beta.0 → 4.7.1-beta.1

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.
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Button = void 0;
4
4
  const React = require("react");
5
5
  const theme_1 = require("../modules/theme");
6
+ const getTestId_1 = require("../modules/getTestId");
6
7
  const react_native_1 = require("react-native");
7
8
  const layout_1 = require("../modules/layout");
8
9
  class Button extends React.Component {
@@ -54,7 +55,7 @@ class Button extends React.Component {
54
55
  primary && styles.touchablePrimary,
55
56
  style,
56
57
  disabled && styles.disabled
57
- ], onPress: onPress, disabled: disabled, testID: nativeID },
58
+ ], onPress: onPress, disabled: disabled, testID: (0, getTestId_1.getTestID)(nativeID) },
58
59
  React.createElement(react_native_1.Text, { nativeID: nativeID, style: [
59
60
  styles.text,
60
61
  primary && styles.textPrimary,
@@ -5,6 +5,7 @@ const React = require("react");
5
5
  const FontAwesome_1 = require("react-native-vector-icons/FontAwesome");
6
6
  const layout_1 = require("../modules/layout");
7
7
  const theme_1 = require("../modules/theme");
8
+ const getTestId_1 = require("../modules/getTestId");
8
9
  const react_native_1 = require("react-native");
9
10
  class CheckBox extends React.Component {
10
11
  constructor() {
@@ -41,7 +42,7 @@ class CheckBox extends React.Component {
41
42
  onChange(!value);
42
43
  }
43
44
  } },
44
- React.createElement(FontAwesome_1.default, { nativeID: nativeID, testID: nativeID, name: value ? 'check-square-o' : 'square-o', style: styles.icon }),
45
+ React.createElement(FontAwesome_1.default, { nativeID: nativeID, testID: (0, getTestId_1.getTestID)(nativeID), name: value ? 'check-square-o' : 'square-o', style: styles.icon }),
45
46
  React.createElement(react_native_1.Text, { style: [styles.label, labelStyle] }, renderLabel ? renderLabel() : label)));
46
47
  }
47
48
  }
@@ -7,6 +7,7 @@ const format_1 = require("../modules/format");
7
7
  const layout_1 = require("../modules/layout");
8
8
  const theme_1 = require("../modules/theme");
9
9
  const ImageButton_1 = require("./ImageButton");
10
+ const getTestId_1 = require("../modules/getTestId");
10
11
  const react_native_1 = require("react-native");
11
12
  class DatePicker extends React.Component {
12
13
  constructor() {
@@ -89,7 +90,7 @@ class DatePicker extends React.Component {
89
90
  const styles = this.getStyles();
90
91
  const theme = (0, theme_1.getTheme)();
91
92
  return (React.createElement(react_native_1.TouchableWithoutFeedback, { disabled: disabled, onPress: this.handlePress },
92
- React.createElement(react_native_1.View, { nativeID: nativeID, testID: nativeID, style: [styles.container, style, disabled ? styles.readonly : null] },
93
+ React.createElement(react_native_1.View, { nativeID: nativeID, testID: (0, getTestId_1.getTestID)(nativeID), style: [styles.container, style, disabled ? styles.readonly : null] },
93
94
  React.createElement(react_native_1.View, null,
94
95
  React.createElement(react_native_1.Text, { style: styles.label }, label),
95
96
  React.createElement(react_native_1.Text, { style: styles.value }, value ? (0, format_1.formatDate)(value, 'cccc, dd/MM/yyyy') : '')),
@@ -8,6 +8,7 @@ const Card_1 = require("./Card");
8
8
  const Space_1 = require("./Space");
9
9
  const theme_1 = require("../modules/theme");
10
10
  const layout_1 = require("../modules/layout");
11
+ const getTestId_1 = require("../modules/getTestId");
11
12
  class Details extends React.Component {
12
13
  constructor() {
13
14
  super(...arguments);
@@ -58,7 +59,7 @@ class Details extends React.Component {
58
59
  };
59
60
  this.renderIcon = (icon, index) => {
60
61
  const styles = this.getStyles();
61
- const fa = (React.createElement(FontAwesome_1.default, { key: index, testID: icon.name, name: icon.name, color: icon.color, size: icon.size, style: styles.lineValueIcon }));
62
+ const fa = (React.createElement(FontAwesome_1.default, { key: index, testID: (0, getTestId_1.getTestID)(icon.name), name: icon.name, color: icon.color, size: icon.size, style: styles.lineValueIcon }));
62
63
  if (icon.onPress) {
63
64
  return (React.createElement(react_native_1.TouchableOpacity, { key: index, onPress: icon.onPress }, fa));
64
65
  }
@@ -6,6 +6,7 @@ const FontAwesome_1 = require("react-native-vector-icons/FontAwesome");
6
6
  const Modal_1 = require("./Modal");
7
7
  const layout_1 = require("../modules/layout");
8
8
  const theme_1 = require("../modules/theme");
9
+ const getTestId_1 = require("../modules/getTestId");
9
10
  const react_native_1 = require("react-native");
10
11
  class DropDownItem extends React.PureComponent {
11
12
  constructor() {
@@ -75,7 +76,7 @@ class DropDownItem extends React.PureComponent {
75
76
  render() {
76
77
  const { first, last, value, onPress, nativeID } = this.props;
77
78
  const theme = (0, theme_1.getTheme)();
78
- return (React.createElement(react_native_1.TouchableHighlight, { onPress: () => onPress(value), testID: nativeID, underlayColor: theme.backgroundColor2, style: {
79
+ return (React.createElement(react_native_1.TouchableHighlight, { onPress: () => onPress(value), testID: (0, getTestId_1.getTestID)(nativeID), underlayColor: theme.backgroundColor2, style: {
79
80
  borderTopLeftRadius: first ? 5 : 0,
80
81
  borderTopRightRadius: first ? 5 : 0,
81
82
  borderBottomLeftRadius: last ? 5 : 0,
@@ -236,7 +237,7 @@ class DropDown extends React.Component {
236
237
  const styles = this.getStyles();
237
238
  const theme = (0, theme_1.getTheme)();
238
239
  return (React.createElement(react_native_1.TouchableWithoutFeedback, { onPress: () => this.setState({ modalOpen: true }), disabled: disabled },
239
- React.createElement(react_native_1.View, { nativeID: nativeID, testID: nativeID, style: [styles.container, style, disabled ? styles.readonly : null] },
240
+ React.createElement(react_native_1.View, { nativeID: nativeID, testID: (0, getTestId_1.getTestID)(nativeID), style: [styles.container, style, disabled ? styles.readonly : null] },
240
241
  icon ? (React.createElement(FontAwesome_1.default, { name: icon, style: styles.iconOnLine })) : (React.createElement(react_native_1.Text, { style: [styles.label, labelStyle] }, label)),
241
242
  this.renderClosedDropDown(selectedItem, inputStyle),
242
243
  React.createElement(Modal_1.Modal, { visible: modalOpen, onRequestClose: () => this.setState({ modalOpen: false }), overlayStyle: styles.modalOverlay },
@@ -4,6 +4,7 @@ exports.ErrorMessage = void 0;
4
4
  const React = require("react");
5
5
  const react_native_1 = require("react-native");
6
6
  const theme_1 = require("../modules/theme");
7
+ const getTestId_1 = require("../modules/getTestId");
7
8
  class ErrorMessage extends React.Component {
8
9
  constructor() {
9
10
  super(...arguments);
@@ -24,7 +25,7 @@ class ErrorMessage extends React.Component {
24
25
  if (!message) {
25
26
  return null;
26
27
  }
27
- return (React.createElement(react_native_1.Text, { nativeID: nativeID, testID: nativeID, style: [styles.errorMessage, style] }, message));
28
+ return (React.createElement(react_native_1.Text, { nativeID: nativeID, testID: (0, getTestId_1.getTestID)(nativeID), style: [styles.errorMessage, style] }, message));
28
29
  }
29
30
  }
30
31
  exports.ErrorMessage = ErrorMessage;
@@ -6,6 +6,7 @@ const react_native_1 = require("react-native");
6
6
  const FontAwesome_1 = require("react-native-vector-icons/FontAwesome");
7
7
  const theme_1 = require("../modules/theme");
8
8
  const layout_1 = require("../modules/layout");
9
+ const getTestId_1 = require("../modules/getTestId");
9
10
  class Header extends React.Component {
10
11
  constructor() {
11
12
  super(...arguments);
@@ -49,7 +50,7 @@ class Header extends React.Component {
49
50
  const styles = this.getStyles();
50
51
  const theme = (0, theme_1.getTheme)();
51
52
  const icon = (React.createElement(React.Fragment, null,
52
- React.createElement(FontAwesome_1.default, { nativeID: button.nativeID, testID: button.nativeID, name: button.icon, size: (0, layout_1.isTablet)() ? 30 : 20, color: button.disabled ? theme.textColor1 : theme.textColor4,
53
+ React.createElement(FontAwesome_1.default, { nativeID: button.nativeID, testID: (0, getTestId_1.getTestID)(button.nativeID), name: button.icon, size: (0, layout_1.isTablet)() ? 30 : 20, color: button.disabled ? theme.textColor1 : theme.textColor4,
53
54
  // @ts-ignore : The component uses a different version of typing
54
55
  style: button.buttonStyle }),
55
56
  button.counter ? (React.createElement(react_native_1.View, { style: styles.counterContainer },
@@ -4,6 +4,7 @@ exports.ImageButton = void 0;
4
4
  const React = require("react");
5
5
  const FontAwesome_1 = require("react-native-vector-icons/FontAwesome");
6
6
  const theme_1 = require("../modules/theme");
7
+ const getTestId_1 = require("../modules/getTestId");
7
8
  const react_native_1 = require("react-native");
8
9
  class ImageButton extends React.Component {
9
10
  render() {
@@ -16,7 +17,7 @@ class ImageButton extends React.Component {
16
17
  right: hitBoxSize
17
18
  }
18
19
  : undefined },
19
- React.createElement(FontAwesome_1.default, { nativeID: nativeID, testID: nativeID, name: icon, size: iconSize || 20, color: iconColor || theme.textColor1 })));
20
+ React.createElement(FontAwesome_1.default, { nativeID: nativeID, testID: (0, getTestId_1.getTestID)(nativeID), name: icon, size: iconSize || 20, color: iconColor || theme.textColor1 })));
20
21
  }
21
22
  }
22
23
  exports.ImageButton = ImageButton;
@@ -5,6 +5,7 @@ const React = require("react");
5
5
  const FontAwesome_1 = require("react-native-vector-icons/FontAwesome");
6
6
  const theme_1 = require("../modules/theme");
7
7
  const layout_1 = require("../modules/layout");
8
+ const getTestId_1 = require("../modules/getTestId");
8
9
  const react_native_1 = require("react-native");
9
10
  function MenuItem(props) {
10
11
  const theme = (0, theme_1.getTheme)();
@@ -42,7 +43,7 @@ function MenuItem(props) {
42
43
  menuItem.path != undefined &&
43
44
  isCurrentMenuPath(menuItem.path);
44
45
  return (React.createElement(react_native_1.TouchableOpacity, { disabled: menuItem.disabled, style: styles.container, onPress: onPress },
45
- React.createElement(react_native_1.Text, { nativeID: menuItem.nativeID, testID: menuItem.nativeID, style: [
46
+ React.createElement(react_native_1.Text, { nativeID: menuItem.nativeID, testID: (0, getTestId_1.getTestID)(menuItem.nativeID), style: [
46
47
  styles.text,
47
48
  menuItem.disabled && styles.textDisabled,
48
49
  selected && styles.textSelected,
@@ -7,6 +7,7 @@ const FontAwesome_1 = require("react-native-vector-icons/FontAwesome");
7
7
  const Modal_1 = require("./Modal");
8
8
  const theme_1 = require("../modules/theme");
9
9
  const layout_1 = require("../modules/layout");
10
+ const getTestId_1 = require("../modules/getTestId");
10
11
  class Message extends React.Component {
11
12
  constructor() {
12
13
  super(...arguments);
@@ -42,7 +43,7 @@ class Message extends React.Component {
42
43
  return (React.createElement(Modal_1.Modal, { visible: visible, onRequestClose: onRequestClose, overlayStyle: styles.overlay },
43
44
  React.createElement(react_native_1.View, { nativeID: nativeID, style: styles.container },
44
45
  React.createElement(FontAwesome_1.default, { name: type === 'warning' ? 'warning' : 'check-circle', color: type === 'warning' ? theme.warningColor : theme.successColor, size: (0, layout_1.isTablet)() ? 52 : 42 }),
45
- React.createElement(react_native_1.Text, { style: [styles.text, textStyle], testID: nativeID }, message))));
46
+ React.createElement(react_native_1.Text, { style: [styles.text, textStyle], testID: (0, getTestId_1.getTestID)(nativeID) }, message))));
46
47
  }
47
48
  }
48
49
  exports.Message = Message;
@@ -7,6 +7,7 @@ const FontAwesome_1 = require("react-native-vector-icons/FontAwesome");
7
7
  const format_1 = require("../modules/format");
8
8
  const layout_1 = require("../modules/layout");
9
9
  const theme_1 = require("../modules/theme");
10
+ const getTestId_1 = require("../modules/getTestId");
10
11
  const Delay_1 = require("./Delay");
11
12
  const react_native_1 = require("react-native");
12
13
  class RangeDatePicker extends React.Component {
@@ -109,7 +110,7 @@ class RangeDatePicker extends React.Component {
109
110
  (0, format_1.formatDate)(endDate, displayFormat);
110
111
  const styles = this.getStyles();
111
112
  return (React.createElement(react_native_1.TouchableWithoutFeedback, { onPress: this.handleDatePickerPress },
112
- React.createElement(react_native_1.View, { nativeID: nativeID, testID: nativeID, style: [styles.container, style] },
113
+ React.createElement(react_native_1.View, { nativeID: nativeID, testID: (0, getTestId_1.getTestID)(nativeID), style: [styles.container, style] },
113
114
  React.createElement(react_native_1.View, null,
114
115
  React.createElement(react_native_1.Text, { style: styles.label }, label),
115
116
  React.createElement(react_native_1.Text, { style: styles.value }, displayText)),
@@ -4,6 +4,7 @@ exports.Text = void 0;
4
4
  const React = require("react");
5
5
  const react_native_1 = require("react-native");
6
6
  const theme_1 = require("../modules/theme");
7
+ const getTestId_1 = require("../modules/getTestId");
7
8
  const theme = (0, theme_1.getTheme)();
8
9
  class Text extends React.Component {
9
10
  constructor() {
@@ -26,7 +27,7 @@ class Text extends React.Component {
26
27
  render() {
27
28
  const { style, children, nativeID } = this.props;
28
29
  const textStyle = this.getStyles();
29
- return (React.createElement(react_native_1.Text, { nativeID: nativeID, testID: nativeID, style: [textStyle.text, style] }, children));
30
+ return (React.createElement(react_native_1.Text, { nativeID: nativeID, testID: (0, getTestId_1.getTestID)(nativeID), style: [textStyle.text, style] }, children));
30
31
  }
31
32
  }
32
33
  exports.Text = Text;
@@ -5,6 +5,7 @@ const React = require("react");
5
5
  const theme_1 = require("../modules/theme");
6
6
  const layout_1 = require("../modules/layout");
7
7
  const FontAwesome_1 = require("react-native-vector-icons/FontAwesome");
8
+ const getTestId_1 = require("../modules/getTestId");
8
9
  const react_native_1 = require("react-native");
9
10
  class TextBox extends React.Component {
10
11
  constructor() {
@@ -47,7 +48,7 @@ class TextBox extends React.Component {
47
48
  const styles = this.getStyles();
48
49
  const incomingProps = {
49
50
  nativeID: this.props.nativeID,
50
- testID: this.props.nativeID,
51
+ testID: (0, getTestId_1.getTestID)(this.props.nativeID),
51
52
  autoFocus: this.props.autoFocus,
52
53
  value: this.props.value,
53
54
  onChangeText: this.props.onChange,
@@ -0,0 +1,2 @@
1
+ export declare function getTestID(testID?: string): string | undefined;
2
+ export declare const testID: typeof getTestID;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.testID = exports.getTestID = void 0;
4
+ const react_native_1 = require("react-native");
5
+ const { RNDeviceInfo } = require('react-native').NativeModules;
6
+ function getTestID(testID) {
7
+ if (!testID) {
8
+ return undefined;
9
+ }
10
+ const prefix = `${RNDeviceInfo.bundleId}:id/`;
11
+ return react_native_1.Platform.select({
12
+ android: `${prefix}${testID}`,
13
+ ios: testID
14
+ });
15
+ }
16
+ exports.getTestID = getTestID;
17
+ exports.testID = getTestID;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "secullum-react-native-ui",
3
- "version": "4.7.1-beta.0",
3
+ "version": "4.7.1-beta.1",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "files": [