react-expressions-baidu
v1.1.0
Published
A React Component about Baidu Expressions.
Downloads
1
Readme
react-expressions-baidu
A React Component about Baidu Expressions.
Install
npm install --save react-expressions-baidu
Usage
import {
BaiduExpressionsPicker,
isSymbol,
convertSymbol
} from 'react-expressions-baidu';
...
handleAddSymbol(symbol){
// check input valid
if(isSymbol(symbol))
this.setState({
symbols: [...symbols, symbol]
});
}
render(){
...
<BaiduExpressionsPicker
onSymbolClick={this.handleAddSymbol} />
<div>
{
this.state.symbols.map(symbol => convertSymbol(symbol))
}
</div>
}
API
BaiduExpressionsPicker [ react component ]
props:
- pickerClass [ string ]
- symbolClass [ string ]
- onItemClick [ func ]
isSymbol [ func | string -> bool ]
check if str
is a valid symbol.