Skip to content
프로젝트

소개

A reactive, declarative, lifecycle aware, testable and reusable way of using UI components on Android using Redux.

기타 프로젝트

이 수치를 측정하는 방법

측정된 스타 증가

in 24h
0
in 7 days
0
in 15 days
0
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

Componentization Architecture v2 - [ReComponents]

A reactive, declarative, lifecycle aware, testable and reusable way of using UI components on Android using Redux.

Blog Post

Fragment is not your view

Installation

dependencies {
    // Netflix's ReComponents 0.0.1 Beta
    api(name:'recomponents-0.0.1', ext:'aar')
}

Fragment / Activity

private val store = StoreImpl(
    reducer = ::appReducer,
    initialState = AppState(),
    middleware = listOf(::appMiddleware)
)

class YourActivity : AppCompatActivity() {
    private val uiComponentManager by lazy {
        ViewModelProviders.of(this,
            object : ViewModelProvider.Factory {
                @Suppress("UNCHECKED_CAST")
                override fun <T : ViewModel?> create(modelClass: Class<T>): T {
                    return UIComponentManager(store) as T
                }
            }
        )[UIComponentManager::class.java]
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.linearlayout_main)

        initComponents(findViewById(R.id.root))
    }
    
    private fun initComponents(container: ViewGroup) {
        with(uiComponentManager) {
            subscribe(YourComponent(container)) {
                YourComponentState(
                    ...
                )
            }
            
            ...
        }
    }

    override fun onDestroy() {
        super.onDestroy()
        uiComponentManager.store.unsubscribeAll()
    }

Component

data class YourComponentState(
    ...
)

class YourComponent(
    container: ViewGroup
) : UIComponent<YourComponentState>() {
    override fun render(state: MyComponentState) {}
}

Complete Code Samples

Activity

Redux + Components

Components & RecyclerViews

References

ReKotlin

Netflix’s Android Componentization Architecture V1 - Droidcon NYC 2018 Talk

Netflix’s Android Componentization Architecture V1 - Droidcon SF 2018 Talk

관련 프로젝트 살펴보기

불러오는 중…