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';
|
2022-08-08 18:38:01 +00:00
|
|
|
import { Provider } from 'react-redux';
|
2020-02-17 12:14:56 +00:00
|
|
|
|
2022-08-08 18:38:01 +00:00
|
|
|
import store from '../../lib/store';
|
2020-02-17 12:14:56 +00:00
|
|
|
import EmojiPicker from '../EmojiPicker';
|
|
|
|
import styles from './styles';
|
2022-10-21 18:27:55 +00:00
|
|
|
import { ThemeContext, TSupportedThemes } from '../../theme';
|
|
|
|
import { EventTypes } from '../EmojiPicker/interfaces';
|
|
|
|
import { IEmoji } from '../../definitions';
|
|
|
|
import { colors } from '../../lib/constants';
|
2020-02-17 12:14:56 +00:00
|
|
|
|
2022-08-08 18:38:01 +00:00
|
|
|
const EmojiKeyboard = ({ theme }: { theme: TSupportedThemes }) => {
|
2022-10-21 18:27:55 +00:00
|
|
|
const onItemClicked = (eventType: EventTypes, emoji?: IEmoji) => {
|
|
|
|
KeyboardRegistry.onItemSelected('EmojiKeyboard', { eventType, emoji });
|
2021-09-13 20:41:05 +00:00
|
|
|
};
|
2020-02-17 12:14:56 +00:00
|
|
|
|
2022-08-08 18:38:01 +00:00
|
|
|
return (
|
|
|
|
<Provider store={store}>
|
2022-10-21 18:27:55 +00:00
|
|
|
<ThemeContext.Provider
|
|
|
|
value={{
|
|
|
|
theme,
|
|
|
|
colors: colors[theme]
|
|
|
|
}}
|
2022-08-08 21:02:08 +00:00
|
|
|
>
|
2022-10-21 18:27:55 +00:00
|
|
|
<View
|
|
|
|
style={[styles.emojiKeyboardContainer, { borderTopColor: colors[theme].borderColor }]}
|
|
|
|
testID='messagebox-keyboard-emoji'
|
|
|
|
>
|
|
|
|
<EmojiPicker onItemClicked={onItemClicked} isEmojiKeyboard={true} />
|
|
|
|
</View>
|
|
|
|
</ThemeContext.Provider>
|
2022-08-08 18:38:01 +00:00
|
|
|
</Provider>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
KeyboardRegistry.registerKeyboard('EmojiKeyboard', () => EmojiKeyboard);
|