提问人:random videos 提问时间:10/25/2023 更新时间:10/25/2023 访问量:9
我想选择内容,突出显示它,然后将突出显示的内容传递给其他屏幕 reacr 本机
I want to select the contents,highlight it and then passing the highlighted content to other screen reacr native
问:
我只想使用突出显示的内容制作一些应用程序功能。我已经选择并突出显示了内容,但将其保存为使用状态并传递到下一个屏幕
const handleTextSelectionChange = (e) => {
const { selection } = e.nativeEvent;
if (selection) {
const selectedPart = pageWords.substring(selection.start, selection.end);
setSelectedText(selectedPart);
console.log('Selected Text:', selectedPart);
}
};
<Text
selectable={true}
selectionColor='orange'
onTextSelectionChange={handleTextSelectionChange}
style={{
paddingHorizontal: PAGE_MARGIN,
paddingTop: 4,
fontSize: fontSizeOfBookRead,
fontWeight: fontWeightOfBookRead,
fontFamily: "NastaliqReg"
}}>
{renderHighlightedText(pageWords, searchText)}
</Text>
答: 暂无答案
上一个:如何在HTML字符串中突出显示searchTerm?
下一个:移动平均线回溯
评论