Skip to content

Commit

Permalink
Support opening the keyboard immediately when the messenger bar is sh…
Browse files Browse the repository at this point in the history
…own #14
  • Loading branch information
EddyVerbruggen committed Jan 25, 2017
1 parent 9d383b8 commit ec6739f
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ There are however __many__ options you can pass in to tweak the appearance and b
|`scrollToBottomAfterMessengerShows`||yes|yes|If `autoscrollElement` was set you can also make the list scroll down initially, when the messenger bar (without the keyboard popping up) is shown.
|`keepOpenAfterSubmit`|`false`|yes|yes|Setting this to `true` is like the video's above: the keyboard doesn't close upon submit.
|`animated`|`false`|yes|yes|Makes the messenger bar slide in from the bottom.
|`showKeyboard`|`false`|yes|yes|Open the keyboard when showing the messenger.
|`text`||yes|yes|The default text set in the messenger input bar.
|`textColor`|`#444444`|yes|yes|The color of the typed text.
|`placeholder`||yes|yes|Like a regular HTML input placeholder.
Expand Down
1 change: 1 addition & 0 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@
maxChars: 140, // setting this > 0 will make the counter show up on iOS (and ignore input on Android, for now)
counterStyle: 'countdownreversed', // iOS only currently, note that 'none' still shows a counter in case maxChars is set
textColor: '#555555',
showKeyboard: true,

// this button is best suited for picking media (camera / cameraroll / last image) from an actionsheet
leftButton: {
Expand Down
1 change: 1 addition & 0 deletions demo/index_all_features.html
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ <h2>Native Keyboard</h2>
maxChars: 140, // setting this > 0 will make the counter show up on iOS (and ignore input on Android, for now)
counterStyle: 'countdownreversed', // iOS only currently, note that 'none' still shows a counter in case maxChars is set
textColor: '#555555',
showKeyboard: true,

// this button is best suited for picking media (camera / cameraroll / last image) from an actionsheet
leftButton: {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cordova-plugin-native-keyboard",
"version": "1.1.7",
"version": "1.1.8",
"description": "This plugin aims to solve common keyboard problems encountered with Cordova / PhoneGap apps. The messenger component (see screenshots) is ready for production, but this plugin will have more tricks up its sleeve. I'll document those once they're ready for primetime as well.",
"cordova": {
"id": "cordova-plugin-native-keyboard",
Expand Down
2 changes: 1 addition & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id="cordova-plugin-native-keyboard"
version="1.1.7">
version="1.1.8">

<name>Native Keyboard</name>

Expand Down
Binary file modified src/android/lib/nativekeyboard.jar
Binary file not shown.
7 changes: 6 additions & 1 deletion src/ios/NKSLKTextViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,12 @@ - (void) configureMessenger {
}

if ([options[@"showKeyboard"] boolValue]) {
[self presentKeyboard:YES];
// this needs a little delay to work
double delayInSeconds = 0.5;
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
[self presentKeyboard:YES];
});
}

NSDictionary *leftButton = options[@"leftButton"];
Expand Down

0 comments on commit ec6739f

Please sign in to comment.