如何在React Native中跨行和跨列?

时间:2019-06-30 16:53:15

标签: react-native flexbox

问题
如何利用flexbox使文本同时占据行和列?我要在正方形的左上角,右上角和左下角填充文本。

Flex方向列/行示例:

return <View style={[
            {flex:1 , flexDirection: 'column' // also tried row}
        ]}>
            <Text style={[
                flex:1,
                flexWrap: 'wrap',
                overflow: "visible",
            ]}>
                This is some text that I want to wrap right and then drop to the next row.
            </Text>
            <View style={
                {
                    justifyContent: 'flex-end',
                    alignSelf: 'flex-end',
                    width: '25%',
                    height: '25%',
                },
            }>
            </View>
        </View>
}

结果
example_image

问题: 如果我将伸缩方向放置到行,则文本将仅跨列,而对于伸缩方向为列,则相反。如何在此项目周围显示文字?


对齐示例:

return <Text style={[
                flex:1,
                flexWrap: 'wrap',
                overflow: "visible",
            ]}>
                This is some text that I want to wrap right and then drop to the next row.
            </Text>
            <View style={
                {
                    justifyContent: 'flex-end',
                    alignSelf: 'flex-end',
                    width: '25%',
                    height: '25%',
                },
            }>
            </View>
}

结果
no_flex_direction_example

问题 文本仍然不会换行到下一行或列中。

0 个答案:

没有答案