The top of an electric car has maybe 3–5 square meters of flat space.
Solar panels, even at high noon, usually only produce about 200 watt-hours per square meter.
The most efficient production electric vehicles today (probably the Hyundai Ioniq and the Tesla Mod 3) would only be able to travel 2–4 miles on that amount of electricity…in an hour. Most people could walk faster.
Financially, the cost of the panels and electronics, R&D and assembly would never pay for itself in the life of the vehicle, compared to charging from the wall in your garage.
While it might be nice to have for cars that sit there for a while or in the apocalypse. Right now it is better to use home solar panels or charging, as they have more surface area. Or maybe build parking structures with panels that can charge with more area. Maybe one day when they are small enough or can pull in sun into a smaller surface areas it will make sense.
Solar panel cars would probably also really up insurance rates and add more safety work/R&D.
[1] https://qz.com/1482588/why-teslas-dont-and-cant-have-solar-r...