question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

onPress doesn't seem to work for iPhone8/X but works for iPhone6/7

See original GitHub issue

I’ve been seeing some odd behaviour with onPress on Path, Rect, Circle, etc. when using iPhone8/X in the iOS simulator. I had originally crafted some nice pie charts, but have since reverted to using a simple scene to test:

class TestScreen extends Component {
  render() {
    return (
      <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
      <Svg
          height="100"
          width="100"
          onPress={ () => console.log('svg') }
      >
          <Circle
              cx="50"
              cy="50"
              r="45"
              stroke="blue"
              strokeWidth="2.5"
              fill="green"
              onPress={ () => console.log('circle') }
          />
          <Rect
              x="15"
              y="15"
              width="70"
              height="70"
              stroke="red"
              strokeWidth="2"
              fill="yellow"
              onPress={ () => console.log('rect') }
          />
      </Svg>
      </View>
    )
  }
}

I am unable to see any of these console.logs on an iPhone8/X but can see them just fine on iPhone6/7 in simulator. I assume maybe the collisions calculations are off on these devices? Has anyone experienced anything similar to this?

I’ll start digging through the native code tomorrow, if anyone can point me in the right direction.

Cheers.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:4
  • Comments:20

github_iconTop GitHub Comments

10reactions
kenyonjcommented, Feb 16, 2018

I’ve seen some issues where onPress will work fine on the simulator but not consistently on the device and it’s been due to force touch issues. Changing it to onPressIn will catch the touch regardless of the amount of pressure (do Circle and Rect support onPressIn?)

5reactions
Yanjing123commented, Mar 9, 2018

@kenyonj for my test Path support onPressIn but Circle not

Read more comments on GitHub >

github_iconTop Results From Across the Web

onPress doesn't seem to work for iPhone8/X but ... - GitHub
I've been seeing some odd behaviour with onPress on Path, Rect, Circle, etc. when using iPhone8/X in the iOS simulator.
Read more >
React Native onPress doesn't work on IOS, but on Web it does
1 Answer 1 ... From your code block, it seems that you are wrapping a button inside a TouchableOpacity Component which is imported...
Read more >
iphone 8 stuck on press home to upgrade - Apple Community
The. Press the side button after it turns off and press the volume down button when the apple logo appears. Then select restore...
Read more >
React Native touchable vs. pressable components
Learn the difference between touchable and pressable components in React Native, and how to implement different effects with each kind.
Read more >
Is Your iPhone Home Button Not Working? 5 Quick Fixes to Try
In fact, there doesn't seem to be a definitive source for this trick, but it's proven to be effective at fixing iPhone Home...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found