reflex-dev/reflex-examples

rx.button color disapper when page reload

AManTw opened this issue · 0 comments

AManTw commented

[Status]
the example code - 'quiz'
In 'index' class, there's a declaration of a 'box' used to place the 'Submit' button,
I've assigned a color "lightblue" to this button and add a alertdialog on it.

However,

  1. when the page is reloaded (F5), the "lightblue" is displayed briefly and then disappears
  2. returned back to this page from result page , button not display "lightblue".
    But other buttons in the alertdialog displayed color correctly.

Please let me know where I might have gone wrong?

[Code]
below is the code of index():

def index():
    """The main view."""
    return rx.center(
        rx.vstack(
            header(),
            question1(),
            question2(),
            question3(),
            rx.box(
                rx.button(
                    "Submit",
                    bg="lightblue",
                    color="black",
                    width="6em",
                    padding="1em",                    
                    on_click=State.alertdialogchange,
                ),
                rx.alert_dialog(
               #setting of alert_dialog 
                ),
            ),          
            spacing="1em",
        ),
        padding_y="2em",
        height="100vh",
        align_items="top",
        bg="#ededed",
        overflow="auto",
    )