Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion resources/android/NativeUIChromeInit.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ import com.nativephp.plugins.native_ui.ui.nuiThemeDefaultTypography
* application context for asset-backed font loading.
*/
fun registerNativeUIChrome(context: Context) {
NativeRootHostRegistry.register("native-ui.drawer", consumes = "native_drawer") { root, content ->
NativeRootHostRegistry.register(
"native-ui.drawer",
consumes = "native_drawer",
reservesNavigationBarSlot = true,
) { root, content ->
val drawerNode = root.children.firstOrNull { it.type == "native_drawer" }
NativeLayoutDrawerHost(drawerNode = drawerNode, content = content)
}
Expand Down
15 changes: 15 additions & 0 deletions tests/NativeUIChromeInitTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

test('registers the Android drawer host with navigation bar slot reservation', function () {
$source = file_get_contents(dirname(__DIR__).'/resources/android/NativeUIChromeInit.kt');
$matched = preg_match(
'/NativeRootHostRegistry\.register\(\s*"native-ui\.drawer",(?<arguments>[^)]*)\)/s',
$source,
$registration,
);

expect($matched)->toBe(1)
->and($registration['arguments'])
->toMatch('/consumes\s*=\s*"native_drawer"/')
->toMatch('/reservesNavigationBarSlot\s*=\s*true/');
});