Skip to content
A smart keyboard for ios base on IQKeyboardManager[android not needed]
Branch: master
Clone or download
Pull request Compare This branch is 3 commits ahead, 1 commit behind remobile:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
ios
screencasts
.gitignore
.npmignore
LICENSE
README.md
index.js
package.json

README.md

React Native Smart Keyboard (remobile)

A smart keyboard for ios base on IQKeyboardManager[android not needed]

Installation

Add `"react-native-smart-keyboard": "git+https://github.com/80percent/react-native-smart-keyboard.git"` to your package.json

Then `npm install`

Installation (iOS)

rnpm link

Android

  • android not needed, because it has windowSoftInputMode.

Usage

Example

'use strict';

var React = require('react');
var ReactNative = require('react-native');
var {
    StyleSheet,
    TextInput,
    ScrollView,
    TouchableOpacity,
    Text,
} = ReactNative;

const SmartKeyboard = require('@remobile/react-native-smart-keyboard');

module.exports = React.createClass({
    getInitialState() {
        return {
            enable: true
        };
    },
    switchEnable() {
        const {enable} = this.state;
        if (enable) {
            SmartKeyboard.disable();
        } else {
            SmartKeyboard.enable();
        }
        this.setState({enable: !enable});
    },
    render() {
        const {enable} = this.state;
        return (
            <ScrollView>
                <TouchableOpacity onPress={this.switchEnable}>
                    <Text style={styles.instructions}>
                        {enable?'关闭':'开启'}
                    </Text>
                </TouchableOpacity>
                <TextInput
                    placeholder="您的手机号码1"
                    style={styles.text_input}
                    />
                <TextInput
                    placeholder="您的手机号码2"
                    style={styles.text_input}
                    />
                <TextInput
                    placeholder="您的手机号码3"
                    style={styles.text_input}
                    />
                <TextInput
                    placeholder="您的手机号码4"
                    style={styles.text_input}
                    />
                <TextInput
                    placeholder="您的手机号码5"
                    style={styles.text_input}
                    />
                <TextInput
                    placeholder="您的手机号码6"
                    style={styles.text_input}
                    />
                <TextInput
                    placeholder="您的手机号码7"
                    style={styles.text_input}
                    />
                <TextInput
                    placeholder="您的手机号码8"
                    style={styles.text_input}
                    />
                <TextInput
                    placeholder="您的手机号码9"
                    style={styles.text_input}
                    />
                <TextInput
                    placeholder="您的手机号码10"
                    style={styles.text_input}
                    />
            </ScrollView>
        );
    }
});

const styles = StyleSheet.create({
    instructions: {
        marginTop: 50,
        textAlign: 'center',
        color: '#333333',
        marginBottom: 5,
    },
    text_input: {
        height:40,
        width: 250,
        fontSize:14,
        marginBottom: 20,
        paddingLeft: 2,
        alignSelf: 'center',
        backgroundColor: '#FFFFFF',
    },
});

Screencasts

demo

Methods

  • enable : PropTypes.function
  • disable : PropTypes.function

see detail use

You can’t perform that action at this time.