react-native dropdown position

时间:2018-03-22 23:37:23

标签: react-native drop-down-menu dimensions

If I have a dropdown that is near the bottom of the screen, how do I prevent the dropdown from leaving the screen when it is opened? Currently if I have more than a few options, the dropdown container goes off the screen. How do I make it so it knows that it is near the bottom and will open upward or will move higher than the bottom of the screen?

1 个答案:

答案 0 :(得分:1)

给top和z-index下拉,比如......

<Dropdown
                    label='Program Type'
                    containerStyle={{width:140,zIndex:60,
                        top:20,}}
                    fontSize={16}
                    baseColor={"#0000ff"}
                    data={dropBoxData}
                    onChangeText={this.onChangeText}>
                </Dropdown>