首页 > 解决方案 > 如何忽略对反应本机模式的拖累

问题描述

我正在使用包含颜色选择器的标准 React Native Modal:react-native-wheel-color-picker。

问题是移动颜色选择器时的拖动事件被模式拾取,并且它弄乱了用户交互。

<Modal
    presentationStyle="pageSheet"
    animationType="slide"
    visible={showCreate}

    >

    <View style={styles.modalView}>
      <View style={{marginBottom: 10, paddingVertical: 20, flexDirection: "row", justifyContent: "space-between", borderBottomColor: "#ccc", borderBottomWidth: 1}}> 
        <TouchableOpacity onPress={() => setShowCreate(false)}>
          <Text style={{fontSize: 17}}>Cancel</Text>
        </TouchableOpacity>
        <Text style={{fontSize: 17, fontWeight: "bold"}}>
            Create Tag
        </Text>
        <Text style={{fontSize: 17}}>
            Save
        </Text>
      </View>
      <CreateTag />
  </View>
  </Modal>

颜色选择器在元素中:

            <View style={{flex: 1}}>

            <ColorPicker
                    // ref={r => { this.picker = r }}
                    // color={this.state.false.state.swatchesOnly}
                    onColorChange={c => (c) = setColor(c)}
                    // onColorChangeComplete={this.onColorChangeComplete}
                    thumbSize={30}
                    sliderSize={20}
                    // noSnap={false}
                    // row={true}
                    // swatchesLast={this.state.swatchesLast}
                    swatches={false}
                    discrete={true}
                />

            </View>

有没有办法阻止模态拾取拖动事件?

谢谢

标签: react-nativemodal-dialogcolor-picker

解决方案


推荐阅读