Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

386
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda