Thread
#compose
    b

    bodo

    1 year ago
    I am currently trying to integrate compose in my existing app… nearly all screens are build with a recyclerview and round about 200 different viewholder types…. every screen can display all of this viewholder types. so my problem is that i can´t migrate all types at once and i created a viewholder with a composeview where i can call the migrated stuff
    fun bindView(item) {
      composeContainer.setContent {
        MyCustomTheme {
          item.Content()
        }
      }
    }
    1. Is it a good practice to do migration like this. i noticed that every call to MyCustomTheme creates new CompositionLocals that i create in it 2. will the view be recomposed every time the bind method is called?
    Zach Klippenstein (he/him) [MOD]

    Zach Klippenstein (he/him) [MOD]

    1 year ago
    That seems like a very reasonable way to approach an incremental migration. It’s probably not an ideal design for a green-field app, but it sounds like this is a temporary state. Once you've finished the migration of individual view holders you can replace your recycler views with compose and lift those theme wrappers up.
    The only potential issue I see with this is if your legacy code also defines themes somewhere, then making sure you compose theme wrapper respects that
    b

    bodo

    1 year ago
    Thx for your feedback. Any other recommandations or best practises? Also maybe you or some other guys can give me some tips for my two issued?