我正在做一个调查表,您可以选择一个答案,也可以选择编写自己的答案。在IOS中,我的代码可以正常工作,但在Android上,我必须触摸textInput两次。我没有解决方案来更改Android中的动态可编辑道具,因为我认为在触摸textInput之前,可编辑道具必须为真。
<View style={{width: wp('86.5%'), height: hp('3.5%'),
marginTop: hp ("2%"), backgroundColor:'transparent',
flexDirection:'row', justifyContent:'space-between',
alignSelf:'center', alignItems:'center'
}}
onTouchStart={()=> {
this.props.checkAnswer(4)
this.props.giveAnswer(this.props.answer4)
}}
>
<Image style={{width: wp('4.7%'), height: wp('4.7%')}}
source={this.props.check == 4 ?
require('../config/Images/circle-o.png') :
require('../config/Images/circle.png')
}
/>
<TextInput
style={[{width: wp('79.5%'), height:"100%", color:"white",
borderBottomColor: "white",borderBottomWidth: 1,
fontFamily:"Arial Rounded MT Bold"}]
}
onChangeText={(text) => this.props.giveAnswer(text)}
editable={(this.props.check == 4)}
value={this.props.answer4}
placeholder={"Donne-nous ta propre réponse"}
placeholderTextColor={'#FFFFFF'}
maxLength= {85}
/>
</View>
这是问卷的一个示例,在IOS中,当我触摸textInput时我可以编辑,但在android中,我必须触摸一次以选择最后一个答案(textInput),如果我要编辑,我有触摸文本再输入一次:
所以我想在IOS和Android中有同样的感觉,我的意思是我只想触摸一次textInput进行编辑,如果我选择其他答案,则textInput无法编辑。 如果您有解决方案,请多谢。