Skip to content

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