8000 Add responsive sizing to custom <Text /> component · Issue #2661 · infinitered/ignite · GitHub
[go: up one dir, main page]

Skip to content
{"payload":{"issueViewerRoute":{"data":{"repository":{"id":"MDEwOlJlcG9zaXRvcnk1MTQ1MjM1Ng==","isOwnerEnterpriseManaged":false,"owner":{"__typename":"Organization","userNameDisplayConfiguration":"HANDLE","id":"MDEyOk9yZ2FuaXphdGlvbjM5MDI1Mjc="},"issue":{"id":"I_kwDOAxEZxM6EJkW_","number":2661,"repository":{"id":"MDEwOlJlcG9zaXRvcnk1MTQ1MjM1Ng==","databaseId":51452356,"name":"ignite","isArchived":false,"nameWithOwner":"infinitered/ignite","viewerCanInteract":false,"viewerInteractionLimitReasonHTML":"","slashCommandsEnabled":false,"visibility":"PUBLIC","viewerCanPush":false,"issueFields":{"totalCount":0},"pinnedIssueFields":{"nodes":[]},"owner":{"__typename":"Organization","login":"infinitered","id":"MDEyOk9yZ2FuaXphdGlvbjM5MDI1Mjc=","url":"https://github.com/infinitered","databaseId":3902527,"planningStatuses":null,"issueFields":{"totalCount":0},"pinnedIssueFields":{"nodes":[]}},"isPrivate":false,"isWritable":true,"isOwnerEnterpriseManaged":false,"viewerCanPinIssues":false,"isCopilotAgentEnabled":null,"issueTypes":{"edges":[{"node":{"id":"IT_kwDOADuMP84ABSfL"}},{"node":{"id":"IT_kwDOADuMP84ABSfP"}},{"node":{"id":"IT_kwDOADuMP84ABSfS"}}]},"viewerIssueCreationPermissions":{"triageable":false},"pinnedIssues":{"totalCount":0}},"viewerCanAssign":false,"viewerCanLabel":false,"viewerCanSetMilestone":false,"viewerCanSetFields":false,"viewerCanType":false,"viewerCanUpdateMetadata":false,"issueType":null,"assignedActors":{"nodes":[]},"labels":{"pageInfo":{"hasNextPage":false,"endCursor":"MQ"},"edges":[{"node":{"id":"MDU6TGFiZWw1NDgyNjQ0NDg=","fullDatabaseId":"548264448","color":"84b6eb","name":"enhancement","nameHTML":"enhancement","description":null,"url":"https://github.com/infinitered/ignite/labels/enhancement","archivedAt":null}}]},"milestone":null,"issueFieldValues":{"nodes":[]},"projectItems":{"edges":[],"pageInfo":{"endCursor":null,"hasNextPage":false}},"agentAssignments":[],"linkedPullRequests":{"nodes":[]},"closedByPullRequestsReferences":{"nodes":[]},"updatedAt":"2024-05-14T14:29:42Z","title":"Add responsive sizing to custom \u003cText /\u003e component ","titleHTML":"Add responsive sizing to custom \u0026lt;Text /\u0026gt; component ","url":"https://github.com/infinitered/ignite/issues/2661","totalCommentsCount":1,"viewerCanUpdateNext":false,"viewerCanSetStatus":false,"subIssuesSummary":{"total":0,"completed":0},"state":"OPEN","stateReason":null,"status":null,"duplicateOf":null,"locked":false,"viewerCanComment":false,"databaseId":2217100735,"createdAt":"2024-03-31T17:31:26Z","viewerDidAuthor":false,"author":{"avatarUrl":"https://avatars.githubusercontent.com/u/122328438?v=4","login":"ChristopherGabba","id":"U_kgDOB0qVdg","profileUrl":"https://github.com/ChristopherGabba","name":"Chris Gabba","__typename":"User"},"body":"I've implemented this into my application that started out with ignite, but would be great if it was automatically a factor in the initial Text Component. Here is a link to some methods that I've used in the past:\r\n\r\nhttps://stackoverflow.com/questions/33628677/react-native-responsive-font-size \r\n\r\nI would like it to be the same general layout, maybe like this?\r\n\r\n```tsx\r\n\u003cText \r\n responsive={true}\r\n size={'xl'}\r\n/\u003e\r\n```\r\n\r\nBut that size in the background is whatever you define inside the TextComponent:\r\n\r\n```tsx\r\nconst $sizeStyles = {\r\n xxl: { fontSize: 36, lineHeight: 44 } satisfies TextStyle,\r\n xl: { fontSize: 24, lineHeight: 34 } satisfies TextStyle,\r\n lg: { fontSize: 20, lineHeight: 32 } satisfies TextStyle,\r\n md: { fontSize: 18, lineHeight: 28 } satisfies TextStyle,\r\n sm: { fontSize: 16, lineHeight: 24 } satisfies TextStyle,\r\n xs: { fontSize: 14, lineHeight: 21 } satisfies TextStyle,\r\n xxs: { fontSize: 12, lineHeight: 18 } satisfies TextStyle,\r\n xxxs: { fontSize: 10, lineHeight: 14 } satisfies TextStyle,\r\n xxxxs: { fontSize: 9, lineHeight: 12 } satisfies TextStyle,\r\n micro: { fontSize: 8, lineHeight: 14 } satisfies TextStyle,\r\n} \r\n```\r\nThat looks tiny on an tablet vs. on a phone. Would be awesome if this component would take that into account.\r\n\r\n\r\nI'm not sure if infinite red has a better method but I've used similar practices to https://github.com/nirsky/react-native-size-matters to scale text automatically depending on the screen dimensions. It ends up looking pretty great on tablet all things considered. Would be a great option. ","bodyHTML":"\u003cp dir=\"auto\"\u003eI've implemented this into my application that started out with ignite, but would be great if it was automatically a factor in the initial Text Component. Here is a link to some methods that I've used in the past:\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e\u003ca href=\"https://stackoverflow.com/questions/33628677/react-native-responsive-font-size\" rel=\"nofollow\"\u003ehttps://stackoverflow.com/questions/33628677/react-native-responsive-font-size\u003c/a\u003e\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eI would like it to be the same general layout, maybe like this?\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-tsx notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"\u0026lt;Text \n responsive={true}\n size={'xl'}\n/\u0026gt;\"\u003e\u003cpre class=\"notranslate\"\u003e\u003cspan class=\"pl-c1\"\u003e\u0026lt;\u003c/span\u003e\u003cspan class=\"pl-v\"\u003eText\u003c/span\u003e \n \u003cspan class=\"pl-c1\"\u003eresponsive\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e{\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003etrue\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e}\u003c/span\u003e\n \u003cspan class=\"pl-c1\"\u003esize\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e{\u003c/span\u003e\u003cspan class=\"pl-s\"\u003e'xl'\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e}\u003c/span\u003e\n\u003cspan class=\"pl-kos\"\u003e/\u0026gt;\u003c/span\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eBut that size in the background is whatever you define inside the TextComponent:\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-tsx notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"const $sizeStyles = {\n xxl: { fontSize: 36, lineHeight: 44 } satisfies TextStyle,\n xl: { fontSize: 24, lineHeight: 34 } satisfies TextStyle,\n lg: { fontSize: 20, lineHeight: 32 } satisfies TextStyle,\n md: { fontSize: 18, lineHeight: 28 } satisfies TextStyle,\n sm: { fontSize: 16, lineHeight: 24 } satisfies TextStyle,\n xs: { fontSize: 14, lineHeight: 21 } satisfies TextStyle,\n xxs: { fontSize: 12, lineHeight: 18 } satisfies TextStyle,\n xxxs: { fontSize: 10, lineHeight: 14 } satisfies TextStyle,\n xxxxs: { fontSize: 9, lineHeight: 12 } satisfies TextStyle,\n micro: { fontSize: 8, lineHeight: 14 } satisfies TextStyle,\n} \"\u003e\u003cpre class=\"notranslate\"\u003e\u003cspan class=\"pl-k\"\u003econst\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003e$sizeStyles\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-kos\"\u003e{\u003c/span\u003e\n \u003cspan class=\"pl-c1\"\u003exxl\u003c/span\u003e: \u003cspan class=\"pl-kos\"\u003e{\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003efontSize\u003c/span\u003e: \u003cspan class=\"pl-c1\"\u003e36\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e,\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003elineHeight\u003c/span\u003e: \u003cspan class=\"pl-c1\"\u003e44\u003c/span\u003e \u003cspan class=\"pl-kos\"\u003e}\u003c/span\u003e \u003cspan class=\"pl-k\"\u003esatisfies\u003c/span\u003e \u003cspan class=\"pl-smi\"\u003eTextStyle\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e,\u003c/span\u003e\n \u003cspan class=\"pl-c1\"\u003exl\u003c/span\u003e: \u003cspan class=\"pl-kos\"\u003e{\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003efontSize\u003c/span\u003e: \u003cspan class=\"pl-c1\"\u003e24\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e,\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003elineHeight\u003c/span\u003e: \u003cspan class=\"pl-c1\"\u003e34\u003c/span\u003e \u003cspan class=\"pl-kos\"\u003e}\u003c/span\u003e \u003cspan class=\"pl-k\"\u003esatisfies\u003c/span\u003e \u003cspan class=\"pl-smi\"\u003eTextStyle\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e,\u003c/span\u003e\n \u003cspan class=\"pl-c1\"\u003elg\u003c/span\u003e: \u003cspan class=\"pl-kos\"\u003e{\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003efontSize\u003c/span\u003e: \u003cspan class=\"pl-c1\"\u003e20\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e,\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003elineHeight\u003c/span\u003e: \u003cspan class=\"pl-c1\"\u003e32\u003c/span\u003e \u003cspan class=\"pl-kos\"\u003e}\u003c/span\u003e \u003cspan class=\"pl-k\"\u003esatisfies\u003c/span\u003e \u003cspan class=\"pl-smi\"\u003eTextStyle\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e,\u003c/span\u003e\n \u003cspan class=\"pl-c1\"\u003emd\u003c/span\u003e: \u003cspan class=\"pl-kos\"\u003e{\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003efontSize\u003c/span\u003e: \u003cspan class=\"pl-c1\"\u003e18\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e,\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003elineHeight\u003c/span\u003e: \u003cspan class=\"pl-c1\"\u003e28\u003c/span\u003e \u003cspan class=\"pl-kos\"\u003e}\u003c/span\u003e \u003cspan class=\"pl-k\"\u003esatisfies\u003c/span\u003e \u003cspan class=\"pl-smi\"\u003eTextStyle\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e,\u003c/span\u003e\n \u003cspan class=\"pl-c1\"\u003esm\u003c/span\u003e: \u003cspan class=\"pl-kos\"\u003e{\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003efontSize\u003c/span\u003e: \u003cspan class=\"pl-c1\"\u003e16\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e,\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003elineHeight\u003c/span\u003e: \u003cspan class=\"pl-c1\"\u003e24\u003c/span\u003e \u003cspan class=\"pl-kos\"\u003e}\u003c/span\u003e \u003cspan class=\"pl-k\"\u003esatisfies\u003c/span\u003e \u003cspan class=\"pl-smi\"\u003eTextStyle\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e,\u003c/span\u003e\n \u003cspan class=\"pl-c1\"\u003exs\u003c/span\u003e: \u003cspan class=\"pl-kos\"\u003e{\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003efontSize\u003c/span\u003e: \u003cspan class=\"pl-c1\"\u003e14\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e,\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003elineHeight\u003c/span\u003e: \u003cspan class=\"pl-c1\"\u003e21\u003c/span\u003e \u003cspan class=\"pl-kos\"\u003e}\u003c/span\u003e \u003cspan class=\"pl-k\"\u003esatisfies\u003c/span\u003e \u003cspan class=\"pl-smi\"\u003eTextStyle\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e,\u003c/span\u003e\n \u003cspan class=\"pl-c1\"\u003exxs\u003c/span\u003e: \u003cspan class=\"pl-kos\"\u003e{\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003efontSize\u003c/span\u003e: \u003cspan class=\"pl-c1\"\u003e12\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e,\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003elineHeight\u003c/span\u003e: \u003cspan class=\"pl-c1\"\u003e18\u003c/span\u003e \u003cspan class=\"pl-kos\"\u003e}\u003c/span\u003e \u003cspan class=\"pl-k\"\u003esatisfies\u003c/span\u003e \u003cspan class=\"pl-smi\"\u003eTextStyle\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e,\u003c/span\u003e\n \u003cspan class=\"pl-c1\"\u003exxxs\u003c/span\u003e: \u003cspan class=\"pl-kos\"\u003e{\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003efontSize\u003c/span\u003e: \u003cspan class=\"pl-c1\"\u003e10\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e,\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003elineHeight\u003c/span\u003e: \u003cspan class=\"pl-c1\"\u003e14\u003c/span\u003e \u003cspan class=\"pl-kos\"\u003e}\u003c/span\u003e \u003cspan class=\"pl-k\"\u003esatisfies\u003c/span\u003e \u003cspan class=\"pl-smi\"\u003eTextStyle\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e,\u003c/span\u003e\n \u003cspan class=\"pl-c1\"\u003exxxxs\u003c/span\u003e: \u003cspan class=\"pl-kos\"\u003e{\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003efontSize\u003c/span\u003e: \u003cspan class=\"pl-c1\"\u003e9\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e,\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003elineHeight\u003c/span\u003e: \u003cspan class=\"pl-c1\"\u003e12\u003c/span\u003e \u003cspan class=\"pl-kos\"\u003e}\u003c/span\u003e \u003cspan class=\"pl-k\"\u003esatisfies\u003c/span\u003e \u003cspan class=\"pl-smi\"\u003eTextStyle\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e,\u003c/span\u003e\n \u003cspan class=\"pl-c1\"\u003emicro\u003c/span\u003e: \u003cspan class=\"pl-kos\"\u003e{\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003efontSize\u003c/span\u003e: \u003cspan class=\"pl-c1\"\u003e8\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e,\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003elineHeight\u003c/span\u003e: \u003cspan class=\"pl-c1\"\u003e14\u003c/span\u003e \u003cspan class=\"pl-kos\"\u003e}\u003c/span\u003e \u003cspan class=\"pl-k\"\u003esatisfies\u003c/span\u003e \u003cspan class=\"pl-smi\"\u003eTextStyle\u003c/span\u003e\u003cspan class=\"pl-kos\"\u003e,\u003c/span\u003e\n\u003cspan class=\"pl-kos\"\u003e}\u003c/span\u003e \u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eThat looks tiny on an tablet vs. on a phone. Would be awesome if this component would take that into account.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eI'm not sure if infinite red has a better method but I've used similar practices to \u003ca href=\"https://github.com/nirsky/react-native-size-matters\"\u003ehttps://github.com/nirsky/react-native-size-matters\u003c/a\u003e to scale text automatically depending on the screen dimensions. It ends up looking pretty great on tablet all things considered. Would be a great option.\u003c/p\u003e","bodyVersion":"bba71dff37fdf81d1c144e6ebe6d44ffb860b8c338e52d6ca6da2afa319aceb2","reactionGroups":[{"content":"THUMBS_UP","viewerHasReacted":false,"reactors":{"totalCount":0,"nodes":[]}},{"content":"THUMBS_DOWN","viewerHasReacted":false,"reactors":{"totalCount":0,"nodes":[]}},{"content":"LAUGH","viewerHasReacted":false,"reactors":{"totalCount":0,"nodes":[]}},{"content":"HOORAY","viewerHasReacted":false,"reactors":{"totalCount":0,"nodes":[]}},{"content":"CONFUSED","viewerHasReacted":false,"reactors":{"totalCount":0,"nodes":[]}},{"content":"HEART","viewerHasReacted":false,"reactors":{"totalCount":0,"nodes":[]}},{"content":"ROCKET","viewerHasReacted":false,"reactors":{"totalCount":0,"nodes":[]}},{"content":"EYES","viewerHasReacted":false,"reactors":{"totalCount":0,"nodes":[]}}],"pinnedIssueComment":null,"__isIssueOrPullRequest":"Issue","isPinned":false,"viewerCanDelete":false,"viewerCanTransfer":false,"viewerCanConvertToDiscussion":false,"viewerCanLock":false,"timelineItems":{"totalCount":2,"beforeFocusCount":0,"afterFocusCount":0,"pageInfo":{"hasNextPage":false,"hasPreviousPage":false,"startCursor":"Y3Vyc29yOnYyOpPPAAABjpWQ6bABqzEyMzA0MzI0MDk4","endCursor":"Y3Vyc29yOnYyOpPPAAABj3eCVAgAqjIxMTAzOTk3MTY="},"edges":[{"cursor":"Y3Vyc29yOnYyOpPPAAABjpWQ6bABqzEyMzA0MzI0MDk4","node":{"__typename":"LabeledEvent","id":"LE_lADOAxEZxM6EJkW_zwAAAALdZRYC","databaseId":12304324098,"createdAt":"2024-03-31T17:31:26Z","actor":{"id":"U_kgDOB0qVdg","avatarUrl":"https://avatars.githubusercontent.com/u/122328438?s=64\u0026v=4","login":"ChristopherGabba","profileResourcePath":"/ChristopherGabba","__typename":"User","name":"Chris Gabba"},"label":{"id":"MDU6TGFiZWw1NDgyNjQ0NDg=","archivedAt":null,"nameHTML":"enhancement","name":"enhancement","color":"84b6eb","description":null},"intent":null}},{"cursor":"Y3Vyc29yOnYyOpPPAAABj3eCVAgAqjIxMTAzOTk3MTY=","node":{"__typename":"IssueComment","id":"IC_kwDOAxEZxM59yiTk","createdAt":"2024-05-14T14:29:41Z","url":"https://github.com/infinitered/ignite/issues/2661#issuecomment-2110399716","isHidden":false,"isMinimized":false,"minimizedReason":null,"databaseId":2110399716,"viewerDidAuthor":false,"issue":{"id":"I_kwDOAxEZxM6EJkW_","author":{"__typename":"User","id":"U_kgDOB0qVdg","login":"ChristopherGabba"},"number":2661,"locked":false,"databaseId":2217100735},"author":{"__typename":"User","id":"MDQ6VXNlcjM3NDAyMg==","login":"frankcalise","avatarUrl":"https://avatars.githubusercontent.com/u/374022?u=c0414713d5cf2cb017a35ae1a4fc1fecd1a6def4\u0026v=4","profileUrl":"https://github.com/frankcalise","name":"Frank Calise"},"authorAssociation":"CONTRIBUTOR","viewerCanDelete":false,"viewerCanMinimize":false,"viewerCanUnminimize":false,"viewerCanReport":false,"viewerCanReportToMaintainer":false,"viewerCanBlockFromOrg":false,"viewerCanUnblockFromOrg":false,"viewerCanBlockPersonally":false,"viewerCanUnblockPersonally":false,"viewerCanPin":false,"viewerCanUnpin":false,"viaApp":null,"showSpammyBadge":false,"createdViaEmail":false,"authorToRepoOwnerSponsorship":null,"viewerCanReadUserContentEdits":true,"lastEditedAt":null,"lastUserContentEdit":null,"pinnedBy":null,"body":"Very interesting point @ChristopherGabba, thanks for bringing that up!","bodyHTML":"\u003cp dir=\"auto\"\u003eVery interesting point \u003ca class=\"user-mention notranslate\" data-hovercard-type=\"user\" data-hovercard-url=\"/users/ChristopherGabba/hovercard\" data-octo-click=\"hovercard-link-click\" data-octo-dimensions=\"link_type:self\" href=\"https://github.com/ChristopherGabba\"\u003e@ChristopherGabba\u003c/a\u003e, thanks for bringing that up!\u003c/p\u003e","bodyVersion":"385d7265607b6c68cf751b9f168e6651d2fdb4c6ec549d822962a3ee891bb145","viewerCanUpdate":false,"repository":{"id":"MDEwOlJlcG9zaXRvcnk1MTQ1MjM1Ng==","name":"ignite","owner":{"__typename":"Organization","id":"MDEyOk9yZ2FuaXphdGlvbjM5MDI1Mjc=","login":"infinitered","url":"https://github.com/infinitered"},"isPrivate":false,"viewerCanCreateIssues":false,"slashCommandsEnabled":false,"nameWithOwner":"infinitered/ignite","databaseId":51452356},"reactionGroups":[{"content":"THUMBS_UP","viewerHasReacted":false,"reactors":{"totalCount":0,"nodes":[]}},{"content":"THUMBS_DOWN","viewerHasReacted":false,"reactors":{"totalCount":0,"nodes":[]}},{"content":"LAUGH","viewerHasReacted":false,"reactors":{"totalCount":0,"nodes":[]}},{"content":"HOORAY","viewerHasReacted":false,"reactors":{"totalCount":0,"nodes":[]}},{"content":"CONFUSED","viewerHasReacted":false,"reactors":{"totalCount":0,"nodes":[]}},{"content":"HEART","viewerHasReacted":false,"reactors":{"totalCount":0,"nodes":[]}},{"content":"ROCKET","viewerHasReacted":false,"reactors":{"totalCount":0,"nodes":[]}},{"content":"EYES","viewerHasReacted":false,"reactors":{"totalCount":0,"nodes":[]}}]}}]},"backTimelineItems":{"totalCount":2,"beforeFocusCount":0,"afterFocusCount":0,"pageInfo":{"hasNextPage":false,"hasPreviousPage":false,"startCursor":"Y3Vyc29yOnYyOpPPAAABjpWQ6bABqzEyMzA0MzI0MDk4","endCursor":"Y3Vyc29yOnYyOpPPAAABj3eCVAgAqjIxMTAzOTk3MTY="},"edges":[{"cursor":"Y3Vyc29yOnYyOpPPAAABjpWQ6bABqzEyMzA0MzI0MDk4","node":{"__typename":"LabeledEvent","id":"LE_lADOAxEZxM6EJkW_zwAAAALdZRYC","databaseId":12304324098,"createdAt":"2024-03-31T17:31:26Z","actor":{"id":"U_kgDOB0qVdg","avatarUrl":"https://avatars.githubusercontent.com/u/122328438?s=64\u0026v=4","login":"ChristopherGabba","profileResourcePath":"/ChristopherGabba","__typename":"User","name":"Chris Gabba"},"label":{"id":"MDU6TGFiZWw1NDgyNjQ0NDg=","archivedAt":null,"nameHTML":"enhancement","name":"enhancement","color":"84b6eb","description":null},"intent":null}},{"cursor":"Y3Vyc29yOnYyOpPPAAABj3eCVAgAqjIxMTAzOTk3MTY=","node":{"__typename":"IssueComment","id":"IC_kwDOAxEZxM59yiTk","createdAt":"2024-05-14T14:29:41Z","url":"https://github.com/infinitered/ignite/issues/2661#issuecomment-2110399716","isHidden":false,"isMinimized":false,"minimizedReason":null,"databaseId":2110399716,"viewerDidAuthor":false,"issue":{"id":"I_kwDOAxEZxM6EJkW_","author":{"__typename":"User","id":"U_kgDOB0qVdg","login":"ChristopherGabba"},"number":2661,"locked":false,"databaseId":2217100735},"author":{"__typename":"User","id":"MDQ6VXNlcjM3NDAyMg==","login":"frankcalise","avatarUrl":"https://avatars.githubusercontent.com/u/374022?u=c0414713d5cf2cb017a35ae1a4fc1fecd1a6def4\u0026v=4","profileUrl":"https://github.com/frankcalise","name":"Frank Calise"},"authorAssociation":"CONTRIBUTOR","viewerCanDelete":false,"viewerCanMinimize":false,"viewerCanUnminimize":false,"viewerCanReport":false,"viewerCanReportToMaintainer":false,"viewerCanBlockFromOrg":false,"viewerCanUnblockFromOrg":false,"viewerCanBlockPersonally":false,"viewerCanUnblockPersonally":false,"viewerCanPin":false,"viewerCanUnpin":false,"viaApp":null,"showSpammyBadge":false,"createdViaEmail":false,"authorToRepoOwnerSponsorship":null,"viewerCanReadUserContentEdits":true,"lastEditedAt":null,"lastUserContentEdit":null,"pinnedBy":null,"body":"Very interesting point @ChristopherGabba, thanks for bringing that up!","bodyHTML":"\u003cp dir=\"auto\"\u003eVery interesting point \u003ca class=\"user-mention notranslate\" data-hovercard-type=\"user\" data-hovercard-url=\"/users/ChristopherGabba/hovercard\" data-octo-click=\"hovercard-link-click\" data-octo-dimensions=\"link_type:self\" href=\"https://github.com/ChristopherGabba\"\u003e@ChristopherGabba\u003c/a\u003e, thanks for bringing that up!\u003c/p\u003e","bodyVersion":"385d7265607b6c68cf751b9f168e6651d2fdb4c6ec549d822962a3ee891bb145","viewerCanUpdate":false,"repository":{"id":"MDEwOlJlcG9zaXRvcnk1MTQ1MjM1Ng==","name":"ignite","owner":{"__typename":"Organization","id":"MDEyOk9yZ2FuaXphdGlvbjM5MDI1Mjc=","login":"infinitered","url":"https://github.com/infinitered"},"isPrivate":false,"viewerCanCreateIssues":false,"slashCommandsEnabled":false,"nameWithOwner":"infinitered/ignite","databaseId":51452356},"reactionGroups":[{"content":"THUMBS_UP","viewerHasReacted":false,"reactors":{"totalCount":0,"nodes":[]}},{"content":"THUMBS_DOWN","viewerHasReacted":false,"reactors":{"totalCount":0,"nodes":[]}},{"content":"LAUGH","viewerHasReacted":false,"reactors":{"totalCount":0,"nodes":[]}},{"content":"HOORAY","viewerHasReacted":false,"reactors":{"totalCount":0,"nodes":[]}},{"content":"CONFUSED","viewerHasReacted":false,"reactors":{"totalCount":0,"nodes":[]}},{"content":"HEART","viewerHasReacted":false,"reactors":{"totalCount":0,"nodes":[]}},{"content":"ROCKET","viewerHasReacted":false,"reactors":{"totalCount":0,"nodes":[]}},{"content":"EYES","viewerHasReacted":false,"reactors":{"totalCount":0,"nodes":[]}}]}}]},"pendingSuggestions":[]}},"safeViewer":null},"feed":"activity","activityTimeline":{"state":"UNAVAILABLE","canToggle":false},"queryOperation":{"name":"IssueViewerPage","id":"c66d034381cc264d626ac8cf9d35ff1bb35455489c4bdb61288e19b36b767678"}},"issuesLayoutRoute":{"has_projects_enabled":false,"has_labels_archiving_enabled":true,"current_user":null,"current_user_settings":{"preferred_emoji_skin_tone":null,"copilot_show_functionality":false},"sidebar_expanded":true,"pinned_views":[],"pinned_views_enabled":true,"best_match_sort_enabled":false,"issue_types_enabled":true,"issue_search_type":null,"show_issue_field_pills":false,"viewer_can_create_issues":false,"is_writable":false,"repository_id":"MDEwOlJlcG9zaXRvcnk1MTQ1MjM1Ng==","can_bulk_update":false,"actions":{"new_issue":{"label":"New issue","url":"/infinitered/ignite/issues/new","disabled_reason":null}},"compact_mode":false},"repoLayoutRoute":{"js":{"scanning":{"values":["https://github.githubassets.com/assets/scanning-14f01a2a69b402d6.js"]},"code-menu":{"values":["https://github.githubassets.com/assets/code-menu-9749b9665add47fd.js"]},"codespaces":{"values":["https://github.githubassets.com/assets/codespaces-55b952b906927f9d.js"]},"pull-requests":{"values":["https://github.githubassets.com/assets/app-runtime-fe654b95a55f1f96.js","https://github.githubassets.com/assets/primer-react-a8793df31d3bf19f.js","https://github.githubassets.com/assets/react-core-b259702d02974425.js","https://github.githubassets.com/assets/28372-16d49407eddff190.js","https://github.githubassets.com/assets/99405-72767a4e8fd2024d.js","https://github.githubassets.com/assets/34719-1311b9cdfd727258.js","https://github.githubassets.com/assets/68764-3093b2901f4f2896.js","https://github.githubassets.com/assets/35284-6b2d77a43bb3ac65.js","https://github.githubassets.com/assets/77485-aba082c667f57f30.js","https://github.githubassets.com/assets/47669-43e09d7789eca28f.js","https://github.githubassets.com/assets/6184-c73106e8a98c68a7.js","https://github.githubassets.com/assets/81650-cad7e383a56a700d.js","https://github.githubassets.com/assets/95184-46e988ac96e00403.js","https://github.githubassets.com/assets/5517-699eb971ed74942d.js","https://github.githubassets.com/assets/98259-dbae220a59956599.js","https://github.githubassets.com/assets/98874-1ec4b2fe1a71f848.js","https://github.githubassets.com/assets/65475-4d313d4477a6e2e6.js","https://github.githubassets.com/assets/7330-2802656eea8d618e.js","https://github.githubassets.com/assets/51741-b12048adeabc25df.js","https://github.githubassets.com/assets/59790-c27884771ac8ca0c.js","https://github.githubassets.com/assets/1416-5480d76a1a3d4829.js","https://github.githubassets.com/assets/31170-6d931eeb334866f7.js","https://github.githubassets.com/assets/25005-9af2856f0d44fba4.js","https://github.githubassets.com/assets/4947-d4955ef6ab10267c.js","https://github.githubassets.com/assets/17043-3844c4c668619a55.js","https://github.githubassets.com/assets/65118-6d24ac47fe7a9538.js","https://github.githubassets.com/assets/15020-87a29233636c76a7.js","https://github.githubassets.com/assets/95223-cc69820b9007936b.js","https://github.githubassets.com/assets/16945-468221b02213e2dd.js","https://github.githubassets.com/assets/42498-e37653ca12cdb197.js","https://github.githubassets.com/assets/56287-fa789bac7dd12804.js","https://github.githubassets.com/assets/62300-540bf2787ac46521.js","https://github.githubassets.com/assets/60380-6d37f93bfd317e69.js","https://github.githubassets.com/assets/66181-b868e342d6e0fb83.js","https://github.githubassets.com/assets/42217-bb252e38cc56479f.js","https://github.githubassets.com/assets/24601-ce492e1c7103a6a6.js","https://github.githubassets.com/assets/2999-584b3ab33f1255f8.js","https://github.githubassets.com/assets/46181-71fc590fcc7cd7c7.js","https://github.githubassets.com/assets/95275-35658a4c43c8fa20.js","https://github.githubassets.com/assets/40434-285b1519a313feb1.js","https://github.githubassets.com/assets/75233-4b6aabd5cd4d0121.js","https://github.githubassets.com/assets/68082-d2ca00d7b736a448.js","https://github.githubassets.com/assets/34207-367a749b938f69f5.js","https://github.githubassets.com/assets/88062-578441d85550f855.js","https://github.githubassets.com/assets/77296-07dbdfbc4488ad2f.js","https://github.githubassets.com/assets/84715-1a759f25ab523232.js","https://github.githubassets.com/assets/21914-4acec81a9cb9c462.js","https://github.githubassets.com/assets/72643-60d9f81a09ab2fc5.js","https://github.githubassets.com/assets/51117-9d458fb2bbd149b7.js","https://github.githubassets.com/assets/48938-788447fa9a14e622.js","https://github.githubassets.com/assets/54491-7cc2be5314825c13.js","https://github.githubassets.com/assets/35498-d1fcde4c26b4d29e.js","https://github.githubassets.com/assets/27455-573b9336909700f1.js","https://github.githubassets.com/assets/94048-97498366a042e466.js","https://github.githubassets.com/assets/64854-f046f1d8fb12e591.js","https://github.githubassets.com/assets/65166-f64858366f223346.js","https://github.githubassets.com/assets/38697-dec3e440a433d0f6.js","https://github.githubassets.com/assets/13982-1b8d8e6f37d50e56.js","https://github.githubassets.com/assets/91700-f2ff82fecb3f6816.js","https://github.githubassets.com/assets/44601-6b682292ce62cc94.js","https://github.githubassets.com/assets/18468-da81aa31133b0a42.js","https://github.githubassets.com/assets/73097-f225d28adb3a8328.js","https://github.githubassets.com/assets/18699-a575a5703ebfbab7.js","https://github.githubassets.com/assets/22584-6527c10c3ff1b2af.js","https://github.githubassets.com/assets/77690-c321acb5864fafd4.js","https://github.githubassets.com/assets/46675-61fc5f18ee6dfa37.js","https://github.githubassets.com/assets/6787-696f233c38d50c02.js","https://github.githubassets.com/assets/73594-70490966efc3dc3a.js","https://github.githubassets.com/assets/11208-811dfa4379996974.js","https://github.githubassets.com/assets/59166-e0792c06d2c0ef06.js","https://github.githubassets.com/assets/83411-21e3db04f21ff7d8.js","https://github.githubassets.com/assets/21045-2f1ba70267388d8e.js","https://github.githubassets.com/assets/2190-0dac0a0972d0c9a7.js","https://github.githubassets.com/assets/40709-1a3b2e9a32a0180c.js","https://github.githubassets.com/assets/59276-04afacc1de234c1b.js","https://github.githubassets.com/assets/52656-180cf2e4e4e307e1.js","https://github.githubassets.com/assets/38078-36b2ee5ba2349c08.js","https://github.githubassets.com/assets/35597-b8ba00c5542dc1ce.js","https://github.githubassets.com/assets/2986-2d0c08e90fa4c87e.js","https://github.githubassets.com/assets/95153-d717e954c0396783.js","https://github.githubassets.com/assets/57002-014d29f1a18bd124.js","https://github.githubassets.com/assets/16666-e3c90f4b34303a13.js","https://github.githubassets.com/assets/38899-86e6c0399bda6983.js","https://github.githubassets.com/assets/24614-3038e9d1a4fd9505.js","https://github.githubassets.com/assets/84029-43f62901e450acb7.js","https://github.githubassets.com/assets/9603-a4aed937f08303b8.js","https://github.githubassets.com/assets/55448-ca807e8e9c989c84.js","https://github.githubassets.com/assets/89843-53697af15c022044.js","https://github.githubassets.com/assets/40777-4877662fb39ee691.js","https://github.githubassets.com/assets/93960-3595dfe6fcc180d5.js","https://github.githubassets.com/assets/42900-b04f9edb1214bd20.js","https://github.githubassets.com/assets/75332-8b2307cefe4b503d.js","https://github.githubassets.com/assets/63202-f0b25bac85a4eb85.js","https://github.githubassets.com/assets/82330-78a63f005a8ca9b1.js","https://github.githubassets.com/assets/13332-d8907431f9a2f78e.js","https://github.githubassets.com/assets/14189-9d73fd58643a9d5b.js","https://github.githubassets.com/assets/73528-aa96c926a9825e09.js","https://github.githubassets.com/assets/96116-54d2c8906e2e2ee8.js","https://github.githubassets.com/assets/92313-4443b9c5c62f2a3c.js","https://github.githubassets.com/assets/12764-01e8250b86afcb04.js","https://github.githubassets.com/assets/21224-9b478ca9c4ac5b47.js","https://github.githubassets.com/assets/54534-11d996da4bf6cc2b.js","https://github.githubassets.com/assets/81421-470b450fe9ce88bd.js","https://github.githubassets.com/assets/91175-599baa07940eac56.js","https://github.githubassets.com/assets/71807-b756fdcc33f106f3.js","https://github.githubassets.com/assets/433-be8624b790d0d5e3.js","https://github.githubassets.com/assets/95737-8419b22008841177.js","https://github.githubassets.com/assets/57210-b19fa9c273c0d32a.js","https://github.githubassets.com/assets/65200-03bae620d82b23ff.js","https://github.githubassets.com/assets/6377-8c38e9355374a5f0.js","https://github.githubassets.com/assets/5701-fd83dce0badfd624.js","https://github.githubassets.com/assets/99079-752eea62e20ed4c8.js","https://github.githubassets.com/assets/79847-8e737fd1a70d2dcf.js","https://github.githubassets.com/assets/3678-20651741cba58a28.js","https://github.githubassets.com/assets/84151-625a43db679ab09d.js","https://github.githubassets.com/assets/14005-5d3288dad516fa8d.js","https://github.githubassets.com/assets/56750-93f0e433c9fded4c.js","https://github.githubassets.com/assets/44622-8f84630d7132f12b.js","https://github.githubassets.com/assets/19790-61492e980601b155.js","https://github.githubassets.com/assets/30190-55b09e3dfef6611c.js","https://github.githubassets.com/assets/39138-088b4c3275c05bb5.js","https://github.githubassets.com/assets/pull-requests-ec8e22c25aa07970.js"]},"editor":{"values":["https://github.githubassets.com/assets/48326-6fd433aebd78c955.js","https://github.githubassets.com/assets/editor-643b4b0c6c86d116.js"]},"repositories":{"values":["https://github.githubassets.com/assets/app-runtime-fe654b95a55f1f96.js","https://github.githubassets.com/assets/repositories-1699b8b9fb08b4c7.js"]},"actions":{"values":["https://github.githubassets.com/assets/actions-2e63cff430b3fe81.js"]},"pull-requests-list":{"values":["https://github.githubassets.com/assets/pull-requests-list-1c086c40797cb7b0.js"]},"diffs":{"values":["https://github.githubassets.com/assets/99430-faf0b06699f8e90d.js","https://github.githubassets.com/assets/diffs-951a90c0959716c1.js"]}},"css":{"repositories":{"values":["https://github.githubassets.com/assets/app-runtime.ab82c7019c867706.module.css"]},"copilot-code-revie 8000 w":{"values":["https://github.githubassets.com/assets/copilot-code-review-42b75ef95db82a2c.css"]},"actions":{"values":["https://github.githubassets.com/assets/actions-812c5f76c57dce11.css"]},"pull-requests":{"values":["https://github.githubassets.com/assets/app-runtime.ab82c7019c867706.module.css","https://github.githubassets.com/assets/react-core.10107776413acc8b.module.css","https://github.githubassets.com/assets/81421.c29817a7879410e1.module.css","https://github.githubassets.com/assets/6377.7c8c137a872736ff.module.css","https://github.githubassets.com/assets/56750.2cc57206ddfee576.module.css","https://github.githubassets.com/assets/30190.809d9efd40d8e29c.module.css","https://github.githubassets.com/assets/pull-requests.22a8cfdb9cdb5d5b.module.css","https://github.githubassets.com/assets/pull-requests-496e57b90f37de3f.css"]},"releases":{"values":["https://github.githubassets.com/assets/releases-259c86dec689d9de.css"]},"code":{"values":["https://github.githubassets.com/assets/code-5fc5d14af880ef6c.css"]}}}},"title":"Add responsive sizing to custom \u003cText /\u003e component · Issue #2661 · infinitered/ignite","appPayload":{"enabled_features":{"issues_bounded_conversation":false,"move_new_comments_ui":false,"cotd_derive_thread_previews":false,"prx_dynamic_split_pref":false,"prx_files":false,"pulls-files-skip-prefer-any-solo-entry":false,"generate_groups_on_files_view":false,"prx_robust_small_screen_support":false,"prs_contextual_comment_controls":true,"ci_analysis_check_runs_ui_enabled":false,"react_data_router_pull_request_files":false,"repo_pulls_dashboard_surface":true,"prs_overview_as_index_route":false,"pull_request_stacks":true,"cotd_ui":true,"pull_request_merge_status_button_opt_out":false,"authentic_contributions_frontend":false}},"meta":{"title":"Add responsive sizing to custom \u003cText /\u003e component · Issue #2661 · infinitered/ignite","protoRoutes":["repoLayoutRoute"]}}

