Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pointerEvents="none" on <Canvas /> not working on android? #1197

Closed
dawidvdh opened this issue Dec 12, 2022 · 1 comment · Fixed by #1208
Closed

pointerEvents="none" on <Canvas /> not working on android? #1197

dawidvdh opened this issue Dec 12, 2022 · 1 comment · Fixed by #1208
Assignees
Labels
bug Something isn't working

Comments

@dawidvdh
Copy link

Description

on Android when I have the Canvas as an overlay using StyleSheet.absoluteFill and I set the prop pointerEvents="none" then I still can not select any buttons below the Canvas overlay, as if the Canvas is still capturing the events, it works perfectly on iOS.

Version

0.1.165

Steps to reproduce

use the Canvas element as an overlay to a View with buttons using absolute positioning and then set the pointerEvents to none, the buttons would still not be pressable on Android.

Snack, code example, screenshot, or link to a repository

If I have an overlay component like so:

function Overlay() {
  const {height, width} = useWindowDimensions();
    
  return (
    <Canvas style={StyleSheet.absoluteFill} pointerEvents="none">
      <Rect height={height} width={width} color="red" opacity={0.5} />
    </Canvas>
  );
}

And I have Screen component like so:

function SomeScreen() {
    return (
        <>
            <View style={{flex: 1}}>
                <Button title="navigate" onPress={() => { console.log('I have been tapped') }} />
            </View>
            <Overlay />
        </>
    )
}

I would not be able to select the button on Android.

@dawidvdh dawidvdh added the bug Something isn't working label Dec 12, 2022
@chrfalch
Copy link
Contributor

Thanks, @dawidvdh - this sounds like a clear issue with the Android touch handler.

@chrfalch chrfalch self-assigned this Dec 15, 2022
chrfalch added a commit that referenced this issue Dec 15, 2022
On Android we were using regular views and viewmanagers to drive our native views. To be able to take advantage of the React Native functionality on views the Skia Views should be backed by a React View Manager which will ensure some functionality that will work out of the box.

This fixes #1197 and pointer events (use example in 1197 to test), and also allows for setting backgroundColor as style for a Canvas.

All tests and examples have been tested and works.
wcandillon pushed a commit that referenced this issue Dec 15, 2022
On Android we were using regular views and viewmanagers to drive our native views. To be able to take advantage of the React Native functionality on views the Skia Views should be backed by a React View Manager which will ensure some functionality that will work out of the box.

This fixes #1197 and pointer events (use example in 1197 to test), and also allows for setting backgroundColor as style for a Canvas.

All tests and examples have been tested and works.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants