How to deal with daughter!?

My 5yr old daughter's behavior is really getting a hit on me.

She would cry very badly when I talk to her about what she did wrong. She cries as if I hit her, when all I did was tell her she shouldn't be tearing up my books.

I would have her on time out, and she'd scream very loudly, stomp on the walls, bang the walls, and cry/scream nonstop on the top of her lungs.

However, when she's with her dad, or uncle, she behaves so well. When there comes a time they put her on timeout, she will just sit there quietly.

Idk what to do, sometimes I lose my temper, and I would slap her hands or legs for banging the walls. But I feel really bad after spanking her like that.

What are some advices?