Check out example codes for "stick menu bar in css". It will help you in understanding the concepts better.

Code Example 1

.navigation {
   /* fixed keyword is fine too */
   position: sticky;
   top: 0;
   z-index: 100;
   /* z-index works pretty much like a layer:
   the higher the z-index value, the greater
   it will allow the navigation tag to stay on top
   of other tags */
}

Learn ReactJs, React Native from akashmittal.com