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

392
Vistas
Strange borders on production build in react native, but not in develope mode

In my App I have a screen that normally looks like this

correct formatting

but when I build for production the title wrapper gets pushed down a few pixels, which results in some strange formatting:

wrong formatting

I don't really understand why the app looks different when build for release vs when I develop it. I also tested it on multiple devices but I have the same error on all of them.

    import React, { useState, useEffect } from 'react';
import { Text, View, StyleSheet, Button } from 'react-native';
import { BarCodeScanner } from 'expo-barcode-scanner';
import BottomBar from './component/BottomBar';

export default function ScanScreen({ navigation }) {
  const [hasPermission, setHasPermission] = useState(null);
  useEffect(() => {
    (async () => {
      const { status } = await BarCodeScanner.requestPermissionsAsync();
      setHasPermission(status === 'granted');
    })();
  }, []);

  const handleBarCodeScanned = ({ type, data }) => {
    navigation.navigate("Shelf", { shelfID: data.toString() })
  };

  if (hasPermission === null) {
    return <Text>Requesting for camera permission</Text>;
  }
  if (hasPermission === false) {
    return <Text>No access to camera</Text>;
  }

  return (
    <View style={styles.container}>

      <View style={styles.contentContainer}>
        <View style={styles.titleWrapper}>
          <Text style={styles.text}> Shelf Scanner </Text>
        </View>
        <View style={{flex: 1}}>
        <BarCodeScanner
          onBarCodeScanned={handleBarCodeScanned}
          style={StyleSheet.absoluteFillObject}
        />
        </View>
      </View>
      <BottomBar navigation={navigation} />

    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#F5FCFF',
    flexDirection: 'row',
},
titleWrapper: {
    width: '100%',
    top: 30,
    height: 50,
    alignSelf: 'center',
    alignItems: 'center',
    backgroundColor: '#A2F5AA',

},
text: {
    fontSize: 15,
    justifyContent: 'center',
    fontWeight: 'bold',
    flex: 1,
    marginTop: 10,
},
contentContainer: {
    flex: 1 
},
});
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I fixed it by removing top: 30, from titleWrapper. The title is now offset in develop mode, but it at least looks correct in the production build

about 4 years ago · Juan Pablo Isaza Denunciar
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