Check out example codes for "how to stop player rotating when hit by object". It will help you in understanding the concepts better.

Code Example 1

//Set freeze rotation on the rigidbody to true.  This will stop the object from
//physics calculations randomly rotating it when hitting other colliders, but 
//will still let you rotate your player by using the transform
_RigidBody2D.freezeRotation = true;

Learn ReactJs, React Native from akashmittal.com