motion-prime/elements/label.rb in motion-prime-0.1.1 vs motion-prime/elements/label.rb in motion-prime-0.1.2
- old
+ new
@@ -1,20 +1,13 @@
module MotionPrime
class LabelElement < BaseElement
+ include MotionPrime::ElementTextHeightMixin
+
after_render :size_to_fit
def size_to_fit
if computed_options[:size_to_fit] || style_options[:size_to_fit]
view.sizeToFit
end
- end
-
- def height
- width = computed_options[:width]
- font = computed_options[:font] || :system.uifont
- raise "Please set element width for height calculation" unless width
- computed_options[:text].sizeWithFont(font,
- constrainedToSize: [width, Float::MAX],
- lineBreakMode:UILineBreakModeWordWrap).height
end
end
end
\ No newline at end of file