vn-verdnaturachat/app/containers/MessageBox/EmojiKeyboard.js

37 lines
1.1 KiB
JavaScript
Raw Normal View History

import React from 'react';
import { View } from 'react-native';
import { KeyboardRegistry } from 'react-native-keyboard-input';
2019-12-04 16:39:53 +00:00
import PropTypes from 'prop-types';
import store from '../../lib/createStore';
import EmojiPicker from '../EmojiPicker';
import styles from './styles';
2019-12-04 16:39:53 +00:00
import { themes } from '../../constants/colors';
import { withTheme } from '../../theme';
export default class EmojiKeyboard extends React.PureComponent {
2019-12-04 16:39:53 +00:00
static propTypes = {
theme: PropTypes.string
};
constructor(props) {
super(props);
const state = store.getState();
this.baseUrl = state.settings.Site_Url || state.server ? state.server.server : '';
}
onEmojiSelected = (emoji) => {
KeyboardRegistry.onItemSelected('EmojiKeyboard', { emoji });
}
render() {
2019-12-04 16:39:53 +00:00
const { theme } = this.props;
return (
2019-12-04 16:39:53 +00:00
<View style={[styles.emojiKeyboardContainer, { borderTopColor: themes[theme].borderColor }]} testID='messagebox-keyboard-emoji'>
2019-11-25 20:01:17 +00:00
<EmojiPicker onEmojiSelected={this.onEmojiSelected} baseUrl={this.baseUrl} />
</View>
);
}
}
2019-12-04 16:39:53 +00:00
KeyboardRegistry.registerKeyboard('EmojiKeyboard', () => withTheme(EmojiKeyboard));