@ray-js/components 0.5.8-beta-1 → 0.5.10

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,283 +0,0 @@
1
- import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
- import _createClass from "@babel/runtime/helpers/esm/createClass";
4
- import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
5
- import _inherits from "@babel/runtime/helpers/esm/inherits";
6
- import _createSuper from "@babel/runtime/helpers/esm/createSuper";
7
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
8
- import "core-js/modules/es.array.concat.js";
9
- import * as React from 'react';
10
- import { ScrollView, StyleSheet } from 'react-native';
11
- import { omit } from '../utils';
12
-
13
- var _ScrollView = /*#__PURE__*/function (_React$Component) {
14
- _inherits(_ScrollView, _React$Component);
15
-
16
- var _super = _createSuper(_ScrollView);
17
-
18
- function _ScrollView() {
19
- var _this;
20
-
21
- _classCallCheck(this, _ScrollView);
22
-
23
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
24
- args[_key] = arguments[_key];
25
- }
26
-
27
- _this = _super.call.apply(_super, [this].concat(args));
28
-
29
- _defineProperty(_assertThisInitialized(_this), "state", {
30
- snapScrollTop: 0,
31
- snapScrollLeft: 0
32
- });
33
-
34
- _defineProperty(_assertThisInitialized(_this), "_scrollMetrics", {
35
- contentLength: 0,
36
- dOffset: 0,
37
- dt: 10,
38
- offset: 0,
39
- offsetX: 0,
40
- offsetY: 0,
41
- timestamp: 0,
42
- velocity: 0,
43
- visibleLength: 0
44
- });
45
-
46
- _defineProperty(_assertThisInitialized(_this), "$scrollView", /*#__PURE__*/React.createRef());
47
-
48
- _defineProperty(_assertThisInitialized(_this), "_sentEndForContentLength", 0);
49
-
50
- _defineProperty(_assertThisInitialized(_this), "_scrollEventThrottle", 50);
51
-
52
- _defineProperty(_assertThisInitialized(_this), "_hasCallScrollToUpperInRange", true);
53
-
54
- _defineProperty(_assertThisInitialized(_this), "_hasCallScrollToLowerInRange", false);
55
-
56
- _defineProperty(_assertThisInitialized(_this), "_selectLength", function (metrics) {
57
- var scrollX = _this.props.scrollX;
58
- return !scrollX ? metrics.height : metrics.width;
59
- });
60
-
61
- _defineProperty(_assertThisInitialized(_this), "_selectOffset", function (metrics) {
62
- var scrollX = _this.props.scrollX;
63
- return !scrollX ? metrics.y : metrics.x;
64
- });
65
-
66
- _defineProperty(_assertThisInitialized(_this), "_maybeCallOnStartReached", function (e) {
67
- var _this$props = _this.props,
68
- onScrollToUpper = _this$props.onScrollToUpper,
69
- upperThreshold = _this$props.upperThreshold,
70
- scrollX = _this$props.scrollX;
71
- var offset = _this._scrollMetrics.offset;
72
-
73
- if (onScrollToUpper && offset <= upperThreshold) {
74
- if (!_this._hasCallScrollToUpperInRange) {
75
- typeof onScrollToUpper === 'function' && onScrollToUpper({
76
- type: 'scrolltoupper',
77
- direction: scrollX ? 'left' : 'top',
78
- // distanceFromTop: offset,
79
- origin: e
80
- });
81
- _this._hasCallScrollToUpperInRange = true;
82
- }
83
- } else {
84
- _this._hasCallScrollToUpperInRange = false;
85
- }
86
- });
87
-
88
- _defineProperty(_assertThisInitialized(_this), "_maybeCallOnEndReached", function (e) {
89
- var _this$props2 = _this.props,
90
- onScrollToLower = _this$props2.onScrollToLower,
91
- lowerThreshold = _this$props2.lowerThreshold,
92
- scrollX = _this$props2.scrollX;
93
- var _this$_scrollMetrics = _this._scrollMetrics,
94
- contentLength = _this$_scrollMetrics.contentLength,
95
- visibleLength = _this$_scrollMetrics.visibleLength,
96
- offset = _this$_scrollMetrics.offset;
97
-
98
- if (onScrollToLower && contentLength - visibleLength - offset < lowerThreshold) {
99
- if (!_this._hasCallScrollToLowerInRange) {
100
- _this._hasDataChangedSinceEndReached = false;
101
- _this._hasCallScrollToLowerInRange = true;
102
- _this._sentEndForContentLength = _this._scrollMetrics.contentLength;
103
- typeof onScrollToLower === 'function' && onScrollToLower({
104
- type: 'scrolltolower',
105
- direction: scrollX ? 'right' : 'bottom',
106
- // distanceFromEnd,
107
- origin: e
108
- });
109
- }
110
- } else {
111
- _this._hasCallScrollToLowerInRange = false;
112
- }
113
- });
114
-
115
- _defineProperty(_assertThisInitialized(_this), "_onContentSizeChange", function (width, height) {
116
- _this._scrollMetrics.contentLength = _this._selectLength({
117
- height: height,
118
- width: width
119
- });
120
- });
121
-
122
- _defineProperty(_assertThisInitialized(_this), "_onScrollEndDrag", function (e) {
123
- var velocity = e.nativeEvent.velocity;
124
-
125
- if (velocity) {
126
- _this._scrollMetrics.velocity = _this._selectOffset(velocity);
127
- }
128
- });
129
-
130
- _defineProperty(_assertThisInitialized(_this), "_onMomentumScrollEnd", function () {
131
- _this._scrollMetrics.velocity = 0;
132
- });
133
-
134
- _defineProperty(_assertThisInitialized(_this), "_onLayout", function (e) {
135
- _this._scrollMetrics.visibleLength = _this._selectLength(e.nativeEvent.layout);
136
- });
137
-
138
- _defineProperty(_assertThisInitialized(_this), "_onScroll", function (e) {
139
- var onScroll = _this.props.onScroll;
140
- var scrollLeft = e.nativeEvent.contentOffset.x;
141
- var scrollTop = e.nativeEvent.contentOffset.y;
142
- var scrollHeight = e.nativeEvent.contentSize.height;
143
- var scrollWidth = e.nativeEvent.contentSize.width;
144
- typeof onScroll === 'function' && onScroll({
145
- type: 'scroll',
146
- scrollLeft: scrollLeft,
147
- scrollTop: scrollTop,
148
- scrollHeight: scrollHeight,
149
- scrollWidth: scrollWidth,
150
- deltaX: scrollLeft - _this._scrollMetrics.offsetX,
151
- deltaY: scrollTop - _this._scrollMetrics.offsetY,
152
- origin: e
153
- });
154
- var timestamp = e.timeStamp;
155
-
156
- var visibleLength = _this._selectLength(e.nativeEvent.layoutMeasurement);
157
-
158
- var contentLength = _this._selectLength(e.nativeEvent.contentSize);
159
-
160
- var offset = _this._selectOffset(e.nativeEvent.contentOffset);
161
-
162
- var dt = Math.max(1, timestamp - _this._scrollMetrics.timestamp);
163
- var dOffset = offset - _this._scrollMetrics.offset;
164
- _this._scrollMetrics = {
165
- contentLength: contentLength,
166
- dt: dt,
167
- dOffset: dOffset,
168
- offset: offset,
169
- offsetX: scrollLeft,
170
- offsetY: scrollTop,
171
- timestamp: timestamp,
172
- velocity: dOffset / dt,
173
- visibleLength: visibleLength
174
- };
175
-
176
- _this._maybeCallOnStartReached(e);
177
-
178
- _this._maybeCallOnEndReached(e);
179
- });
180
-
181
- _defineProperty(_assertThisInitialized(_this), "scrollToOffset", function () {
182
- var x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
183
- var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
184
- var node = _this.$scrollView.current;
185
-
186
- if (node) {
187
- node.scrollTo({
188
- x: x,
189
- y: y,
190
- animated: !!_this.props.scrollWithAnimation
191
- });
192
- }
193
- });
194
-
195
- return _this;
196
- }
197
-
198
- _createClass(_ScrollView, [{
199
- key: "componentDidMount",
200
- value: function componentDidMount() {
201
- var _this2 = this;
202
-
203
- if (this.state.snapScrollTop || this.state.snapScrollLeft) {
204
- this._initialScrollIndexTimeout = setTimeout(function () {
205
- _this2.scrollToOffset(_this2.state.snapScrollLeft, _this2.state.snapScrollTop);
206
- }, 0);
207
- }
208
- }
209
- }, {
210
- key: "getSnapshotBeforeUpdate",
211
- value: function getSnapshotBeforeUpdate(prevProps, prevState) {
212
- if (prevProps.scrollTop !== undefined) {
213
- return this._scrollMetrics.offsetY !== this.state.snapScrollTop || this._scrollMetrics.offsetX !== this.state.snapScrollLeft;
214
- }
215
-
216
- return prevState.snapScrollTop !== this.state.snapScrollTop || prevState.snapScrollLeft !== this.state.snapScrollLeft;
217
- }
218
- }, {
219
- key: "componentDidUpdate",
220
- value: function componentDidUpdate(prevProps, prevState, snapshot) {
221
- if (snapshot) {
222
- this.scrollToOffset(this.state.snapScrollLeft, this.state.snapScrollTop);
223
- }
224
- }
225
- }, {
226
- key: "componentWillUnmount",
227
- value: function componentWillUnmount() {
228
- this._initialScrollIndexTimeout && clearTimeout(this._initialScrollIndexTimeout);
229
- }
230
- }, {
231
- key: "render",
232
- value: function render() {
233
- var _this$props3 = this.props,
234
- children = _this$props3.children,
235
- style = _this$props3.style,
236
- scrollX = _this$props3.scrollX;
237
- var flattenStyle = StyleSheet.flatten(style);
238
- var wrapperStyle = omit(flattenStyle, ['alignItems', 'justifyContent']);
239
- var _contentContainerStyle = {};
240
-
241
- if (flattenStyle) {
242
- flattenStyle.alignItems && (_contentContainerStyle.alignItems = flattenStyle.alignItems);
243
- flattenStyle.justifyContent && (_contentContainerStyle.justifyContent = flattenStyle.justifyContent);
244
- }
245
-
246
- var scrollElementProps = _objectSpread(_objectSpread({
247
- horizontal: scrollX,
248
- onContentSizeChange: this._onContentSizeChange,
249
- onLayout: this._onLayout,
250
- onScroll: this._onScroll,
251
- onScrollEndDrag: this._onScrollEndDrag,
252
- onMomentumScrollEnd: this._onMomentumScrollEnd,
253
- scrollEventThrottle: this._scrollEventThrottle,
254
- style: wrapperStyle,
255
- contentContainerStyle: [_contentContainerStyle]
256
- }, omit(this.props, [// props
257
- 'style', 'scrollX', 'upperThreshold', 'lowerThreshold', 'scrollTop', 'scrollLeft', 'scrollWithAnimation', 'onScrollToUpper', 'onScrollToLower', 'onScroll', 'contentContainerStyle', // SProps
258
- 'horizontal', 'onContentSizeChange', 'onLayout', 'onScroll', 'onScrollEndDrag', 'onMomentumScrollEnd', 'scrollEventThrottle', 'scrollsToTop', 'style', 'contentContainerStyle', 'data', 'renderItem', 'keyExtractor'])), {}, {
259
- ref: this.$scrollView
260
- });
261
-
262
- return /*#__PURE__*/React.createElement(ScrollView, scrollElementProps, children);
263
- }
264
- }], [{
265
- key: "getDerivedStateFromProps",
266
- value: function getDerivedStateFromProps(props, state) {
267
- return state.snapScrollTop !== props.scrollTop || state.snapScrollLeft !== props.scrollLeft ? {
268
- snapScrollTop: props.scrollTop || 0,
269
- snapScrollLeft: props.scrollLeft || 0
270
- } : null;
271
- }
272
- }]);
273
-
274
- return _ScrollView;
275
- }(React.Component);
276
-
277
- _defineProperty(_ScrollView, "defaultProps", {
278
- upperThreshold: 50,
279
- lowerThreshold: 50,
280
- scrollX: false
281
- });
282
-
283
- export default _ScrollView;
@@ -1,21 +0,0 @@
1
- import React from 'react';
2
- import { SliderProps } from './props';
3
- export default class Slider extends React.Component<SliderProps> {
4
- static defaultProps: {
5
- blockSize: number;
6
- activeColor: string;
7
- backgroundColor: string;
8
- blockColor: string;
9
- min: number;
10
- max: number;
11
- disabled: boolean;
12
- value: number;
13
- step: number;
14
- };
15
- constructor(props: SliderProps);
16
- componentDidUpdate(prevProps: SliderProps): void;
17
- state: {
18
- currentValue: number;
19
- };
20
- render(): JSX.Element;
21
- }
@@ -1,114 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
4
- import _createClass from "@babel/runtime/helpers/esm/createClass";
5
- import _inherits from "@babel/runtime/helpers/esm/inherits";
6
- import _createSuper from "@babel/runtime/helpers/esm/createSuper";
7
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
8
- var _excluded = ["min", "max", "step", "backgroundColor", "activeColor", "blockSize", "blockColor", "onChange", "onChanging", "showValue"];
9
- import React from 'react';
10
- import { View, Text } from 'react-native';
11
- import SliderBase from 'tuya-panel-slider/lib/slider';
12
- import { sliderDefault } from './props';
13
-
14
- var Slider = /*#__PURE__*/function (_React$Component) {
15
- _inherits(Slider, _React$Component);
16
-
17
- var _super = _createSuper(Slider);
18
-
19
- function Slider(props) {
20
- var _this;
21
-
22
- _classCallCheck(this, Slider);
23
-
24
- _this = _super.call(this, props);
25
- _this.state = {
26
- currentValue: props.value
27
- };
28
- return _this;
29
- }
30
-
31
- _createClass(Slider, [{
32
- key: "componentDidUpdate",
33
- value: function componentDidUpdate(prevProps) {
34
- if (prevProps.value !== this.props.value) {
35
- this.setState({
36
- currentValue: this.props.value
37
- });
38
- }
39
- }
40
- }, {
41
- key: "render",
42
- value: function render() {
43
- var _this2 = this;
44
-
45
- var _this$props = this.props,
46
- min = _this$props.min,
47
- max = _this$props.max,
48
- step = _this$props.step,
49
- backgroundColor = _this$props.backgroundColor,
50
- activeColor = _this$props.activeColor,
51
- blockSize = _this$props.blockSize,
52
- blockColor = _this$props.blockColor,
53
- onChange = _this$props.onChange,
54
- onChanging = _this$props.onChanging,
55
- showValue = _this$props.showValue,
56
- rest = _objectWithoutProperties(_this$props, _excluded);
57
-
58
- return /*#__PURE__*/React.createElement(View, {
59
- style: {
60
- flexDirection: 'row',
61
- alignItems: 'center'
62
- }
63
- }, /*#__PURE__*/React.createElement(SliderBase, _extends({
64
- trackStyle: {
65
- width: 312,
66
- height: 4
67
- }
68
- }, rest, {
69
- minimumValue: min,
70
- maximumValue: max,
71
- stepValue: step,
72
- maximumTrackTintColor: backgroundColor,
73
- minimumTrackTintColor: activeColor,
74
- thumbTouchSize: {
75
- width: blockSize,
76
- height: blockSize
77
- },
78
- thumbTintColor: blockColor,
79
- onSlidingComplete: function onSlidingComplete(value) {
80
- _this2.setState({
81
- currentValue: value
82
- });
83
-
84
- typeof onChange === 'function' && onChange({
85
- type: 'change',
86
- value: value,
87
- origin: undefined
88
- });
89
- },
90
- onValueChange: function onValueChange(value) {
91
- _this2.setState({
92
- currentValue: value
93
- });
94
-
95
- typeof onChanging === 'function' && onChanging({
96
- type: 'changing',
97
- value: value,
98
- origin: undefined
99
- });
100
- }
101
- })), showValue && /*#__PURE__*/React.createElement(Text, {
102
- style: {
103
- marginLeft: 15
104
- }
105
- }, this.state.currentValue));
106
- }
107
- }]);
108
-
109
- return Slider;
110
- }(React.Component);
111
-
112
- _defineProperty(Slider, "defaultProps", sliderDefault);
113
-
114
- export { Slider as default };
@@ -1,6 +0,0 @@
1
- import { SwiperProps } from './props';
2
- declare const Swiper: {
3
- (props: any): JSX.Element | null;
4
- defaultProps: Partial<SwiperProps<any>>;
5
- };
6
- export default Swiper;
@@ -1,68 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
4
- var _excluded = ["style", "vertical", "circular", "autoplay", "current", "dotActiveColor", "dotColor", "dots", "interval", "dataSource", "renderItem", "onAfterChange", "onchange"],
5
- _excluded2 = ["width", "height"];
6
- import "core-js/modules/es.array.map.js";
7
- import React from 'react';
8
- import OriginSwiper from 'react-native-swiper';
9
- import { defaultSwiperProps } from './props';
10
-
11
- var Swiper = function (props) {
12
- var style = props.style,
13
- vertical = props.vertical,
14
- circular = props.circular,
15
- autoplay = props.autoplay,
16
- current = props.current,
17
- dotActiveColor = props.dotActiveColor,
18
- dotColor = props.dotColor,
19
- dots = props.dots,
20
- interval = props.interval,
21
- dataSource = props.dataSource,
22
- renderItem = props.renderItem,
23
- onAfterChange = props.onAfterChange,
24
- onchange = props.onchange,
25
- rest = _objectWithoutProperties(props, _excluded);
26
-
27
- var width = style.width,
28
- height = style.height,
29
- restStyle = _objectWithoutProperties(style, _excluded2);
30
-
31
- if (!dataSource || dataSource.length === 0 || !renderItem) return null;
32
- return /*#__PURE__*/React.createElement(OriginSwiper, _extends({}, rest, {
33
- style: _objectSpread({}, restStyle),
34
- width: width,
35
- height: height,
36
- showsButtons: false,
37
- horizontal: !vertical,
38
- loop: circular,
39
- autoplay: autoplay,
40
- index: current,
41
- activeDotColor: dotActiveColor,
42
- dotColor: dotColor,
43
- showsPagination: dots,
44
- autoplayTimeout: interval / 1000,
45
- onIndexChanged: function _handleIndexChange(index) {
46
- typeof onchange === 'function' && onchange({
47
- type: 'change',
48
- current: index,
49
- origin: null
50
- });
51
- },
52
- onMomentumScrollEnd: function _handleIndexChangeEnd(event, state) {
53
- var index = state.index;
54
- typeof onAfterChange === 'function' && onAfterChange({
55
- type: 'afterchange',
56
- current: index,
57
- origin: null
58
- });
59
- }
60
- }), dataSource.map(function (item, index) {
61
- if (renderItem) {
62
- return renderItem(item, index);
63
- }
64
- }));
65
- };
66
-
67
- Swiper.defaultProps = defaultSwiperProps;
68
- export default Swiper;
@@ -1,25 +0,0 @@
1
- import React from 'react';
2
- import { GestureResponderEvent } from 'react-native';
3
- import { SwitchProps } from './props';
4
- export interface ISwitchState {
5
- checked: boolean;
6
- }
7
- export default class _Switch extends React.Component<SwitchProps, ISwitchState> {
8
- static displayName: string;
9
- static defaultProps: {
10
- type: string;
11
- color: string;
12
- disabled: boolean;
13
- };
14
- $touchable: React.RefObject<any>;
15
- state: {
16
- checked: boolean;
17
- };
18
- _simulateNativePress: (evt: GestureResponderEvent) => void;
19
- onCheckedChange: (event: {
20
- value: string;
21
- checked: boolean;
22
- }) => void;
23
- onSwitchChange: (isChecked: boolean) => void;
24
- render(): JSX.Element;
25
- }
@@ -1,128 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
4
- import _createClass from "@babel/runtime/helpers/esm/createClass";
5
- import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
6
- import _inherits from "@babel/runtime/helpers/esm/inherits";
7
- import _createSuper from "@babel/runtime/helpers/esm/createSuper";
8
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
9
- var _excluded = ["style", "color", "disabled", "type"];
10
- import "core-js/modules/es.array.concat.js";
11
- import React from 'react';
12
- import Switch from 'tuya-panel-switch/lib/switch';
13
- import Checkbox from '../Checkbox';
14
- import { defaultSwitchProps } from './props';
15
-
16
- var _Switch = /*#__PURE__*/function (_React$Component) {
17
- _inherits(_Switch, _React$Component);
18
-
19
- var _super = _createSuper(_Switch);
20
-
21
- function _Switch() {
22
- var _this;
23
-
24
- _classCallCheck(this, _Switch);
25
-
26
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
27
- args[_key] = arguments[_key];
28
- }
29
-
30
- _this = _super.call.apply(_super, [this].concat(args));
31
-
32
- _defineProperty(_assertThisInitialized(_this), "$touchable", /*#__PURE__*/React.createRef());
33
-
34
- _defineProperty(_assertThisInitialized(_this), "state", {
35
- checked: !!_this.props.checked
36
- });
37
-
38
- _defineProperty(_assertThisInitialized(_this), "_simulateNativePress", function (evt) {
39
- var type = _this.props.type;
40
-
41
- if (type === 'checkbox') {
42
- var node = _this.$touchable.current;
43
- node && node._simulateNativePress(evt);
44
- } else {
45
- _this.setState({
46
- checked: !_this.state.checked
47
- });
48
- }
49
- });
50
-
51
- _defineProperty(_assertThisInitialized(_this), "onCheckedChange", function (event) {
52
- var checked = event.checked;
53
- var onChange = _this.props.onChange;
54
- typeof onChange === 'function' && onChange({
55
- type: 'change',
56
- value: checked
57
- });
58
-
59
- _this.setState({
60
- checked: checked
61
- });
62
- });
63
-
64
- _defineProperty(_assertThisInitialized(_this), "onSwitchChange", function (isChecked) {
65
- var onChange = _this.props.onChange;
66
- typeof onChange === 'function' && onChange({
67
- type: 'change',
68
- value: isChecked
69
- });
70
-
71
- _this.setState({
72
- checked: isChecked
73
- });
74
- });
75
-
76
- return _this;
77
- }
78
-
79
- _createClass(_Switch, [{
80
- key: "render",
81
- value: function render() {
82
- var _this$props = this.props,
83
- style = _this$props.style,
84
- color = _this$props.color,
85
- disabled = _this$props.disabled,
86
- type = _this$props.type,
87
- rest = _objectWithoutProperties(_this$props, _excluded);
88
-
89
- var checked = this.state.checked;
90
-
91
- if (type === 'checkbox') {
92
- return /*#__PURE__*/React.createElement(Checkbox, {
93
- checked: this.state.checked,
94
- style: style,
95
- disabled: disabled,
96
- onChange: this.onCheckedChange,
97
- ref: this.$touchable
98
- });
99
- }
100
-
101
- return /*#__PURE__*/React.createElement(Switch, _extends({
102
- size: {
103
- width: 50,
104
- height: 30,
105
- activeSize: 26,
106
- margin: 2
107
- },
108
- thumbTintColor: "#FFFFFF",
109
- tintColor: 'rgba(0,0,0,0.12)'
110
- }, rest, {
111
- value: checked,
112
- onValueChange: this.onSwitchChange,
113
- style: style,
114
- onTintColor: color,
115
- disabled: disabled,
116
- ref: this.$touchable
117
- }));
118
- }
119
- }]);
120
-
121
- return _Switch;
122
- }(React.Component);
123
-
124
- _defineProperty(_Switch, "displayName", 'Switch');
125
-
126
- _defineProperty(_Switch, "defaultProps", defaultSwitchProps);
127
-
128
- export { _Switch as default };
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- import { StyleProp, ViewStyle } from 'react-native';
3
- import { TextProps } from './props';
4
- export interface IProps extends Omit<TextProps, 'style'> {
5
- style?: StyleProp<ViewStyle>;
6
- }
7
- declare const _Text: React.FC<IProps>;
8
- export default _Text;
@@ -1,37 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- var _excluded = ["selectable", "onClick", "style", "children"];
4
- import React from 'react';
5
- import { Text } from 'react-native';
6
-
7
- var _Text = function (props) {
8
- var selectable = props.selectable,
9
- onClick = props.onClick,
10
- style = props.style,
11
- children = props.children,
12
- rest = _objectWithoutProperties(props, _excluded);
13
-
14
- var clickProps = {
15
- onPress: undefined
16
- };
17
- if (onClick) clickProps.onPress = function onTextClick(event) {
18
- var nativeEvent = event.nativeEvent;
19
- var timestamp = nativeEvent.timestamp,
20
- pageX = nativeEvent.pageX,
21
- pageY = nativeEvent.pageY;
22
- typeof onClick === 'function' && onClick({
23
- type: 'click',
24
- timeStamp: timestamp,
25
- pageX: pageX,
26
- pageY: pageY,
27
- origin: event
28
- });
29
- };
30
- return /*#__PURE__*/React.createElement(Text, _extends({
31
- selectable: !!selectable,
32
- style: style
33
- }, rest, clickProps), children);
34
- };
35
-
36
- _Text.displayName = '_Text';
37
- export default _Text;