react-native-touch-through-view icon indicating copy to clipboard operation
react-native-touch-through-view copied to clipboard

[Android] Touchables in TouchThroughView do not work

Open woodpav opened this issue 5 years ago • 13 comments

Version: https://github.com/simonhoss/react-native-touch-through-view/commit/0ae415af69365785c3ff5f10901e6b606bc11348

Steps to reproduce:

  1. Put a Touchable in a TouchThroughView
  2. Touch the Touchable
  3. No interaction on Android, interaction on iOS

Workaround:

Put multiple TouchThroughViews in a View such that the area underneath the Touchable is the View.

Artboard 1

woodpav avatar Aug 29 '19 04:08 woodpav

I'm having the same problem. It works on iOS. Does not work on Android. Could you share an example code of your workaround?

AndresAltomobile avatar Jan 19 '20 21:01 AndresAltomobile

@AndresAltomobile can you maybe share a repository where it does not work?

simonhoss avatar Jan 22 '20 07:01 simonhoss

@simonhoss Repo: TouchThroughViewAndroidIssueDemo. Sorry for the late response. I created a small demo. I tried to make it as simple as possible. If you have any questions about the demo, please ask.

AndresAltomobile avatar Feb 04 '20 18:02 AndresAltomobile

Hi @simonhoss Any news about the issue?

AndresAltomobile avatar Feb 25 '20 22:02 AndresAltomobile

@simonhoss I'm having the same problem, could you help us out?

elios264 avatar Feb 29 '20 16:02 elios264

I'm struggling with this issue too. Have you guys found a solution for it? @woodpav @simonhoss

nojosu avatar Mar 03 '20 16:03 nojosu

Im sorry for the delay. I have to finish some personal stuff. I try to find a solution asap.

simonhoss avatar Mar 03 '20 16:03 simonhoss

Hello @simonhoss, any news about this?

SioJL13 avatar Mar 18 '20 15:03 SioJL13

I think its related to #14

Can you please try the 1.2.0-beta.0 ?

simonhoss avatar Mar 20 '20 08:03 simonhoss

Hi @simonhoss I tried the 1.2.0-beta.0 version, but I'm still experiencing this problem on Android.

Screen Shot 2020-03-20 at 12 14 13 PM Screen Shot 2020-03-20 at 12 14 33 PM

Do I need to add additional configuration or something?

I updated the Repo: TouchThroughViewAndroidIssueDemo to the 1.2.0-beta.0 version. Could you take a look?

AndresAltomobile avatar Mar 20 '20 18:03 AndresAltomobile

The problem was that the TouchThroughView took the whole height but it should only take the space above.

Here is a small fix:

<TouchThroughWrapper
          style={{position: 'absolute', zIndex: 15, bottom: 0, top: 10}}>
          <Carousel
            ref={carouselRef}
            data={[1, 2, 3, 4, 5]}
            renderItem={({item}) => {
              return (
                <View style={{flex: 1, zIndex: 15}}>
                  <TouchThroughView
                    style={{
                      flex: 1,
                      zIndex: 15,
                    }}
                  />
                  <View style={{height: 300}}>
                    <Sheet />
                  </View>
                </View>
              );
            }}
            inactiveSlideScale={1}
            sliderWidth={width}
            itemWidth={width - 70}
            useScrollView={true}
            scrollEnabled={true}
          />

simonhoss avatar Mar 27 '20 11:03 simonhoss

@simonhoss , It worked, however, this only works with a fixed height. The component in this case <Sheet /> will change the height when user taps the component, so if it grows more than 300 and the user touches the part of <Sheet /> that is outside of <View style = {{height: 300}}> , the touches will go through the component and/or the <Sheet /> will not look good. That is why I wrap the component with <TouchThroughView /> and it works great on iOS but not on Android.

Do you have any other idea how I could make it work just like on iOS?

AndresAltomobile avatar Apr 02 '20 23:04 AndresAltomobile

Inside your Sheet component you have a BottomSheet component. It seems that this does not resize correct based on the content. Maybe it uses an absolute style? But this has nothing todo with the TouchThroughView.

simonhoss avatar Apr 08 '20 08:04 simonhoss