Quantcast
Channel: Active questions tagged react-native+android - Stack Overflow
Viewing all 28480 articles
Browse latest View live

Music File Cover Image Not Showing in React Native

$
0
0

I am trying to make a music player app in React Native. I am using 'react-native-get-music-files' to get the list of music files in my phone. Everything works fine but cover Image of the music files is not showing. I am loading music files on "Load" button click in the app. I tried to load a simple image that is stored in the device by pasting the path with file:///storage......jpg but that was not loaded too.

dependencies

"dependencies": {
    "react": "16.9.0",
    "react-native": "0.61.5",
    "react-native-get-music-files": "^2.1.0",
    "react-native-permissions": "^2.0.8",
    "react-native-track-player": "^1.1.8"
  },

code

import React from 'react';
import {
  StyleSheet,
  ScrollView,
  View,
  Text,
 Button,
 Image
} from 'react-native';
import TrackPlayer from 'react-native-track-player';
import MusicFiles from 'react-native-get-music-files';
import {request, PERMISSIONS} from 'react-native-permissions';
class App extends React.Component{
  state = {
    storagePermission:null,
    songs : null,
  }

  // this track is already in my laptop where I am building the app... just to test play
  track = {
  id: 'testing123',
  url: require('./maula.mp3'),
  title: 'Maula Mere Maula',
    artist: 'deadmau5',
    album: 'while(1<2)',
    genre: 'Progressive House, Electro House',
    date: '2014-05-20T07:00:00+00:00', 
 }

 // function to show music files on load button pressed.
 getSongs =() =>{
  let AllSongs;
  if(this.state.songs== null){
    return(
      <Text>Press Load Button to Load Songs.</Text>
    )
  }
  else{
    // here is the problem.... it does not show cover image 
    AllSongs = this.state.songs.map(
      (song)=>{
        return(
          <View key={song.title} style={{marginTop:5,borderRadius:2,borderColor:"black",borderWidth:2,padding:10}}>
          <Text>{song.title}</Text>
          <Text> {song.path} </Text>
        <Text>{song.album}</Text>
        <Text>{song.duration}</Text>
          <Image source={{uri:song.cover}} style={{width: 200, height: 200}}/> 
        </View>
        );
      }
    );
  }

    return AllSongs;
}
  componentDidMount = ()=>{
    // getting permission of storage
    request(PERMISSIONS.ANDROID.READ_EXTERNAL_STORAGE).then(result => {
      this.setState({
        storagePermission : result
      }), ()=>{
        console.log(this.state.storagePermission);
      };
    });
    // getting track player ready
    TrackPlayer.setupPlayer().then(() => {
      console.log("Player Setup Completed");
      TrackPlayer.add([this.track, ]).then(function() {
        console.log("Track Added");
    });
  });
  }

  render(){
  return (
    <View style={styles.main}>
      <Text>Music Player</Text>
      <View style={{flexDirection:"row", justifyContent:"space-between"}}>
      <Button title="Prev" onPress={
        ()=>{
          TrackPlayer.skipToPrevious();
        }
      } />
      <Button title="Load" onPress={
        ()=>{
        let Songs; 
        // loading all the music files presesnt in my phone
        MusicFiles.getAll({
          blured : true, 
          artist : true,
          duration : true, 
          cover : true, 
          genre : true,
          title : true,
          cover : true,
             }).then((tracks) => {
                Songs = tracks;
                console.log(Songs);
                this.setState({
                 songs : Songs
               })
             }).catch(error => {
             console.log(error)
        });
        }
      } />
      <Button title="Pause"  onPress={
        ()=>{
          TrackPlayer.pause();
        }
      } />
      <Button title="Play" onPress={
        ()=>{
          TrackPlayer.play();
        }
      } />
      <Button title="Stop" onPress={
        ()=>{
          TrackPlayer.stop();
        }
      } />
       <Button title="Next" onPress={
        ()=>{
          TrackPlayer.skipToNext();
        }
      } />
      </View>
      <ScrollView>
      {this.getSongs()}
      </ScrollView>

    </View>
  )
}
}

