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

385
Views
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 answers
Answer question

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 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!