A deal has been made between the US and China to keep TikTok running in the US, according to US President Donald Trump.

We have a deal on TikTok, I've reached a deal with China, I'm going to speak to President Xi on Friday to confirm everything up, Trump told reporters as he left the White House for a state visit to the UK.

The social media platform, which is run by Chinese company ByteDance, was told it had to sell its US operations or risk being shut down.

However, Trump has repeatedly delayed the ban since it was first announced in January.

The US president said a buyer will be announced soon. CNBC reported the deal would include a mix of current and new investors, and would be completed in the next 30 to 45 days.

It also said US tech company Oracle would keep its existing agreement to host TikTok servers inside the US, addressing concerns from American lawmakers over data sharing with China due to national security issues.

On Monday, a US trade delegation announced a framework deal with China amid broader trade negotiations. China confirmed the framework but emphasized that their firms' interests would not be compromised.

After previously calling for TikTok to be banned during his first term, Trump's current stance marks a shift. The US Supreme Court upheld a law requiring the app's Chinese parent company ByteDance to sell its US operations or face a ban.

The Justice Department had warned that TikTok poses a significant national-security threat due to its data access on American users, but ByteDance maintains its US operations are independent and that no data is shared with the Chinese government.

The deadline for a sale has already been extended multiple times, with the current extension set to end on September 17.