diff --git a/app/containers/EmojiPicker/EmojiCategory.js b/app/containers/EmojiPicker/EmojiCategory.tsx similarity index 82% rename from app/containers/EmojiPicker/EmojiCategory.js rename to app/containers/EmojiPicker/EmojiCategory.tsx index 8e1a124ff..7c6fbce76 100644 --- a/app/containers/EmojiPicker/EmojiCategory.js +++ b/app/containers/EmojiPicker/EmojiCategory.tsx @@ -1,5 +1,4 @@ import React from 'react'; -import PropTypes from 'prop-types'; import { Text, TouchableOpacity, FlatList } from 'react-native'; import shortnameToUnicode from '../../utils/shortnameToUnicode'; @@ -7,9 +6,17 @@ import styles from './styles'; import CustomEmoji from './CustomEmoji'; import scrollPersistTaps from '../../utils/scrollPersistTaps'; -const EMOJI_SIZE = 50; +const EMOJI_SIZE: number = 50; -const renderEmoji = (emoji, size, baseUrl) => { +interface IEmoji { + baseUrl: string; + emojis: any; + onEmojiSelected({}: any): void; + emojisPerRow: number; + width: number; +} + +const renderEmoji = (emoji: any, size: number, baseUrl: string) => { if (emoji && emoji.isCustom) { return ; } @@ -20,16 +27,9 @@ const renderEmoji = (emoji, size, baseUrl) => { ); }; -class EmojiCategory extends React.Component { - static propTypes = { - baseUrl: PropTypes.string.isRequired, - emojis: PropTypes.any, - onEmojiSelected: PropTypes.func, - emojisPerRow: PropTypes.number, - width: PropTypes.number - } +class EmojiCategory extends React.Component { - renderItem(emoji) { + renderItem(emoji: any) { const { baseUrl, onEmojiSelected } = this.props; return ( { + + shouldComponentUpdate(nextProps: any) { const { activeTab, theme } = this.props; if (nextProps.activeTab !== activeTab) { return true; @@ -25,9 +25,7 @@ export default class TabBar extends React.Component { } render() { - const { - tabs, goToPage, tabEmojiStyle, activeTab, theme - } = this.props; + const { tabs, goToPage, tabEmojiStyle, activeTab, theme } = this.props; return ( diff --git a/app/containers/EmojiPicker/categories.js b/app/containers/EmojiPicker/categories.ts similarity index 100% rename from app/containers/EmojiPicker/categories.js rename to app/containers/EmojiPicker/categories.ts diff --git a/app/containers/EmojiPicker/index.js b/app/containers/EmojiPicker/index.tsx similarity index 100% rename from app/containers/EmojiPicker/index.js rename to app/containers/EmojiPicker/index.tsx diff --git a/app/containers/EmojiPicker/styles.js b/app/containers/EmojiPicker/styles.ts similarity index 100% rename from app/containers/EmojiPicker/styles.js rename to app/containers/EmojiPicker/styles.ts diff --git a/package.json b/package.json index e60404c67..a621a1d7f 100644 --- a/package.json +++ b/package.json @@ -138,10 +138,12 @@ "@storybook/addon-storyshots": "5.3.19", "@storybook/react-native": "5.3.19", "@types/jest": "^26.0.24", + "@types/lodash": "^4.14.171", "@types/react": "^17.0.14", "@types/react-native": "^0.62.7", "@types/react-native-config-reader": "^4.1.0", "@types/react-native-platform-touchable": "^1.1.2", + "@types/react-native-scrollable-tab-view": "^0.10.2", "@types/react-redux": "^7.1.18", "@types/react-test-renderer": "^17.0.1", "@typescript-eslint/eslint-plugin": "^4.28.3", diff --git a/yarn.lock b/yarn.lock index 31a4ad7a5..cefceb60d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2834,6 +2834,11 @@ resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee" integrity sha1-7ihweulOEdK4J7y+UnC86n8+ce4= +"@types/lodash@^4.14.171": + version "4.14.171" + resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.171.tgz#f01b3a5fe3499e34b622c362a46a609fdb23573b" + integrity sha512-7eQ2xYLLI/LsicL2nejW9Wyko3lcpN6O/z0ZLHrEQsg280zIdCv1t/0m6UtBjUHokCGBQ3gYTbHzDkZ1xOBwwg== + "@types/minimatch@*": version "3.0.3" resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d" @@ -2890,6 +2895,14 @@ "@types/react" "*" "@types/react-native" "*" +"@types/react-native-scrollable-tab-view@^0.10.2": + version "0.10.2" + resolved "https://registry.yarnpkg.com/@types/react-native-scrollable-tab-view/-/react-native-scrollable-tab-view-0.10.2.tgz#a6006efcad320b9dffd23b080cfe153cebcbc1a6" + integrity sha512-N6IObGTHFKIi2/lFqMLcUICjzqA8phbNWUC6apAdfBnJSrGWkHjTctPt28qpYaQA6KqtCsmhZ19RpzszDje0pg== + dependencies: + "@types/react" "*" + "@types/react-native" "*" + "@types/react-native@*": version "0.64.12" resolved "https://registry.yarnpkg.com/@types/react-native/-/react-native-0.64.12.tgz#1c6a3226c26d7a5949cdf8878e6cfe95fe0951d6"