Hitslop无法在TouchableNativeFeedback中使用动画儿童

时间:2019-04-28 12:39:53

标签: react-native popmotion

const Overlay = posed.View({
  open: {
    y: 0,
    delayChildren: 300,
    staggerChildren: 300,
    staggerDirection: 1
  },
  closed: { y: '100vh', delay: 300 }
});

const Item = posed.View({
  open: { x: 0, opacity: 1 },
  closed: { x: 100, opacity: 0 }
})

<Overlay pose={isVisible ? 'open' : 'closed'}>
        <Wrapper>
          {
            items.map((item)=> (
              <Item key={item.id} >
                <Card 
                  item={item} 
                  active={active} 
                  length={items.length} 
                  onPress={(id)=>{this.handleSelect(id)}} 
                  />
              </Item> 
            ))
          }
        </Wrapper>
      </Overlay>

<TouchableNativeFeedback 
      onPress={()=> onPress(item.id)}
      background={TouchableNativeFeedback.SelectableBackground()}
      hitSlop={{top: 0, bottom: 0, left: 50, right: 50}}
    >
        <TouchableWrapper
          style={{
            height: 150-15*(length>2? length : 1),

          }} 
        >
          <TextWrapper 
            style={{
              color: active===item.id?'#ffffff': '#000000'
            }}
          > 
            {item.title} 
          </TextWrapper>
        </TouchableWrapper>
    </TouchableNativeFeedback>

我的Hitslop在TouchableNativeFeedback内部不起作用。但是,如果我忽略/注释掉叠加部分,则Hitslop正常工作。不确定为什么我的TouchableNativeFeedback进入时不响应Hitslop

$Overlay = posed.View()

软件包的

github链接:Link 预先感谢。

0 个答案:

没有答案