无法在 Animated.View 中换行文本 - React Native
Can't wrap text in Animated.View - React Native
我是 React Native 动画的新手。我正在使用 react native animated 将菜单向右移动并将所有内容向右推送而不剪切文本,但如您所见,它没有换行。
我已经尝试过这些解决方案:
对 Text
组件使用 flexShrink
flex: 1
和 flexWrap
到父 View
元素
但是没有任何效果,有人可以给我一些建议吗?
`<Animated.View style={boxValue.getLayout()}>
<Text style={{flexWrap: 'wrap'}}>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur
dapibus massa eu quam porttitor, id suscipit felis volutpat. Duis
tempus turpis
</Text>
</Animated.View>`
使用 Animated API. You can wrap the text component in a Animated.View
that is shifted to right using an Animated.Value
combined with styling the text with flexWrap: 'wrap'
. That seems to be what you were going for, but perhaps you are not updating the width of the text container? Here is a snack 显示实际操作的一般想法,您尝试做的事情是完全可能的。
我是 React Native 动画的新手。我正在使用 react native animated 将菜单向右移动并将所有内容向右推送而不剪切文本,但如您所见,它没有换行。
我已经尝试过这些解决方案:
对
Text
组件使用flexShrink
flex: 1
和flexWrap
到父View
元素 但是没有任何效果,有人可以给我一些建议吗?`<Animated.View style={boxValue.getLayout()}> <Text style={{flexWrap: 'wrap'}}> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur dapibus massa eu quam porttitor, id suscipit felis volutpat. Duis tempus turpis </Text> </Animated.View>`
使用 Animated API. You can wrap the text component in a Animated.View
that is shifted to right using an Animated.Value
combined with styling the text with flexWrap: 'wrap'
. That seems to be what you were going for, but perhaps you are not updating the width of the text container? Here is a snack 显示实际操作的一般想法,您尝试做的事情是完全可能的。