Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Schmidt committed Jan 13, 2016
0 parents commit d3ea21f
Show file tree
Hide file tree
Showing 6 changed files with 183 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"whitelist": [
"es6.modules",
"es6.arrowFunctions",
"es6.blockScoping",
"es6.classes",
"es6.destructuring",
"es6.parameters",
"es6.properties.computed",
"es6.properties.shorthand",
"es6.spread",
"es6.templateLiterals",
"es6.constants",
"es7.trailingFunctionCommas",
"es7.objectRestSpread",
"react",
"es7.classProperties",
"es7.asyncFunctions",
"es7.decorators"
]
}
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# EditorConfig is awesome: http://EditorConfig.org

# top-most EditorConfig file
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 2
31 changes: 31 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# OSX
#
.DS_Store

# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
project.xcworkspace

# node.js
#
node_modules/
npm-debug.log


/dist
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
## react-native-dismiss-keyboard ![CircleCi](https://circleci.com/gh/DanielMSchmidt/react-native-dismiss-keyboard.png?circle-token=905f7ed099611e3f8079a5bf72674beab5e55e50)

A simple way to dismiss the keyboard programmatically in a react native application.

## Add it to your project

1. Run `npm install react-native-dismiss-keyboard --save`
2. `var dismissKeyboard = require('react-native-dismiss-keyboard');`
3. Run `dismissKeyboard()` anywhere in your code to close the keyboard.

## Support

We currently support `react-native >= 0.11`, if you experience any restrictions or if it works below, please let us know.

## Contribution

Please make sure to run the tests before proposing a PR by running `npm test`.
11 changes: 11 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from 'react-native';

const {
TextInput: {
State: TextInputState,
},
} = React;

export default function dismissKeyboard() {
TextInputState.blurTextInput(TextInputState.currentlyFocusedField());
}
91 changes: 91 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
{
"name": "react-native-dismiss-keyboard",
"version": "0.0.2",
"description": "A simple way to dismiss the keyboard programmatically in a react native application.",
"main": "dist/index.js",
"scripts": {
"babel": "babel *.js --out-dir dist",
"build": "npm run-script clear && npm run-script babel",
"clear": "rm -rf dist/ && mkdir dist/",
"prepublish": "npm run build",
"test": "xo"
},
"files": [
"dist/"
],
"repository": {
"type": "git",
"url": "[email protected]:DanielMSchmidt/react-native-dismiss-keyboard.git"
},
"author": "Daniel Schmidt <[email protected]> (https://github.com/DanielMSchmidt)",

"xo": {
"ignores": [
"DismissKeyboardExample/**",
"dist/*"
],
"esnext": true,
"space": 2,
"plugins": [
"react"
],
"rules": {
"babel/object-curly-spacing": [
2,
"always"
],
"comma-dangle": [
2,
"always-multiline"
],
"react/jsx-curly-spacing": 2,
"strict": [
2,
"never"
],
"no-use-before-define": 0,
"one-var": [
2,
{
"uninitialized": "always",
"initialized": "never"
}
],
"react/no-set-state": 1,
"react/prop-types": 2,
"react/jsx-sort-prop-types": 2,
"react/jsx-closing-bracket-location": [
2,
{
"selfClosing": "after-props",
"nonEmpty": "after-props"
}
],
"react/jsx-indent-props": [
2,
2
],
"react/self-closing-comp": 2
}
},
"keywords": [
"react",
"react-native",
"ios",
"android",
"keyboard",
"dismiss"
],
"license": "MIT",
"devDependencies": {
"babel": "^5.8.34",
"babel-eslint": "^5.0.0-beta6",
"eslint": "^1.10.3",
"eslint-config-xo": "^0.9.1",
"eslint-plugin-babel": "^3.0.0",
"eslint-plugin-no-empty-blocks": "0.0.2",
"eslint-plugin-no-use-extend-native": "^0.3.3",
"eslint-plugin-react": "^3.13.1",
"xo": "^0.12.1"
}
}

0 comments on commit d3ea21f

Please sign in to comment.