Questions tagged [onpress]
156 questions
3
votes
2 answers
React Native: onPress: How can I toggle the button text and function call?
I have a button that looks like this...
addToFavorites() {
...run some code
}
After the user presses the button, how can I change…

mobiman
- 619
- 1
- 11
- 26
3
votes
2 answers
react-native TouchableHighlight disable onPress color flickering
I want to disable the "color blink" or "color flickering" effect that blackens the image when TouchableHighlight gets pressed.
Here is the screen render:

Jacs
- 1,437
- 4
- 21
- 31
2
votes
3 answers
custom radio buttons not working in react native
i am creating custom radio btns. my code is as follows:
const [isAvailable, setIsAvailable] = useState([
{id: 0, value: true, title: 'Always available', selected: true},
{id: 1, value: false, title: 'Never available', selected: false},
{
id: 2,
…

Adeena Lathiya
- 165
- 1
- 11
2
votes
1 answer
firebase realtime database is not getting fetched with onPress in react native, have to refresh the ref().on function everytime
I have a realtime database with main node 'user' and then inside it i have 3 child nodes and those 3 child nodes have 4 more child nodes, each of them. One of the 4 nodes is a recording, one is image and 2 of them are strings. I am trying to fetch…

Mariam Ikram
- 29
- 5
2
votes
1 answer
React Native Button navigate to another page
I'm new to React Native. I need that if I click on a button, a new page appears. I already tried a few things but maybe the problem is somewhere else.
I will paste my code underneath. Please help me :)
Further explanation: I want to click on the…

Lisa Katzmaier
- 21
- 1
- 1
- 2
2
votes
1 answer
React native Typescript Touchableopacity props error
I have created one reusable button by using Styled component and Typescript. I made onPress void. I am using this button to the headStyles. HeaderStyles have a one prop name headerLeft. headerLeft's props' onPress is optional or undefined. When I…

Krisna
- 2,854
- 2
- 24
- 66
2
votes
2 answers
Onpress() of native-base Button is not working on Android
I am using the native-base button and trying to download the image by pressing the button. It's is working perfectly fine in IOS but not working in Android. Here is my code

Badal S
- 507
- 1
- 3
- 20
2
votes
1 answer
onPress not workin in a FlatList - React Native
I am working in a regular app using github API and can't solve a problem.
On my FlatList I am trying to implement an onPress to enter an Webview but this onPress
is not working for some reason. I tried everything. Now I just put a console.log and…

Jeferson Costa
- 31
- 4
2
votes
0 answers
Can't seem to get my console log to log image index when I press on an image
I've got my images coming from an array variable, into an within a being rendered into the space between my navigation. Everywhere I put my console log, it logs the index number of each image on load, and I am unable to press on an…

infinesse
- 97
- 2
- 13
2
votes
1 answer
React Native onPress not working while using modal
I am having a modal that displays image, I am using an image viewer which will display the image for me and also zoom etc. Because I dont have direct control over how the modal is styled, image-viewer gave an option to give react element for…

Kireeti K
- 1,370
- 1
- 19
- 32
2
votes
2 answers
Rotate icon when TouchableOpacity onPress is clicked
I am having the hardest time with rotating my FontAwesome Icon when the TouchableOpacity is clicked. I would like to have the FontAwesome pro icon point downwards when it's been clicked and go back to its original state when clicked again. …

Shawn Nguyen
- 57
- 1
- 9
2
votes
3 answers
React Native how to play a sound after an "onPress"?
Here is some of my code:
Play Sound
I want to write a function "onPress" which will play an .mp3 sound.
I have already…

Rob Rouse Jr.
- 69
- 1
- 6
2
votes
1 answer
Wix React-Native-Navigation: onPress for custom component button
I have written a custom right navigation button by following the example given here. However, it seems like the onNavigatorEvent() method does not get called anymore when using a custom component. I even tried passing the onPress event as a prop to…

pnizzle
- 6,243
- 4
- 52
- 81
1
vote
1 answer
I want to make two buttons which go into different screen like if i click on chat it will go to chat page if i click on calls it will go in calls page
How can I build two buttons where when i click at chat button then it will directly go to chat history and if i click at calls button it will directly go to call history?
Is there is alternative of making dynamic buttons?
import { StyleSheet,…

Star Lord
- 11
- 1
1
vote
1 answer
Repeatedly popping "undefined is not an object (evaluating 'navigation.navigate')" after routing a particular screen
const ResolvedPlaces = ({navigation}) => {
return(
navigation.navigate("ProfileScreen")} >

Abishethvarman V
- 129
- 1
- 1
- 9