Method: ProMotion::MotionTable::SectionedTable#remap_data_cell

Defined in:
lib/ProMotion/screen_helpers/_tables/_sectioned_table.rb

#remap_data_cell(data_cell) ⇒ Object



110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# File 'lib/ProMotion/screen_helpers/_tables/_sectioned_table.rb', line 110

def remap_data_cell(data_cell)
  # Re-maps legacy data cell calls
  mappings = {
    cell_style: :cellStyle,
    cell_identifier: :cellIdentifier,
    cell_class: :cellClass,
    masks_to_bounds: :masksToBounds,
    background_color: :backgroundColor,
    selection_style: :selectionStyle,
    cell_class_attributes: :cellClassAttributes,
    accessory_view: :accessoryView,
    accessory_type: :accessoryType,
    accessory_checked: :accessoryDefault,
    remote_image: :remoteImage,
    subviews: :subViews
  }
  mappings.each_pair do |n, old|
    if data_cell[old]
      warn "[DEPRECATION] `:#{old}` is deprecated in TableScreens. Use `:#{n}`"
      data_cell[n] = data_cell[old]
    end
  end
  if data_cell[:styles] && data_cell[:styles][:textLabel]
    warn "[DEPRECATION] `:textLabel` is deprecated in TableScreens. Use `:label`"
    data_cell[:styles][:label] = data_cell[:styles][:textLabel]
  end
  data_cell
end