secullum-react-native-ui 4.11.1 → 4.12.0
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.
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
exports.DropDown = void 0;
|
|
4
13
|
const React = require("react");
|
|
@@ -232,11 +241,19 @@ class DropDown extends React.Component {
|
|
|
232
241
|
}
|
|
233
242
|
render() {
|
|
234
243
|
const { modalOpen } = this.state;
|
|
235
|
-
const { label, items, value, emptyMessage, style, disabledStyle, disabled, labelStyle, inputStyle, iconComponent, nativeID, icon } = this.props;
|
|
244
|
+
const { label, items, value, emptyMessage, style, disabledStyle, disabled, labelStyle, inputStyle, iconComponent, nativeID, onPress, icon } = this.props;
|
|
236
245
|
const selectedItem = items.find(x => x.value === value);
|
|
237
246
|
const styles = this.getStyles();
|
|
238
247
|
const theme = (0, theme_1.getTheme)();
|
|
239
|
-
return (React.createElement(react_native_1.TouchableWithoutFeedback, { onPress: () => this
|
|
248
|
+
return (React.createElement(react_native_1.TouchableWithoutFeedback, { onPress: () => __awaiter(this, void 0, void 0, function* () {
|
|
249
|
+
if (onPress) {
|
|
250
|
+
const result = yield onPress();
|
|
251
|
+
if (result === false) {
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
this.setState({ modalOpen: true });
|
|
256
|
+
}), disabled: disabled },
|
|
240
257
|
React.createElement(react_native_1.View, { nativeID: nativeID, testID: (0, test_1.getTestID)(nativeID), style: [
|
|
241
258
|
styles.container,
|
|
242
259
|
style,
|
|
@@ -5,22 +5,21 @@ export interface QuestionProperties {
|
|
|
5
5
|
visible: boolean;
|
|
6
6
|
nativeID?: string;
|
|
7
7
|
textStyle?: StyleProp<TextStyle>;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
style?: StyleProp<ViewStyle>;
|
|
19
|
-
textStyle?: StyleProp<TextStyle>;
|
|
20
|
-
nativeID?: string;
|
|
21
|
-
};
|
|
8
|
+
buttonOrder: 'ok,cancel' | 'cancel,ok';
|
|
9
|
+
okButton: QuestionButtonProperties;
|
|
10
|
+
cancelButton: QuestionButtonProperties;
|
|
11
|
+
}
|
|
12
|
+
export interface QuestionButtonProperties {
|
|
13
|
+
text: string;
|
|
14
|
+
onPress: () => void;
|
|
15
|
+
style?: StyleProp<ViewStyle>;
|
|
16
|
+
textStyle?: StyleProp<TextStyle>;
|
|
17
|
+
nativeID?: string;
|
|
22
18
|
}
|
|
23
19
|
export declare class Question extends React.Component<QuestionProperties> {
|
|
20
|
+
static defaultProps: {
|
|
21
|
+
buttonOrder: string;
|
|
22
|
+
};
|
|
24
23
|
getStyles: () => {
|
|
25
24
|
botoesAcao: {
|
|
26
25
|
flexDirection: "row";
|
|
@@ -50,8 +50,11 @@ class Question extends React.Component {
|
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
52
|
render() {
|
|
53
|
-
const { message, textStyle, visible, nativeID, okButton, cancelButton } = this.props;
|
|
53
|
+
const { message, textStyle, visible, nativeID, buttonOrder, okButton, cancelButton } = this.props;
|
|
54
54
|
const styles = this.getStyles();
|
|
55
|
+
const [leftButtonProps, rightButtonProps] = buttonOrder === 'ok,cancel'
|
|
56
|
+
? [okButton, cancelButton]
|
|
57
|
+
: [cancelButton, okButton];
|
|
55
58
|
return (React.createElement(react_native_1.Modal, { animationType: "fade", transparent: true, visible: visible },
|
|
56
59
|
React.createElement(react_native_1.View, { style: [styles.overlay], nativeID: nativeID },
|
|
57
60
|
React.createElement(react_native_1.View, { style: styles.container },
|
|
@@ -59,14 +62,17 @@ class Question extends React.Component {
|
|
|
59
62
|
React.createElement(react_native_1.Text, { style: [styles.text, textStyle] }, message),
|
|
60
63
|
React.createElement(Space_1.Space, null),
|
|
61
64
|
React.createElement(react_native_1.View, { style: styles.botoesAcao },
|
|
62
|
-
React.createElement(Button_1.Button, { text:
|
|
65
|
+
React.createElement(Button_1.Button, { text: leftButtonProps.text, onPress: leftButtonProps.onPress, style: [
|
|
63
66
|
{ flex: 1, marginRight: (0, layout_1.isTablet)() ? 13 : 8 },
|
|
64
|
-
|
|
65
|
-
], textStyle:
|
|
66
|
-
React.createElement(Button_1.Button, { text:
|
|
67
|
+
leftButtonProps.style
|
|
68
|
+
], textStyle: leftButtonProps.textStyle, primary: buttonOrder === 'ok,cancel', nativeID: leftButtonProps.nativeID }),
|
|
69
|
+
React.createElement(Button_1.Button, { text: rightButtonProps.text, onPress: rightButtonProps.onPress, style: [
|
|
67
70
|
{ flex: 1, marginLeft: (0, layout_1.isTablet)() ? 13 : 8 },
|
|
68
|
-
|
|
69
|
-
], textStyle:
|
|
71
|
+
rightButtonProps.style
|
|
72
|
+
], textStyle: rightButtonProps.textStyle, primary: buttonOrder === 'cancel,ok', nativeID: rightButtonProps.nativeID }))))));
|
|
70
73
|
}
|
|
71
74
|
}
|
|
72
75
|
exports.Question = Question;
|
|
76
|
+
Question.defaultProps = {
|
|
77
|
+
buttonOrder: 'cancel,ok'
|
|
78
|
+
};
|