Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

129
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda