@ray-js/components 0.5.7-beta-2 → 0.5.9-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.
- package/lib/Button/Button.thing.js +0 -2
- package/lib/CheckboxGroup/CheckboxGroup.js +0 -1
- package/lib/CheckboxGroup/CheckboxGroup.thing.js +0 -1
- package/lib/CheckboxGroup/CheckboxGroup.wechat.js +0 -1
- package/lib/Icon/Icon.thing.js +0 -2
- package/lib/Input/Input.thing.js +0 -3
- package/lib/Input/Input.wechat.js +0 -1
- package/lib/RadioGroup/RadioGroup.thing.js +0 -1
- package/lib/RadioGroup/RadioGroup.wechat.js +0 -1
- package/lib/ScrollView/ScrollView.thing.js +0 -2
- package/lib/Swiper/Swiper.thing.d.ts +0 -3
- package/lib/Swiper/Swiper.thing.js +1 -2
- package/lib/Textarea/Textarea.thing.js +0 -1
- package/lib/Textarea/Textarea.wechat.js +0 -1
- package/lib/View/View.thing.js +0 -2
- package/lib/utils/handleProps.js +0 -1
- package/lib/utils/index.d.ts +1 -2
- package/package.json +4 -4
- 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.d.ts +0 -4
- package/lib/Form/Form.native.js +0 -8
- 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
@@ -5,7 +5,6 @@ import * as React from 'react';
|
|
5
5
|
import clsx from 'clsx';
|
6
6
|
import { inlineStyle } from '@ray-js/framework-shared';
|
7
7
|
import { Button as RemaxButton } from '@ray-js/adapter';
|
8
|
-
import { defaultButtonProps } from './props';
|
9
8
|
|
10
9
|
var Button = function (props) {
|
11
10
|
var style = props.style,
|
@@ -37,6 +36,5 @@ var Button = function (props) {
|
|
37
36
|
}, restProps));
|
38
37
|
};
|
39
38
|
|
40
|
-
Button.defaultProps = defaultButtonProps;
|
41
39
|
Button.displayName = 'Button';
|
42
40
|
export default Button;
|
package/lib/Icon/Icon.thing.js
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
2
2
|
import * as React from 'react';
|
3
3
|
import { Text } from '@ray-js/components';
|
4
|
-
import { defaultIconProps } from './props';
|
5
4
|
import './index.less';
|
6
5
|
|
7
6
|
var Icon = function (props) {
|
@@ -18,6 +17,5 @@ var Icon = function (props) {
|
|
18
17
|
});
|
19
18
|
};
|
20
19
|
|
21
|
-
Icon.defaultProps = defaultIconProps;
|
22
20
|
Icon.displayName = 'Icon';
|
23
21
|
export default Icon;
|
package/lib/Input/Input.thing.js
CHANGED
@@ -2,12 +2,10 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
4
4
|
var _excluded = ["name", "id", "className", "style", "disabled", "type", "value", "focus", "maxLength", "onBlur", "onConfirm", "onFocus", "onInput", "password", "placeholder", "placeholderStyle"];
|
5
|
-
import "core-js/modules/es.function.name.js";
|
6
5
|
import * as React from 'react';
|
7
6
|
import clsx from 'clsx';
|
8
7
|
import { Input as RemaxInput } from '@ray-js/adapter';
|
9
8
|
import { inlineStyle } from '@ray-js/framework-shared';
|
10
|
-
import { defaultInputProps } from './props';
|
11
9
|
import { nextFrame } from '../core';
|
12
10
|
import styles from './index.module.less';
|
13
11
|
var Input = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
@@ -82,5 +80,4 @@ var Input = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
82
80
|
value: internalValue
|
83
81
|
}, selection, restProps));
|
84
82
|
});
|
85
|
-
Input.defaultProps = defaultInputProps;
|
86
83
|
export default Input;
|
@@ -2,7 +2,6 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
4
4
|
var _excluded = ["name", "id", "className", "style", "disabled", "type", "value", "focus", "maxLength", "onBlur", "onConfirm", "onFocus", "onInput", "password", "placeholder", "placeholderStyle"];
|
5
|
-
import "core-js/modules/es.function.name.js";
|
6
5
|
import * as React from 'react';
|
7
6
|
import clsx from 'clsx';
|
8
7
|
import { Input as RemaxInput } from '@ray-core/wechat';
|
@@ -4,7 +4,6 @@ var _excluded = ["style"];
|
|
4
4
|
import * as React from 'react';
|
5
5
|
import { inlineStyle } from '@ray-js/framework-shared';
|
6
6
|
import { ScrollView as RemaxScrollView } from '@ray-js/adapter';
|
7
|
-
import { defaultScrollViewProps } from './props';
|
8
7
|
|
9
8
|
var ScrollView = function (props) {
|
10
9
|
var style = props.style,
|
@@ -16,5 +15,4 @@ var ScrollView = function (props) {
|
|
16
15
|
}, restProps));
|
17
16
|
};
|
18
17
|
|
19
|
-
ScrollView.defaultProps = defaultScrollViewProps;
|
20
18
|
export default ScrollView;
|
@@ -8,7 +8,7 @@ import * as React from 'react';
|
|
8
8
|
import { inlineStyle } from '@ray-js/framework-shared';
|
9
9
|
import { Swiper as RemaxSwiper, SwiperItem as RemaxSwiperItem } from '@ray-js/adapter';
|
10
10
|
import { propsAlias } from '../core';
|
11
|
-
import { SwiperPropsAlias
|
11
|
+
import { SwiperPropsAlias } from './props';
|
12
12
|
|
13
13
|
function Swiper(props) {
|
14
14
|
var id = props.id,
|
@@ -56,5 +56,4 @@ function Swiper(props) {
|
|
56
56
|
}());
|
57
57
|
}
|
58
58
|
|
59
|
-
Swiper.defaultProps = defaultSwiperProps;
|
60
59
|
export default Swiper;
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
3
3
|
var _excluded = ["id", "className", "style", "value", "placeholderStyle", "placeholder", "onInput", "onFocus", "onConfirm", "onBlur", "maxLength", "focus", "disabled", "name", "autoHeight"];
|
4
|
-
import "core-js/modules/es.function.name.js";
|
5
4
|
import * as React from 'react';
|
6
5
|
import clsx from 'clsx';
|
7
6
|
import { inlineStyle } from '@ray-js/framework-shared';
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
3
3
|
var _excluded = ["id", "className", "style", "value", "placeholderStyle", "placeholder", "onInput", "onFocus", "onConfirm", "onBlur", "maxLength", "focus", "disabled", "name", "autoHeight"];
|
4
|
-
import "core-js/modules/es.function.name.js";
|
5
4
|
import * as React from 'react';
|
6
5
|
import clsx from 'clsx';
|
7
6
|
import { inlineStyle } from '@ray-js/framework-shared';
|
package/lib/View/View.thing.js
CHANGED
@@ -8,7 +8,6 @@ import clsx from 'clsx';
|
|
8
8
|
import PropTypes from 'prop-types';
|
9
9
|
import { inlineStyle, useTouch } from '@ray-js/framework-shared';
|
10
10
|
import { View as RemaxView } from '@ray-js/adapter';
|
11
|
-
import { defaultViewProps } from './props';
|
12
11
|
import styles from './index.module.less';
|
13
12
|
var View = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
14
13
|
var id = props.id,
|
@@ -54,7 +53,6 @@ var View = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
54
53
|
onTransitionEnd: onTransitionEnd
|
55
54
|
}, handlers, restProps), children);
|
56
55
|
});
|
57
|
-
View.defaultProps = defaultViewProps;
|
58
56
|
View.displayName = 'View';
|
59
57
|
export default View;
|
60
58
|
View.propTypes = {
|
package/lib/utils/handleProps.js
CHANGED
@@ -3,7 +3,6 @@ import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
4
4
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
5
5
|
var _excluded = ["className", "hoverClassName", "hoverStyle", "refresherDefaultStyle", "overlayStyle", "customStyle", "indicatorStyle", "maskStyle", "placeholderStyle", "borderStyle", "style", "children"];
|
6
|
-
import "core-js/modules/es.array.join.js";
|
7
6
|
import "core-js/modules/es.array.map.js";
|
8
7
|
import "core-js/modules/es.object.entries.js";
|
9
8
|
import "core-js/modules/es.array.concat.js";
|
package/lib/utils/index.d.ts
CHANGED
@@ -1,10 +1,9 @@
|
|
1
|
-
import { GestureResponderEvent, StyleProp, ViewStyle, TextStyle } from 'react-native';
|
2
1
|
import { ClickEventRet, TouchEventRet } from './interface';
|
3
2
|
declare const omit: (obj?: any, fields?: string[]) => {
|
4
3
|
[key: string]: any;
|
5
4
|
};
|
6
5
|
declare const getClickEvent: (event: GestureResponderEvent, type: 'click' | 'longclick') => ClickEventRet;
|
7
6
|
declare const getTouchEvent: (event: GestureResponderEvent, type: 'touchstart' | 'touchmove' | 'touchend' | 'touchcancel') => TouchEventRet;
|
8
|
-
declare const extracteTextStyle: (style?:
|
7
|
+
declare const extracteTextStyle: (style?: any) => StyleProp<TextStyle>;
|
9
8
|
declare const isTwoArray: (array: any) => boolean;
|
10
9
|
export { omit, getClickEvent, getTouchEvent, extracteTextStyle, isTwoArray };
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ray-js/components",
|
3
|
-
"version": "0.5.
|
3
|
+
"version": "0.5.9-beta-1",
|
4
4
|
"description": "Ray basic components",
|
5
5
|
"keywords": [
|
6
6
|
"ray"
|
@@ -26,7 +26,7 @@
|
|
26
26
|
"dependencies": {
|
27
27
|
"@ray-core/macro": "^0.0.x",
|
28
28
|
"@ray-core/wechat": "^0.0.x",
|
29
|
-
"@ray-js/framework-shared": "^0.5.
|
29
|
+
"@ray-js/framework-shared": "^0.5.9-beta-1",
|
30
30
|
"@ray-js/remax-tuya": "^0.5.7-beta-1",
|
31
31
|
"antd-mobile": "^5.0.0-beta.17",
|
32
32
|
"antd-mobile-icons": "^0.2.2",
|
@@ -45,7 +45,7 @@
|
|
45
45
|
"tuya-panel-switch": "^0.1.1"
|
46
46
|
},
|
47
47
|
"devDependencies": {
|
48
|
-
"@ray-js/cli": "^0.5.
|
48
|
+
"@ray-js/cli": "^0.5.9-beta-1"
|
49
49
|
},
|
50
50
|
"maintainers": [
|
51
51
|
{
|
@@ -53,6 +53,6 @@
|
|
53
53
|
"email": "tuyafe@tuya.com"
|
54
54
|
}
|
55
55
|
],
|
56
|
-
"gitHead": "
|
56
|
+
"gitHead": "45232c09ae46aee3f29663e455158965ad329ff3",
|
57
57
|
"repository": {}
|
58
58
|
}
|
@@ -1,29 +0,0 @@
|
|
1
|
-
/// <reference types="node" />
|
2
|
-
import React from 'react';
|
3
|
-
import { GestureResponderEvent, TouchableWithoutFeedback } from 'react-native';
|
4
|
-
import { ButtonProps } from './props';
|
5
|
-
export interface IEvent {
|
6
|
-
timeStamp: number;
|
7
|
-
pageX: number;
|
8
|
-
pageY: number;
|
9
|
-
origin: GestureResponderEvent;
|
10
|
-
}
|
11
|
-
declare class Button extends React.Component<ButtonProps> {
|
12
|
-
static displayName: string;
|
13
|
-
static defaultProps: ButtonProps;
|
14
|
-
$touchable: React.RefObject<TouchableWithoutFeedback>;
|
15
|
-
isTouchEnd: boolean;
|
16
|
-
pressInTimer: NodeJS.Timeout | null;
|
17
|
-
pressOutTimer: NodeJS.Timeout | null;
|
18
|
-
state: {
|
19
|
-
isHover: boolean;
|
20
|
-
};
|
21
|
-
componentWillUnmount(): void;
|
22
|
-
onPress: () => void;
|
23
|
-
onPressIn: () => void;
|
24
|
-
stopHover: () => void;
|
25
|
-
onPressOut: () => void;
|
26
|
-
_simulateNativePress: (evt: GestureResponderEvent) => void;
|
27
|
-
render(): JSX.Element;
|
28
|
-
}
|
29
|
-
export default Button;
|
@@ -1,229 +0,0 @@
|
|
1
|
-
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
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 "core-js/modules/es.array.map.js";
|
10
|
-
import "core-js/modules/es.array.index-of.js";
|
11
|
-
import React from 'react';
|
12
|
-
import { Animated, Image, Easing, StyleSheet, View, Text, TouchableWithoutFeedback } from 'react-native';
|
13
|
-
import { iconList } from '../assets/icons';
|
14
|
-
import { defaultButtonProps } from './props';
|
15
|
-
import { extracteTextStyle } from '../utils';
|
16
|
-
|
17
|
-
var Loading = function (props) {
|
18
|
-
var rotate = React.useRef(new Animated.Value(0)).current;
|
19
|
-
var tintColor = props.tintColor;
|
20
|
-
React.useEffect(function () {
|
21
|
-
var animation = Animated.loop(Animated.timing(rotate, {
|
22
|
-
toValue: 1,
|
23
|
-
duration: 1000,
|
24
|
-
easing: Easing.linear,
|
25
|
-
useNativeDriver: true,
|
26
|
-
isInteraction: false
|
27
|
-
}));
|
28
|
-
animation.start();
|
29
|
-
return function () {
|
30
|
-
animation.stop();
|
31
|
-
};
|
32
|
-
}, []);
|
33
|
-
var rotateDeg = rotate.interpolate({
|
34
|
-
inputRange: [0, 1],
|
35
|
-
outputRange: ['0deg', '360deg']
|
36
|
-
});
|
37
|
-
return /*#__PURE__*/React.createElement(Animated.View, {
|
38
|
-
style: [styles.loading, {
|
39
|
-
transform: [{
|
40
|
-
rotate: rotateDeg
|
41
|
-
}]
|
42
|
-
}]
|
43
|
-
}, /*#__PURE__*/React.createElement(Image, {
|
44
|
-
source: iconList.loading,
|
45
|
-
style: [styles.loadingImg, {
|
46
|
-
tintColor: tintColor
|
47
|
-
}]
|
48
|
-
}));
|
49
|
-
};
|
50
|
-
|
51
|
-
var Button = /*#__PURE__*/function (_React$Component) {
|
52
|
-
_inherits(Button, _React$Component);
|
53
|
-
|
54
|
-
var _super = _createSuper(Button);
|
55
|
-
|
56
|
-
function Button() {
|
57
|
-
var _this;
|
58
|
-
|
59
|
-
_classCallCheck(this, Button);
|
60
|
-
|
61
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
62
|
-
args[_key] = arguments[_key];
|
63
|
-
}
|
64
|
-
|
65
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
66
|
-
|
67
|
-
_defineProperty(_assertThisInitialized(_this), "$touchable", /*#__PURE__*/React.createRef());
|
68
|
-
|
69
|
-
_defineProperty(_assertThisInitialized(_this), "isTouchEnd", false);
|
70
|
-
|
71
|
-
_defineProperty(_assertThisInitialized(_this), "pressInTimer", null);
|
72
|
-
|
73
|
-
_defineProperty(_assertThisInitialized(_this), "pressOutTimer", null);
|
74
|
-
|
75
|
-
_defineProperty(_assertThisInitialized(_this), "state", {
|
76
|
-
isHover: false
|
77
|
-
});
|
78
|
-
|
79
|
-
_defineProperty(_assertThisInitialized(_this), "onPress", function () {
|
80
|
-
var _this$props = _this.props,
|
81
|
-
disabled = _this$props.disabled,
|
82
|
-
onClick = _this$props.onClick;
|
83
|
-
!disabled && typeof onClick === 'function' && onClick({
|
84
|
-
type: 'click'
|
85
|
-
});
|
86
|
-
});
|
87
|
-
|
88
|
-
_defineProperty(_assertThisInitialized(_this), "onPressIn", function () {
|
89
|
-
var _this$props2 = _this.props,
|
90
|
-
hoverStartTime = _this$props2.hoverStartTime,
|
91
|
-
hoverStyle = _this$props2.hoverStyle;
|
92
|
-
_this.isTouchEnd = false;
|
93
|
-
|
94
|
-
if (hoverStyle) {
|
95
|
-
_this.pressInTimer = setTimeout(function () {
|
96
|
-
_this.setState({
|
97
|
-
isHover: true
|
98
|
-
}, function () {
|
99
|
-
if (_this.isTouchEnd) {
|
100
|
-
_this.stopHover();
|
101
|
-
}
|
102
|
-
});
|
103
|
-
|
104
|
-
clearTimeout(_this.pressInTimer);
|
105
|
-
}, hoverStartTime);
|
106
|
-
}
|
107
|
-
});
|
108
|
-
|
109
|
-
_defineProperty(_assertThisInitialized(_this), "stopHover", function () {
|
110
|
-
var hoverStayTime = _this.props.hoverStayTime;
|
111
|
-
_this.pressOutTimer = setTimeout(function () {
|
112
|
-
_this.setState({
|
113
|
-
isHover: false
|
114
|
-
});
|
115
|
-
|
116
|
-
clearTimeout(_this.pressOutTimer);
|
117
|
-
}, hoverStayTime);
|
118
|
-
});
|
119
|
-
|
120
|
-
_defineProperty(_assertThisInitialized(_this), "onPressOut", function () {
|
121
|
-
var hoverStyle = _this.props.hoverStyle;
|
122
|
-
var isHover = _this.state.isHover;
|
123
|
-
_this.isTouchEnd = true;
|
124
|
-
|
125
|
-
if (hoverStyle && isHover) {
|
126
|
-
_this.stopHover();
|
127
|
-
}
|
128
|
-
});
|
129
|
-
|
130
|
-
_defineProperty(_assertThisInitialized(_this), "_simulateNativePress", function (evt) {
|
131
|
-
var node = _this.$touchable.current;
|
132
|
-
node && node.props.onPress && node.props.onPress(evt);
|
133
|
-
});
|
134
|
-
|
135
|
-
return _this;
|
136
|
-
}
|
137
|
-
|
138
|
-
_createClass(Button, [{
|
139
|
-
key: "componentWillUnmount",
|
140
|
-
value: function componentWillUnmount() {
|
141
|
-
clearTimeout(this.pressOutTimer);
|
142
|
-
clearTimeout(this.pressInTimer);
|
143
|
-
}
|
144
|
-
}, {
|
145
|
-
key: "render",
|
146
|
-
value: function render() {
|
147
|
-
var _this$props3 = this.props,
|
148
|
-
loading = _this$props3.loading,
|
149
|
-
style = _this$props3.style,
|
150
|
-
size = _this$props3.size,
|
151
|
-
children = _this$props3.children,
|
152
|
-
disabled = _this$props3.disabled,
|
153
|
-
type = _this$props3.type,
|
154
|
-
plain = _this$props3.plain,
|
155
|
-
hoverStyle = _this$props3.hoverStyle;
|
156
|
-
var isDefaultSize = size === 'default';
|
157
|
-
var isDefaultType = type === 'default';
|
158
|
-
var isPrimaryType = type === 'primary';
|
159
|
-
var borderColor = isPrimaryType ? '#007AFF' : isDefaultType ? 'rgba(0, 0, 0, 0.2)' : '#FF4444';
|
160
|
-
var backgroundColor = disabled ? 'rgba(0, 0, 0, 0.2)' : plain ? 'transparent' : isPrimaryType ? '#007AFF' : '#FFF';
|
161
|
-
var textColor = disabled ? '#FFF' : plain ? borderColor : isDefaultType ? '#007AFF' : type === 'warn' ? '#FF4444' : '#FFFFFF';
|
162
|
-
var textHoverStyle = this.state.isHover ? extracteTextStyle(hoverStyle) : {};
|
163
|
-
return /*#__PURE__*/React.createElement(TouchableWithoutFeedback, {
|
164
|
-
onPress: this.onPress,
|
165
|
-
onLongPress: this.onPress,
|
166
|
-
onPressIn: this.onPressIn,
|
167
|
-
onPressOut: this.onPressOut,
|
168
|
-
ref: this.$touchable,
|
169
|
-
disabled: disabled
|
170
|
-
}, /*#__PURE__*/React.createElement(View, {
|
171
|
-
style: [styles.btn, !isDefaultSize && styles.btnMini, {
|
172
|
-
backgroundColor: backgroundColor
|
173
|
-
}, plain && {
|
174
|
-
borderWidth: 1,
|
175
|
-
borderColor: borderColor
|
176
|
-
}, style, this.state.isHover && hoverStyle]
|
177
|
-
}, loading && /*#__PURE__*/React.createElement(Loading, {
|
178
|
-
tintColor: textColor
|
179
|
-
}), Array.isArray(children) ? children.map(function (c, i) {
|
180
|
-
return /*#__PURE__*/React.createElement(Text, {
|
181
|
-
key: i,
|
182
|
-
style: [styles.btnText, !isDefaultSize && styles.btnTextMini, {
|
183
|
-
color: textColor
|
184
|
-
}, textHoverStyle]
|
185
|
-
}, c);
|
186
|
-
}) : ['string', 'number'].indexOf(_typeof(children)) > -1 ? /*#__PURE__*/React.createElement(Text, {
|
187
|
-
style: [styles.btnText, !isDefaultSize && styles.btnTextMini, {
|
188
|
-
color: textColor
|
189
|
-
}, textHoverStyle]
|
190
|
-
}, children) : children));
|
191
|
-
}
|
192
|
-
}]);
|
193
|
-
|
194
|
-
return Button;
|
195
|
-
}(React.Component);
|
196
|
-
|
197
|
-
_defineProperty(Button, "displayName", '_Button');
|
198
|
-
|
199
|
-
_defineProperty(Button, "defaultProps", defaultButtonProps);
|
200
|
-
|
201
|
-
export default Button;
|
202
|
-
var styles = StyleSheet.create({
|
203
|
-
btn: {
|
204
|
-
flexDirection: 'row',
|
205
|
-
justifyContent: 'center',
|
206
|
-
alignItems: 'center',
|
207
|
-
paddingHorizontal: 14,
|
208
|
-
height: 46,
|
209
|
-
backgroundColor: '#F8F8F8',
|
210
|
-
borderRadius: 5
|
211
|
-
},
|
212
|
-
loading: {
|
213
|
-
marginRight: 5
|
214
|
-
},
|
215
|
-
loadingImg: {
|
216
|
-
width: 20,
|
217
|
-
height: 20
|
218
|
-
},
|
219
|
-
btnMini: {
|
220
|
-
height: 30
|
221
|
-
},
|
222
|
-
btnText: {
|
223
|
-
fontSize: 18,
|
224
|
-
color: '#000'
|
225
|
-
},
|
226
|
-
btnTextMini: {
|
227
|
-
fontSize: 13
|
228
|
-
}
|
229
|
-
});
|
@@ -1,28 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { TouchableWithoutFeedback, GestureResponderEvent } from 'react-native';
|
3
|
-
import { CheckboxProps } from './props';
|
4
|
-
export declare type EventOnChange = {
|
5
|
-
value: string;
|
6
|
-
checked: boolean;
|
7
|
-
type: 'change';
|
8
|
-
};
|
9
|
-
export interface CheckboxNativeProps extends CheckboxProps {
|
10
|
-
onChange?: (evt: EventOnChange) => void;
|
11
|
-
}
|
12
|
-
export interface CheckboxState {
|
13
|
-
checked: boolean;
|
14
|
-
}
|
15
|
-
declare class Checkbox extends React.Component<CheckboxNativeProps, CheckboxState> {
|
16
|
-
static displayName: string;
|
17
|
-
static defaultProps: {
|
18
|
-
value: string;
|
19
|
-
color: string;
|
20
|
-
};
|
21
|
-
$touchable: React.RefObject<TouchableWithoutFeedback>;
|
22
|
-
constructor(props: CheckboxNativeProps);
|
23
|
-
componentDidUpdate(prevProps: CheckboxNativeProps): void;
|
24
|
-
_simulateNativePress: (evt: GestureResponderEvent) => void;
|
25
|
-
onPress: () => void;
|
26
|
-
render(): JSX.Element;
|
27
|
-
}
|
28
|
-
export default Checkbox;
|
@@ -1,118 +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 { TouchableWithoutFeedback, StyleSheet, View } from 'react-native';
|
9
|
-
import Icon from '../Icon';
|
10
|
-
|
11
|
-
var Checkbox = /*#__PURE__*/function (_React$Component) {
|
12
|
-
_inherits(Checkbox, _React$Component);
|
13
|
-
|
14
|
-
var _super = _createSuper(Checkbox);
|
15
|
-
|
16
|
-
function Checkbox(props) {
|
17
|
-
var _this;
|
18
|
-
|
19
|
-
_classCallCheck(this, Checkbox);
|
20
|
-
|
21
|
-
_this = _super.call(this, props);
|
22
|
-
|
23
|
-
_defineProperty(_assertThisInitialized(_this), "$touchable", /*#__PURE__*/React.createRef());
|
24
|
-
|
25
|
-
_defineProperty(_assertThisInitialized(_this), "_simulateNativePress", function (evt) {
|
26
|
-
var node = _this.$touchable.current;
|
27
|
-
node && node.props.onPress && node.props.onPress(evt);
|
28
|
-
});
|
29
|
-
|
30
|
-
_defineProperty(_assertThisInitialized(_this), "onPress", function () {
|
31
|
-
var _this$props = _this.props,
|
32
|
-
disabled = _this$props.disabled,
|
33
|
-
onChange = _this$props.onChange,
|
34
|
-
value = _this$props.value;
|
35
|
-
if (disabled) return;
|
36
|
-
var checked = !_this.state.checked;
|
37
|
-
typeof onChange === 'function' && onChange({
|
38
|
-
value: value,
|
39
|
-
checked: checked,
|
40
|
-
type: 'change'
|
41
|
-
});
|
42
|
-
|
43
|
-
_this.setState({
|
44
|
-
checked: checked
|
45
|
-
});
|
46
|
-
});
|
47
|
-
|
48
|
-
_this.state = {
|
49
|
-
checked: props.checked
|
50
|
-
};
|
51
|
-
return _this;
|
52
|
-
}
|
53
|
-
|
54
|
-
_createClass(Checkbox, [{
|
55
|
-
key: "componentDidUpdate",
|
56
|
-
value: function componentDidUpdate(prevProps) {
|
57
|
-
if (prevProps.checked !== this.props.checked) {
|
58
|
-
this.setState({
|
59
|
-
checked: !!this.props.checked
|
60
|
-
});
|
61
|
-
}
|
62
|
-
}
|
63
|
-
}, {
|
64
|
-
key: "render",
|
65
|
-
value: function render() {
|
66
|
-
var _this$props2 = this.props,
|
67
|
-
style = _this$props2.style,
|
68
|
-
color = _this$props2.color,
|
69
|
-
disabled = _this$props2.disabled;
|
70
|
-
var checked = this.state.checked;
|
71
|
-
return /*#__PURE__*/React.createElement(TouchableWithoutFeedback, {
|
72
|
-
onPress: this.onPress,
|
73
|
-
ref: this.$touchable
|
74
|
-
}, /*#__PURE__*/React.createElement(View, {
|
75
|
-
style: [styles.wrapper, {
|
76
|
-
backgroundColor: disabled ? 'rgba(0,0,0,0.2)' : checked ? '#007AFF' : '#FFF',
|
77
|
-
borderColor: disabled ? 'rgba(0,0,0,0.2)' : checked ? '#007AFF' : 'rgba(0,0,0,0.2)'
|
78
|
-
}, style]
|
79
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
80
|
-
type: "success_no_circle",
|
81
|
-
size: 12,
|
82
|
-
color: color,
|
83
|
-
style: [styles.wrapperIcon, checked && styles.wrapperCheckedIcon]
|
84
|
-
}), /*#__PURE__*/React.createElement(View, {
|
85
|
-
style: {
|
86
|
-
flexGrow: 0
|
87
|
-
}
|
88
|
-
}, this.props.children)));
|
89
|
-
}
|
90
|
-
}]);
|
91
|
-
|
92
|
-
return Checkbox;
|
93
|
-
}(React.Component);
|
94
|
-
|
95
|
-
_defineProperty(Checkbox, "displayName", '_Checkbox');
|
96
|
-
|
97
|
-
_defineProperty(Checkbox, "defaultProps", {
|
98
|
-
value: '',
|
99
|
-
color: '#FFF'
|
100
|
-
});
|
101
|
-
|
102
|
-
export default Checkbox;
|
103
|
-
var styles = StyleSheet.create({
|
104
|
-
wrapper: {
|
105
|
-
alignItems: 'center',
|
106
|
-
justifyContent: 'center',
|
107
|
-
width: 18,
|
108
|
-
height: 18,
|
109
|
-
borderWidth: 1,
|
110
|
-
borderRadius: 4
|
111
|
-
},
|
112
|
-
wrapperIcon: {
|
113
|
-
opacity: 0
|
114
|
-
},
|
115
|
-
wrapperCheckedIcon: {
|
116
|
-
opacity: 1
|
117
|
-
}
|
118
|
-
});
|
@@ -1,18 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { ViewStyle, StyleProp } from 'react-native';
|
3
|
-
import { CheckboxGroupProps, CheckboxGroupOption } from './props';
|
4
|
-
export interface IProps extends Omit<CheckboxGroupProps, 'style'> {
|
5
|
-
style?: StyleProp<ViewStyle>;
|
6
|
-
}
|
7
|
-
export interface IState {
|
8
|
-
options: CheckboxGroupOption[];
|
9
|
-
}
|
10
|
-
export default class CheckboxGroup extends React.Component<IProps, IState> {
|
11
|
-
constructor(props: IProps);
|
12
|
-
getValueData: (options: CheckboxGroupOption[]) => string[];
|
13
|
-
_handleChange: (event: {
|
14
|
-
value: string;
|
15
|
-
checked: boolean;
|
16
|
-
}, index: number) => void;
|
17
|
-
render(): JSX.Element;
|
18
|
-
}
|