@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.
- package/lib/Button/{Button.thing.d.ts → Button.tuya.d.ts} +0 -0
- package/lib/Button/{Button.thing.js → Button.tuya.js} +1 -1
- package/lib/Checkbox/{Checkbox.thing.d.ts → Checkbox.tuya.d.ts} +0 -0
- package/lib/Checkbox/{Checkbox.thing.js → Checkbox.tuya.js} +1 -1
- package/lib/CheckboxGroup/{CheckboxGroup.thing.d.ts → CheckboxGroup.tuya.d.ts} +0 -0
- package/lib/CheckboxGroup/{CheckboxGroup.thing.js → CheckboxGroup.tuya.js} +1 -1
- package/lib/CoverView/{CoverView.thing.d.ts → CoverView.tuya.d.ts} +0 -0
- package/lib/CoverView/{CoverView.thing.js → CoverView.tuya.js} +1 -1
- package/lib/DatePicker/{DatePicker.thing.d.ts → DatePicker.tuya.d.ts} +0 -0
- package/lib/DatePicker/{DatePicker.thing.js → DatePicker.tuya.js} +1 -1
- package/lib/Form/{Form.native.d.ts → Form.tuya.d.ts} +0 -0
- package/lib/Form/{Form.thing.js → Form.tuya.js} +1 -1
- package/lib/Icon/{Icon.thing.d.ts → Icon.tuya.d.ts} +0 -0
- package/lib/Icon/{Icon.thing.js → Icon.tuya.js} +0 -0
- package/lib/Image/{Image.thing.d.ts → Image.tuya.d.ts} +0 -0
- package/lib/Image/{Image.thing.js → Image.tuya.js} +1 -1
- package/lib/Input/{Input.thing.d.ts → Input.tuya.d.ts} +0 -0
- package/lib/Input/{Input.thing.js → Input.tuya.js} +1 -1
- package/lib/IpcPlayer/{IpcPlayer.thing.d.ts → IpcPlayer.tuya.d.ts} +0 -0
- package/lib/IpcPlayer/{IpcPlayer.thing.js → IpcPlayer.tuya.js} +1 -1
- package/lib/IpcPlayer/props.d.ts +1 -1
- package/lib/Label/{Label.thing.d.ts → Label.tuya.d.ts} +0 -0
- package/lib/Label/{Label.thing.js → Label.tuya.js} +1 -1
- package/lib/LinearGradient/{LinearGradient.thing.d.ts → LinearGradient.tuya.d.ts} +0 -0
- package/lib/LinearGradient/{LinearGradient.thing.js → LinearGradient.tuya.js} +0 -0
- package/lib/Modal/{Modal.thing.d.ts → Modal.tuya.d.ts} +0 -0
- package/lib/Modal/{Modal.thing.js → Modal.tuya.js} +0 -0
- package/lib/Motion/Fade/{index.thing.d.ts → index.tuya.d.ts} +0 -0
- package/lib/Motion/Fade/{index.thing.js → index.tuya.js} +0 -0
- package/lib/Motion/PullUp/{index.thing.d.ts → index.tuya.d.ts} +0 -0
- package/lib/Motion/PullUp/{index.thing.js → index.tuya.js} +0 -0
- package/lib/Motion/PushDown/{index.thing.d.ts → index.tuya.d.ts} +0 -0
- package/lib/Motion/PushDown/{index.thing.js → index.tuya.js} +0 -0
- package/lib/Motion/ScaleFadeIn/{index.thing.d.ts → index.tuya.d.ts} +0 -0
- package/lib/Motion/ScaleFadeIn/{index.thing.js → index.tuya.js} +0 -0
- package/lib/Motion/ScalePullDown/{index.thing.d.ts → index.tuya.d.ts} +0 -0
- package/lib/Motion/ScalePullDown/{index.thing.js → index.tuya.js} +0 -0
- package/lib/PageContainer/{PageContainer.thing.d.ts → PageContainer.tuya.d.ts} +0 -0
- package/lib/PageContainer/{PageContainer.thing.js → PageContainer.tuya.js} +1 -1
- package/lib/PageContainer/props.d.ts +1 -1
- package/lib/Picker/{Picker.thing.d.ts → Picker.tuya.d.ts} +0 -0
- package/lib/Picker/{Picker.thing.js → Picker.tuya.js} +1 -1
- package/lib/PickerView/{PickerView.thing.d.ts → PickerView.tuya.d.ts} +0 -0
- package/lib/PickerView/{PickerView.thing.js → PickerView.tuya.js} +1 -1
- package/lib/PickerViewColumn/{PickerViewColumn.thing.d.ts → PickerViewColumn.tuya.d.ts} +0 -0
- package/lib/PickerViewColumn/{PickerViewColumn.thing.js → PickerViewColumn.tuya.js} +1 -1
- package/lib/PickerViewColumn/PickerViewColumn.wechat.js +1 -1
- package/lib/RadialGradient/{RadialGradient.thing.d.ts → RadialGradient.tuya.d.ts} +0 -0
- package/lib/RadialGradient/{RadialGradient.thing.js → RadialGradient.tuya.js} +0 -0
- package/lib/Radio/{Radio.thing.d.ts → Radio.tuya.d.ts} +0 -0
- package/lib/Radio/{Radio.thing.js → Radio.tuya.js} +1 -1
- package/lib/RadioGroup/{RadioGroup.thing.d.ts → RadioGroup.tuya.d.ts} +0 -0
- package/lib/RadioGroup/{RadioGroup.thing.js → RadioGroup.tuya.js} +1 -1
- package/lib/ScrollView/{ScrollView.thing.d.ts → ScrollView.tuya.d.ts} +0 -0
- package/lib/ScrollView/{ScrollView.thing.js → ScrollView.tuya.js} +1 -1
- package/lib/Slider/{Slider.thing.d.ts → Slider.tuya.d.ts} +0 -0
- package/lib/Slider/{Slider.thing.js → Slider.tuya.js} +1 -1
- package/lib/Swiper/{Swiper.thing.d.ts → Swiper.tuya.d.ts} +0 -0
- package/lib/Swiper/{Swiper.thing.js → Swiper.tuya.js} +1 -1
- package/lib/SwiperItem/{SwiperItem.thing.d.ts → SwiperItem.tuya.d.ts} +0 -0
- package/lib/SwiperItem/{SwiperItem.thing.js → SwiperItem.tuya.js} +1 -1
- package/lib/SwiperItem/SwiperItem.wechat.js +1 -1
- package/lib/Switch/{Switch.thing.d.ts → Switch.tuya.d.ts} +0 -0
- package/lib/Switch/{Switch.thing.js → Switch.tuya.js} +1 -1
- package/lib/Text/{Text.thing.d.ts → Text.tuya.d.ts} +0 -0
- package/lib/Text/{Text.thing.js → Text.tuya.js} +1 -1
- package/lib/Textarea/{Textarea.thing.d.ts → Textarea.tuya.d.ts} +0 -0
- package/lib/Textarea/{Textarea.thing.js → Textarea.tuya.js} +1 -1
- package/lib/TimePicker/{TimePicker.thing.d.ts → TimePicker.tuya.d.ts} +0 -0
- package/lib/TimePicker/{TimePicker.thing.js → TimePicker.tuya.js} +1 -1
- package/lib/View/{View.thing.d.ts → View.tuya.d.ts} +0 -0
- package/lib/View/{View.thing.js → View.tuya.js} +1 -1
- package/lib/utils/index.d.ts +1 -2
- package/package.json +5 -5
- package/lib/Button/Button.native.d.ts +0 -29
- package/lib/Button/Button.native.js +0 -229
- package/lib/Checkbox/Checkbox.native.d.ts +0 -28
- package/lib/Checkbox/Checkbox.native.js +0 -118
- package/lib/CheckboxGroup/CheckboxGroup.native.d.ts +0 -18
- package/lib/CheckboxGroup/CheckboxGroup.native.js +0 -99
- package/lib/ClickableSimplified/index.native.d.ts +0 -42
- package/lib/ClickableSimplified/index.native.js +0 -166
- package/lib/DatePicker/DatePicker.native.d.ts +0 -34
- package/lib/DatePicker/DatePicker.native.js +0 -449
- package/lib/Form/Form.native.js +0 -8
- package/lib/Form/Form.thing.d.ts +0 -4
- package/lib/Icon/Icon.native.d.ts +0 -15
- package/lib/Icon/Icon.native.js +0 -48
- package/lib/Image/Image.native.d.ts +0 -28
- package/lib/Image/Image.native.js +0 -219
- package/lib/Input/Input.native.d.ts +0 -32
- package/lib/Input/Input.native.js +0 -212
- package/lib/Label/Label.native.d.ts +0 -4
- package/lib/Label/Label.native.js +0 -29
- package/lib/LinearGradient/LinearGradient.native.d.ts +0 -16
- package/lib/LinearGradient/LinearGradient.native.js +0 -60
- package/lib/Modal/Modal.native.d.ts +0 -24
- package/lib/Modal/Modal.native.js +0 -98
- package/lib/Motion/Fade/index.native.d.ts +0 -2
- package/lib/Motion/Fade/index.native.js +0 -3
- package/lib/Motion/PullUp/index.native.d.ts +0 -2
- package/lib/Motion/PullUp/index.native.js +0 -3
- package/lib/Motion/PushDown/index.native.d.ts +0 -2
- package/lib/Motion/PushDown/index.native.js +0 -3
- package/lib/Motion/ScaleFadeIn/index.native.d.ts +0 -2
- package/lib/Motion/ScaleFadeIn/index.native.js +0 -3
- package/lib/Motion/ScalePullDown/index.native.d.ts +0 -2
- package/lib/Motion/ScalePullDown/index.native.js +0 -3
- package/lib/Picker/Picker.native.d.ts +0 -22
- package/lib/Picker/Picker.native.js +0 -181
- package/lib/PickerView/PickerView.native.d.ts +0 -31
- package/lib/PickerView/PickerView.native.js +0 -175
- package/lib/PickerViewColumn/PickerViewColumn.native.d.ts +0 -31
- package/lib/PickerViewColumn/PickerViewColumn.native.js +0 -175
- package/lib/RadialGradient/RadialGradient.native.d.ts +0 -17
- package/lib/RadialGradient/RadialGradient.native.js +0 -52
- package/lib/Radio/Radio.native.d.ts +0 -30
- package/lib/Radio/Radio.native.js +0 -132
- package/lib/RadioGroup/RadioGroup.native.d.ts +0 -18
- package/lib/RadioGroup/RadioGroup.native.js +0 -99
- package/lib/ScrollView/ScrollView.native.d.ts +0 -57
- package/lib/ScrollView/ScrollView.native.js +0 -283
- package/lib/Slider/Slider.native.d.ts +0 -21
- package/lib/Slider/Slider.native.js +0 -114
- package/lib/Swiper/Swiper.native.d.ts +0 -6
- package/lib/Swiper/Swiper.native.js +0 -68
- package/lib/Switch/Switch.native.d.ts +0 -25
- package/lib/Switch/Switch.native.js +0 -128
- package/lib/Text/Text.native.d.ts +0 -8
- package/lib/Text/Text.native.js +0 -37
- package/lib/Textarea/Textarea.native.d.ts +0 -4
- package/lib/Textarea/Textarea.native.js +0 -26
- package/lib/TimePicker/TimePicker.native.d.ts +0 -39
- package/lib/TimePicker/TimePicker.native.js +0 -319
- package/lib/View/View.native.d.ts +0 -2
- 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,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 {};
|