Hi guys, I’m struggling with the implementation of the Keyboard
component from the @lightningjs/ui
package. Is it even possible to use components from Lightning v2 in a Blits app?
Here is my code:
// file components/KeyboardTest.js
import Blits from '@lightningjs/blits'
import { Keyboard } from '@lightningjs/ui'
export default Blits.Component('KeyboardTest', {
components: {
Keyboard,
},
template: `
<Element>
<Keyboard ref="keyboard" x="50" y="50" />
</Element>
`,
hooks: {
ready() {
const keyboard = this.select('keyboard')
keyboard.on('input', (input) => {
console.log('Keyboard input:', input)
})
keyboard.on('enter', () => {
console.log('Keyboard input finalized')
})
},
},
methods: {
openKeyboard() {
const keyboard = this.select('keyboard')
keyboard.visible = true
keyboard.start()
},
closeKeyboard() {
const keyboard = this.select('keyboard')
keyboard.visible = false
keyboard.stop()
},
},
input: {
enter() {
const keyboard = this.select('keyboard')
if (keyboard.visible) {
this.closeKeyboard()
} else {
this.openKeyboard()
}
},
},
})