Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 24 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,36 @@
TiAndroidAutofocus
==================
# TiAndroidAutofocus

Prevents TextFields in Android to autofocus
Prevents TextFields in Android to auto-focus.

> **NOTE**: When using Titanium SDK 7.3.0+, Android matches the iOS / Windws behavior and does not auto-focus
the first text field when a window opens. See [TIMOB-24138](https://jira.appcelerator.org/browse/TIMOB-24138) for details!

### Usage
Simply create a View using this module above the first TextField occurence to prevent autofocus.
That's it!

**JS Usage**

```js
var autofocus = require('de.marcelpociot.autofocus');
var win = Ti.UI.createWindow({
backgroundColor: 'white'
});

var textField = Ti.UI.createTextField({
width: 100,
value: 'I do not auto-focus'
});

win.add(autofocus.createView());
win.add(textField);

var win = Ti.UI.createWindow({
backgroundColor:'white'
});
var autofocus = require('de.marcelpociot.autofocus');
win.add( autofocus.createView() );
win.open();
```

win.add( Ti.UI.createTextField({
width: 100,
value: "I don't autofocus"
}) );
win.open();

**Alloy usage**

<View platform="android" module="de.marcelpociot.autofocus" />
<TextField value="No more ugly autofocus!" />

```xml
<View platform="android" module="de.marcelpociot.autofocus" />
<TextField value="No more ugly autofocus!" />
```