0

I am creating a bridge from Kotlin to JS (RN), so I created a simple view manager for my edittext.

class DummyUI(var context: ReactApplicationContext) : SimpleViewManager<EditText?>() {

lateinit var editText: EditText

override fun getName(): String {
    return "DummyUI"
}

override fun createViewInstance(p0: ThemedReactContext): EditText {
    editText = EditText(context)
    editText.background = AppCompatResources.getDrawable(p0, R.drawable.rounded_edit_text_green)
    editText.isFocusable = true
    editText.isFocusableInTouchMode = true
    editText.isEnabled = true
    editText.isClickable = true
    editText.setTextColor(ContextCompat.getColor(p0, android.R.color.holo_green_dark))
    return editText
}

}

I registered it like usual

    override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
    val viewManagers: MutableList<ViewManager<*, *>> = ArrayList()
    viewManagers.add(DummyUI(reactContext))
    return viewManagers
}

But when I press on the edit text, nothing happens. It just discards my click so I cannot edit it at all.

Can anyone help me? What am I missing?

This is JS code how I use it

<DummyUI style={styles.wrapper} />

and style

wrapper: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',

Nothing complex, just basic setup for a view (edittext). If you have some samples or something, I would be grateful. I searched everything and still stuck with this.

UPDATE: It's interesting that I can go up and down by pressing buttons on a keyboard, and just then my edit text gets focus. By touch it's not possible.

Thanks in advance.

vanste25
  • 1,754
  • 14
  • 39

0 Answers0