Skip to content

Commit 1a23df7

Browse files
authored
Merge pull request #87 from mendix/feat/onfocus
Add focus styles
2 parents cb98739 + f1fdce8 commit 1a23df7

File tree

5 files changed

+81
-46
lines changed

5 files changed

+81
-46
lines changed

styles/native/ts/core/widgets/dropdown.ts

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,30 +33,36 @@ export const DropDown: DropDownType = {
3333
value: {
3434
// All TextStyle properties & placeholderTextColor are allowed
3535
color: input.color,
36-
borderColor: input.borderColor,
37-
backgroundColor: input.backgroundColor,
38-
3936
fontSize: input.fontSize,
4037
fontFamily: input.fontFamily,
41-
borderWidth: input.borderWidth,
42-
borderRadius: input.borderRadius,
43-
44-
paddingHorizontal: input.paddingHorizontal,
45-
paddingVertical: input.paddingVertical,
46-
4738
placeholderTextColor: input.placeholderTextColor, // Only applied when useUniformDesign is true
4839
},
49-
valueDisabled: {
50-
// All TextStyle properties are allowed
51-
...TextBox.inputDisabled
52-
},
5340
validationMessage: {
5441
// All TextStyle properties are allowed
5542
...TextBox.validationMessage,
5643
},
5744
/* New dropdown styles start */
45+
valueFocused: {
46+
// All TextStyle properties are allowed
47+
},
48+
valueDisabled: {
49+
// All TextStyle properties are allowed
50+
...TextBox.inputDisabled
51+
},
5852
valueContainer: {
59-
// All ViewStyle properties & rippleColor & activeOpacity & underlayColor are allowed
53+
// All ViewStyle properties & rippleColor are allowed
54+
flexDirection: "row",
55+
justifyContent: "space-between",
56+
alignItems: "center",
57+
borderWidth: input.borderWidth,
58+
borderRadius: input.borderRadius,
59+
borderColor: input.borderColor,
60+
paddingHorizontal: input.paddingHorizontal,
61+
paddingVertical: input.paddingVertical,
62+
backgroundColor: input.backgroundColor,
63+
},
64+
valueContainerFocused: {
65+
// All ViewStyle properties are allowed
6066
},
6167
valueContainerDisabled: {
6268
// All ViewStyle properties are allowed
@@ -78,6 +84,9 @@ export const DropDown: DropDownType = {
7884
backgroundColor: input.backgroundColor,
7985
underlayColor: input.inputContainerUnderlayColor,
8086
},
87+
iconStyle: {
88+
// All TextStyle properties are allowed
89+
},
8190
item: {
8291
// All TextStlye properties are allowed
8392
color: input.color,
@@ -115,12 +124,15 @@ export const DropDownVertical: DropDownType = {
115124
label: TextBoxVertical.label,
116125
labelDisabled: TextBoxVertical.labelDisabled,
117126
value: DropDown.value,
127+
valueFocused: DropDown.valueFocused,
128+
validationMessage: TextBoxVertical.validationMessage,
118129
valueContainer: DropDown.valueContainer,
130+
valueContainerFocused: DropDown.valueContainerFocused,
119131
valueContainerDisabled: DropDown.valueContainerDisabled,
120-
validationMessage: TextBoxVertical.validationMessage,
121132
menuWrapper: DropDown.menuWrapper,
122133
itemContainer: DropDown.itemContainer,
123134
item: DropDown.item,
135+
iconStyle: DropDown.iconStyle,
124136
useUniformDesign: DropDown.useUniformDesign,
125137
pickerIOS: DropDown.pickerIOS,
126138
pickerItemIOS: DropDown.pickerItemIOS,

styles/native/ts/core/widgets/referenceselector.ts

Lines changed: 38 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { border, contrast, font, input } from "../variables";
2-
import { DropDown } from "./dropdown";
2+
import { DropDownVertical } from "./dropdown";
33
import { TextBox, TextBoxVertical } from "./textbox";
44
import { DropDownType } from "../../types/widgets";
55
/*
@@ -34,31 +34,37 @@ export const ReferenceSelector: DropDownType = {
3434
value: {
3535
// All TextStyle properties & placeholderTextColor are allowed
3636
color: input.color,
37-
borderColor: input.borderColor,
38-
backgroundColor: input.backgroundColor,
39-
4037
fontSize: input.fontSize,
4138
fontFamily: input.fontFamily,
42-
borderWidth: input.borderWidth,
43-
borderRadius: input.borderRadius,
44-
4539
overflow: "hidden",
46-
paddingHorizontal: input.paddingHorizontal,
47-
paddingVertical: input.paddingVertical,
48-
4940
placeholderTextColor: input.placeholderTextColor, // Only applied when useUniformDesign is true
5041
},
51-
valueDisabled: {
52-
// All TextStyle properties are allowed
53-
...TextBox.inputDisabled
54-
},
5542
validationMessage: {
5643
// All TextStyle properties are allowed
5744
...TextBox.validationMessage,
5845
},
5946
/* New dropdown styles start */
47+
valueFocused: {
48+
// All TextStyle properties are allowed
49+
},
50+
valueDisabled: {
51+
// All TextStyle properties are allowed
52+
...TextBox.inputDisabled
53+
},
6054
valueContainer: {
61-
// All ViewStyle properties & rippleColor & activeOpacity & underlayColor are allowed
55+
// All ViewStyle properties & rippleColor are allowed
56+
flexDirection: "row",
57+
justifyContent: "space-between",
58+
alignItems: "center",
59+
borderWidth: input.borderWidth,
60+
borderRadius: input.borderRadius,
61+
borderColor: input.borderColor,
62+
paddingHorizontal: input.paddingHorizontal,
63+
paddingVertical: input.paddingVertical,
64+
backgroundColor: input.backgroundColor,
65+
},
66+
valueContainerFocused: {
67+
// All ViewStyle properties are allowed
6268
},
6369
valueContainerDisabled: {
6470
// All ViewStyle properties are allowed
@@ -80,6 +86,9 @@ export const ReferenceSelector: DropDownType = {
8086
backgroundColor: input.backgroundColor,
8187
underlayColor: input.inputContainerUnderlayColor,
8288
},
89+
iconStyle: {
90+
// All TextStyle properties are allowed
91+
},
8392
item: {
8493
// All TextStyle properties are allowed
8594
color: input.color,
@@ -116,16 +125,19 @@ export const ReferenceSelectorVertical: DropDownType = {
116125
containerDisabled: TextBoxVertical.containerDisabled,
117126
label: TextBoxVertical.label,
118127
labelDisabled: TextBoxVertical.labelDisabled,
119-
value: DropDown.value,
120-
valueContainer: DropDown.valueContainer,
121-
valueContainerDisabled: DropDown.valueContainerDisabled,
128+
value: DropDownVertical.value,
129+
valueFocused: DropDownVertical.valueFocused,
122130
validationMessage: TextBoxVertical.validationMessage,
123-
menuWrapper: DropDown.menuWrapper,
124-
itemContainer: DropDown.itemContainer,
125-
item: DropDown.item,
126-
useUniformDesign: DropDown.useUniformDesign,
127-
pickerIOS: DropDown.pickerIOS,
128-
pickerItemIOS: DropDown.pickerItemIOS,
129-
pickerBackdropIOS: DropDown.pickerBackdropIOS,
130-
pickerTopIOS: DropDown.pickerTopIOS,
131+
valueContainer: DropDownVertical.valueContainer,
132+
valueContainerFocused: DropDownVertical.valueContainerFocused,
133+
valueContainerDisabled: DropDownVertical.valueContainerDisabled,
134+
menuWrapper: DropDownVertical.menuWrapper,
135+
itemContainer: DropDownVertical.itemContainer,
136+
item: DropDownVertical.item,
137+
iconStyle: DropDownVertical.iconStyle,
138+
useUniformDesign: DropDownVertical.useUniformDesign,
139+
pickerIOS: DropDownVertical.pickerIOS,
140+
pickerItemIOS: DropDownVertical.pickerItemIOS,
141+
pickerBackdropIOS: DropDownVertical.pickerBackdropIOS,
142+
pickerTopIOS: DropDownVertical.pickerTopIOS,
131143
};

styles/native/ts/core/widgets/textarea.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ export const TextArea: TextBoxType = {
4747
// autoCapitalize, placeholderTextColor, selectionColor, underlineColorAndroid and all TextStyle properties are allowed
4848
...TextBox.inputError,
4949
},
50+
inputFocused: {
51+
// autoCapitalize, placeholderTextColor, selectionColor, underlineColorAndroid and all TextStyle properties are allowed
52+
...TextBox.inputFocused,
53+
},
5054
validationMessage: {
5155
// All TextStyle properties are allowed
5256
...TextBox.validationMessage,
@@ -65,5 +69,6 @@ export const TextAreaVertical: TextBoxType = {
6569
input: TextBoxVertical.input,
6670
inputDisabled: TextBoxVertical.inputDisabled,
6771
inputError: TextBoxVertical.inputError,
72+
inputFocused: TextBoxVertical.inputFocused,
6873
validationMessage: TextBoxVertical.validationMessage,
6974
};

styles/native/ts/core/widgets/textbox.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ export const TextBox: TextBoxType = {
6060
placeholderTextColor: input.errorColor,
6161
underlineColorAndroid: input.underlineColorAndroid,
6262
},
63+
inputFocused: {
64+
// autoCapitalize, placeholderTextColor, selectionColor, underlineColorAndroid and all TextStyle properties are allowed
65+
},
6366
validationMessage: {
6467
// All TextStyle properties are allowed
6568
color: input.errorColor,
@@ -94,6 +97,7 @@ export const TextBoxVertical: TextBoxType = {
9497
paddingHorizontal: input.paddingHorizontal,
9598
paddingVertical: input.paddingVertical,
9699
},
100+
inputFocused: TextBox.inputFocused,
97101
inputDisabled: TextBox.inputDisabled,
98102
inputError: TextBox.inputError,
99103
validationMessage: TextBox.validationMessage,

styles/native/ts/types/widgets.d.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,13 +173,14 @@ export interface DropDownType {
173173
valueDisabled?: TextStyle,
174174
validationMessage?: TextStyle,
175175
/* New dropdown styles start */
176-
valueContainer?: ViewStyle & {
177-
rippleColor?: string;
178-
underlayColor?: string;
179-
activeOpacity?: number;
180-
};
176+
valueContainer?: {
177+
rippleColor?: string
178+
} & ViewStyle;
179+
valueContainerFocused?: ViewStyle;
181180
valueContainerDisabled?: ViewStyle;
181+
valueFocused?: TextStyle;
182182
menuWrapper?: ViewStyle;
183+
iconStyle?: TextStyle;
183184
item?: TextStyle;
184185
itemContainer?: ViewStyle & {
185186
rippleColor?: string;
@@ -451,6 +452,7 @@ export interface TextBoxType {
451452
input?: InputType,
452453
inputDisabled?: InputType,
453454
inputError?: InputType,
455+
inputFocused?: InputType;
454456
validationMessage?: TextStyle
455457
}
456458

0 commit comments

Comments
 (0)