From 577f672c15c683eab721cefcf7f5031efd07fda3 Mon Sep 17 00:00:00 2001 From: Parvesh Monu Date: Tue, 12 Apr 2022 22:13:47 +0530 Subject: [PATCH] Modified Emoji Keyboard as per Status Design Requirements --- package.json | 2 +- src/components/Categories.tsx | 19 +++++++------- src/components/CategoryItem.tsx | 35 ++++++++++++++++++++------ src/components/EmojiCategory.tsx | 1 + src/components/EmojiStaticKeyboard.tsx | 4 +-- 5 files changed, 41 insertions(+), 20 deletions(-) diff --git a/package.json b/package.json index 38275f2..fce77d3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rn-emoji-keyboard", - "version": "0.4.0", + "version": "0.4.3", "description": "Super performant, lightweight, fully customizable emoji picker. Designated to be user and developer friendly! 💖", "main": "lib/commonjs/index", "module": "lib/module/index", diff --git a/src/components/Categories.tsx b/src/components/Categories.tsx index 5a3d1bc..2a37c7b 100644 --- a/src/components/Categories.tsx +++ b/src/components/Categories.tsx @@ -122,12 +122,11 @@ const styles = StyleSheet.create({ alignItems: 'center', }, navigation: { - padding: 3, alignItems: 'center', - borderColor: '#00000011', + borderColor: '#EEF2F5', }, navigationFloating: { - borderRadius: 8, + borderRadius: 20, }, navigationBottom: { paddingVertical: 6, @@ -145,18 +144,20 @@ const styles = StyleSheet.create({ separator: { width: 1, height: 28, - backgroundColor: '#00000011', + backgroundColor: '#00000000', marginHorizontal: 4, }, activeIndicator: { position: 'absolute', - width: 28, - height: 28, - borderRadius: 6, + width: 30, + height: 30, + borderRadius: 15, }, activeIndicatorContainer: { position: 'absolute', - width: 28, - height: 28, + width: 30, + height: 30, + top: 5, + left: 12, }, }) diff --git a/src/components/CategoryItem.tsx b/src/components/CategoryItem.tsx index bd809b0..4f7dce2 100644 --- a/src/components/CategoryItem.tsx +++ b/src/components/CategoryItem.tsx @@ -1,5 +1,5 @@ import * as React from 'react' -import { View, StyleSheet, TouchableOpacity } from 'react-native' +import { View, ViewStyle, StyleSheet, TouchableOpacity } from 'react-native' import { KeyboardContext } from '../contexts/KeyboardContext' import type { CategoryNavigationItem, CategoryTypes } from '../types' import { Icon } from './Icon' @@ -11,17 +11,35 @@ type CategoryItemProps = { } export const CategoryItem = ({ item, index, handleScrollToCategory }: CategoryItemProps) => { - const { activeCategoryIndex, categoryColor, activeCategoryColor, setActiveCategoryIndex } = - React.useContext(KeyboardContext) + const { + activeCategoryIndex, + searchPhrase, + categoryColor, + activeCategoryColor, + setActiveCategoryIndex, + } = React.useContext(KeyboardContext) const handleSelect = () => { handleScrollToCategory(item.category) setActiveCategoryIndex(index) } + const getStylesBasedOnIndex = () => { + const style: ViewStyle[] = [styles.container] + + if (index === 0) { + style.push({ marginLeft: 7 }) + } else if (index === 7 && searchPhrase === '') { + style.push({ marginRight: 7 }) + } else if (index === 8 && searchPhrase !== '') { + style.push({ marginRight: 7 }) + } + return style + } + return ( - + {!hideHeader && {translation[title]}} emoji.name} numColumns={numberOfColumns} diff --git a/src/components/EmojiStaticKeyboard.tsx b/src/components/EmojiStaticKeyboard.tsx index f6078cd..530a3a0 100644 --- a/src/components/EmojiStaticKeyboard.tsx +++ b/src/components/EmojiStaticKeyboard.tsx @@ -9,7 +9,7 @@ import emojisByGroup from '../assets/emojis.json' import { SearchBar } from './SearchBar' import { useKeyboardStore } from '../store/useKeyboardStore' -const CATEGORY_ELEMENT_WIDTH = 37 +const CATEGORY_ELEMENT_WIDTH = 34.9 export const EmojiStaticKeyboard = () => { const { width } = useWindowDimensions() @@ -77,12 +77,12 @@ export const EmojiStaticKeyboard = () => { {enableSearchBar && } item.title}