Cannot capture keypressed event in modal on Android
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 25/100
- Tipo di issue
- Bug
- Chiarezza
- Da chiarire
- Stato di attività
- Ferma
- Stack tecnologico
- android, angular, typescript
- Ambito
- mobile
Direzione di ricerca
Inizia con la activity.android.ts estesa e il modal non a schermo intero descritto nei passaggi per la riproduzione. Traccia il comportamento di dispatchKeyEvent e delle notifiche dell’applicazione quando il modal e il relativo menu a discesa sono aperti, quindi verifica che gli eventi dei tasti freccia hardware possano essere acquisiti e registrati nel modal.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):
- CLI: 8.2.0
- Cross-platform modules:
- Android Runtime: 6.3.1
- iOS Runtime: N/A
- Plugin(s):
- NativeScript-Angular: 8.2.1
- Angular: 8.2.0
Describe the bug
Same as title, I am unable to capture the keydown event in a modal dialog.
The key press is coming from a hardware keyboard, not the onscreen one.
I can accomplish this in any other component using:
application.on('KEYCODE_DPAD_DOWN', (() => {
console.log('Keyboard Down Arrow Pressed');
}));
And it works fine.
This is after extending activity.android.ts, and adding:
public dispatchKeyEvent(event) {
let keyCode = event.getKeyCode();
switch (keyCode) {
case android.view.KeyEvent.KEYCODE_DPAD_LEFT:
case android.view.KeyEvent.KEYCODE_DPAD_UP:
application.notify({
eventName: 'KEYCODE_DPAD_UP',
})
return true;
case android.view.KeyEvent.KEYCODE_DPAD_RIGHT:
case android.view.KeyEvent.KEYCODE_DPAD_DOWN:
application.notify({
eventName: 'KEYCODE_DPAD_DOWN',
})
return true;
default:
return super.dispatchKeyEvent(event);
}
}
I have tried every manner of capturing the keypress in a modal that I could, none work.
To Reproduce
Extend android activity to capture a keypress, try to capture a keypress in a non-fullscreen modal.
Expected behavior
Should be able to capture the keypress and console log it, similar to how it is in a component.
Additional context
In my modal, I have a dropdown. If I open the dropdown and then press the up/down arrow keys, it navigates through the selections, so the buttons work in the modal, I just don't know how to capture and console log them.
Please let me know if additional info is required.
- Lingua principale
- TypeScript
- Stelle
- 55
- Fork
- 13
- Merge medio
- 16m
- PR unite (30g)
- 1
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di NativeScript/angular
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
NativeScript/angular#170 · 1 commento ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
NativeScript/angular#164 ·
-
My types are gone Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 45/100
NativeScript/angular#163 · 1 commento ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 38/100
NativeScript/angular#158 · 1 reazione ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 35/100
NativeScript/angular#155 ·
Tutte le issue di NativeScript/angular
Issue simili
-
comp/dashboard P3 type/bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
NousResearch/hermes-agent#117722 ·
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P3
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 76/100
-
code-quality refactoring
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
github/gh-aw-firewall#8816 ·
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
langchain-ai/deepagents#6450 ·