Questions tagged [onpress]

156 questions
26
votes
5 answers

how to setup Onpress On Textinput in react-native

I am developing an app on react native. I want to call a date picker when i press on a Text-Input and after selecting a date it should show on the Text-Input
Savad
  • 1,240
  • 3
  • 21
  • 50
7
votes
4 answers

Image with TouchableOpacity onpress not working in react native

I am new to react native development. In my application in one screen I have image click. So i have taken image inside touchable opacity and wrote onpress method to that touchable opacity. But onpress is not working. But i have written the same code…
rams
  • 1,558
  • 7
  • 25
  • 48
7
votes
1 answer

react-native-swipeout onPress method disables containing component's onPress method

I have the following flatlist render method that upon tapping on a list item, it will call the this._onPress method: render() { return (
William L.
  • 81
  • 3
6
votes
2 answers

Get key and item onPress TouchableOpacity when items are map

In below code items are rendered properly and working But When I Press TouchableOpacity it returns event. I Used JSON.stringify(event.nativeEvent) but not working I want to get the key value that set on TouchableOpacity and that item Data. export…
Bhaumik Surani
  • 1,730
  • 3
  • 19
  • 40
6
votes
3 answers

OnPress not working inside Touchable Opacity

I am building a mobile app on react-native! Recently I build my own header component for every page. Here is the code of my Header component. I have two icons inside that component. But unfortunately these buttons are not working at all!! import…
5
votes
2 answers

(React Native) onPress doesn't work for Text component

I'm trying to get the onPress to work, but "hi" is not being printed. In fact, the gray default background that should show behind the text when it is clicked does not show. If I replace the nested text with a TouchableHighlight component, it does…
Andy Lebowitz
  • 1,471
  • 2
  • 16
  • 23
5
votes
3 answers

How can i scroll top on onPress of button in react-native?

I have added the button in bottom of simple screen and I want to scroll top whenever I press the button. what code to add to button onPress?, Please suggest any solution, Thanks in advance.
kalyani_jamunkar
  • 582
  • 1
  • 13
  • 33
5
votes
2 answers

Get name of button onPress in react native

I have two buttons that both call the same onPress function. In the callback I want to be able to differentiate between which was pressed.
Alexis
  • 23,545
  • 19
  • 104
  • 143
4
votes
2 answers

React Native two time taps required for onPress event inside scrollview

I'm using TextInput inside ScrollView and KeyboardAvoidingView but it require two time taps for submit text when keyboard is open. for soluation i'm add keyboardShouldPersistTaps="always" but it not working. render() { return (
Bhaumik Surani
  • 1,730
  • 3
  • 19
  • 40
4
votes
0 answers

onPress not working in nested views

I'm using TouchableOpacity for handling clicks.Everything is working fine in upper hierarchy views, but bellow two containers view is not clickable.I've set an alert when it's clicked for testing purposes.View bellow comment is not working and I…
J.range
  • 449
  • 5
  • 20
3
votes
1 answer

Sending TCP packets over IP in React Native not working

I have been trying to send TCP hex packets over IP with the use of the react-native-tcp library. I have coded a very, very simple app that tries to do this. However, the function sendPackets in the code never seems to run. I think it may be an issue…
Cactus
  • 87
  • 10
3
votes
3 answers

onPress in functional react native component not working

I'm trying to create a simple reusable button component in react-native but for some reason the onPress function never gets called. Most threads I find simply call the function instantly or declared something wrong I believe everything should be…
3
votes
1 answer

react-native-svg onPress event not working

I'm working with react-native-svg, as documentation says it's possible to trigger onPress event on svg elements but it doesn't work.
Emanuele Sacco
  • 411
  • 5
  • 20
3
votes
0 answers

React Native conditional state in onPress render any time without press component

Why is this onPress activated at any time without pressing TouchableOpacity when I change any property of state if project_id is not null? { if (this.state.feedback.project_id != null) { …
Cookie
  • 352
  • 4
  • 16
3
votes
2 answers

react-native : onPress doesn't work

I work on an onPress event on react native. At a first time, I wrote that code : =this.props.minimum) ? this.props.onDecrement …
Lothindil
  • 31
  • 1
  • 8
1
2 3
10 11