Skip to content

React native issues

Navigate to a nested tab navigator with a wrapper component in between (stack navigator > component > tab navigator)

TabNavigator
          navigation={navigation}
          screenProps={{
            rootNavigation: navigation
          }}
        />

WrapperComponent.router = TabNavigator.router;

You can then navigate from the parent to the child with following snippet:

this.props.navigation.dispatch(
NavigationActions.navigate({
routeName: 'Name_Öf_TabNavigator',
params: {
matchId: item.id,
},
action: NavigationActions.navigate({ routeName: 'Name of tabscreen' }),
}),
)

hase module error
Do in terminal a cache:clean

derivedData error
Clean build folder : in Xcode: product > cdm clean

unable to find utility “instruments”, not a developer tool or in PATH
Install the Xcode Command Line Tools. Open Xcode > “Preferences…” > Locations panel >install most recent version in the Command Line Tools dropdown.

ANDROID: AVD manager not visible in Android studio
Open the react native project from the android folder. Click on gradle.build. Install the right version of the sdk tools when the warnings come up.

ANDROID: Cannot find com.android.tools.build:gradle:3.0.1
Add google() to the buildscript repository object in build.gradle

ANDROID: > SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.
export ANDROID_HOME=/Users//Library/Android/sdk/
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools

ANDROID: “/dev/kvm is not found”
Open preferences > security > general > allow intel blocked Fix /dev/kvm

Bluetooth does not receive updates in the background
Use the react native ble-manager library react native ble manager and add UiBackgroundModes array key to the info.plist Background tasks

App crashes on IOS simulator
1. check if there are no javascript errors in your code
2. Clear cache with npm start -- --reset-cache
3. Restart the with app npm run ios

 

No bundle url present error in simulator

1. add following code to your package.json:

"clean": "rm -rf ./ios/build && rm -rf ./node_modules && npm i && lsof -n -i4TCP:8081 | sed '1 d' | awk '{print $2}' | xargs kill -9 && react-native start --reset-cache"

2. npm run clean

If this doesn’t work
Open ios/sushiking/info.plist (do NOT open this in xcode but with a IDE)
Add following code:

<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>localhost</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>

 

Text inside flex-direction row view does not wrap
1. IF TEXT IS NESTED INSIDE VIEW : Set width: 0 to the View inside the row




 Very loooooooooooooooooooooooooooooooooong text 


 Normal text 


2. IF TEXT IS NOT NESTED INSIDE VIEW: add flexWrap: ‘Wrap’ to the text

Developer menu not showing on android device

in terminal : adb shell input keyevent KEYCODE_MENU

 

Files not found when building on IOS in release or debug scheme

Check the header paths (especially for capitals)

NETWORK REQUESTS FAIL

Network request problems
DEBUG MODE ON
android + debug mode on + https + self-signed certificate url => NO
ios + debug mode on + https + self-signed certificate url => NO

DEBUG MODE OFF
android + debug mode off + http => ??
ios + debug mode off + http => YES , network calls fail => solution (see nr 1)

android + debug mode off + https + self-signed certificate url => YES , network calls fail
ios + debug mode off + https + self-signed certificate url => YES , network calls fail => solution (see nr 2)

android + debug mode off + https + self-signed certificate url + over VPN => NO
ios + debug mode off + https + self-signed certificate url + over VPN => NO

solutions

  1. http is not allowed
    in info.plist add Exception domains to the App Transport Security Settings :

    mydomain.be  Dictionary
    
    NSExceptionAllowsinsecureHTTPLoads Boolean YES
    
    NSIncludesSubdomains  Boolean YES
    
    NSTemporaryExeptionAllowsInsecureHTTPLoads Boolean YES
    
    NSTemporaryExceptionMinimumTLSVersion String TLSv1.1
    
     
    
    
  2. Calls to self-signed certificate servers do not work on ios
    Go in XCode to Libraries > HttpRequestHandler.mm
    Add following function

    - (void)URLSession:(NSURLSession *)session didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler
    {
      completionHandler(NSURLSessionAuthChallengeUseCredential, [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]);
    }
    

    See this website for more information

Show Network calls in debugger or chrome
Add following code to the render function of your top lepel index.js or app.js file

  global.XMLHttpRequest = GLOBAL.originalXMLHttpRequest ? GLOBAL.originalXMLHttpRequest : GLOBAL.XMLHttpRequest 

or use a global fetch logger

    global._fetch = fetch
    global.fetch = function (uri, options, ...args) {
      return global._fetch(uri, options, ...args).then((response) => {
        console.log('Fetch', { request: { uri, options, ...args }, response })
        return response
      })
    }

CSFBundleIdentifier does not exist

Add to your packager and run in terminal

   "clean": "yarn run clean:build && yarn run clean:npm && yarn run clean:kill-packager && yarn run clean:start-packager",

Multiple dex files

Add to your android gradle.build (app) file

    dexOptions {
        preDexLibraries = false
    }

Use of undeclared identiefier LOTKeypath

Remove derived data
https://stackoverflow.com/questions/7279141/how-can-i-safely-delete-in-my-library-developer-xcode-deriveddata-directory
yarn run clean

White screen after splash screen
on Android , in manifest.xml, change android:theme=”@style/AppTheme” to android:theme=”@style/SplashTheme”
On Ios, in AppDelegate.m paste

   
UIImageView *launchView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"launchScreen"]];
rootView.loadingView = launchView; 

Do not slide bottom nav bar up with open keyboard on android
In Androidmanigest.xml add android:windowSoftInputMode=”stateAlwaysHidden|adjustPan”/>

ScrollView does not scroll to bottom, but bounces back
Do not add flex to the content container style

   
adb reverse tcp:8081 tcp:8081
adb devices
adb shell input keyevent 82
Published inReact nativeUncategorized

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *