我正在尝试创建一个可编辑且具有可点击网址的 TextInput 组件。根据 react native docs,仅当 editable={false} 时才支持 dataDetectorTypes 属性。
Determines the types of data converted to clickable URLs in the text input. Only valid if multiline={true} and editable={false}.
有没有人找到解决这个限制的方法?好像应该是可以的。我想要的行为是...
最佳答案
我能想到的唯一解决方法就是存储 editable
状态中的值,然后单击某些 Edit
按钮将从 editable
更改状态为真。onBlur
会将此状态切换回 false
我之前没有尝试过这个,所以只是关于尝试变通方法或在两者之间找到一些中间立场的建议。
关于react-native - 使用 editable=true 和 dataDetectorTypes 响应 Native TextInput,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61445821/