```class NavigationDrawerComponent(@MenuRes privat...
# anko
d
Copy code
class NavigationDrawerComponent(@MenuRes private val menuId : Int,
                                private val setupContent : (AnkoContext<Activity>) -> View) : AnkoComponent<Activity> {

    lateinit var navigationView : NavigationView

    override fun createView(ui: AnkoContext<Activity>): View {
        return with(ui) {
            frameLayout {
                drawerLayout {
                    setupContent(this@with).lparams(matchParent, matchParent)

                    navigationView = navigationView {
                        inflateMenu(menuId)
                    }.lparams(matchParent, matchParent) {
                        gravity = Gravity.START
                    }
                }
                lparams(matchParent, matchParent)
            }
        }
    }

}
This isn't working because the
View
retrieved from the setupContent() doesn't get attached to the
drawerLayout
, must
setupContent
be of type
(DrawerLayout) -> View
instead of
(AnkoContext<Activity>) -> View
to make it work?