const styles = StyleSheet.create({
  main:{
    flex:1,
    margin:10,
    padding:10,

  }
})



export default App;

React-Native :java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes.so

$
0
0

I have just updated my project to use react-native version 0.60.2 . But when I am trying to run an application on Android device it gets crashed after launch screen. I got the following error logs :

E/AndroidRuntime: FATAL EXCEPTION: create_react_context
    Process: com.tjspeed, PID: 3909
    java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes.so
        at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:738)
        at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:591)
        at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:529)
        at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:484)
        at com.facebook.hermes.reactexecutor.HermesExecutor.<clinit>(HermesExecutor.java:20)
        at com.facebook.hermes.reactexecutor.HermesExecutorFactory.create(HermesExecutorFactory.java:27)
        at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:949)
        at java.lang.Thread.run(Thread.java:760)

Few suggestions available here : https://github.com/facebook/react-native/issues/25601 but unfortunately none of them worked for me. Please suggest the workaround.

Change version build release sdk 22 for android 5.1.1 react-native

$
0
0

thank you already the answers

Problem

I am trying to generate a version for Android 5.1.1, 22. However, Android studio returns this message to me

Description

Android SDK Build Tools 28.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '22.0.0'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
Remove Build Tools version and sync project
Affected Modules: @react-native-community_async-storage, react-native-activity-result-deeplink, react-native-communication-hardware-getnet, react-native-screens, realm

Question

My question is any solution to this problem or how to work around it? so far my attempts are downgrading the dependencies mentioned but I am not sure if it will work

info the project

System:
    OS: Windows 10 10.0.18362
    CPU: (4) x64 Intel(R) Core(TM) i5-7400 CPU @ 3.00GHz
    Memory: 625.54 MB / 7.91 GB
  Binaries:
    Node: 10.16.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.16.0 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 6.9.0 - C:\Program Files\nodejs\npm.CMD
  SDKs:
    Android SDK:
      API Levels: 22, 23, 25, 27, 28, 29
      Build Tools: 23.0.1, 25.0.3, 27.0.3, 28.0.3, 29.0.1, 29.0.2
      System Images: android-22 | ARM EABI v7a, android-22 | Google APIs ARM EABI v7a, android-22 | Google APIs Intel x86 Atom, android-22 | Google APIs Intel x86 Atom_64, android-23 | ARM EABI v7a, android-23 | Google APIs ARM EABI v7a, android-25 | Google APIs ARM 64 v8a, android-25 | Google APIs ARM EABI v7a, android-27 | Google APIs Intel x86 Atom, android-27 | Google Play Intel x86 Atom, android-28 | Google APIs Intel x86 Atom, android-29 | Google APIs Intel x86 Atom, android-29 | Google Play Intel x86 Atom
      Android NDK: 20.0.5594570
  IDEs:
    Android Studio: Version  3.5.0.0 AI-191.8026.42.35.5791312
  npmPackages:
    react: 16.9.0 => 16.9.0
    react-native: 0.61.5 => 0.61.5

Cropped image is very small in react-native

$
0
0

I would like to crop my image and I used @react-native-community/image-editor I want to crop the image from the base64 image so I used RNFetchBlob too. Here is my code.

const file_path =
      RNFetchBlob.fs.dirs.DocumentDir + '/' + new Date().getTime() + '.jpg';
RNFetchBlob.fs
      .writeFile(file_path, this.state.image, 'base64')
      .then(res => {
        console.log(res);
        ImageEditor.cropImage(
          'file:///' + file_path,
          {
            offset: {x: topX, y: topY},
            size: {width: bottomX - topX, height: bottomY - topY},
            displaySize: {width: bottomX - topX, height: bottomY - topY},
          },
          'PNG',
        ).then(url => {
          console.log(url);
          this.setState({visible: true, cropedImage: url});
        });
      });

It's working on Android but in iOS it's very small like 20*20 pixel even I set the size as more than 1000 pixel. I should upload cropped image to the server so I need the file of the cropped image. Thank you for your answer.

Is there a way to show CPU and memory usage on a react-native app?

$
0
0

I have tried to show the built in performance monitor but it does not show CPU or ram usage.

