Kevin Hester
03/11/2020, 10:26 PMLeland Richardson [G]
03/11/2020, 10:28 PMKevin Hester
03/11/2020, 10:30 PM<com.mapbox.mapboxsdk.maps.MapView
android:id="@+id/mapView"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
I'd be okay with also not using xml and just making the view directly from kotlin if there was a way to do that@Composable
fun MapContent() {
analyticsScreen(name = "map")
val typography = MaterialTheme.typography()
val context = ContextAmbient.current
AndroidView(R.layout.map_view) {
}
}
Leland Richardson [G]
03/11/2020, 10:35 PMKevin Hester
03/11/2020, 10:36 PMLeland Richardson [G]
03/11/2020, 10:41 PMColumn
and see what happensKevin Hester
03/11/2020, 10:47 PMromainguy
03/11/2020, 10:51 PMLeland Richardson [G]
03/11/2020, 10:51 PMsetContent
or similar?Kevin Hester
03/11/2020, 10:57 PMLeland Richardson [G]
03/11/2020, 11:02 PMKevin Hester
03/11/2020, 11:04 PMclass ViewAdapters {
private val adapters = mutableListOf<(parent: Any, child: Any) -> Any?>()
fun register(adapter: (parent: Any, child: Any) -> Any?) = adapters.add(adapter)
fun adapt(parent: Any, child: Any): Any? =
adapters.map { it(parent, child) }.filterNotNull().firstOrNull()
}
Leland Richardson [G]
03/11/2020, 11:09 PMKevin Hester
03/11/2020, 11:09 PMLeland Richardson [G]
03/11/2020, 11:10 PMKevin Hester
03/11/2020, 11:10 PMLeland Richardson [G]
03/11/2020, 11:11 PMKevin Hester
03/11/2020, 11:12 PMLeland Richardson [G]
03/11/2020, 11:12 PMKevin Hester
03/11/2020, 11:13 PMprivate fun doSetContent(
composeView: AndroidComposeView,
context: Context,
content: @Composable() () -> Unit
): Composition = Compose.composeInto(composeView.root, context) {
val currentComposer = currentComposer as ViewComposer
remember { currentComposer.adapters?.register(AndroidViewAdapter) }
WrapWithAmbients(composeView, context, Dispatchers.Main) {
WrapWithSelectionContainer(content)
}
}
but, I can see that adapters != null but my breakpoint on ViewAdapters.register() never got hitLeland Richardson [G]
03/11/2020, 11:23 PMKevin Hester
03/11/2020, 11:24 PMLeland Richardson [G]
03/11/2020, 11:24 PMKevin Hester
03/11/2020, 11:31 PMLeland Richardson [G]
03/11/2020, 11:41 PMKevin Hester
03/11/2020, 11:42 PMjolo
03/12/2020, 8:09 AMKevin Hester
03/12/2020, 4:48 PM