Yes, a few members have done this to their ebikes...although a bit uncommon.
If I remember correctly they are usually giant panels that are flexed to fit somewhat like a shade, or giant panels pulled in a trailer. The whole setup will be pretty expensive as far as I know investing in a large solar panel and the electronics to convert the power to charge the battery is not cheap.
Highly possible but depending on the energy needed, you can end up with big panels.
I would advise you to watch a few videos of the Sun Trip race, people are doing it to be able to use their ebike all day long but I suppose if you only need to ride a few hours, you can cut down the panels needed.
Here is the channel (lot of French content though since it is a French race).
If you are thinking about using the solar cell as your power source, forget it. If you are wanting to charge your battery while riding, it may be possible but it is certainly unpractical. The typical state of the art rooftop solar cell is 3' x 4' and is rated at 300 watts. They never actually produce that much, and that is in IDEAL conditions, clear, cool and full overhead sun. You will get 240 volts, +/-, and 1.25 Amps, IN ONE HOUR. That is no where enough to do anything but add a few minutes of riding time over the course of a ride, unless you are letting the bike sit and charge. Even then, you would only add 1/10th capacity to a 12 Amp battery, IN AN HOUR. Keep in mind that that panel will act like a sail, and will be hugely cumbersome. Unless you can situate it perfectly parallel to the ground, it will also create lift (or down force), and A gust of wind may likely seriously impact your ride safety! I think it is not a likely prospect, yet...
Having said that, I have rooftop solar, and charge my bike (and car) with solar, for free!
Stock Rad charger is 48V, 2A, so 96 watts. To get equivalent charge rate, you‘d need 100+ watts of solar. Then you have to figure out charge controller that takes power from panel(s) and provides to battery at correct voltage. A 48V lithium-compatbile charge controller would be ideal. Bike-mounted panels really aren’t practical. A more practical solution would be a solar shed in which you could store and charge your bike from a small off-grid solar system. You’ll end up spending hundreds of dollars/pounds for panels, charge controller, possibly an inverter, etc, but would be a fun project.
You will need 4 12v panels in series & a charge controller. From my research on this you will not get much of a range boost due to the limited size of the panels. I use a single 12v panel & charge controller to charge batteries. I purchased 4 12v 16Ah Lithium-ion batteries ($200) which essentially doubles the range of my Rad Wagon. Plus, it is way cheaper than the $500+ they ask for a new 14Ah battery pack I also have a trailer for my bike so carrying them along is easy. They would also easily mount on either the rack or the foot boards on the back. I can then connect them by running a wire from the batteries to the charge port on the battery pack. One thing I am trying to find out is how many Amps I can charge the Rad Battery Pack, they will tell me nothing In fact, Radpowerbikes will tell me nothing about the electronics on my bike.