2018-02-08 14:08:50 +00:00
|
|
|
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';
|
2018-09-11 16:32:52 +00:00
|
|
|
|
2018-02-08 14:08:50 +00:00
|
|
|
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';
|
2018-02-08 14:08:50 +00:00
|
|
|
|
|
|
|
export default class EmojiKeyboard extends React.PureComponent {
|
2019-12-04 16:39:53 +00:00
|
|
|
static propTypes = {
|
|
|
|
theme: PropTypes.string
|
|
|
|
};
|
|
|
|
|
2018-09-11 16:32:52 +00:00
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
const state = store.getState();
|
|
|
|
this.baseUrl = state.settings.Site_Url || state.server ? state.server.server : '';
|
|
|
|
}
|
2018-09-25 19:28:42 +00:00
|
|
|
|
2018-02-08 14:08:50 +00:00
|
|
|
onEmojiSelected = (emoji) => {
|
|
|
|
KeyboardRegistry.onItemSelected('EmojiKeyboard', { emoji });
|
|
|
|
}
|
2018-09-25 19:28:42 +00:00
|
|
|
|
2018-02-08 14:08:50 +00:00
|
|
|
render() {
|
2019-12-04 16:39:53 +00:00
|
|
|
const { theme } = this.props;
|
2018-02-08 14:08:50 +00:00
|
|
|
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} />
|
2018-09-11 16:32:52 +00:00
|
|
|
</View>
|
2018-02-08 14:08:50 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2019-12-04 16:39:53 +00:00
|
|
|
KeyboardRegistry.registerKeyboard('EmojiKeyboard', () => withTheme(EmojiKeyboard));
|