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
|
|
|
|
2022-02-09 21:16:20 +00:00
|
|
|
import { store } from '../../lib/auxStore';
|
2020-02-17 12:14:56 +00:00
|
|
|
import EmojiPicker from '../EmojiPicker';
|
|
|
|
import styles from './styles';
|
2022-04-07 14:10:03 +00:00
|
|
|
import { themes } from '../../lib/constants';
|
2020-02-17 12:14:56 +00:00
|
|
|
import { withTheme } from '../../theme';
|
2022-03-31 22:39:24 +00:00
|
|
|
import { IEmoji } from '../../definitions/IEmoji';
|
2020-02-17 12:14:56 +00:00
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2022-03-31 22:39:24 +00:00
|
|
|
onEmojiSelected = (emoji: IEmoji) => {
|
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));
|