How to have a multiline button? #2584
Replies: 5 comments 3 replies
-
Did you try
|
Beta Was this translation helpful? Give feedback.
-
@raajnadar doesn't work because nested |
Beta Was this translation helpful? Give feedback.
-
If you want a multiline text Button, use the TouchableRipple component wrapped with the Surface component:
and then apply the button theme of your app or the DefaultTheme to the |
Beta Was this translation helpful? Give feedback.
-
If you want to keep using a Button component - use an IconButton component and set the Text as a custom button, though you will have to use a fixed width, else it will have the default icon width. You could also use the icon prop on a normal button, but it has some stylings applied to it that make the IconButton a better candidate: <IconButton
style={{ width: "28%", maxHeight: "100%" }}
icon={() => (
<Text
style={{
width: "100%",
textAlign: "center",
}}
numberOfLines={2}
>
Your multiline text
</Text>
)}
/> |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
I'm trying to use the
Button
component with multiple lines of text, is it even possible?I was looking at the source code and found that the
Text
component of theButton
have a fixed propnumberOfLines={1}
. Maybe it should be possible to customize theText
component passing something liketextProps
?I know that multiline button goes agains material design guide lines, but... is it possible?
Beta Was this translation helpful? Give feedback.
All reactions