Check out example codes for "screen record ios simulator". It will help you in understanding the concepts better.

Code Example 1

// when iOS simulator is running
xcrun simctl io booted recordVideo <filename>.<file extension>

Learn ReactJs, React Native from akashmittal.com