Is there a way to show the usage like in android studios profiler?

The sampling profiler does not work either.

What is the typical time to get the location on android?

$
0
0

I am using react-native-location to get the location on android.

This package's installation documentation for android says:

The library provides two methods of getting the location on Android. The default is the builtin location manager, however, you can optionally choose to install the Fused Location library which provides more accurate and faster results.

I need to get the location on my app's startup, and decide based on that in which 'application mode' to start (each mode has a different home screen).
So, on one hand, getting the location is very important, but on the other hand I don't want the user to wait more than a fraction of a second.

My code for getting the location is:

RNLocation.configure({ distanceFilter: 0,
      desiredAccuracy: 'highAccuracy' });
    RNLocation.getLatestLocation({ timeout: xxx })

Based on your experience: how long will it usually take to get the location with and without the Fused Location library?

Android React native Exo-av certificate pinning

$
0
0

Our app uses certificate pinning. This all works with React native nicely, because React native provides a hook to specify a custom OkHttp Client, that manages the pinned certificate. Very similar to example provided here https://medium.com/@jaedmuva/react-native-ssl-pinning-is-back-e317e6682642

Things like <Image source='https://domain.withcert.com/image.jpg' /> work well with this model, as react native, using its underlying okhttp mechanism, relies on the custom-provided OkHTTp client were we manage the certificate.

Now we are adding audio (via Expo-AV). Expo-AV uses Android Exoplayer2 audio library. That Audio library issues https request to our server, eg. https://domain.withcert.com/sound.mp3 The https handshake fails, and it shows up as

'Error: com.google.android.exomplayer2.upstream.HttpDataSource$HttpDataSourceExcception: Unable to connecto to https://domain.withcert.com/sound.mp3'

But that does not work, because it appears that Expo-AV does not instruct Android's Exoplayer2 to use a custom certificate.

Is there a way to solve this?

FLAG_ACTIVITY_NEW_TASK error integrating android native library in react native

$
0
0

I'm trying to integrate this native pay library in a react native application.

The library requires an view setup like this to process the pay result.

<activity android:name=".athmovil.CheckoutResultActivity">
  <intent-filter>
    <action android:name="com.athmovil.athmovilNAMTRIK" />
    <category android:name="android.intent.category.DEFAULT" />
  </intent-filter>
</activity>

My manifest looks like that:

...
<activity android:name=".athmovil.CheckoutResultActivity">
  <intent-filter>
    <action android:name="com.athmovil.athmovil.SCHEME" />
    <category android:name="android.intent.category.DEFAULT" />
  </intent-filter>
</activity>
...

The library raises next error

Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?

My project structure is next:

athmovil/  
  athmovil/
    ATHMovilModule.java
    ATHMovilPackage.java
    CheckoutResultActivity.java
MainActivity.java
MainApplication.java

I don't know if my configuration is wrong, the native library demo application works fine. :( The pay response intent tries load the com.athmovil.NAMTRIK activity but apparently can't find it.

Any idea?


React Native: How can I detect if my code is running in the Simulator?

$
0
0

In a Obj-C iOS app I can use #if (TARGET_IPHONE_SIMULATOR) to write simulator-only code.

In react native I can use:

if (__DEV__) {
 .. do something special
}

.. to detect development mode.

We can use Platform.OS === 'ios' to detect the platform (Android/iOS). See here for more info Platform Docs

But how do we detect if the app is running in the simulator?

The reason I ask is that my app uses the camera to scan barcodes, and this isn't supported in the iOS Simulator.

React Native problem: WebView has been removed from React Native

$
0
0

I built new React Native project yesterday using react-native-cli. But when running the project with my android phone, I got this error in red screen.

Invariant Violation: WebView has been removed from React Native. It can now be installed and imported from 'react-native-webview' instead of 'react-native'. See 'https://github.com/react-native-community/react-native-webview'.

I never used WebView and here is my "package.json".

