2020-02-17 12:14:56 +00:00
|
|
|
import React from 'react';
|
|
|
|
import { View } from 'react-native';
|
2020-12-01 11:58:51 +00:00
|
|
|
import { KeyboardRegistry } from 'react-native-ui-lib/keyboard';
|
2020-02-17 12:14:56 +00:00
|
|
|
|
|
|
|
import store from '../../lib/createStore';
|
|
|
|
import EmojiPicker from '../EmojiPicker';
|
|
|
|
import styles from './styles';
|
|
|
|
import { themes } from '../../constants/colors';
|
|
|
|
import { withTheme } from '../../theme';
|
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
interface IMessageBoxEmojiKeyboard {
|
|
|
|
theme: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export default class EmojiKeyboard extends React.PureComponent<IMessageBoxEmojiKeyboard, any> {
|
2021-12-03 19:27:57 +00:00
|
|
|
private readonly baseUrl: string;
|
2020-02-17 12:14:56 +00:00
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
constructor(props: IMessageBoxEmojiKeyboard) {
|
2020-02-17 12:14:56 +00:00
|
|
|
super(props);
|
|
|
|
const state = store.getState();
|
2020-11-04 16:53:44 +00:00
|
|
|
this.baseUrl = state.share.server.server || state.server.server;
|
2020-02-17 12:14:56 +00:00
|
|
|
}
|
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
onEmojiSelected = (emoji: any) => {
|
2020-02-17 12:14:56 +00:00
|
|
|
KeyboardRegistry.onItemSelected('EmojiKeyboard', { emoji });
|
2021-09-13 20:41:05 +00:00
|
|
|
};
|
2020-02-17 12:14:56 +00:00
|
|
|
|
|
|
|
render() {
|
|
|
|
const { theme } = this.props;
|
|
|
|
return (
|
2021-09-13 20:41:05 +00:00
|
|
|
<View
|
|
|
|
style={[styles.emojiKeyboardContainer, { borderTopColor: themes[theme].borderColor }]}
|
|
|
|
testID='messagebox-keyboard-emoji'>
|
2020-02-17 12:14:56 +00:00
|
|
|
<EmojiPicker onEmojiSelected={this.onEmojiSelected} baseUrl={this.baseUrl} />
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
KeyboardRegistry.registerKeyboard('EmojiKeyboard', () => withTheme(EmojiKeyboard));
|