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

368
Views
TypeError: undefined no es un objeto (evaluando '_expoConstants.Constants.statusBarHeight')

Estoy tratando de usar Constants.statusBarHeight para separar la vista de la barra de estado en react-native, instalé Constants usando expo install expo-constants

pero estoy recibiendo este error:

 TypeError: undefined is not an object (evaluating '_expoConstants.Constants.statusBarHeight') at node_modules\react-native\Libraries\LogBox\LogBox.js:149:8 in registerError at node_modules\react-native\Libraries\LogBox\LogBox.js:60:8 in errorImpl at node_modules\react-native\Libraries\LogBox\LogBox.js:34:4 in console.error at node_modules\expo\build\environment\react-native-logs.fx.js:27:4 in error at node_modules\react-native\Libraries\Core\ExceptionsManager.js:104:6 in reportException at node_modules\react-native\Libraries\Core\ExceptionsManager.js:172:19 in handleException at node_modules\react-native\Libraries\Core\setUpErrorHandling.js:24:6 in handleError at node_modules\@react-native\polyfills\error-guard.js:49:36 in ErrorUtils.reportFatalError at node_modules\metro-runtime\src\polyfills\require.js:204:6 in guardedLoadModule at http://192.168.1.5:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false:137612:3 in global code

este es mi código fuente:

 import React from "react"; import Constants from "expo-constants"; import { StyleSheet, SafeAreaView, View } from "react-native"; function Screen({ children, style }) { return ( <SafeAreaView style={[styles.screen, style]}> <View style={style}>{children}</View> </SafeAreaView> ); } const styles = StyleSheet.create({ screen: { paddingTop: Constants.statusBarHeight, flex: 1, }, }); export default Screen;

parece que el código Vs no puede importar constantes.

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

parece que has importado las constantes de exposición y las has instalado de la manera correcta, prueba el siguiente truco si funciona declara variable const barHeight = Constants.statusBarHeight; y usar en tu propiedad de estilo

about 4 years ago · Juan Pablo Isaza Report

0

Importar expo-constants :

 import * as Constants from 'expo-constants'

Luego peina con lo siguiente:

 const styles = StyleSheet.create({ screen: { paddingTop: Constants.default.statusBarHeight, flex: 1, }, });
about 4 years ago · Juan Pablo Isaza Report
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!