Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve extensibility of core ViewFactories #224

Open
Alex009 opened this issue Apr 11, 2020 · 0 comments
Open

Improve extensibility of core ViewFactories #224

Alex009 opened this issue Apr 11, 2020 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@Alex009
Copy link
Member

Alex009 commented Apr 11, 2020

Now each core ViewFactory is final classes, all actions doing in buildView function. It's reason why we should copy-paste core factories for small customization, even when we want change small piece of view building logic.
I suggest to do core factories is open classes with open functions which show each step of building.
Example API of InputViewFactory:
common:

expect open class SystemInputViewFactory

android:

actual open class SystemInputViewFactory {
    open fun createEditText(context: Context): EditText
    open fun applyBackground(editText: EditText)
    open fun applyMargins(editText: EditText)
    open fun applyPaddings(editText: EditText)
    open fun applyTextStyle(editText: EditText)
    open fun applyAlignment(editText: EditText)
    open fun bindFormField(editText: EditText, formField: FormField)
    open fun bindLabel(editText: EditText, label: LiveData)
    open fun bindEnabled(editText: EditText, enabled: LiveData)
    open fun bindMaxLines(editText: EditText, maxLines: LiveData)
}

something like on android will be and for ios.

this change allow us to just create subclass of core factory without duplication of all logic and simple change some piece, for example create custom EditText from some library, not just system

@Alex009 Alex009 added the enhancement New feature or request label Apr 11, 2020
@Alex009 Alex009 added this to the 0.1.0-dev-20 milestone Apr 11, 2020
@Alex009 Alex009 self-assigned this Apr 11, 2020
@Alex009 Alex009 modified the milestones: 0.1.0-dev-20, 0.1.0-dev-21 Aug 30, 2020
@Alex009 Alex009 modified the milestones: 0.1.0, 0.2.0 Jul 15, 2021
@Alex009 Alex009 removed this from the 0.2.0 milestone Jun 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant