Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

128
Views
Calling function not working in React Native?

I am coding in react native, I am trying to call the function playButton() onPress inside TouchableOpacity, but the function is not showing up on onPress.

What could be the problem?

import { StyleSheet, Text, View, Image, TouchableOpacity,Alert } from 'react-native';

    export default function App () {
    
      const playButton = () => {
        Alert.alert('Hello' );
     }
    
      return (
        <View style={styles.container}>        
         <TouchableOpacity onPress={playButton} >
        <Text style={styles.button}>Play</Text>
        </TouchableOpacity>
        </View>
      );
    }

Below is the package.json

{
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web",
    "eject": "expo eject"
  },
  "dependencies": {
    "expo": "~44.0.0",
    "expo-status-bar": "~1.2.0",
    "react": "17.0.1",
    "react-dom": "17.0.1",
    "react-native": "0.64.3",
    "react-native-web": "0.17.1",
    "reactotron-react-js": "^3.3.7"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9"
  },
  "private": true
}
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!