This is an iOS 12 issue. It also happens with older iPhones. The device will charge if it is awake when you plug the cable in. This is inconvenient but it’s not a big deal.
The bigger deal is the XS and XS Max coming with a charger that can’t quick charge the phones.