Navigate back to the homepage

How to call multiple functions onPress in react native?

Infinitbility
React Native
October 13th, 2021 · 1 min read
How to call multiple functions onPress in react native?

Hello Friends 👋,

Welcome To Infinitbility! ❤️

This tutorial will help you to call two or multiple functions in react native when user press button or touchableOpecity.

Here, i will share two ways to call multiple functions on onPress, use whatever you like.

Let start today tutorial How to call multiple functions onPress in react native?

Create Common function

In this way, Create new function and call both or multiple functions from there.

1functionOne(){
2// do something
3}
4
5functionTwo(){
6// do something
7}
8
9functionCombined() {
10 this.functionOne();
11 this.functionTwo();
12}
13
14<TouchableHighlight onPress={() => this.functionCombined()}/>

Call multiple functions inline

In this way, you can mantion all function in one line in onPress like below example.

1functionOne(){
2// do something
3}
4
5functionTwo(){
6// do someting
7}
8
9<TouchableHighlight
10 onPress={
11 () => { this.functionOne(); this.functionTwo(); }
12 }
13/>

Thanks for reading…

Join our email list and get notified about new content

No worries, I respect your privacy and I will never abuse your email.

Every week, on Tuesday, you will receive a list of free tutorials I made during the week (I write one every day) and news on other training products I create.

Looking For React Native Tutorial?

we are trying to create the best Tutorial for react native developers.

When you want a daily updates about React Native Tutorial or infinitbility update subscribe to our newsletter.

Read React Native Tutorial

Request New Tutorial or Article on mail [email protected]

Guide book

Guidebook: The Javascript Monorepo

Tutorials

Categories

More articles from Infinitbility

How to check data store in localstorage?

How to check data store in localstorage?

Example of check and verify data store in localstorage or not

October 12th, 2021 · 1 min read
Where does AsyncStorage store data?

Where does AsyncStorage store data?

React Native AsyncStorage where store our all data

October 11th, 2021 · 1 min read
© 2020–2021 Infinitbility
About
Link to $https://medium.com/infinitbilityLink to $https://www.facebook.com/InfinitbilityLink to $https://github.com/infinitbilityLink to $https://twitter.com/infinitbilityLink to $https://www.buymeacoffee.com/infinitbilityLink to $mailto:[email protected]