kiwicom / mobile

:calling: Kiwi.com mobile app written in React Native
https://www.kiwi.com/en/
MIT License
140 stars 33 forks source link

Hotels: SummaryRow should use dynamic width to truncate text #1609

Closed RobinCsl closed 5 years ago

RobinCsl commented 5 years ago

This fixes https://github.com/kiwicom/mobile/issues/1607

The issue was that using the withDimension HOC meant using the dimensions of the device. On Tablet view, the RoomSummary component is displayed only on half the screen width while SummaryRow assumed there is the full width of the device to render the text. This caused the row to go out of the container if the name of the hotel room was too long on Tablet.

The SummaryRow component was refactored to use two onLayout event listeners so that both the width of the container of the row and the width of the price tag are computed, and the max width for text can be deduced from that.