Skip to content

input with compositionStart,compositionUpdate,compositionEnd for ime like Chinese input

Notifications You must be signed in to change notification settings

suhaotian/react-input

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

react-input

See facebook/react#3926

Usage

npm install lodash --save # for debounce util
import React, { Component } from 'react'

import Input from './index'

class New extends Component {
  constructor(props) {
    super(props)
  
    this.state = {
      value: ''
    }

    this.handleChange = this.handleChange.bind(this)
  }


  handleChange(value) {
    this.setState({value})
  }

  render() {
    return (
      <div>
        You type: {this.state.value}
        <br />
        <Input 
          value={this.state.value} 
          refc={c => {       // refc for ref
            this._input = c  // you can access input DOM node with this._input
          }}
          onChange={value => {
            this.handleChange(value)
          }}
        />
      </div>
    )
  }
}

About

input with compositionStart,compositionUpdate,compositionEnd for ime like Chinese input

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published