换行(多行)按钮

Bil*_*een 2 react-native react-native-elements

如何将react-native-elements按钮的标题分成多行?

import { Button } from 'react-native-elements';
....
// The \n in the following statement does NOT work! 
<Button
    title="Creating a Shift \n(and inviting employees)"
    onPress={ () => {
        console.log("Button Pressed");
    }}
/>
Run Code Online (Sandbox Code Playgroud)

Bil*_*een 6

您需要将标题文本括在大括号中。

<Button
    title={"Creating a Shift \n(and inviting employees)"}
    onPress={ () => {
        console.log("Button Pressed");
    }}
/>
Run Code Online (Sandbox Code Playgroud)