Many agile advocates will avoid the waterfall approach of writing all the user stories at the beginning of the project. After all, you can easily spend a month on mid-size projects writing documents, without producing a line of code.
What’s the other extreme then? To delegate product decisions to developers when they are working on the implementation of the screens. They need to make decisions quickly, otherwise, they won’t make progress. The problem is you -as a product owner- might not like those decisions.
When is it the right time to write a user story? Just before the developer needs it. If you write it too early, it will be subject to change. If you write it too late, it will create more work, pushing the deadlines forward.
Write the user story a sprint before its implementation. In that way, you have the time pressure to get it done, and the developer will have enough clarity about what to build.