Correct answer has already been posted with float, but here is a solution for React Native where float isn't available. Not a pure css solution, it's a bit inelegant since it measures the elements, but I think it handles all the edge cases and works nicely.
