-
Notifications
You must be signed in to change notification settings - Fork 1.4k
chore: migrate from react-native-vector-icons to @expo/vector-icons #6620
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Caution Review failedThe pull request is closed. WalkthroughReplaces react-native-vector-icons with Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor U as User
participant S as Status component
participant CI as CustomIcon module
participant GM as glyphMap
U->>S: render Status(iconName)
S->>CI: call hasIcon(iconName)
CI->>GM: lookup iconName
GM-->>CI: found? (true/false)
CI-->>S: return boolean
alt icon exists
S->>S: render provided iconName
else icon missing
S->>S: render "status-offline"
end
S-->>U: UI rendered
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro Disabled knowledge base sources:
⛔ Files ignored due to path filters (2)
📒 Files selected for processing (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Jira integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (2)
ios/Podfile.lockis excluded by!**/*.lockyarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (5)
app/containers/CustomIcon/index.tsx(1 hunks)app/containers/Status/Status.tsx(2 hunks)docs/icons.md(1 hunks)ios/RocketChatRN.xcodeproj/project.pbxproj(0 hunks)package.json(1 hunks)
💤 Files with no reviewable changes (1)
- ios/RocketChatRN.xcodeproj/project.pbxproj
🧰 Additional context used
🧬 Code graph analysis (2)
app/containers/Status/Status.tsx (1)
app/containers/CustomIcon/index.tsx (1)
hasIcon(19-19)
app/containers/CustomIcon/index.tsx (1)
app/containers/CustomIcon/mappedIcons.js (2)
mappedIcons(1-229)mappedIcons(1-229)
🪛 markdownlint-cli2 (0.18.1)
docs/icons.md
3-3: Bare URL used
(MD034, no-bare-urls)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: ESLint and Test / run-eslint-and-test
- GitHub Check: format
| const glyphMap = IconSet.getRawGlyphMap | ||
| ? IconSet.getRawGlyphMap() | ||
| : icoMoonConfig.icons?.reduce((map: Record<string, string | number>, glyph: any) => { | ||
| map[glyph.icon.name] = glyph.icon.code; | ||
| return map; | ||
| }, {}) || {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix fallback glyph map extraction.
icoMoonConfig.icons stores metadata under properties, not icon, so the fallback map is always empty. If IconSet.getRawGlyphMap is unavailable, hasIcon will return false for every name and regress status icons. Please pull the name/code from glyph.properties.
Apply this diff:
-const glyphMap = IconSet.getRawGlyphMap
- ? IconSet.getRawGlyphMap()
- : icoMoonConfig.icons?.reduce((map: Record<string, string | number>, glyph: any) => {
- map[glyph.icon.name] = glyph.icon.code;
- return map;
- }, {}) || {};
+const glyphMap =
+ IconSet.getRawGlyphMap?.() ??
+ (icoMoonConfig.icons ?? []).reduce((map: Record<string, string | number>, glyph: any) => {
+ const name = glyph?.properties?.name;
+ if (name) {
+ map[name] = glyph?.properties?.code ?? map[name];
+ }
+ return map;
+ }, {});📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const glyphMap = IconSet.getRawGlyphMap | |
| ? IconSet.getRawGlyphMap() | |
| : icoMoonConfig.icons?.reduce((map: Record<string, string | number>, glyph: any) => { | |
| map[glyph.icon.name] = glyph.icon.code; | |
| return map; | |
| }, {}) || {}; | |
| const glyphMap = | |
| IconSet.getRawGlyphMap?.() ?? | |
| (icoMoonConfig.icons ?? []).reduce((map: Record<string, string | number>, glyph: any) => { | |
| const name = glyph?.properties?.name; | |
| if (name) { | |
| map[name] = glyph?.properties?.code ?? map[name]; | |
| } | |
| return map; | |
| }, {}); |
🤖 Prompt for AI Agents
In app/containers/CustomIcon/index.tsx around lines 12 to 17, the fallback glyph
map reads name/code from glyph.icon but icoMoonConfig.icons stores metadata
under glyph.properties, so the fallback map is always empty; update the reduce
to pull name and code from glyph.properties (e.g., glyph.properties.name and
glyph.properties.code), keeping the same map type and defaulting to {} so
hasIcon works when IconSet.getRawGlyphMap is unavailable.
| # Icons | ||
|
|
||
| Icons are generated using IcoMoon and react-native-vector-icons https://github.com/oblador/react-native-vector-icons#createiconsetfromicomoonconfig-fontfamily-fontfile | ||
| Icons are generated using IcoMoon and `@expo/vector-icons` https://docs.expo.dev/guides/icons/#createiconsetfromicomoon |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrap bare URL for markdownlint compliance.
Markdown lint (MD034) flags this bare URL; wrap it like <https://docs.expo.dev/guides/icons/#createiconsetfromicomoon> to satisfy the check.
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)
3-3: Bare URL used
(MD034, no-bare-urls)
🤖 Prompt for AI Agents
In docs/icons.md around line 3, the markdown contains a bare URL which triggers
MD034; wrap the URL in angle brackets to make it inline code-compliant by
replacing the raw link with the bracketed form
<https://docs.expo.dev/guides/icons/#createiconsetfromicomoon> so markdownlint
stops flagging it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Jira integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (2)
ios/Podfile.lockis excluded by!**/*.lockyarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (5)
app/containers/CustomIcon/index.tsx(1 hunks)app/containers/Status/Status.tsx(2 hunks)docs/icons.md(1 hunks)ios/RocketChatRN.xcodeproj/project.pbxproj(0 hunks)package.json(1 hunks)
💤 Files with no reviewable changes (1)
- ios/RocketChatRN.xcodeproj/project.pbxproj
🧰 Additional context used
🧬 Code graph analysis (2)
app/containers/CustomIcon/index.tsx (2)
app/containers/CustomIcon/mappedIcons.js (2)
mappedIcons(1-229)mappedIcons(1-229)scripts/build-icon-set.js (1)
mappedIcons(19-19)
app/containers/Status/Status.tsx (1)
app/containers/CustomIcon/index.tsx (1)
hasIcon(19-19)
🪛 markdownlint-cli2 (0.18.1)
docs/icons.md
3-3: Bare URL used
(MD034, no-bare-urls)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: ESLint and Test / run-eslint-and-test
- GitHub Check: format
| : icoMoonConfig.icons?.reduce((map: Record<string, string | number>, glyph: any) => { | ||
| map[glyph.icon.name] = glyph.icon.code; | ||
| return map; | ||
| }, {}) || {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix glyphMap fallback to read metadata from properties.
selection.json stores the icon name/code under glyph.properties, not glyph.icon. This fallback currently builds a map with undefined keys/values, so hasIcon() always returns false whenever IconSet.getRawGlyphMap isn’t available (which happens with @expo/vector-icons). That breaks every icon guard, e.g. statuses always falling back to status-offline. Please read the metadata from properties (and guard for missing codes).
- : icoMoonConfig.icons?.reduce((map: Record<string, string | number>, glyph: any) => {
- map[glyph.icon.name] = glyph.icon.code;
- return map;
- }, {}) || {};
+ : icoMoonConfig.icons?.reduce((map: Record<string, string | number>, glyph: any) => {
+ const name = glyph?.properties?.name;
+ const code = glyph?.properties?.code;
+ if (typeof name === 'string') {
+ map[name] = code ?? mappedIcons[name];
+ }
+ return map;
+ }, {}) || {};📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| : icoMoonConfig.icons?.reduce((map: Record<string, string | number>, glyph: any) => { | |
| map[glyph.icon.name] = glyph.icon.code; | |
| return map; | |
| }, {}) || {}; | |
| : icoMoonConfig.icons?.reduce((map: Record<string, string | number>, glyph: any) => { | |
| const name = glyph?.properties?.name; | |
| const code = glyph?.properties?.code; | |
| if (typeof name === 'string') { | |
| map[name] = code ?? mappedIcons[name]; | |
| } | |
| return map; | |
| }, {}) || {}; |
🤖 Prompt for AI Agents
In app/containers/CustomIcon/index.tsx around lines 14–17, the fallback glyphMap
reads from glyph.icon but selection.json stores metadata under glyph.properties;
update the reducer to read the icon name and code from glyph.properties (e.g.
properties.name and properties.code or properties.codepoint/unicode as
available), only add entries when a valid name and code exist, and coerce the
code to the same type expected by other callers (string or number) so missing
codes are skipped instead of inserting undefined keys/values.
| # Icons | ||
|
|
||
| Icons are generated using IcoMoon and react-native-vector-icons https://github.com/oblador/react-native-vector-icons#createiconsetfromicomoonconfig-fontfamily-fontfile | ||
| Icons are generated using IcoMoon and `@expo/vector-icons` https://docs.expo.dev/guides/icons/#createiconsetfromicomoon |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrap the link to satisfy markdownlint.
markdownlint (MD034) flags the bare URL. Please wrap it in angle brackets or convert it into markdown link syntax to keep docs lint passing.
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)
3-3: Bare URL used
(MD034, no-bare-urls)
🤖 Prompt for AI Agents
docs/icons.md around line 3: the bare URL triggers markdownlint MD034; update
the text to wrap the URL in angle brackets or convert it into markdown link
syntax (e.g., [Expo icons
guide](https://docs.expo.dev/guides/icons/#createiconsetfromicomoon)) so the
link is no longer a bare URL and the markdown linter passes.
|
Conflict Resolved |
Proposed changes
Issue(s)
https://rocketchat.atlassian.net/browse/COMM-65
How to test or reproduce
Screenshots
Types of changes
Checklist
Further comments
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.