The rock and play is okay for the baby to sleep in during the daytime when the baby is being supervised.
But it's not safe for a baby to sleep in the rock and play overnight when no one will be available to supervise the baby.
A baby should always be placed in either a bassinet or baby crib for overnight unsupervised sleep.
A baby sleeping overnight in a rock and play could result in the baby dying overnight due to SIDS "Sudden Infant Death Syndrome.".
To keep a baby safe and prevent SIDS a baby needs to sleep on their back on a sleep surface that is firm and flat until the baby is past 1 year of age.