{
  "name": "",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint ."
  },
  "dependencies": {
    "react": "16.9.0",
    "react-native": "0.61.5",
    "react-native-image-slider": "^2.0.3",
    "react-native-svg": "^9.13.6",
    "react-navigation": "^4.0.10",
    "react-navigation-drawer": "^2.3.3",
    "react-navigation-stack": "^1.10.3",
    "react-redux": "^7.1.3",
    "redux": "^4.0.4"
  },
  "devDependencies": {
    "@babel/core": "^7.7.5",
    "@babel/runtime": "^7.7.6",
    "@react-native-community/eslint-config": "^0.0.5",
    "babel-jest": "^24.9.0",
    "eslint": "^6.7.2",
    "install-peers": "^1.0.3",
    "jest": "^24.9.0",
    "metro-react-native-babel-preset": "^0.57.0",
    "react-native-gesture-handler": "^1.5.2",
    "react-native-reanimated": "^1.4.0",
    "react-test-renderer": "16.9.0"
  },
  "jest": {
    "preset": "react-native"
  }
}

I tried to fix this problem for a whole day but I couldn't. I just think 'react-native-gesture-handler' causes this problem. Anyone who has much experience of React-Native, please help me. Thank you.

How to lunch Google Map app from a react native app with a direction as coordinates

$
0
0

I am drawing a polyline on the MapView component from an array of coordinates that I am fetching from my backend server. There is a case when I want the user to open the installed Google Map on their android device with these coordinates and get directions based on that.

I know how to open the Google Map app with a single coordinate, like the following one:

const url = 'geo:37.484847,-122.148386';
Linking.openURL(url);

But, I am not sure (even have no idea if it is possible at all) how would I lunch the Google Map app with a bunch of coordinates and show them as a direction route (blue line).

As an example, If I have 3 points: A, B and C, I want to open the Google Map app and the app should display a direction route made using A to B and B to C.

React Native Network Fails On Android 9

$
0
0

