File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed
WooCommerce/Classes/ViewRelated/ReusableViews/SwiftUI Components Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,22 @@ struct BindableTextfield: UIViewRepresentable {
1515 ///
1616 @Binding var text : String
1717
18+ /// Textfield font.
19+ ///
20+ var font = UIFont . body
21+
22+ /// Textfield keyboard.
23+ ///
24+ var keyboardType = UIKeyboardType . default
25+
26+ /// Textfield text color.
27+ ///
28+ var foregroundColor = UIColor . text
29+
30+ /// Textfield text alignment.
31+ ///
32+ var textAlignment = NSTextAlignment . left
33+
1834 init ( _ placeholder: String ? , text: Binding < String > ) {
1935 self . placeHolder = placeholder
2036 self . _text = text
@@ -24,7 +40,6 @@ struct BindableTextfield: UIViewRepresentable {
2440 ///
2541 func makeUIView( context: Context ) -> UITextField {
2642 let textfield = UITextField ( )
27- textfield. placeholder = placeHolder
2843 textfield. delegate = context. coordinator
2944 return textfield
3045 }
@@ -38,7 +53,12 @@ struct BindableTextfield: UIViewRepresentable {
3853 /// Updates underlying view.
3954 ///
4055 func updateUIView( _ uiView: UITextField , context: Context ) {
56+ uiView. placeholder = placeHolder
4157 uiView. text = text
58+ uiView. font = font
59+ uiView. textColor = foregroundColor
60+ uiView. textAlignment = textAlignment
61+ uiView. keyboardType = keyboardType
4262 }
4363}
4464
You can’t perform that action at this time.
0 commit comments