The forthcoming movie, called Peter Pan and Wendy, will also star Jude Law as villain Captain Hook.
It is the latest in Disney's live-action remakes of animated classics, following on from Aladdin, The Lion King and Mulan.
Shahidi's casting marks the latest move in Disney's ongoing efforts to improve diversity.
She may only be 20 years old, but Yara Shahidi has been acting for more than a decade.
The actress had a guest appearance in US TV series Entourage at the age of seven and has since appeared in films alongside Samuel L Jackson, Angelina Jolie and Eddie Murphy.
Her biggest role to date, however, came in 2013, when she was cast in the hugely popular US comedy series Black-ish.
Shahidi played Zoey, the daughter of Andre (Anthony Anderson) and Rainbow (Tracee Ellis Ross), and was one of the main characters for the first three seasons of the show.
Black-ish explored issues of class and race in America, and was a commercial and critical success, with Ross winning the Golden Globe for best comedy actress in 2017.
The series was so popular, it prompted a spin-off named Grown-ish, which centred on Zoey. Shahidi has starred in every series since, while continuing to appear occasionally in Black-ish.