So far it hasn’t been a problem. Junior candidates have shown code from a school project and others have submitted code from a personal project or from something they contributed to an open source project. I think the personal projects are the most interesting to talk about.
Expecting people to have personal projects outside work is very much selecting for a certain type of person. You're ruling out people who devote their time outside work to their families, or sport, or hobbies that don't involve programming.
I’m not ruling out anything. So far I have yet to find somebody who can’t come up with a code sample to bring to the interview. When that happens, I would probably give them a (paid) assignment. Maybe something like “fix issue #12345 on open source project X”. I’d have to think about it a little and discuss it with the candidate.