@ray-js/components 0.5.7-beta-2 → 0.5.9

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.
Files changed (136) hide show
  1. package/lib/Button/{Button.thing.d.ts → Button.tuya.d.ts} +0 -0
  2. package/lib/Button/{Button.thing.js → Button.tuya.js} +1 -1
  3. package/lib/Checkbox/{Checkbox.thing.d.ts → Checkbox.tuya.d.ts} +0 -0
  4. package/lib/Checkbox/{Checkbox.thing.js → Checkbox.tuya.js} +1 -1
  5. package/lib/CheckboxGroup/{CheckboxGroup.thing.d.ts → CheckboxGroup.tuya.d.ts} +0 -0
  6. package/lib/CheckboxGroup/{CheckboxGroup.thing.js → CheckboxGroup.tuya.js} +1 -1
  7. package/lib/CoverView/{CoverView.thing.d.ts → CoverView.tuya.d.ts} +0 -0
  8. package/lib/CoverView/{CoverView.thing.js → CoverView.tuya.js} +1 -1
  9. package/lib/DatePicker/{DatePicker.thing.d.ts → DatePicker.tuya.d.ts} +0 -0
  10. package/lib/DatePicker/{DatePicker.thing.js → DatePicker.tuya.js} +1 -1
  11. package/lib/Form/{Form.native.d.ts → Form.tuya.d.ts} +0 -0
  12. package/lib/Form/{Form.thing.js → Form.tuya.js} +1 -1
  13. package/lib/Icon/{Icon.thing.d.ts → Icon.tuya.d.ts} +0 -0
  14. package/lib/Icon/{Icon.thing.js → Icon.tuya.js} +0 -0
  15. package/lib/Image/{Image.thing.d.ts → Image.tuya.d.ts} +0 -0
  16. package/lib/Image/{Image.thing.js → Image.tuya.js} +1 -1
  17. package/lib/Input/{Input.thing.d.ts → Input.tuya.d.ts} +0 -0
  18. package/lib/Input/{Input.thing.js → Input.tuya.js} +1 -1
  19. package/lib/IpcPlayer/{IpcPlayer.thing.d.ts → IpcPlayer.tuya.d.ts} +0 -0
  20. package/lib/IpcPlayer/{IpcPlayer.thing.js → IpcPlayer.tuya.js} +1 -1
  21. package/lib/IpcPlayer/props.d.ts +1 -1
  22. package/lib/Label/{Label.thing.d.ts → Label.tuya.d.ts} +0 -0
  23. package/lib/Label/{Label.thing.js → Label.tuya.js} +1 -1
  24. package/lib/LinearGradient/{LinearGradient.thing.d.ts → LinearGradient.tuya.d.ts} +0 -0
  25. package/lib/LinearGradient/{LinearGradient.thing.js → LinearGradient.tuya.js} +0 -0
  26. package/lib/Modal/{Modal.thing.d.ts → Modal.tuya.d.ts} +0 -0
  27. package/lib/Modal/{Modal.thing.js → Modal.tuya.js} +0 -0
  28. package/lib/Motion/Fade/{index.thing.d.ts → index.tuya.d.ts} +0 -0
  29. package/lib/Motion/Fade/{index.thing.js → index.tuya.js} +0 -0
  30. package/lib/Motion/PullUp/{index.thing.d.ts → index.tuya.d.ts} +0 -0
  31. package/lib/Motion/PullUp/{index.thing.js → index.tuya.js} +0 -0
  32. package/lib/Motion/PushDown/{index.thing.d.ts → index.tuya.d.ts} +0 -0
  33. package/lib/Motion/PushDown/{index.thing.js → index.tuya.js} +0 -0
  34. package/lib/Motion/ScaleFadeIn/{index.thing.d.ts → index.tuya.d.ts} +0 -0
  35. package/lib/Motion/ScaleFadeIn/{index.thing.js → index.tuya.js} +0 -0
  36. package/lib/Motion/ScalePullDown/{index.thing.d.ts → index.tuya.d.ts} +0 -0
  37. package/lib/Motion/ScalePullDown/{index.thing.js → index.tuya.js} +0 -0
  38. package/lib/PageContainer/{PageContainer.thing.d.ts → PageContainer.tuya.d.ts} +0 -0
  39. package/lib/PageContainer/{PageContainer.thing.js → PageContainer.tuya.js} +1 -1
  40. package/lib/PageContainer/props.d.ts +1 -1
  41. package/lib/Picker/{Picker.thing.d.ts → Picker.tuya.d.ts} +0 -0
  42. package/lib/Picker/{Picker.thing.js → Picker.tuya.js} +1 -1
  43. package/lib/PickerView/{PickerView.thing.d.ts → PickerView.tuya.d.ts} +0 -0
  44. package/lib/PickerView/{PickerView.thing.js → PickerView.tuya.js} +1 -1
  45. package/lib/PickerViewColumn/{PickerViewColumn.thing.d.ts → PickerViewColumn.tuya.d.ts} +0 -0
  46. package/lib/PickerViewColumn/{PickerViewColumn.thing.js → PickerViewColumn.tuya.js} +1 -1
  47. package/lib/PickerViewColumn/PickerViewColumn.wechat.js +1 -1
  48. package/lib/RadialGradient/{RadialGradient.thing.d.ts → RadialGradient.tuya.d.ts} +0 -0
  49. package/lib/RadialGradient/{RadialGradient.thing.js → RadialGradient.tuya.js} +0 -0
  50. package/lib/Radio/{Radio.thing.d.ts → Radio.tuya.d.ts} +0 -0
  51. package/lib/Radio/{Radio.thing.js → Radio.tuya.js} +1 -1
  52. package/lib/RadioGroup/{RadioGroup.thing.d.ts → RadioGroup.tuya.d.ts} +0 -0
  53. package/lib/RadioGroup/{RadioGroup.thing.js → RadioGroup.tuya.js} +1 -1
  54. package/lib/ScrollView/{ScrollView.thing.d.ts → ScrollView.tuya.d.ts} +0 -0
  55. package/lib/ScrollView/{ScrollView.thing.js → ScrollView.tuya.js} +1 -1
  56. package/lib/Slider/{Slider.thing.d.ts → Slider.tuya.d.ts} +0 -0
  57. package/lib/Slider/{Slider.thing.js → Slider.tuya.js} +1 -1
  58. package/lib/Swiper/{Swiper.thing.d.ts → Swiper.tuya.d.ts} +0 -0
  59. package/lib/Swiper/{Swiper.thing.js → Swiper.tuya.js} +1 -1
  60. package/lib/SwiperItem/{SwiperItem.thing.d.ts → SwiperItem.tuya.d.ts} +0 -0
  61. package/lib/SwiperItem/{SwiperItem.thing.js → SwiperItem.tuya.js} +1 -1
  62. package/lib/SwiperItem/SwiperItem.wechat.js +1 -1
  63. package/lib/Switch/{Switch.thing.d.ts → Switch.tuya.d.ts} +0 -0
  64. package/lib/Switch/{Switch.thing.js → Switch.tuya.js} +1 -1
  65. package/lib/Text/{Text.thing.d.ts → Text.tuya.d.ts} +0 -0
  66. package/lib/Text/{Text.thing.js → Text.tuya.js} +1 -1
  67. package/lib/Textarea/{Textarea.thing.d.ts → Textarea.tuya.d.ts} +0 -0
  68. package/lib/Textarea/{Textarea.thing.js → Textarea.tuya.js} +1 -1
  69. package/lib/TimePicker/{TimePicker.thing.d.ts → TimePicker.tuya.d.ts} +0 -0
  70. package/lib/TimePicker/{TimePicker.thing.js → TimePicker.tuya.js} +1 -1
  71. package/lib/View/{View.thing.d.ts → View.tuya.d.ts} +0 -0
  72. package/lib/View/{View.thing.js → View.tuya.js} +1 -1
  73. package/lib/utils/index.d.ts +1 -2
  74. package/package.json +5 -5
  75. package/lib/Button/Button.native.d.ts +0 -29
  76. package/lib/Button/Button.native.js +0 -229
  77. package/lib/Checkbox/Checkbox.native.d.ts +0 -28
  78. package/lib/Checkbox/Checkbox.native.js +0 -118
  79. package/lib/CheckboxGroup/CheckboxGroup.native.d.ts +0 -18
  80. package/lib/CheckboxGroup/CheckboxGroup.native.js +0 -99
  81. package/lib/ClickableSimplified/index.native.d.ts +0 -42
  82. package/lib/ClickableSimplified/index.native.js +0 -166
  83. package/lib/DatePicker/DatePicker.native.d.ts +0 -34
  84. package/lib/DatePicker/DatePicker.native.js +0 -449
  85. package/lib/Form/Form.native.js +0 -8
  86. package/lib/Form/Form.thing.d.ts +0 -4
  87. package/lib/Icon/Icon.native.d.ts +0 -15
  88. package/lib/Icon/Icon.native.js +0 -48
  89. package/lib/Image/Image.native.d.ts +0 -28
  90. package/lib/Image/Image.native.js +0 -219
  91. package/lib/Input/Input.native.d.ts +0 -32
  92. package/lib/Input/Input.native.js +0 -212
  93. package/lib/Label/Label.native.d.ts +0 -4
  94. package/lib/Label/Label.native.js +0 -29
  95. package/lib/LinearGradient/LinearGradient.native.d.ts +0 -16
  96. package/lib/LinearGradient/LinearGradient.native.js +0 -60
  97. package/lib/Modal/Modal.native.d.ts +0 -24
  98. package/lib/Modal/Modal.native.js +0 -98
  99. package/lib/Motion/Fade/index.native.d.ts +0 -2
  100. package/lib/Motion/Fade/index.native.js +0 -3
  101. package/lib/Motion/PullUp/index.native.d.ts +0 -2
  102. package/lib/Motion/PullUp/index.native.js +0 -3
  103. package/lib/Motion/PushDown/index.native.d.ts +0 -2
  104. package/lib/Motion/PushDown/index.native.js +0 -3
  105. package/lib/Motion/ScaleFadeIn/index.native.d.ts +0 -2
  106. package/lib/Motion/ScaleFadeIn/index.native.js +0 -3
  107. package/lib/Motion/ScalePullDown/index.native.d.ts +0 -2
  108. package/lib/Motion/ScalePullDown/index.native.js +0 -3
  109. package/lib/Picker/Picker.native.d.ts +0 -22
  110. package/lib/Picker/Picker.native.js +0 -181
  111. package/lib/PickerView/PickerView.native.d.ts +0 -31
  112. package/lib/PickerView/PickerView.native.js +0 -175
  113. package/lib/PickerViewColumn/PickerViewColumn.native.d.ts +0 -31
  114. package/lib/PickerViewColumn/PickerViewColumn.native.js +0 -175
  115. package/lib/RadialGradient/RadialGradient.native.d.ts +0 -17
  116. package/lib/RadialGradient/RadialGradient.native.js +0 -52
  117. package/lib/Radio/Radio.native.d.ts +0 -30
  118. package/lib/Radio/Radio.native.js +0 -132
  119. package/lib/RadioGroup/RadioGroup.native.d.ts +0 -18
  120. package/lib/RadioGroup/RadioGroup.native.js +0 -99
  121. package/lib/ScrollView/ScrollView.native.d.ts +0 -57
  122. package/lib/ScrollView/ScrollView.native.js +0 -283
  123. package/lib/Slider/Slider.native.d.ts +0 -21
  124. package/lib/Slider/Slider.native.js +0 -114
  125. package/lib/Swiper/Swiper.native.d.ts +0 -6
  126. package/lib/Swiper/Swiper.native.js +0 -68
  127. package/lib/Switch/Switch.native.d.ts +0 -25
  128. package/lib/Switch/Switch.native.js +0 -128
  129. package/lib/Text/Text.native.d.ts +0 -8
  130. package/lib/Text/Text.native.js +0 -37
  131. package/lib/Textarea/Textarea.native.d.ts +0 -4
  132. package/lib/Textarea/Textarea.native.js +0 -26
  133. package/lib/TimePicker/TimePicker.native.d.ts +0 -39
  134. package/lib/TimePicker/TimePicker.native.js +0 -319
  135. package/lib/View/View.native.d.ts +0 -2
  136. package/lib/View/View.native.js +0 -35
