Check out example codes for "div not larger than its content". It will help you in understanding the concepts better.

Code Example 1

The solution is to set your div to display: inline-block.

Learn ReactJs, React Native from akashmittal.com