react-native-safe-area-context icon indicating copy to clipboard operation
react-native-safe-area-context copied to clipboard

Simple application using React-Native-safe-area-context crash on production build on iOS

Open allan-simon opened this issue 4 years ago • 10 comments

version of the lib: 3.1.9 ios version 14.0 iphone 7

I have the following app

App.tsx

import React from 'react';
import {Text} from 'react-native';
import { SafeAreaProvider, SafeAreaView } from 'react-native-safe-area-context';
export default function App() {

    return (
        <SafeAreaProvider>
            <SafeAreaView style={{height: '100%'}}>
                <Text>
                    Hello world{'\n'}
                    hello world  hellllllloo
                </Text>
            </SafeAreaView>
        </SafeAreaProvider>

    );
}

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": "~40.0.0",
    "react": "16.13.1",
    "react-dom": "16.13.1",
    "react-native": "https://github.com/expo/react-native/archive/sdk-40.0.1.tar.gz",
    "react-native-safe-area-context": "3.1.9"
  },
  "devDependencies": {
    "@babel/core": "~7.9.0",
    "@types/react": "~16.9.35",
    "@types/react-dom": "~16.9.8",
    "@types/react-native": "~0.63.2",
    "typescript": "~4.0.0"
  },
  "private": true
}

when I run the app through expo it works fine , but when i load the ipa, it crash just after the splash screen.

this however works :

import React from 'react';
import {Text} from 'react-native';
export default function App() {

    return (
                <Text>
                    Hello world{'\n'}
                    hello world  hellllllloo
                </Text>
    );
}

I'm pretty new to mobile development so tell me if you need additional information. I unfortunately don't have a mac so i'm building the app through the expo build system

allan-simon avatar Jan 29 '21 23:01 allan-simon

Hey! It might be because expo requires a particular version of this library. Can you try using expo install react-native-safe-area-context to install it?

janicduplessis avatar Mar 07 '21 19:03 janicduplessis

Hello, thanks for your message, however it was already installed that way :(

allan-simon avatar Mar 07 '21 20:03 allan-simon

@brentvatne What’s the easiest way to get release crash logs on expo (without xcode)?

janicduplessis avatar Mar 08 '21 18:03 janicduplessis

the only way to do this is with the xcode crashes organizer, should work the same for managed expo apps

brentvatne avatar Mar 08 '21 19:03 brentvatne

can't reproduce this using the code you provided above. i suspect your app has some other unrelated code that is causing the crash.

i did a simulator build and ran it on an ios 7 ios 14.2, worked fine. you can try the simulator build here: https://exp-shell-app-assets.s3.us-west-1.amazonaws.com/ios/%40notbrent/allan-a53f83be-4da9-44b7-8057-c8fb85d2e737-simulator.tar.gz

repo: https://github.com/brentvatne/allan-simon

brentvatne avatar Mar 08 '21 20:03 brentvatne

Thanks @brentvatne for checking this out. Maybe adding Sentry you could get some crash logs (https://docs.expo.io/guides/using-sentry/)? The problem is @allan-simon does not have a mac to check xcode crashes directly.

janicduplessis avatar Mar 08 '21 20:03 janicduplessis

yeah that might help, but the best option would be to provide a reproducible example that we can use to debug the issue

brentvatne avatar Mar 08 '21 20:03 brentvatne

@allan-simon - can you share a git repo that i can clone and build to reproduce?

brentvatne avatar Mar 09 '21 22:03 brentvatne

@brentvatne i'm really sorry but as it was a quick experiment , the code has now been replaced by other sutff :/ but it was really nothing more than the code at the beginning of this ticket.

allan-simon avatar Mar 09 '21 22:03 allan-simon

@allan-simon - i used that exact code and could not repro :/ see https://github.com/brentvatne/allan-simon - let me know if i'm missing something obvious there

brentvatne avatar Mar 09 '21 22:03 brentvatne