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-04-07 14:19:54 +00:00
|
|
|
import { store } from '../../lib/store/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';
|
2022-04-12 16:27:05 +00:00
|
|
|
import { TSupportedThemes, withTheme } from '../../theme';
|
2020-02-17 12:14:56 +00:00
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
interface IMessageBoxEmojiKeyboard {
|
2022-04-12 16:27:05 +00:00
|
|
|
theme: TSupportedThemes;
|
2021-09-13 20:41:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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-05-07 01:06:08 +00:00
|
|
|
onEmojiSelected = (emoji: string) => {
|
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'>
|
2022-05-07 01:06:08 +00:00
|
|
|
<EmojiPicker onEmojiSelected={this.onEmojiSelected} baseUrl={this.baseUrl} theme={theme} />
|
2020-02-17 12:14:56 +00:00
|
|
|
</View>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
KeyboardRegistry.registerKeyboard('EmojiKeyboard', () => withTheme(EmojiKeyboard));
|