onPress doesn't seem to work for iPhone8/X but works for iPhone6/7
See original GitHub issueI’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.log
s 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:
- Created 6 years ago
- Reactions:4
- Comments:20
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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 toonPressIn
will catch the touch regardless of the amount of pressure (doCircle
andRect
supportonPressIn
?)@kenyonj for my test Path support onPressIn but Circle not