The White House requested Navy ship bearing the name of Trump's late rival John McCain be kept out.

The White House requested a Navy ship bearing the name of US President Donald Trump's late rival senator John McCain be kept "out of sight" during a recent presidential trip to Japan, the Wall Street Journal reported Wednesday.

"USS John McCain needs to be out of sight," a Navy official instructed in an email about the visit, according to the newspaper.

The ship, which was undergoing repairs at the Yokosuka US naval base after a 2017 collision, would have been difficult to move for Trump's speech on board another ship there Tuesday, the newspaper said, citing officials.

A tarp was laid over the ship's name, which also references McCain's father and grandfather, the ship's sailors were given the day off and a barge blocked the ship after the tarp was taken down, the Journal said, though Navy officials told the paper the barge was not moved in order to block the name.

And acting Secretary of Defense Patrick Shanahan said he wasn't aware of the instruction to move the ship, his spokesman Joe Buccino said late Wednesday, "nor was he aware of the concern precipitating the directive."

Trump echoed that sentiment on Twitter.

"I was not informed about anything having to do with the Navy Ship USS John S. McCain during my recent visit to Japan," the president tweeted.

"Nevertheless, @FLOTUS and I loved being with our great Military Men and Women - what a spectacular job they do!"

Trump and McCain, who died in August and who was taken prisoner and tortured during the Vietnam war, had a contentious political relationship.

Trump, who never served in the military, mocked the moderate Republican's status as a war hero in 2015.

McCain, a respected figure in US politics for decades who himself ran for president twice, withdrew his support for Trump in the 2016 presidential election and blocked Trump's healthcare efforts in Congress in 2017.

Before McCain died of brain cancer at the age of 81, he said he didn't want Trump attending his funeral.

Even after McCain's death, the president has continued to make his dislike of the senator known: "I was never a fan of John McCain and I never will be," Trump said in March.

"Trump is a child who will always be deeply threatened by the greatness of my dads incredible life," McCain's daughter Meghan tweeted Wednesday evening.

"There is a lot of criticism of how much I speak about my dad, but nine months since he passed, Trump won't let him RIP. So I have to stand up for him. It makes my grief unbearable."