【问题标题】:Adding longpress event in react native在本机反应中添加长按事件
【发布时间】:2020-01-16 06:58:10
【问题描述】:

我有一个输入框,我通过它添加一些文本,在长按上我必须将添加的字段设置为可编辑,我该如何在 react native 中做到这一点。

【问题讨论】:

    标签: react-native


    【解决方案1】:

    如果你想让你的文件可以点击而不看到按钮,那么你应该使用 touchableopacity。 试试这个;

    <TouchableOpacity onLongPress={this._onLongPress}>
       <Input/>
    </TouchableOpacity>
    
    _onLongPress = () => {
        this.setState({
            makeEditableFunction: true
        })
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-08-17
      • 2019-06-21
      • 1970-01-01
      • 2019-03-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-11-02
      相关资源
      最近更新 更多