在React native上删除底部和顶部项目Picker IOS中的行

Hoa*_*ran 5 picker react-native

我使用Picker来定制我的屏幕: 在此输入图像描述

您可以在我的屏幕中看到底部和顶部项目选择了两行.我怎么能删除它们?这是我的代码

renderIOS() {
    let marginTop = isIOS ? 70 : 25;
    marginTop = this.state.isEdit ? 0 : marginTop;
    let color = this.props.theme.color;
    let serviceItems = this.state.listItem.map((s, i) => {
      return (
        <Picker.Item
          key={i}
          value={s}
          label={s}
          color={s == this.state.selected ? "white" : color}
        />
      );
    });
    return (
      <View
        style={{
          width: width,
          height: height - marginTop
        }}
      >
        <Picker
          style={{ position: "absolute", right: 10 }}
          itemStyle={{
            height: height - marginTop,
            fontSize: 35,
            width: 100
          }}
          selectedValue={this.state.selected}
          onValueChange={selected => this.setState({ selected })}
        >
          {serviceItems}
        </Picker>
      </View>
    );
  }
Run Code Online (Sandbox Code Playgroud)

归档时间:

查看次数:

516 次

最近记录:

7 年,9 月 前