-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace usage of KeyDownHandler with Compose onKeyEvent
The KeyDownHandler was using each platform's native key handling mechanism, which doesn't play nice with Compose's key events system and it caused bugs. One example would be trying to hide a Menu on JVM by pressing Esc. The Menu could not consume the Compose key event, as a result other onKeyEvent listeners in the tree are triggered.
- Loading branch information
Showing
16 changed files
with
168 additions
and
297 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,12 @@ | ||
package com.composables.core | ||
|
||
import androidx.compose.ui.window.DialogProperties as ComposeDialogProperties | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.window.Dialog | ||
import androidx.compose.ui.input.key.KeyEvent | ||
import internal.ComposeDialog | ||
|
||
@Composable | ||
internal actual fun Modal(protectNavBars: Boolean, content: @Composable () -> Unit) { | ||
Dialog( | ||
onDismissRequest = {}, | ||
properties = ComposeDialogProperties( | ||
dismissOnBackPress = false, | ||
dismissOnClickOutside = false, | ||
usePlatformInsets = false, | ||
usePlatformDefaultWidth = false, | ||
scrimColor = Color.Transparent | ||
), | ||
content = content | ||
) | ||
} | ||
internal actual fun Modal( | ||
protectNavBars: Boolean, | ||
onKeyEvent: (KeyEvent) -> Boolean, | ||
content: @Composable () -> Unit | ||
) = ComposeDialog(onKeyEvent, content) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,11 @@ | ||
package com.composables.core | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.input.key.KeyEvent | ||
|
||
@Composable | ||
internal expect fun Modal(protectNavBars: Boolean = false, content: @Composable () -> Unit) | ||
internal expect fun Modal( | ||
protectNavBars: Boolean = false, | ||
onKeyEvent: (KeyEvent) -> Boolean = { false }, | ||
content: @Composable () -> Unit | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.