1

我将 ProMotion 与 PM::FormotionScreen 屏幕一起使用。

如何在 ProMotion 中使用 Formotion 的 row .on_delete 回调

我有这个 table_data 方法

  def table_data
    {
      sections: [{
          rows: [

          {
          title: "URL",
          key: :url,
          placeholder: "http://myapp/dj_mon/",
          action: :delete_account,
          deletable: true,
          type: :string,
          auto_correction: :no,
          auto_capitalization: :none
          }

          ]
        }]
    }
  end

截图:http: //i.stack.imgur.com/e1dlu.png

4

1 回答 1

2

您必须使用 DSL,而不是使用哈希来初始化 Formotion 表单:

form = Formotion::Form.new

form.build_section do |section|
  section.build_row do |row|
    row.title               = 'URL'
    row.key                 = :url
    row.placeholder         = "http://myapp/dj_mon/"
    row.type                = :string
    row.auto_correction     = :no
    row.auto_capitalization = :none
    row.deletable           = true

    row.on_tap do |row|
      p "I'm tapped!"
    end

    row.on_delete do |row|
     p "I'm called before the delete animation"
    end
  end
end
于 2013-09-05T15:29:11.803 回答