emoji-picker-react 4.20.8 → 4.20.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.20.8",
2
+ "version": "4.20.9",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -31,6 +31,17 @@ export function CategoryNavigation() {
31
31
  const CategoryNavigationRef = useCategoryNavigationRef();
32
32
  const hideCustomCategory = useShouldHideCustomEmojis();
33
33
 
34
+ const visibleCategories = categoriesConfig.filter(
35
+ categoryConfig =>
36
+ !(isCustomCategory(categoryConfig) && hideCustomCategory),
37
+ );
38
+
39
+ // A single tab navigates nowhere — hide the bar to reclaim its space.
40
+ // https://github.com/ealush/emoji-picker-react/issues/396
41
+ if (visibleCategories.length <= 1) {
42
+ return null;
43
+ }
44
+
34
45
  return (
35
46
  <div
36
47
  className={cx(styles.nav)}
@@ -39,14 +50,10 @@ export function CategoryNavigation() {
39
50
  id="epr-category-nav-id"
40
51
  ref={CategoryNavigationRef}
41
52
  >
42
- {categoriesConfig.map((categoryConfig) => {
53
+ {visibleCategories.map(categoryConfig => {
43
54
  const category = categoryFromCategoryConfig(categoryConfig);
44
55
  const isActiveCategory = category === activeCategory;
45
56
 
46
- if (isCustomCategory(categoryConfig) && hideCustomCategory) {
47
- return null;
48
- }
49
-
50
57
  const allowNavigation = !isSearchMode && !isActiveCategory;
51
58
 
52
59
  return (