eclipsesource / eclipsesource/tabris-js

[Android] beforeTextChange and textChange events fire when `autoCapitalize` property set

Open
#2,127 1 comment 0 reactions 1 assignee Claimed by @elshadsm View on GitHub
bug
Dominant language
JavaScript
Stars
1.4k
Forks
171
PR merge metrics
No merged PRs in 30d

Description

### Problem description

When `autoCapitalize` property changes, `beforeTextChange` and `textChange` events fire.

If someone relies only on `beforeTextChange` event to sync the value of the text input then the user will never get notified with the new value but they will receive the old value.

This happens only on Android with Tabris 2.x but not with Tabris 3.x.

### Expected behavior

Those events do not fire when `autoCapitalize` property changes.

### Environment

- Tabris.js version: 2.x nightly
- Device: Samsung galaxy tab S3, Google Pixel 3
- OS: Android 9, 10

### Code snippet

```js
const { ui, TextInput } = require('tabris');

let myText = new TextInput({
top: 200,
left: '20%',
right: '20%',
height: 120,
type: 'multiline',
alignment: 'left'
});

myText.on('beforeTextChange', event => {
console.log('new value:', event.newValue);
});

myText.on('textChanged', event => {
console.log('text changed:', event.value);
});

ui.contentView.append(myText);

myText.set({ autoCapitalize: 'sentence' });

setTimeout(() => myText.text = 'Test', 100);

```

Output:
```
new value:
text changed:
new value:
text changed:
text changed: Test
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.