The issue can be fixed by resetting data and cache of the application.

  1. Open Settings
  2. Go to Apps > Gboard > Storage
  3. Press Clear Data and Clear Cache