Battery technology is the only thing holding electric powered cars back. The motors and electronics to build them are already available and robust enough. As they get better it will happen, and battery tech has already advanced a ton in the past 10 years. Even right now if car companies could just develop a battery pack that could be quickly swapped out in like 5 minutes (think popping your trunk and replacing the spare tire) to replace a dead battery with a fully charged one if needed, that could be the end game for a lot of gas powered cars.
I don't think we will have "no" gas cars by 2050, but I could see the ratio doing a 180 by then and most cars ( daily commuters) being 100% electric. I think it will take longer for the big diesel rigs to be phased out, really they are not nearly as inefficient.