You should turn on Show app and notification content in phone settings and turn off Hide notification details on Lock screen of the apps to show the app and notification content on the lock screen.
Setting method:
For phone settings:
realme UI 3.0 & above versions: Settings > Notifications & Quick Settings/Notifications & Status Bar > Lock screen > Lock Screen notifications > Show app and notification content.
realme UI 2.0 & 1.0: Settings > Notifications & Status Bar > Manage Notifications > Lock Screen Notifications > Display title and body.
realme UI R & Go & T & S Edition: Settings > Apps & notifications > Notifications > Notifications on lock screen > Show conversations, default, and silent.
For app settings, take WhatsApp as an example:
realme UI 1.0 & above versions: Long press the app icon > App info > Manage notifications > Enable Allow notifications on Lock screen > Disable Hide notification details on the Lock screen.
realme UI R & Go & T & S Edition: Long press the app icon > App info > Notifications > Enable Allow WhatsApp notifications.
Related Articles:
Notifications not showing on the lock screen
Can't receive notifications after off the screen