Add responsive sizing to custom <Text /> component  #2661

Open

Description

@ChristopherGabba

I've implemented this into my application that started out with ignite, but would be great if it was automatically a factor in the initial Text Component. Here is a link to some methods that I've used in the past:

https://stackoverflow.com/questions/33628677/react-native-responsive-font-size

I would like it to be the same general layout, maybe like this?

<Text 
   responsive={true}
   size={'xl'}
/>

But that size in the background is whatever you define inside the TextComponent:

const $sizeStyles = {
  xxl: { fontSize: 36, lineHeight: 44 } satisfies TextStyle,
  xl: { fontSize: 24, lineHeight: 34 } satisfies TextStyle,
  lg: { fontSize: 20, lineHeight: 32 } satisfies TextStyle,
  md: { fontSize: 18, lineHeight: 28 } satisfies TextStyle,
  sm: { fontSize: 16, lineHeight: 24 } satisfies TextStyle,
  xs: { fontSize: 14, lineHeight: 21 } satisfies TextStyle,
  xxs: { fontSize: 12, lineHeight: 18 } satisfies TextStyle,
  xxxs: { fontSize: 10, lineHeight: 14 } satisfies TextStyle,
  xxxxs: { fontSize: 9, lineHeight: 12 } satisfies TextStyle,
  micro: { fontSize: 8, lineHeight: 14 } satisfies TextStyle,
} 

That looks tiny on an tablet vs. on a phone. Would be awesome if this component would take that into account.

I'm not sure if infinite red has a better method but I've used similar practices to https://github.com/nirsky/react-native-size-matters to scale text automatically depending on the screen dimensions. It ends up looking pretty great on tablet all things considered. Would be a great option.

Activity

  1. frankcalise commented on May 14, 2024

    @frankcalise
    Contributor

    Very interesting point @ChristopherGabba, thanks for bringing that up!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0