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

TouchableOpacity can't call onPress props. #15927

Closed
kaelinda opened this issue Sep 13, 2017 · 4 comments
Closed

TouchableOpacity can't call onPress props. #15927

kaelinda opened this issue Sep 13, 2017 · 4 comments
Labels
Ran Commands One of our bots successfully processed a command. Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@kaelinda
Copy link

Is this a bug report?

TouchableOpacity can't call onPress method in iPhone 6sP.
When TouchableOpacity cantains a View ,
The View contains two View(top and bottom)
top can call onPress but bottom can't,in iPhone 6sP

(write your answer here)

Have you read the Contributing Guidelines?

(Write your answer here.)

Environment

  1. react-native -0.48.1:
  2. node -v8.1.4:
  3. npm -5.4.1:
  4. yarn --v0.23.4:

Then, specify:

  • Target Platform:
  • Development Operating System:
  • Build tools:

Steps to Reproduce

(Write your steps here:)

1.A View ,inside ,top is Text,bottom is View
2. TouchableOpacity contains the View,not defined TouchableOpacity's style
3.iPhone 6p:touch bottom View is normal,
but,iPhone 6s P:touch bottom View is can't call onPress

Expected Behavior

(Write what you thought would happen.)

Actual Behavior

(Write what happened. Add screenshots!)

Reproducible Demo

(Paste the link to an example project and exact instructions to reproduce the issue.)

@radko93
Copy link
Contributor

radko93 commented Sep 13, 2017

@facebook-github-bot needs-repro

@facebook-github-bot
Copy link
Contributor

Can you reproduce the issue using Snack? This step is necessary for people to be able to see and debug the issue being reported. See "How to Contribute".

@facebook-github-bot facebook-github-bot added Needs more information Ran Commands One of our bots successfully processed a command. labels Sep 13, 2017
@Norfeldt
Copy link

Norfeldt commented Oct 28, 2017

I tumbling a bit around with this as well until I found a solution that might help you. As oppose to the parent component you are not allowed to use this in the pure child component. So it should look like this:

const RNPureComponent = ({ onPress }) => (
  <TouchableOpacity onPress={onPress}>
    <.../>
  </TouchableOpacity>
)

export default RNPureComponent

An even cleaner solution

const RNPureComponent = (props) => (
  <TouchableOpacity {...props}>
    <.../>
  </TouchableOpacity>
)

export default RNPureComponent

@stale
Copy link

stale bot commented Dec 27, 2017

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. If you think this issue should definitely remain open, please let us know why. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Dec 27, 2017
@stale stale bot closed this as completed Jan 3, 2018
@facebook facebook locked and limited conversation to collaborators May 15, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Ran Commands One of our bots successfully processed a command. Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests

4 participants