I'm trying to create a long-press handler on the checkbox. The package with checkbox is http://ift.tt/2cmZp6M — i think it is default one. The problem is that checkbox intercepts onPressIn and onPressOut events and my TouchableWithoutFeedback component doesn't emit anything. Here is the code:
var pressStart = 0;
const pressTimeout = 400;
function pressIn() {
alert(0);
pressStart = parseInt((new Date()).getTime() / 1000);
}
function pressOut() {
var pressEnd = parseInt((new Date()).getTime() / 1000);
if (pressEnd - pressStart < pressTimeout) return;
alert(1);
}
return (
<View style={style.container}>
<TouchableWithoutFeedback onPressIn={pressIn} onPressOut={pressOut}>
<View>
{/*<Text>asdasdasd</Text>*/}
<CheckBox checked={this.state.done} labelStyle={style.checkbox} label={this.state.name} onChange={toggleChecked} />
</View>
</TouchableWithoutFeedback>
</View>
);
Also, if i use Text component instead of CheckBox — it fires pressIn event, but pressOut doesn't work (i see alert(0), but not alert(1)).
Aucun commentaire:
Enregistrer un commentaire