我有一个代码,显示使用' react-native-modal-dropdown'
的React Native下拉列表 <View style = {{alignItems:'center',}}>
<TouchableOpacity onPress = {()=>{this.dropDown && this.dropDown.show();}}>
<View style = {{width:170,height:40, alignItems:'center',flexDirection:'row'}}>
<ModalDropdown ref={(el) => {this.dropDown = el}}
options={["A", "B", "C"]}
defaultValue = {"A"}
style = {{ flex: 1}}
textStyle = {{fontWeight:'bold', textAlign: 'right'}}
onSelect = {(index,value)=>{this.onClickDropDown(value)}}
dropdownStyle={{width:170, }}
renderRow={this._dropdown_renderRow.bind(this)}
/>
<Text>▼</Text>
</View>
</TouchableOpacity>
</View>
结果是显示在&#34; A&#34;:enter image description here
背后的下拉菜单我希望下拉菜单显示落后&#34;▼&#34;,它是正确的。 enter image description here
你能帮帮我吗?非常感谢你。答案 0 :(得分:0)
<TouchableOpacity onPress = {()=>{this.dropDown && this.dropDown.show();}}>
<View style = {{height:40, alignItems:'center',flexDirection:'row'}}>
<ModalDropdown ref={(el) => {this.dropDown = el}}
options={["A", "B", "C"]}
defaultValue = {"A"}
style = {{ flex: 1,paddingRight:30}}
textStyle = {{fontWeight:'bold', textAlign: 'right'}}
dropdownStyle={{width:170, }}
/>
<View style={{ position: "absolute", right: 10, top: 10 }}><Text>▼</Text></View>
</View>
</TouchableOpacity>