Most of the aircrafts have covers (caps) so as to isolate the landing gear from the air around so as to prevent it from icing. Commercial airliners reach altitudes to the proximity of 35000 feet (and maybe more in some cases) and temperatures could drop 80 degrees below zero. In such cases, if the landing gear has caps and is isolated from the free stream, the heat retained in the landing gear bay from the hydraulics and the friction in the tires while takeoff does keep the landing gear warm and hence protect it from icing (source).
Heat from the plane’s hydraulic lines in the wheel well, as well as
heat retained in the tires, could have helped the stowaway survive as
the aircraft climbed to altitudes with sub-zero temperatures, the FAA
reported.
Now, for airplanes like the one shown above, there is a possibility of the landing gear getting iced. When this happens, it might cause a range of problems. Problems ranging from skidding while landing to jammed landing gear. Usually, before landing when an airplane descents, the rise in temperature is good enough to deice the landing gear, but if that does not happen then pilots need to tackle with the icing problem in flight itself. Source
When surface temperatures are low enough for frozen deposits to be
present, consider whether the mechanisms might have become frozen
during flight as a result of prior extended taxiing through slush or
wet snow. Flight above the freezing level for prolonged periods may
result in the landing gear becoming frozen in the retracted position.
This is less of a problem on most modern commercial transport
aircraft, where the gear bays are largely enclosed by doors unless
retraction/extension is in progress, but is a relatively common
occurrence on aircraft such as the LOCKHEED AC-130 Spectre. If it is
suspected that taxiing through slush or wet snow may have led to
deposits adhering to the landing gear assemblies, then it may be
advisable to cycle the gear after initial post take off retraction to
try and shed any deposits.