textinput.View can just accept a textinput.Model argument

This commit is contained in:
Christian Rocha 2020-10-15 18:43:08 -04:00
parent eff931bdea
commit 154f3763f7
No known key found for this signature in database
GPG Key ID: D6CC7A16E5878018

View File

@ -396,12 +396,7 @@ func Update(msg tea.Msg, m Model) (Model, tea.Cmd) {
}
// View renders the textinput in its current state.
func View(model tea.Model) string {
m, ok := model.(Model)
if !ok {
return "could not perform assertion on model"
}
func View(m Model) string {
// Placeholder text
if len(m.value) == 0 && m.Placeholder != "" {
return placeholderView(m)