Quantcast
Channel: Disabling buttons on react native - Stack Overflow
Browsing latest articles
Browse All 17 View Live

Answer by Ammar Ismaeel for Disabling buttons on react native

I think the most efficient way is to wrap the touchableOpacity with a view and add the prop pointerEvents with a style condition. <View style={this.state.disabled &&...

View Article



Answer by keerthi c for Disabling buttons on react native

You can enable and disable button or by using condition or directly by default it will be disable : true // in calling function of button handledisableenable() { // set the state for disabling or...

View Article

Answer by Xdabier for Disabling buttons on react native

Here's my work around for this I hope it helps : <TouchableOpacity onPress={() => { this.onSubmit() }} disabled={this.state.validity} style={this.state.validity ? SignUpStyleSheet.inputStyle :...

View Article

Answer by Anja Ishmukhametova for Disabling buttons on react native

this native-base there is solution: <Button block disabled={!learnedWordsByUser.length} style={{ marginTop: 10 }} onPress={learnedWordsByUser.length && () => {...

View Article

Answer by Cory McAboy for Disabling buttons on react native

I was able to fix this by putting a conditional in the style property. const startQuizDisabled = () => props.deck.cards.length === 0; <TouchableOpacity style={startQuizDisabled() ?...

View Article


Answer by Julien Deniau for Disabling buttons on react native

TouchableOpacity extents TouchableWithoutFeedback, so you can just use the disabled property : <TouchableOpacity disabled={true}> <Text>I'm disabled</Text> </TouchableOpacity>...

View Article

Answer by Tallboy for Disabling buttons on react native

Just do this <TouchableOpacity activeOpacity={disabled ? 1 : 0.7} onPress={!disabled && onPress}> <View> <Text>{text}</Text> </View> </TouchableOpacity>

View Article

Answer by Chris Geirman for Disabling buttons on react native

This seems like the kind of thing that could be solved using a Higher Order Component. I could be wrong though because I'm struggling to understand it 100% myself, but maybe it'll be helpful to you...

View Article


Answer by eyal83 for Disabling buttons on react native

TouchableOpacity receives activeOpacity. You can do something like this <TouchableOpacity activeOpacity={enabled ? 0.5 : 1}> </TouchableOpacity> So if it's enabled, it will look normal,...

View Article


Answer by Fomahaut for Disabling buttons on react native

You can build an CustButton with TouchableWithoutFeedback, and set the effect and logic you want with onPressIn, onPressout or other props.

View Article

Disabling buttons on react native

I'm making an android app using react native and I've used TouchableOpacity component to create buttons. I use a text input component to accept text from the user and the button should only be enabled...

View Article

Answer by Danish Hassan for Disabling buttons on react native

To disable Text you have to set the opacity:0 in Text style like this:<TouchableOpacity style={{opacity:0}}> <Text>I'm disabled</Text> </TouchableOpacity>

View Article

Answer by Abdullah for Disabling buttons on react native

Here is the simplest solution ever:You can add onPressOut event to the TouchableOpcaityand do whatever you want to do.It will not let user to press again until onPressOut is done

View Article


Answer by Shahmir Khan for Disabling buttons on react native

So it is very easy to disable any button in react native<TouchableOpacity disabled={true}><Text> This is disabled button</Text></TouchableOpacity>disabled is a prop in react...

View Article

Answer by bisma for Disabling buttons on react native

Use disabled true property<TouchableOpacity disabled={true}> </TouchableOpacity>

View Article


Answer by AIK for Disabling buttons on react native

You can use the disabled prop in TouchableOpacity when your input does not match the string<TouchableOpacity disabled = { stringMatched ? false : true }><Text>Some...

View Article
Browsing latest articles
Browse All 17 View Live




Latest Images