Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

how to obtain button content size dynamically in react js?

$
0
0

I have a button that has dynamic width according to its content. When I put the word 'next' for example, it gets the size it should be, but when this button goes to the loading state and displays the spinner it adjusts to the size of the spinner. How can I solve this and leave it the size of the previous content?

<Container isDisabled={disabled} {...props}>    {loading ? <Spinner /> : children}</Container>

I’m using styled components to style. The reference of the width is the child, I want to leave the 2 in the same size

Ideal size

Ideal button size

Button in loading state that should be in the ideal size

Button in loading state that should be in the ideal size


Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>