Skip to content

Setting disabled through setState  #26

@CamiloTerevinto

Description

@CamiloTerevinto

I am using this:

import { RoundButton } from 'react-native-button-component';

<View style={{width: "100%", justifyContent: "center", alignItems: "center"}}>
    <RoundButton text="Terminar compra" onPress={() => navigate("PurchaseConfirmation", { data: this.state.basket})} 
        disabled={this.state.anyProductSelected == false}
        style={{width: 125, height: 35, marginBottom: 5, marginTop: 5}}>
    </RoundButton>
</View>

And I am updating the state with:

addHandler = (index: number, product: Product) : number => {
        ...
        this.setState({ anyProductSelected: true});
    }

But the button stays disabled (while the rest of the UI updates just fine).

Am I doing something wrong or this not supported?

More data:

  • "react": "16.0.0-alpha.12",
  • "react-native": "^0.47.1",
  • "react-native-button-component": "^0.1.24",
  • typescript 2.3
  • Android 7 (emulator)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions