我使用react native渲染html包在视图中显示文本,我需要实现阅读更多按钮,但我不知道如何减少渲染html文本中的行数。这个描述来自一个API,所以不能对程序的HTML部分做任何改变
这是我用来显示HTML的代码:<RenderHtml
contentWidth={100}
source={{ html: item.description }}
baseStyle={styles.card}
defaultTextProps={{ numberOfLines: 1 }}
/>
<Pressable onPress={() => { openArticle(item.feed_id) }}>
<AppText style={styles.read}> read more</AppText>
</Pressable>
</View>
<AppText style={styles.feedText}>{item.description}</AppText>}
这是我试图实现的代码,但它不工作
尝试设置变量numberOfLines
in的值,点击in按钮后更改为null