Comparing version 1.0.107 to 1.0.108
@@ -112,6 +112,30 @@ "use strict"; | ||
var _b = _react["default"].useState(0), | ||
process = _b[0], | ||
setProcess = _b[1]; | ||
var children = _react["default"].Children.toArray(props.children); | ||
var disabled = props === null || props === void 0 ? void 0 : props.disabled; | ||
var _b = _react["default"].useState(false), | ||
focused = _b[0], | ||
setFocused = _b[1]; | ||
var isSubmit = props.type === 'submit' && !props.onClick && !props.onPress; | ||
var prefixes = []; | ||
if (disabled || (props === null || props === void 0 ? void 0 : props.readOnly) || isSubmit && (formProps === null || formProps === void 0 ? void 0 : formProps.disabled) || isSubmit && (formProps === null || formProps === void 0 ? void 0 : formProps.readOnly)) prefixes.push('disabled'); | ||
if (focused) prefixes.push('focus'); | ||
var _c = (0, _useParseProps.useParseProps)('button', props, prefixes), | ||
outStyle = _c.style, | ||
onPress = _c.onPress, | ||
extraProps = (0, _tslib.__rest)(_c, ["style", "onPress"]); | ||
var style = outStyle === null || outStyle === void 0 ? void 0 : outStyle.filter(function (v) { | ||
return !!v; | ||
}).reduce(function (a, v) { | ||
return (0, _tslib.__assign)((0, _tslib.__assign)({}, a), v); | ||
}, {}); | ||
var _d = _react["default"].useState(0), | ||
process = _d[0], | ||
setProcess = _d[1]; | ||
var handleClick = function handleClick() { | ||
@@ -161,25 +185,2 @@ if (process > 0) return; | ||
var children = _react["default"].Children.toArray(props.children); | ||
var disabled = props === null || props === void 0 ? void 0 : props.disabled; | ||
var _c = _react["default"].useState(false), | ||
focused = _c[0], | ||
setFocused = _c[1]; | ||
var isSubmit = props.type === 'submit' && !props.onClick && !props.onPress; | ||
var prefixes = []; | ||
if (disabled || (props === null || props === void 0 ? void 0 : props.readOnly) || isSubmit && (formProps === null || formProps === void 0 ? void 0 : formProps.disabled) || isSubmit && (formProps === null || formProps === void 0 ? void 0 : formProps.readOnly)) prefixes.push('disabled'); | ||
if (focused) prefixes.push('focus'); | ||
var _d = (0, _useParseProps.useParseProps)('button', props, prefixes), | ||
outStyle = _d.style, | ||
onPress = _d.onPress, | ||
extraProps = (0, _tslib.__rest)(_d, ["style", "onPress"]); | ||
var style = outStyle === null || outStyle === void 0 ? void 0 : outStyle.filter(function (v) { | ||
return !!v; | ||
}).reduce(function (a, v) { | ||
return (0, _tslib.__assign)((0, _tslib.__assign)({}, a), v); | ||
}, {}); | ||
return _react["default"].createElement(_reactNative.TouchableOpacity, (0, _tslib.__assign)({ | ||
@@ -192,5 +193,7 @@ ref: (0, _mergeRefs.mergeRefs)(forwardedRef, nodeRef), | ||
}, formProps, extraProps, { | ||
disabled: disabled, | ||
disabled: disabled || process, | ||
style: style | ||
}), children === null || children === void 0 ? void 0 : children.map(function (v, index) { | ||
}), process && (props === null || props === void 0 ? void 0 : props.showProcess) ? _react["default"].createElement(_reactNative.ActivityIndicator, { | ||
size: 'small' | ||
}) : children === null || children === void 0 ? void 0 : children.map(function (v, index) { | ||
return typeof v === 'string' ? _react["default"].createElement(_reactNative.Text, { | ||
@@ -197,0 +200,0 @@ key: "" + index, |
@@ -38,2 +38,3 @@ import { ReactNode } from 'react'; | ||
onPress?: () => void; | ||
showProcess?: boolean; | ||
} | ||
@@ -40,0 +41,0 @@ export interface ScrollableProps extends ViewProps { |
{ | ||
"name": "actbase", | ||
"version": "1.0.107", | ||
"version": "1.0.108", | ||
"description": "React-Native Design Components", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is not supported yet
399277
7441