Accessing hidden method Lcom/android/org/conscrypt/OpenSSLSocketImpl;->setAlpnProtocols([B)V (light greylist, reflection)

I use fetch to connect and retrieve data from https Url. On the first try, the connection takes long and the request fails. But when I click the second time, request succeeds. Release and Debug apks has the same result.

the only log I could get as an error is above. I have already added the following to the manifest

 android:usesCleartextTraffic="true"
 tools:targetApi="28"

Also, I should add that when sending requests if I disconnect the device from the internet and reconnect the phone, request succeeds.

Here is Manifesto

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.weecomicustomernative">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.CAMERA" />

    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.VIBRATE" />

    <!-- These require runtime permissions on M -->
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

    <application
        android:name=".MainApplication"
        android:allowBackup="false"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:theme="@style/AppTheme"
        android:usesCleartextTraffic="true"
        tools:ignore="GoogleAppIndexingWarning"
        tools:targetApi="28">
        <activity
            android:name="com.weecomicustomernative.MainActivity"
            android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
            android:label="@string/app_name"
            android:windowSoftInputMode="adjustResize">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />

        <meta-data
            android:name="com.google.android.geo.API_KEY"
            android:value="AIzaSyCviF26pcJZtKxFx1koGhhJLbwC4bLDTBs" />

    </application>

</manifest>

Here is package.json file

"@react-native-community/async-storage": "^1.6.3",
"@react-native-community/geolocation": "^2.0.2",
"@react-native-community/netinfo": "^4.6.1",
"axios": "^0.19.0",
"react": "16.9.0",
"react-native": "0.61.5",
"react-native-camera": "^3.11.1",
"react-native-check-box": "^2.1.7",
"react-native-geolocation-service": "^3.1.0",
"react-native-gesture-handler": "~1.3.0",
"react-native-i18n": "^2.0.15",
"react-native-image-crop-picker": "^0.26.1",
"react-native-image-picker": "^1.1.0",
"react-native-image-placeholder": "^1.0.14",
"react-native-maps": "0.26.1",
"react-native-modal": "^11.5.3",
"react-native-permissions": "^2.0.6",
"react-native-progress-circle": "^2.1.0",
"react-native-pull-to-refresh": "^2.1.3",
"react-native-qrcode-svg": "^5.3.2",
"react-native-reanimated": "^1.4.0",
"react-native-s3-upload": "0.0.12",
"react-native-svg": "^9.13.3",
"react-native-swiper-flatlist": "^2.0.3",
"react-native-vector-icons": "^6.6.0",
"react-navigation": "^4.0.10",
"react-navigation-drawer": "^2.3.3",
"react-navigation-header-buttons": "^3.0.4",
"react-navigation-stack": "^1.10.3",
"react-navigation-tabs": "^2.5.6",
"react-redux": "^7.1.3",
"redux": "^4.0.4"

Any help will be appreciated.

Selectively stopping the push notification listener or toggling the _displayInForeground for Expo Push Notifications

$
0
0

Expo Push Notification has the _displayInForeground property that can be set to allow receiving push notifications when the app in the foreground. Currently, I have the notification listener activated upon mounting the home screen, which is the very first screen.

Is there a way to either turn off the listener or toggle the _displayInForeground only when the user is in the chat screen? I don't want the push notifications for the chat messages coming in while the user is on the chat screen.

QR Scanner react-native crash on second invocation

Axios Request failed with status code 404 - React Native

$
0
0

I am trying to send data to my Google Cloud server. (login form). I have an error,

[Error: Request failed with status code 404]

I also tried fetch method, but I got a network failed error there.

This is my code:

handleLoginUser(){
const data = new FormData();
  data.append('email', 'aaykgxr@gmail.com');
  data.append('password', '1234567890');

  return axios.post('http://*serverip*/users/login',
    data,
    {
      headers: {
        'Content-Type': 'application/json',
      }
    },
  )
  .then(function (response) {
          console.log(response);
      })
      .catch(function (response) {
          console.log(response);
      });
}

Thanks for your help.


How to check for esim eligibility in react-native app?

$
0
0

I need to make a react-native app that checks if the device is suitable for esim or not.

I obtain this information https://source.android.com/devices/tech/connect/esim-overview to setup esim but cannot figure out how to implement it in real code. I am trying to use EuiccManager to check whether it supports esim or not?

Please, could you help me?

I tried to take reference from this class EuiccManager but do not find how to use this in react native.

How to extract cookie on Android in React-Native?

$
0
0

I am currently working on react-native app and I am trying to extract all cookies using react-native-cookies and this is working fine on IOS platform, but not working on Android. On Android I've tried to extract it like this:

const cookie = await CookieManager.get(url);

But that returns me an empty object. My question is: How to extract all the cookies on Android platform? Thank you!

react-native-permissions returning RNPermissions null in react-native expo project

$
0
0

I am new to Expo and I can't tell whats the problem here, I am good enough with Android and that I am trying to use the react-native-qrcode-scanner in a newly created blank react-native expo project. I haven't touched anything inside the project, just created a brand new project and I get an error saying RNPermissions is null. I think its telling to pass details about my android App, can anyone help me with how to start this? I am using react-native-permissions as its needed by the code of QR Code Scanner, I uninstalled everything in dependencies and left only these:

"dependencies": {
    "expo": "~36.0.0",
    "react": "~16.9.0",
    "react-dom": "~16.9.0",
    "react-native": "https://github.com/expo/react-native/archive/sdk-36.0.0.tar.gz",
    "react-native-permissions": "^2.0.2",
    "react-native-web": "~0.11.7"
}

so there is just basic welcome to react message in App.js like this:

import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { check, PERMISSIONS, RESULTS } from 'react-native-permissions';

class App extends React.Component {
  constructor(props) {
    super(props);
  }
  render() {
    return (
      <View style={styles.container}>
        <Text>Open up App.js to start working on your app!</Text>
      </View>  
    );
  }
}
const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',     
  },
});
export default App;

THIS is the app.json file:

{
  "expo": {
    "name": "App1",
    "slug": "App1",
    "privacy": "public",
    "sdkVersion": "36.0.0",
    "platforms": [
      "ios",
      "android",
      "web"
    ],
    "version": "1.0.0",
    "orientation": "portrait",
    "icon": "./assets/icon.png",
    "splash": {
      "image": "./assets/splash.png",
      "resizeMode": "contain",
      "backgroundColor": "#ffffff"
    },
    "updates": {  
      "fallbackToCacheTimeout": 0
    },
    "assetBundlePatterns": [
      "**/*"
    ],
    "ios": {
      "supportsTablet": true
    }
  }
}