@@ -1,98 +0,0 @@
1
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/esm/createClass";
3
- import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
4
- import _inherits from "@babel/runtime/helpers/esm/inherits";
5
- import _createSuper from "@babel/runtime/helpers/esm/createSuper";
6
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
7
- import React from 'react';
8
- import { Modal, StyleSheet, View, TouchableHighlight } from 'react-native';
9
- var ALIGN = {
10
- top: 'flex-start',
11
- center: 'center',
12
- bottom: 'flex-end'
13
- };
14
-
15
- var TYModal = /*#__PURE__*/function (_React$Component) {
16
- _inherits(TYModal, _React$Component);
17
-
18
- var _super = _createSuper(TYModal);
19
-
20
- function TYModal(props) {
21
- var _this;
22
-
23
- _classCallCheck(this, TYModal);
24
-
25
- _this = _super.call(this, props);
26
-
27
- _defineProperty(_assertThisInitialized(_this), "_handleMaskPress", function () {
28
- var onClickOverlay = _this.props.onClickOverlay;
29
- typeof onClickOverlay === 'function' && onClickOverlay({
30
- type: 'clickoverlay'
31
- });
32
- });
33
-
34
- _this.state = {
35
- visible: props.show
36
- };
37
- return _this;
38
- }
39
-
40
- _createClass(TYModal, [{
41
- key: "componentDidUpdate",
42
- value: function componentDidUpdate(prevProps) {
43
- var show = this.props.show;
44
-
45
- if (show !== prevProps.show) {
46
- this.setState({
47
- visible: !!show
48
- });
49
- }
50
- }
51
- }, {
52
- key: "render",
53
- value: function render() {
54
- var _this$props = this.props,
55
- children = _this$props.children,
56
- position = _this$props.position,
57
- overlayStyle = _this$props.overlayStyle,
58
- customStyle = _this$props.customStyle,
59
- overlay = _this$props.overlay;
60
- var visible = this.state.visible;
61
- var maskColor = overlay ? 'rgba(0, 0, 0, 0.7)' : 'transparent';
62
- var maskContainer = [StyleSheet.absoluteFill, position && {
63
- justifyContent: ALIGN[position]
64
- }, {
65
- flex: 1,
66
- backgroundColor: maskColor
67
- }, overlayStyle];
68
- return /*#__PURE__*/React.createElement(Modal, {
69
- animationType: "fade",
70
- onRequestClose: this._handleMaskPress,
71
- visible: visible,
72
- transparent: true
73
- }, /*#__PURE__*/React.createElement(TouchableHighlight, {
74
- style: maskContainer,
75
- underlayColor: maskColor,
76
- onPress: this._handleMaskPress,
77
- activeOpacity: 1
78
- }, /*#__PURE__*/React.createElement(View, {
79
- onStartShouldSetResponder: function onStartShouldSetResponder() {
80
- return true;
81
- },
82
- style: customStyle
83
- }, children)));
84
- }
85
- }]);
86
-
87
- return TYModal;
88
- }(React.Component);
89
-
90
- _defineProperty(TYModal, "defaultProps", {
91
- position: 'center',
92
- onClickOverlay: null,
93
- overlayStyle: null,
94
- overlay: true,
95
- customStyle: null
96
- });
97
-
98
- export default TYModal;
@@ -1,2 +0,0 @@
1
- declare const Fade: typeof import("tuya-panel-motion/lib/fade").default;
2
- export default Fade;
@@ -1,3 +0,0 @@
1
- import Motion from 'tuya-panel-motion';
2
- var Fade = Motion.Fade;
3
- export default Fade;
@@ -1,2 +0,0 @@
1
- declare const PullUp: typeof import("tuya-panel-motion/lib/pull-up").default;
2
- export default PullUp;
@@ -1,3 +0,0 @@
1
- import Motion from 'tuya-panel-motion';
2
- var PullUp = Motion.PullUp;
3
- export default PullUp;
@@ -1,2 +0,0 @@
1
- declare const PushDown: typeof import("tuya-panel-motion/lib/push-down").default;
2
- export default PushDown;
@@ -1,3 +0,0 @@
1
- import Motion from 'tuya-panel-motion';
2
- var PushDown = Motion.PushDown;
3
- export default PushDown;
@@ -1,2 +0,0 @@
1
- declare const ScaleFadeIn: typeof import("tuya-panel-motion/lib/scale-fade-in").default;
2
- export default ScaleFadeIn;
@@ -1,3 +0,0 @@
1
- import Motion from 'tuya-panel-motion';
2
- var ScaleFadeIn = Motion.ScaleFadeIn;
3
- export default ScaleFadeIn;
@@ -1,2 +0,0 @@
1
- declare const ScalePullDown: typeof import("tuya-panel-motion/lib/scale-pull-down").default;
2
- export default ScalePullDown;
@@ -1,3 +0,0 @@
1
- import Motion from 'tuya-panel-motion';
2
- var ScalePullDown = Motion.ScalePullDown;
3
- export default ScalePullDown;
@@ -1,22 +0,0 @@
1
- import React from 'react';
2
- import { PickerProps } from './props';
3
- interface IState {
4
- visible: boolean;
5
- value: number | number[];
6
- changeValue: number | number[];
7
- }
8
- export default class Picker extends React.Component<PickerProps, IState> {
9
- static displayName: string;
10
- static defaultProps: {
11
- cancelText: string;
12
- confirmText: string;
13
- };
14
- constructor(props: PickerProps);
15
- componentDidUpdate(prevProps: Readonly<PickerProps>): void;
16
- _handleCancel: () => void;
17
- _handleConfirm: () => void;
18
- _handlePickerChange: (event: any) => void;
19
- renderTitleView: () => JSX.Element;
20
- render(): JSX.Element;
21
- }
22
- export {};
@@ -1,181 +0,0 @@
1
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/esm/createClass";
3
- import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
4
- import _inherits from "@babel/runtime/helpers/esm/inherits";
5
- import _createSuper from "@babel/runtime/helpers/esm/createSuper";
6
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
7
- import React from 'react';
8
- import { View, Text, TouchableOpacity, StyleSheet, Platform } from 'react-native';
9
- import { IDefaultPickerProps } from './props';
10
- import Modal from '../Modal';
11
- import PickerView from '../PickerView';
12
- import { isTwoArray } from '../utils';
13
-
14
- var Picker = /*#__PURE__*/function (_React$Component) {
15
- _inherits(Picker, _React$Component);
16
-
17
- var _super = _createSuper(Picker);
18
-
19
- function Picker(props) {
20
- var _this;
21
-
22
- _classCallCheck(this, Picker);
23
-
24
- _this = _super.call(this, props);
25
-
26
- _defineProperty(_assertThisInitialized(_this), "_handleCancel", function () {
27
- var onCancel = _this.props.onCancel;
28
- typeof onCancel === 'function' && onCancel({
29
- type: 'cancel',
30
- origin: null
31
- });
32
-
33
- _this.setState({
34
- visible: false
35
- });
36
- });
37
-
38
- _defineProperty(_assertThisInitialized(_this), "_handleConfirm", function () {
39
- var onChange = _this.props.onChange;
40
- var changeValue = _this.state.changeValue;
41
- typeof onChange === 'function' && onChange({
42
- type: 'change',
43
- value: changeValue,
44
- origin: null
45
- });
46
-
47
- _this.setState({
48
- visible: false,
49
- value: changeValue
50
- });
51
- });
52
-
53
- _defineProperty(_assertThisInitialized(_this), "_handlePickerChange", function (event) {
54
- var value = event.value,
55
- column = event.column;
56
- var _this$props = _this.props,
57
- range = _this$props.range,
58
- onColumnChange = _this$props.onColumnChange;
59
- var isOnly = !isTwoArray(range);
60
-
61
- if (!isOnly) {
62
- typeof onColumnChange === 'function' && onColumnChange({
63
- type: 'columnchange',
64
- value: value[column],
65
- column: column,
66
- origin: null
67
- });
68
- }
69
-
70
- _this.setState({
71
- changeValue: value
72
- });
73
- });
74
-
75
- _defineProperty(_assertThisInitialized(_this), "renderTitleView", function () {
76
- var _this$props2 = _this.props,
77
- confirmText = _this$props2.confirmText,
78
- cancelText = _this$props2.cancelText;
79
- return /*#__PURE__*/React.createElement(View, {
80
- style: styles.title
81
- }, /*#__PURE__*/React.createElement(TouchableOpacity, {
82
- style: styles.button,
83
- activeOpacity: 0.8,
84
- onPress: _this._handleCancel
85
- }, /*#__PURE__*/React.createElement(Text, {
86
- style: styles.text
87
- }, cancelText)), /*#__PURE__*/React.createElement(TouchableOpacity, {
88
- style: styles.button,
89
- activeOpacity: 0.8,
90
- onPress: _this._handleConfirm
91
- }, /*#__PURE__*/React.createElement(Text, {
92
- style: [styles.text, {
93
- color: '#007AFF'
94
- }]
95
- }, confirmText)));
96
- });
97
-
98
- _this.state = {
99
- visible: false,
100
- value: props.value,
101
- changeValue: props.value
102
- };
103
- return _this;
104
- }
105
-
106
- _createClass(Picker, [{
107
- key: "componentDidUpdate",
108
- value: function componentDidUpdate(prevProps) {
109
- if (this.props.value !== prevProps.value) {
110
- this.setState({
111
- value: this.props.value,
112
- changeValue: this.props.value
113
- });
114
- }
115
- }
116
- }, {
117
- key: "render",
118
- value: function render() {
119
- var _this2 = this;
120
-
121
- var _this$props3 = this.props,
122
- children = _this$props3.children,
123
- range = _this$props3.range,
124
- disabled = _this$props3.disabled;
125
- var _this$state = this.state,
126
- visible = _this$state.visible,
127
- value = _this$state.value;
128
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TouchableOpacity, {
129
- onPress: function onPress() {
130
- return _this2.setState({
131
- visible: true
132
- });
133
- },
134
- disabled: disabled,
135
- activeOpacity: 0.8
136
- }, children), /*#__PURE__*/React.createElement(Modal, {
137
- show: visible,
138
- position: 'bottom'
139
- }, this.renderTitleView(), Platform.OS === 'android' && /*#__PURE__*/React.createElement(View, {
140
- style: {
141
- backgroundColor: '#fff',
142
- height: 2
143
- }
144
- }), /*#__PURE__*/React.createElement(PickerView, {
145
- range: range,
146
- value: value,
147
- style: {
148
- backgroundColor: '#fff'
149
- },
150
- onChange: this._handlePickerChange
151
- })));
152
- }
153
- }]);
154
-
155
- return Picker;
156
- }(React.Component);
157
-
158
- _defineProperty(Picker, "displayName", '_Picker');
159
-
160
- _defineProperty(Picker, "defaultProps", IDefaultPickerProps);
161
-
162
- export { Picker as default };
163
- var styles = StyleSheet.create({
164
- button: {
165
- height: 54,
166
- width: 68,
167
- alignItems: 'center',
168
- justifyContent: 'center'
169
- },
170
- title: {
171
- flexDirection: 'row',
172
- justifyContent: 'space-between',
173
- backgroundColor: '#fff',
174
- borderBottomColor: 'rgba(0, 0, 0, 0.05)',
175
- borderBottomWidth: StyleSheet.hairlineWidth
176
- },
177
- text: {
178
- fontSize: 18,
179
- color: '#333'
180
- }
181
- });
@@ -1,31 +0,0 @@
1
- import * as React from 'react';
2
- import { StyleProp, ViewStyle } from 'react-native';
3
- import { PickerViewProps } from './props';
4
- interface IProps extends Omit<PickerViewProps, 'style'> {
5
- style?: StyleProp<ViewStyle>;
6
- }
7
- interface IState {
8
- selectIdx: number | number[];
9
- }
10
- export default class _Picker extends React.Component<IProps, IState> {
11
- static displayName: string;
12
- static defaultProps: {
13
- value: number;
14
- };
15
- constructor(props: IProps);
16
- componentDidUpdate(prevProps: Readonly<IProps>): void;
17
- getItem: () => {
18
- label: string;
19
- value: string;
20
- }[] | {
21
- label: string;
22
- value: string;
23
- }[][];
24
- onItemSelected: (event: any, isOnly: boolean, index: number) => void;
25
- renderPickerItem: (item: {
26
- label: string;
27
- value: string;
28
- }, selectIdx: number | number[], isOnly: boolean, index: number) => JSX.Element;
29
- render(): React.ReactNode;
30
- }
31
- export {};
@@ -1,175 +0,0 @@
1
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/esm/createClass";
3
- import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
4
- import _inherits from "@babel/runtime/helpers/esm/inherits";
5
- import _createSuper from "@babel/runtime/helpers/esm/createSuper";
6
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
7
- import "core-js/modules/es.array.map.js";
8
- import "core-js/modules/es.array.concat.js";
9
- import * as React from 'react';
10
- import { Platform, requireNativeComponent, processColor, View } from 'react-native';
11
- import { RatioUtils } from '@ray-js/ray-panel-utils';
12
- import { isTwoArray } from '../utils';
13
- var width = RatioUtils.width;
14
- var TYRCTPicker = requireNativeComponent('TYRCTPicker');
15
- var WheelPickerView = requireNativeComponent('TYRCTWheelViewManager');
16
-
17
- var _Picker = /*#__PURE__*/function (_React$Component) {
18
- _inherits(_Picker, _React$Component);
19
-
20
- var _super = _createSuper(_Picker);
21
-
22
- function _Picker(props) {
23
- var _this;
24
-
25
- _classCallCheck(this, _Picker);
26
-
27
- _this = _super.call(this, props);
28
-
29
- _defineProperty(_assertThisInitialized(_this), "getItem", function () {
30
- var range = _this.props.range;
31
- var isOnly = !isTwoArray(range);
32
-
33
- if (isOnly) {
34
- return range.map(function (item) {
35
- return {
36
- label: item,
37
- value: item
38
- };
39
- });
40
- }
41
-
42
- return range.map(function (item) {
43
- return item.map(function (data) {
44
- return {
45
- label: data,
46
- value: data
47
- };
48
- });
49
- });
50
- });
51
-
52
- _defineProperty(_assertThisInitialized(_this), "onItemSelected", function (event, isOnly, index) {
53
- var newIndex = event.nativeEvent.newIndex;
54
- var onChange = _this.props.onChange;
55
-
56
- if (isOnly) {
57
- _this.setState({
58
- selectIdx: newIndex
59
- });
60
-
61
- typeof onChange === 'function' && onChange({
62
- type: 'change',
63
- value: newIndex
64
- });
65
- } else {
66
- var selectIdx = _this.state.selectIdx;
67
- var newSelectArr = selectIdx.concat([]);
68
- newSelectArr[index] = newIndex;
69
- typeof onChange === 'function' && onChange({
70
- type: 'change',
71
- value: newSelectArr,
72
- column: index
73
- });
74
-
75
- _this.setState({
76
- selectIdx: newSelectArr
77
- });
78
- }
79
- });
80
-
81
- _defineProperty(_assertThisInitialized(_this), "renderPickerItem", function (item, selectIdx, isOnly, index) {
82
- var _this$props = _this.props,
83
- style = _this$props.style,
84
- fontSize = _this$props.fontSize;
85
-
86
- var items = _this.getItem();
87
-
88
- var theme = {
89
- dividerColor: 'rgba(0, 0, 0, 0.05)',
90
- fontColor: 'rgba(0,0,0,0.9)',
91
- fontSize: fontSize || isOnly ? 24 : items.length < 3 ? 24 : 20
92
- };
93
- var length = isOnly ? 1 : items.length;
94
- return Platform.OS === 'android' ? /*#__PURE__*/React.createElement(WheelPickerView, {
95
- key: index,
96
- style: [{
97
- width: width / length,
98
- height: 216
99
- }, style],
100
- items: item,
101
- itemTextColor: theme.fontColor,
102
- selectedItemTextColor: theme.fontColor,
103
- dividerColor: theme.dividerColor,
104
- visibleItemCount: 5,
105
- itemAlign: 'center',
106
- selectedIndex: selectIdx,
107
- textSize: theme.fontSize,
108
- loop: false,
109
- onChange: function onChange(e) {
110
- return _this.onItemSelected(e, isOnly, index);
111
- }
112
- }) : /*#__PURE__*/React.createElement(TYRCTPicker, {
113
- key: index,
114
- style: [{
115
- width: width / length,
116
- height: 216
117
- }, style],
118
- items: item,
119
- itemPadding: 14,
120
- selectedIndex: selectIdx,
121
- separatorColor: processColor(theme.dividerColor),
122
- color: processColor(theme.fontColor),
123
- textAlign: 1,
124
- fontSize: theme.fontSize,
125
- fontWeight: 'normal',
126
- onChange: function onChange(e) {
127
- return _this.onItemSelected(e, isOnly, index);
128
- }
129
- });
130
- });
131
-
132
- _this.state = {
133
- selectIdx: props.value
134
- };
135
- return _this;
136
- }
137
-
138
- _createClass(_Picker, [{
139
- key: "componentDidUpdate",
140
- value: function componentDidUpdate(prevProps) {
141
- if (prevProps.value !== this.props.value) {
142
- this.setState({
143
- selectIdx: this.props.value
144
- });
145
- }
146
- }
147
- }, {
148
- key: "render",
149
- value: function render() {
150
- var _this2 = this;
151
-
152
- var selectIdx = this.state.selectIdx;
153
- var items = this.getItem();
154
- var isOnly = !isTwoArray(items);
155
- return isOnly ? this.renderPickerItem(items, selectIdx, isOnly, 0) : /*#__PURE__*/React.createElement(View, {
156
- style: {
157
- flexDirection: 'row',
158
- overflow: 'hidden'
159
- }
160
- }, items.map(function (item, idx) {
161
- return _this2.renderPickerItem(item, selectIdx[idx], isOnly, idx);
162
- }));
163
- }
164
- }]);
165
-
166
- return _Picker;
167
- }(React.Component);
168
-
169
- _defineProperty(_Picker, "displayName", '_PickerView');
170
-
171
- _defineProperty(_Picker, "defaultProps", {
172
- value: 0
173
- });
174
-
175
- export { _Picker as default };
@@ -1,31 +0,0 @@
1
- import * as React from 'react';
2
- import { StyleProp, ViewStyle } from 'react-native';
3
- import { PickerViewProps } from './props';
4
- interface IProps extends Omit<PickerViewProps, 'style'> {
5
- style?: StyleProp<ViewStyle>;
6
- }
7
- interface IState {
8
- selectIdx: number | number[];
9
- }
10
- export default class _Picker extends React.Component<IProps, IState> {
11
- static displayName: string;
12
- static defaultProps: {
13
- value: number;
14
- };
15
- constructor(props: IProps);
16
- componentDidUpdate(prevProps: Readonly<IProps>): void;
17
- getItem: () => {
18
- label: string;
19
- value: string;
20
- }[] | {
21
- label: string;
22
- value: string;
23
- }[][];
24
- onItemSelected: (event: any, isOnly: boolean, index: number) => void;
25
- renderPickerItem: (item: {
26
- label: string;
27
- value: string;
28
- }, selectIdx: number | number[], isOnly: boolean, index: number) => JSX.Element;
29
- render(): React.ReactNode;
30
- }
31
- export {};