Sync react componenent theme mode with streamlite theme mode

i created a custom element component with react , but i faced a problem that theme mode of the react component does not sync with streamlit change , streamlit engine actually change the color not correctly but not changing the mode , can some one help me with a clean way to do it ?