How to get the flag of the included full-screen mode (gesture control) in Android for React Native

$
0
0

I got a bug of incorrect display of the player in full screen mode. I can’t get the flag whether gesture control mode is enabled on the device or not. I tried to get it from View.SYSTEM_UI_FLAG_HIDE_NAVIGATION, but regardless of whether the setting is enabled or not, it returns a constant value

The flags also do not change:

SYSTEM_UI_FLAG_IMMERSIVE, 
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN,
SYSTEM_UI_FLAG_FULLSCREEN,
SYSTEM_UI_FLAG_HIDE_NAVIGATION

For example on device MI 8 Lite (MIUI 11, Android 9)

const WINDOW_WIDTH = Dimensions.get('window').width // 392
const WINDOW_HEIGHT = Dimensions.get('window').height // 752

const SCREEN_HEIGHT = Dimensions.get('screen').height // 829
const SCREEN_WIDTH = Dimensions.get('screen').width // 392
StatusBar.currentHeight // 29.81
const heightNavBar = SCREEN_HEIGHT - WINDOW_HEIGHT - StatusBar.currentHeight //47

When I change the setting on device for full-screen mode, the height parameters of the screen a and the windows do not change and I can not correctly set the height for the popup in full-screen mode.

bug in with enable fullscreen mode

How can I get the configuration status from the device and where can I get it from? There are many examples of how to set a flag, but how to get only the status flag could not find and get it.

import android.os.Bundle
import com.facebook.react.ReactActivity
import com.facebook.react.ReactActivityDelegate
import com.facebook.react.ReactRootView
import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView
import android.content.Intent
import android.content.res.Configuration
import android.view.View
import java.util.*

class MainActivity : ReactActivity() {
    override fun onStart() {
        overridePendingTransition(0, 0)
        super.onStart()
    }
    /**
     * Returns the name of the main component registered from JavaScript.
     * This is used to schedule rendering of the component.
     */
    override fun createReactActivityDelegate(): ReactActivityDelegate {
        return object : ReactActivityDelegate(this, mainComponentName) {
            override fun createRootView(): ReactRootView {
                return RNGestureHandlerEnabledRootView(this@MainActivity)
            }
            override fun getLaunchOptions(): Bundle? {
                val properties = Bundle()
                val appConfig = Bundle()
                appConfig.putString("isImmersive", View.SYSTEM_UI_FLAG_IMMERSIVE.toString())
                appConfig.putString("isHideNav", View.SYSTEM_UI_FLAG_HIDE_NAVIGATION.toString())
                return properties
            }
        }
    }

}

This is repeated on other gesture control devices. Samsung s10+ (Android 10)

open drawer navigator not in a screen of drawernavigator

$
0
0

is it possible to open a drawer navigator from a screen that I DONT WANT IT TO BE INSIDE MY DRAWER NAVIGATOR

const AppDrawerNavigator = createDrawerNavigator({
  Home:{
    screen:MainStackNavigator,//stack with tab
  },
  Pdf:{
    screen:AnotherScreen
  }
},
{
  drawerPosition: 'left',
  drawerWidth:Dimensions.get('window').width-50,

})

and this is my stacknavigator

const AppStackNavigator = createStackNavigator({
  Main:{screen:AppDrawerNavigator,navigationOptions: {
    header: null,
  }},
  Login:{screen:LoginScreen},

  Map:{screen:MapScreen,navigationOptions:({navigation})=>({
    headerLeft:null,
    headerTransparent:true,
    headerRight:
        <TouchableOpacity
         onPress={()=>navigation.toggleDrawer()}>
           <IconMenu name='menu' size={25} style={{marginRight:20}} />
         </TouchableOpacity>})},
})

I want MapScreen to open the drawer i defined above (its not working , it says navigation is undefined.toggleDrawer() is not a function ,when i click on my IconMenu)

Thnak you

Viewing all 28480 articles
Browse latest View live