Skip to content

fix: fix error on width change of AnimatedFAB when label is empty string #4729

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

Merged
merged 1 commit into from
May 13, 2025

Conversation

rnigro-rwb
Copy link
Contributor

onTextLayout sets the width of the text for the AnimatedFAB when the text changes. If the label is an empty string the nativeEvent.lines[0] is undefined for iOS. This change handles this case and defaults to 0.

Motivation

On iOS, when the label is changed from a non-empty string to and empty string, it throws an Uncaught error

Cannot read property 'width' of undefined

Related issue

None

Test plan

Tested on iPhone 11 by changing the label from a non-empty string to an empty string. Before the fix, this would throw an Uncaught error. After the fix, not error was thrown and the component resized as expected.

@callstack-bot
Copy link

Hey @rnigro-rwb, thank you for your pull request 🤗. The documentation from this branch can be viewed here.

@lukewalczak lukewalczak merged commit e395271 into callstack:main May 13, 2025
3 checks passed
@rnigro-rwb rnigro-rwb deleted the animated-fab-empty-string branch May 13, 2025 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants