Hide keyboard or show keyboard on a real device using Appium

I want to deal with the keyboard when clicking the text field and then click outside, the keyboard will be disappeared in real device -iOS and android