I am using stackNavigator for navigating between screens. I am calling two API's in componentDidMount() function in my second activity. When i load it first time, it gets loaded successfully. Then i press back button to go back to first activity. Then, if i am again going to second activity, the APIs are not called and I get render error. I am not able to find any solution for this. Any suggestions would be appreciated.
`componentDidMount()` function is not called after navigation
How To Post API to server from Native Modules React Native?
I have a problem, I made an application where I work. Which combines React Native and Native Modules Java. In native modules, I use the native java floating pop up feature. Now when a popup appears triggered from FCM / Socket, the Native Modules Java pop up appears and must send an API to the server.
Basically, how do I POST (send data) with native modules on react native Android?
This is an example of the picture when the user presses "Yes" then I have to POST data to the Server from NativeNodules.
Thank you for your help.
One URL scheme for both Ios and Android
So I am in the mids of inplementing url-schemes in my app (React-native and for both Android and Ios) but I am having some trouble with the html implementation of the url schemes. I figured out that for android you have to use:
<a href="intent://Something/#Intent;scheme=SomeApp;package=com.SomeApp;end">
But for IOS only this link works: <a href="SomeApp://Something">
Is there a way to allow both the android and IOS app to use the same link to open the app? I figured that it's quite common to ask that but I couldn't find any resource on the internet that was usefull for this. I could try to make some JS code to try both the links but that's not really a pretty solution (Android doesn't respond to the IOS link so I can run that one first and then the Android link after that)
Any help would be appreciated!
Pick multiple images in react native Expo with Imagepicker
It seems like Expo only supports imagepicker for selecting one image rather than multiple images. Is there any way to pick multiple images without ejecting expo or starting new react-native-init?
How to run on iPhone a React Native app from Ubuntu OS
Am I able to run my React Native application on a ios physical device? And if I am able to..let me ask you how is it possible?
I have created the application via 'React Native CLI quickstart''dev OS: Linux', 'target device: Android'..because I read: 'If you want to develop for both Android and iOS, that's fine - you can pick one to start with, since the setup is a bit different.'
I am not using Expo, because i will need the feature of reading NFC tags.
State does not unmount when changing screens and opens randomly ( react-navigation - firebase - react native-maps - giftedcha )
The screen states do not reset when navigating between screens.
Screen A: Map ( Main Screen ) Screen B : Map filters
When the user logs in he sees the main screen - Screen A - where on componentdidmount setState with the users in the firebase realtime db. To filter the map he goes to Screen B where he sets the filters, and the filters are saved to firebase. After the filters are saved he goes back to screen A, but the users in from the initial state are the same and to view the filtered list the user needs to restart the app.
Having the same problem with gifted chat library and firebase when a user sends a message the chat screen opens randomly on the other users' app and reopens even if the users are not chatting.
Tried in both situations to put isMonted = true on componentdidmount and set it to false when leaving the screens, but with no success.
Tried to setState when leaving the screen to all initial states to false, also with no luck.
All the screens are on the same navigation stack.
Using : -expo -firebase -react native navigation -react native maps -giftedchat
Is any way to unmount the states when the user leaves the screen and prevents the screen from opening randomly?
Tried : Which lifecycle event is called when a screen appears? but the data remained the same
How to solve the error, Failed to launch emulator. Reason: No emulators found as an output of `emulator -list-avds` in React native?
I am creating react native app for mobile application. I am fully new in building react native app. I am using ubuntu for creating the app and following below link to create the app. https://facebook.github.io/react-native/docs/getting-started . Can anyone please solve the issue ?
At below stage I am getting error:
cd AwesomeProject
npx react-native run-android
Error in my command line:
All-Series:~/Projects_App/AwesomeProject$ npx react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 864 file(s) to forward-jetify. Using 4 workers...
info Starting JS server...
/bin/sh: 1: adb: not found
info Launching emulator...
error Failed to launch emulator. Reason: No emulators found as an output of `emulator -list-avds`.
warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch.
info Installing the app...
> Task :app:compileDebugJavaWithJavac FAILED
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.5/userguide/command_line_interface.html#sec:command_line_warnings
13 actionable tasks: 4 executed, 9 up-to-date
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Could not find tools.jar. Please check that /usr/lib/jvm/java-8-openjdk-amd64 contains a valid JDK installation.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 5s
error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Could not find tools.jar. Please check that /usr/lib/jvm/java-8-openjdk-amd64 contains a valid JDK installation.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 5s
at checkExecSyncError (child_process.js:621:11)
at execFileSync (child_process.js:639:15)
at runOnAllDevices (/home/rupeevest/Projects_App/AwesomeProject/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:94:39)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
App is sometimes unable to perform network requests after returning from background
My team is working on a react-native (0.59.10) app that's currently in closed testing. The issue we're facing is that sometimes all of our API requests (made using https://github.com/axios/axios 0.18) will time out for some users on Android after the app returns from the background. It does not happen every time, and is random as far as we can tell. This is most likely not due to Doze because the issue will sometimes occur while the device is being actively used, sometimes even when just sending the app to the background and back.
We're using https://github.com/rgommezz/react-native-offline to check for internet connection whenever the app changes from background to foreground, and as far as the app can tell, there often IS an internet connection. Closing the app and restarting it fixes the problem, so we can rule out a real internet connection issue.
Interestingly, we've found that if there is no timeout configured for the requests, they may actually go through after as long as 4 minutes!
So far, the cases of this problem that we've been able to confirm have all been on Android 9 devices with power saving enabled.
We've tried re-creating the Axios instance every time the app comes to the foreground, but to no avail.
We've also tried reworking some of the API calls so that they use fetch instead of Axios, but the problem persisted. It's worth noting Axios has a bug that causes it to never time out in some scenarios regardless of configuration (we've just found this out recently and implemented a workaround, but our main issue persists). Fetch actually throws a timeout error, however.
We've been unable to reproduce this on an Android 9 emulator with power saving enabled and low (10%) battery levels, or on other Android physical devices.
Any ideas are more than welcome!
error: package com.android.annotations does not exist
I have the following class
import com.android.annotations.NonNullByDefault;
@NonNullByDefault
public final class Log {
...
}
and here is my build.gradle file (some parts omitted)
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '24.0.1'
defaultConfig {
minSdkVersion 16
targetSdkVersion 25
versionCode 2
versionName "0.2"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
dependencies {
compile 'com.android.support:appcompat-v7:25.0.0'
compile 'com.android.support:support-annotations:25.0.0'
compile 'com.android.support:design:25.0.0'
}
In Android Studio there is no warning raised for my class
However when I try to build and run my app I get this error from gradle
Information:Gradle tasks [:app:clean, :app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:assembleDebug]
Warning:[options] bootstrap class path not set in conjunction with -source 1.7
/home/puter/git-repos/TaskManager3/app/src/main/java/com/treemetrics/taskmanager3/util/Log.java
Error:(3, 31) error: package com.android.annotations does not exist
Error:(7, 2) error: cannot find symbol class NonNullByDefault
Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
Information:BUILD FAILED
Information:Total time: 21.021 secs
Information:3 errors
Information:1 warning
Information:See complete output in console
How to Handle Listen FCM messages in the background?
I have read the FCM firebase documentation for react native and I want to implement the FCM background on react native android.
But I'm still a little confused by the documentation
my code:
// @flow
import firebase from 'react-native-firebase';
// Optional flow type
import type { RemoteMessage } from 'react-native-firebase';
export default async (message: RemoteMessage) => {
// handle your message
return Promise.resolve();
}
AppRegistry.registerHeadlessTask('RNFirebaseBackgroundMessage', () => bgMessaging);
How to trigger and implement it, Please help, thank you very much.
empty response error in react-native android app while using epubjs with http://localhost:3456/fileName/
I'm currently working on react-native project and building simple app for reading books. and i'm using "epubjs" and "react-native-static-server" for local file accessing.
everything works fine in android os version below 8.0 devices but not in 9/10 (in ios everything works )
and the frustrating thing is that in develop/debug build (assembleDebug) it's working in android 9/10 but after installing release build (assembleRelease) it gives me empty response error.
this is my code
streamer component:
import StaticServer from 'react-native-static-server';
import { MainBundlePath, DocumentDirectoryPath, readDir, readFile, stat, mkdir, exists } from 'react-native-fs';
import RNFetchBlob from "rn-fetch-blob";
import { zip, unzip, unzipAssets, subscribe } from 'react-native-zip-archive';
import { join } from "path";
const Uri = require("epubjs/lib/utils/url");
export class Streamer {
constructor(opts) {
opts = opts || {};
this.port = opts.port || "3" + Math.round(Math.random() * 1000);
this.root = opts.root || "www";
this.serverOrigin = 'file://';
this.urls = [];
this.locals = [];
this.paths = [];
this.started = false;
this.server = undefined;
}
setup() {
// Add the directory
const dirPath = join(DocumentDirectoryPath,this.root);
return exists(dirPath)
.then((exists) => {
if (!exists) {
return mkdir(dirPath);
}
})
.then(() => {
return new StaticServer(this.port, this.root, { localOnly: true });
})
.catch((e) => { console.error(e) });
}
start() {
this.started = true;
return this.setup()
.then((server) => {
this.server = server;
return this.server.start();
})
.then((url) => {
this.serverOrigin = url;
console.log(url, this.urls, this.paths);
return url;
});
}
stop() {
this.started = false;
if (this.server) {
this.server.stop();
}
}
kill() {
this.started = false;
if (this.server) {
this.server.kill();
}
}
check(bookUrl) {
const filename = this.filename(bookUrl);
const targetPath = join(DocumentDirectoryPath,this.root,filename);
return RNFetchBlob.fs.exists(targetPath);
}
get(bookUrl) {
return this.check(bookUrl)
.then((exists) => {
if (exists) {
const filename = this.filename(bookUrl);
const url = `${this.serverOrigin}/${filename}/`
console.log(url, this.urls, this.paths);
return url;
}
return this.add(bookUrl);
})
}
add(bookUrl) {
const filename = this.filename(bookUrl);
return RNFetchBlob
.config({
fileCache: true,
path: join(DocumentDirectoryPath,filename)
})
.fetch("GET", bookUrl)
.then((res) => {
const sourcePath = res.path();
const targetPath = join(DocumentDirectoryPath,this.root,filename);
const url = `${this.serverOrigin}/${filename}/`
return unzip(sourcePath, targetPath)
.then((path) => {
this.urls.push(bookUrl);
this.locals.push(url);
this.paths.push(path);
// res.flush();
return url;
})
});
}
filename(bookUrl) {
var uri = new Uri(bookUrl);
if(uri.filename && (uri.filename.indexOf("?") > -1)) {
return uri.filename.split("?")[0].split("%")[0].replace(".epub", "");
} else {
return uri.filename.replace(".epub", "");
}
}
}
and here is the method:
import { Streamer } from './streamer';
import ePub, { Layout, EpubCFI, } from "epubjs";
_startStreamer = (bookUrl) => {
if (this.book) {
this.book.destroy();
}
this.book = ePub();
this.streamer = new Streamer();
return streamer.start()
.then(origin=>{
return streamer.get(bookUrl);
})
.then(src=>{
return this.book.open(src);
})
.then(()=>this.book.ready)
.then(()=>{
this.setState({toc:this.book.navigation.toc})
return this.book.navigation.toc;
})
}
React Native Rendering Image borderRadius in iOS
Images are rendered in different aspects in ios and android using image component from react-native. I’m trying to display image with 45 degree angle cutoff every corner.
I have tried to use cover, contain and center of the resizeMode prop cover fills the image inside the view giving the 45 degree cut but crops either width or height.
Center does not crop the image but if the image isn’t similar ratio as the view the 45 degree angles aren’t cut of the image, Android does this well though.
<View style={(this.state.controlsDisplayed) ? styles.flexLR : styles.flexLRBlack}>
<View style={{flex: (Platform.OS === ‘ios’) ? 0.85 : 0.5}} />
<View style={styles.imageWrapView}>
<Image source={{uri: ‘file://’ + item.photoLeft}} key={“TDVIEW”} resizeMode={(Platform.OS == ‘ios’) ? ‘cover’ : ‘center’} style={styles.floatingImagePartView} />
</View>
<View style={{flex: (Platform.OS === ‘ios’) ? 0.85 : 0.5}} />
</View>
Want to get uncropped images on ios that have corners cut of by 45 degrees. Same as is in the android images. Here are images from android device that are rendered correctly.


Here are the images rendered on ios using center and cover

This is rendered using contain on ios


How can I get the images rendered with 45 degree cutoff on ios device as it is on an android device?
React Native build failed in android, @react-native-community/cli-platform-android /native_modules.gradle' line: 130
I've upgraded my ReactNative project from 0.59 to 0.61.2 iOS is building fine but in android i'm facing the issue in @react-native-community/cli-platform-android module.
My settings.gradle file
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
My build.gradle file
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
I get the following error while building the app.
> Task :app:generatePackageList FAILED
FAILURE: Build failed with an exception.
* Where:
Script '/Users/yashwanth_c/Documents/projects/MobileApp/node_modules/@react-native-community/cli-platform-android
/native_modules.gradle' line: 130
* What went wrong:
Execution failed for task ':app:generatePackageList'.
> ReactNativeModules$_generatePackagesFile_closure3
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.5/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 5m 21s
4 actionable tasks: 4 executed
As always i've cleaned the cache and deleted the node_module folder, tried many times but no luck. Also googled for more than a week but still not able to find a fix, any advice is appreciated.
How remove SYSTEM_ALERT_WINDOW android permission in react native
How remove SYSTEM_ALERT_WINDOW android permission in React Native?
I remove it from AndroidManifest.xml but it don't removed from app.
React native 0.59.9 app crashing in android
The app crashes when I signed in and in the main application but no problems when I am in the login screen with no error what so ever and a few seconds the app crash. The IOS is doing okay and running perfectly.
React Native Environment Info: System: OS: Windows 10 CPU: (8) x64 Intel(R) Core(TM) i5-8300H CPU @ 2.30GHz Memory: 1.19 GB / 7.85 GB Binaries: Yarn: 1.19.2 - C:\Program Files (x86)\Yarn\bin\yarn.CMD npm: 6.11.2 - C:\Program Files\nodejs\npm.CMD
package.json
{
"name": "FitnessCapital",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start -- --reset-cache",
"test": "jest",
"postinstall": "sh ./fix.sh"
},
"dependencies": {
"@feathersjs/authentication-client": "^1.0.2",
"@feathersjs/feathers": "^3.1.7",
"@feathersjs/socketio-client": "^1.1.0",
"@react-native-community/slider": "^2.0.0",
"appcenter": "^1.6.0",
"appcenter-analytics": "^1.6.0",
"appcenter-crashes": "^1.6.0",
"axios": "^0.18.0",
"cloudinary": "^1.13.2",
"instabug-reactnative": "^8.3.2",
"mobx": "4.3.1",
"mobx-react": "5.1.0",
"moment": "^2.24.0",
"native-base": "^2.8.0",
"react": "16.8.3",
"react-native": "^0.59.9",
"react-native-amplitude-analytics": "^0.2.6",
"react-native-easy-grid": "^0.2.0",
"react-native-extended-stylesheet": "^0.11.1",
"react-native-fbsdk": "^0.10.0",
"react-native-fetch-blob": "^0.10.8",
"react-native-gifted-chat": "^0.4.3",
"react-native-google-signin": "2.0.0",
"react-native-image-crop-picker": "^0.24.1",
"react-native-image-picker": "^0.27.0",
"react-native-linear-gradient": "^2.5.3",
"react-native-modal": "^6.5.0",
"react-native-navigation": "^1.1.493",
"react-native-permissions": "^1.1.1",
"react-native-progress": "^3.5.0",
"react-native-push-notification": "^3.1.2",
"react-native-share": "^1.2.1",
"react-native-smtp-mailer": "^1.1.8",
"react-native-snap-carousel": "^3.7.5",
"react-native-svg": "^9.4.0",
"react-native-svg-charts": "^5.2.0",
"react-native-swiper": "^1.5.13",
"react-native-vector-icons": "^6.3.0",
"react-native-video": "^4.0.0",
"react-native-view-shot": "^2.6.0",
"react-timer-mixin": "^0.13.4",
"socket.io-client": "^2.1.1",
"victory-native": "^31.0.0"
},
"devDependencies": {
"@babel/core": "^7.4.4",
"@babel/plugin-proposal-decorators": "^7.4.4",
"@babel/preset-flow": "^7.0.0",
"@babel/runtime": "^7.4.4",
"babel-eslint": "^8.2.5",
"babel-jest": "^24.8.0",
"babel-plugin-transform-decorators-legacy": "^1.3.5",
"babel-preset-react-native": "^4.0.0",
"eslint": "^4.19.1",
"eslint-config-airbnb": "^17.0.0",
"eslint-plugin-import": "^2.13.0",
"eslint-plugin-jsx-a11y": "^6.1.0",
"eslint-plugin-react": "^7.10.0",
"jest": "^24.8.0",
"metro-react-native-babel-preset": "^0.54.0",
"react-test-renderer": "16.8.3"
},
"jest": {
"preset": "react-native",
"setupFiles": [
".\\node_modules\\appcenter\\test\\AppCenterMock.js",
".\\node_modules\\appcenter-analytics\\test\\AppCenterAnalyticsMock.js",
".\\node_modules\\appcenter-crashes\\test\\AppCenterCrashesMock.js"
]
}
}
adroid/build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
def versionOverrides = [
"com.facebook.android:facebook-android-sdk": "4.37.0",
]
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"
googlePlayServicesAuthVersion = "15.0.1"
}
repositories {
google()
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.1'
classpath 'com.google.gms:google-services:4.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
subprojects {
if (project.name.contains('react-native-image-picker')) {
buildscript {
repositories {
jcenter()
maven { url "https://dl.bintray.com/android/android-tools/" }
}
}
}
afterEvaluate {project ->
// force libs to use recent buildtools
if (project.hasProperty("android")) {
android {
compileSdkVersion = 28 // change to match your desired version
buildToolsVersion = "28.0.3" // ....
}
}
}
}
allprojects {
repositories {
google()
jcenter()
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
maven {
url 'https://maven.google.com/'
name 'Google'
}
maven { url "https://jitpack.io" }
maven {
url "https://sdks.instabug.com/nexus/repository/instabug-cp"
}
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def overrideVersion = versionOverrides[details.requested.group + ":" + details.requested.name]
if (overrideVersion != null && details.requested.version != overrideVersion) {
details.useVersion overrideVersion
}
}
}
}
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"
}
React Native | App Crash because of "react-native-google-signin"
React Native | react-native-google-signin
After i install react-native-google-sigin with
npm i react-native-google-signin
It suddenly crash ( force close ) right when the app start, I have already did all the steps that is told on the github documentation yet when i run my App it crash instantly, without giving any error in the log. ( neither android-log nor adb logcat *:S ReactNative:V ReactNativeJS:V does )
Here are my codes:
build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"
googlePlayServicesAuthVersion = "16.0.1" // <--- use this version or newer
}
repositories {
google()
jcenter()
}
dependencies {
classpath("com.android.tools.build:gradle:3.4.1")
classpath 'com.android.tools.build:gradle:3.1.2' // <--- use this version or newer
classpath 'com.google.gms:google-services:4.1.0' // <--- use this version or newer
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
google()
jcenter()
}
}
settings.gradle
rootProject.name = 'App'
include ':react-native-reanimated'
project(':react-native-reanimated').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-reanimated/android')
include ':react-native-gesture-handler'
project(':react-native-gesture-handler').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-gesture-handler/android')
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':react-native-google-signin', ':app'
project(':react-native-google-signin').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-google-signin/android')
include ':app'app/build.gradle
dependencies {
implementation project(':react-native-reanimated')
implementation project(':react-native-gesture-handler')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation(project(":react-native-google-signin"))
implementation "com.facebook.react:react-native:+" // From node_modules
implementation(project(':react-native-maps')){
exclude group: 'com.google.android.gms', module: 'play-services-base'
exclude group: 'com.google.android.gms', module: 'play-services-maps'
}
implementation 'com.google.android.gms:play-services-base:10.0.1'
implementation 'com.google.android.gms:play-services-maps:10.0.1'
if (enableHermes) {
def hermesPath = "../../node_modules/hermesvm/android/";
debugImplementation files(hermesPath + "hermes-debug.aar")
releaseImplementation files(hermesPath + "hermes-release.aar")
} else {
implementation jscFlavor
}
}
apply plugin: 'com.google.gms.google-services' // <--- this should be the last line
Can someone help me with this error? because when i uninstall react-native-google-signin with
npm uninstall react-native-google-signin
it works just fine
How to connect react native app to live URL server using socket.io for Chat application?
Here is the code implemented for socket connection but it did not working. I want to create chat messaging app in react native with realtime updates which uses backend of our web side server. I am trying to connect my app to socket io but its not working.
I have used socket.IO-client for react native:
import SocketIOClient from 'socket.IO-client'
export default Class Socket extends Component{
constructor(){
super();
var Live_URL = "https://xxx.xxxxxxx.xxx/"
this.socket = SocketIOClient(Live_URL);
}
componentDidMount(){
this.socket.connect();
this.socket.on("connect", () => {
console.log('connection.')
});
}
}
here is the server side code....
module.exports = function(app, httpServer) {
var socketioJWT = require('socketio-jwt');
var io = require("socket.io").listen(httpServer);
var clients = [];
var connectedClientSocketIds = []; //for store socket all opened ids.
var clientsStatus = {};
io.use(socketioJWT.authorize({
secret: global.hzConfig.jwtPrivateKey,
handshake: true
}));
//for store all ffmpeg converting process (user for kill running process)
var runningFfmpegCommands = {};
/**
* @description Socket connection in when user going to online
*/
io.sockets.on("connect", function(socket){
console.log(socket)
}
i am getting this kind of error in console.....
Error: server error
at Socket.onPacket (socket.js:455)
at XHR.<anonymous> (socket.js:278)
at XHR.Emitter.emit (index.js:133)
at XHR.Transport.onPacket (transport.js:149)
at callback (polling.js:144)
at Object.exports.decodePayload (browser.js:384)
at XHR.Polling.onData (polling.js:148)
at Request.<anonymous> (polling-xhr.js:128)
at Request.Emitter.emit (index.js:133)
at Request.onData (polling-xhr.js:302)
Please, any solution?
How to post data API from React Native Native Modules Java To Server?
I'm having trouble using Java Native Modules in React Native. How do I POST data from POP UP Floating Window in Native Modules Java?
Should I POST API data in Native Java or React Native.
Thanks for the help or the tutorial link.
SHARE PDF REACT-NATIVE - can't see file name on android
When i share a PDF file on ANDROID by whatsapp, for example, on android the file get a aleatory name like (81276392183).
But when i share on IOS it's working fine!

For do it i use this lib: "react-native-fetch-blob";
[info] “react-native”: “0.59”, "react-native-fetch-blob": "^0.10.8",
this is my function to share: import RNFetchBlob from "react-native-fetch-blob";
shareCard = async card => {
console.log({ CARD: card });
const { url_pdf, nome } = card;
const formattedName = nome.trim();
const DIRS = RNFetchBlob.fs.dirs;
if (Platform.OS === "android") {
const path = `${DIRS.DocumentDir}/folder/${formattedName}.pdf`;
RNFetchBlob.config({
// add this option that makes response data to be stored as a file,
// this is much more performant.
fileCache: true,
path
})
.fetch("GET", url_pdf)
.then(resp => resp.readFile("base64"))
.then(async base64Data => {
const base64DataToShare = `data:application/pdf;base64,${base64Data}`;
await Share.open({
// title: "Compatilhar PDF",
url: base64DataToShare
// type: "base64",
// filename: "test",
});
});
} else {
let filePath = null;
const configOptions = {
fileCache: true,
path: `${DIRS.DocumentDir}/${formattedName}.pdf`
};
RNFetchBlob.config(configOptions)
.fetch("GET", url_pdf)
.then(async resp => {
filePath = resp.path();
const options = {
type: "application/pdf",
url: filePath
};
await Share.open(options);
});
}
};
My goal is to make it possible for users to see the file name before downloading :)
I would like to know if it is possible to put the name in the file in android, using this lib or another.
AppCenter's responsibility
I'm trying to figure out the CI portion that provided by AppCenter. I've implemented CodePush for my app and please correct me if my understanding is wrong.
- We build the native android app and generate a signed apk.
- Release the generated signed apk to playstore
- execute command to upload bundle
appcenter codepush release-react -a <owner>/<android-app> -d Production
The above are generally the way I understand CodePush and I've tested and working fine.
Now I've noticed that we can integrate our github project branch to appcenter, and whenever there is a git push, AppCenter will build it automatically and we can configure to release to playstore automatically.
Now the part I don't understand is, is this CI auto build by AppCenter actually nothing to do with CodePush?
If now my situation is only having updates on JS code side, actually when I git-push to repo, there isn't a need to auto-release to playstore right?


