You asked

Can the canon ef 50mm f 1 8 stm be used on an rf camera with an adapter and does autofocus still work?

The guide can't confirm this one. The Canon EF 50mm f/1.8 STM page lists only EF-mount DSLR bodies it fits, and it says nothing about using the lens on an RF camera through an adapter or whether autofocus carries over. So the guide won't promise either.

The adapters section gives the general picture: mirrorless mounts are shallow, so adapting older lenses is easy and cheap. But that section covers manual-focus film-era lenses without autofocus, so it doesn't settle your case.

If your goal is a fast 50mm on an RF body with autofocus, the guide points to the Canon RF 50mm f/1.8 STM. It's described as the cheapest fast lens on Canon mirrorless and a great first prime. It's a full-frame lens, so on an APS-C body it frames like about 80mm. The guide's lens pages don't give current prices here, so check the page for them, since prices change.

For people and low light, the guide's view is that a 50mm f/1.8 is the lens to buy first, which makes the RF version the simpler route if you're buying into mirrorless.

Written by Claude from this site's pages.

From these pages

This answer is for the question above. Each answer is written for the exact question in its address, so a question with its details in it (a budget, what you shoot, what you already have) gets an answer about those details. An answer draws on all 15 pages of the guide and its catalogue of 320 cameras and 1050 lenses. Another question gets its own answer at its own address, as words after /ask/. Or fill in your own: /ask/which-camera-for-{what-you-shoot}-under-{budget}-euros or /ask/which-lens-for-{what-you-shoot}-on-{your-camera}.