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

Text is getting cut off in android for react native

$
0
0

I am working on React native and I am new to this. I am trying to display text, But, It's showing in an android end of the text ... and not showing complete text. It's only happening in android, working fine in iOS.

I have written following code

<Text    numberOfLines={1}    adjustsFontSizeToFit    minimumFontScale={0.1}    style={labelStyle} //labelStyle nothing I have written></Text>

Can anyone suggest me, where I am doing wrong in the code?

enter image description here

↧

React native: Error executing ./gradlew bundleRelease

$
0
0

I want to publish my app to the app-store. I followed this documentation.

However I keep getting the following error:enter image description here

I ultimately want to have my signed apk to publish to the app-store. I don't get why the documentation tells you to "./gradlew bundleRelease" instead of "./gradlew assembleRelease"

↧
↧

How to upgrade the gradle in a react native app

$
0
0

I am working on a react-native project which has gradle version of 4.4 (can be found in project folder /android/.gradle/4.4) but I want to upgrade it to latest one which is 6.0.1. Please help me

I want to change the version in red to 6.0.1(latest) not the one in white

enter image description here

↧

How to show ringing UI on mobile even if the app is killed and phone is locked?

$
0
0

I don't exactly know the flow of Video calling in mobile apps. The flow which I am using for video calling is as follows:

  1. User 1 taps to call User 2
  2. Your app generates a unique name for a Room. Perhaps a combination of the two user's IDs.
  3. User 1 connects to Room with generated unique name
  4. Using FCM or GCM, send message of high priority with the unique name of the Room and token to User 2
  5. User 2 to receives notification and you display a ringing UI(even when the app is killed and phone is locked)
  6. User 2 accepts and connects to the same Room

    Now I am stuck on point 5. I am sending the FCM notification(which shows up in tray (edit: now using voip notif) to user2 and now I need to show ringing UI on user2's mobile even if the app is killed and phone is locked. How can I achieve this?

↧

Accessing react-native View from Android

$
0
0

CONTEXT:

I am making a react-native app using react-native-navigation.

I want to create simple local notifications (I do not want to use react-native-notifications) for my react native project (especially Android as react-native-community has already something for iOS).

Basically the idea is that the users will receive a notification to let them know that they are on a call. I want them to be able to go back to the call screen by tapping on the notification while the app is in background.

QUESTION:

How can I access (get the reference of) a react-native View from Android so that I can target the right one as this will refer to MainActivity ?

My question is mainly for the intent what do I put instead of the question marks:

Intent intent = new Intent(this, ??????);intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, 0);NotificationCompat.Builder builder = new NotificationCompat.Builder(this, CHANNEL_ID)        .setSmallIcon(R.drawable.notification_icon)        .setContentTitle("title")        .setContentText("text")        .setPriority(NotificationCompat.PRIORITY_DEFAULT)        .setContentIntent(pendingIntent)        .setAutoCancel(true);

Thank you in advance for your time and your help.

↧
↧

React Native Expo StackNavigator overlaps Notification bar

$
0
0

I am trying to implement navigation bar for my React Native Expo app. Here is a problem:

enter image description here

"dependencies": {"expo": "^18.0.3","react": "16.0.0-alpha.12","react-native": "^0.45.1","react-navigation": "^1.0.0-beta.11"}

I don't know where and how I can set up styles for this component to make it not overlap with notifications bar. I tried to set marginTop: StatusBar.currentHeight for my root View but it didn't work. It applied the margin on the View but not on the navigation bar.

My App:

import {StackNavigator} from 'react-navigation';import Home from './app/screens/Home';export default App = StackNavigator({  Home: { screen: Home }})

Home:

export default class Home extends Component {    constructor() {        super();          // <...>    }    static navigationOptions = {        title: 'Welcome'    };    // <...>}
↧

How to remove the blank white screen in my android phone in a react native project?

$
0
0

I am new to react-native.

I am making a project in react-native with my android phone connected to my laptop at the USB port. When I run the project I see a blank screen on my phone. My phone is android version 9.

First I ran npm start and then I ran npm run android.

I ran adb -s device-name reverse tcp:8081 tcp:8081. Still the screen on my phone is blank.

This is my App.tsx file:

import "./i18n"import React, { useState, useEffect, useRef } from "react"import { YellowBox } from "react-native"import { NavigationContainerRef } from "@react-navigation/native";import { contains } from "ramda"import { enableScreens } from "react-native-screens"import { SafeAreaProvider, initialWindowSafeAreaInsets } from "react-native-safe-area-context";import { RootNavigator, exitRoutes, setRootNavigation } from "./navigation"import { useBackButtonHandler } from "./navigation/use-back-button-handler"import { RootStore, RootStoreProvider, setupRootStore } from "./models/root-store"import * as storage from "./utils/storage"import getActiveRouteName from "./navigation/get-active-routename"import { ThemeProvider } from 'react-native-elements';import * as theme from 'theme';import { AuthScreensWelcomeScreen } from './screens/auth-screens/welcome-screen';enableScreens()YellowBox.ignoreWarnings(["componentWillMount is deprecated","componentWillReceiveProps is deprecated","Require cycle:",])const canExit = (routeName: string) => contains(routeName, exitRoutes)export const NAVIGATION_PERSISTENCE_KEY = "NAVIGATION_STATE"const App: React.FunctionComponent<{}> = () => {const navigationRef = useRef<NavigationContainerRef>()const [rootStore, setRootStore] = useState<RootStore | undefined>(undefined)const [initialNavigationState, setInitialNavigationState] = useState()const [isRestoringNavigationState, setIsRestoringNavigationState] = useState(true)setRootNavigation(navigationRef)useBackButtonHandler(navigationRef, canExit)    const routeNameRef = useRef()    const onNavigationStateChange = state => {    const previousRouteName = routeNameRef.current    const currentRouteName = getActiveRouteName(state)    if (previousRouteName !== currentRouteName) {        // track screens.        __DEV__ && console.tron.log(currentRouteName)    }    // Save the current route name for later comparision    routeNameRef.current = currentRouteName    // Clear the storage if we are navigating to auth stack    if ( ['register', 'login', 'forgotpassword'].includes(currentRouteName) ) {        storage.remove(NAVIGATION_PERSISTENCE_KEY);    } else {        // Persist navigation state to storage        storage.save(NAVIGATION_PERSISTENCE_KEY, state)    }}useEffect(() => {    (async () => {        setupRootStore().then(setRootStore)    })()}, [])useEffect(() => {    const restoreState = async () => {        try {            const state = await storage.load(NAVIGATION_PERSISTENCE_KEY)            if (state) {                setInitialNavigationState(state)            }        } finally {            setIsRestoringNavigationState(false)        }    }    if (isRestoringNavigationState) {        restoreState()    }}, [isRestoringNavigationState])if (!rootStore) {    return null}return (<SafeAreaProvider initialSafeAreaInsets={initialWindowSafeAreaInsets}><AuthScreensWelcomeScreen /></SafeAreaProvider>)}export default App

Here is the welcome screen that should appear:

import React, { FunctionComponent, useState } from "react"import { observer } from "mobx-react-lite"import { Dimensions, Image } from "react-native"import { Screen, Button } from "components"import Carousel, { Pagination } from 'react-native-snap-carousel';import { Block } from "components/block/block"const { width: ScreenWidth } = Dimensions.get('screen');import { NavigationProp, NavigationState } from "@react-navigation/native";export interface AuthScreensWelcomeScreenProps {navigation?: NavigationProp<Record<string, object>, string, NavigationState, {}, {}>}export const AuthScreensWelcomeScreen: FunctionComponent<AuthScreensWelcomeScreenProps> = observer((props) => {const {    navigation} = props;const [activeSlide, setActiveSlide ] = useState(0);const items = [    { image: require('../../../assets/splash1.jpg') },    { image: require('../../../assets/splash2.jpg') },    { image: require('../../../assets/splash3.jpg') }];function renderItem ( { item, index } ) {    return (<Image style={{ alignSelf: 'center', flex: 1, resizeMode: 'contain', width: ScreenWidth / 1.25 }} source={item.image}></Image>    )}return (<Screen preset="fixed"><Block flex><Carousel                sliderWidth={ScreenWidth}                itemWidth={ScreenWidth}                data={ items }                layout="default"                renderItem={ renderItem }                onSnapToItem={ index => { setActiveSlide( index ) } }/><Block><Pagination                     activeDotIndex={activeSlide}                    dotsLength={items.length}                     dotStyle={{                        width: 10,                        height: 10                    }}/></Block></Block><Block row my={20} space="evenly" px={20}><Button title="Continue" containerStyle={{ flex: 1 }} onPress={ ( ) => navigation.navigate('login') }/></Block></Screen>)})

Can anyone help?

↧

Appstate keep on getting change in React native in Android

$
0
0

I am working on React native project and there I am taking location permissions. Also I have to track location permissions always like if user has given permission access after install the application and then after sometime user goes to the app settings in device settings and disable/revoked the permissions. Again once app comes from background to foreground, I have to check permission based on that, Needs to show the messages.

So that, I am using Appstate. But, In Android strangely, After installed the application, If user denied the permission with "Dont show again" checkbox, Then Appstate getting keep on changing with background and active always. It is keep on loop.

componentDidMount = async () => {    AppState.addEventListener('change', this.handleAppStateChange);  };  componentWillUnmount() {    AppState.removeEventListener('change', this.handleAppStateChange);    Geolocation.clearWatch(this.watchID);  }  handleAppStateChange = async nextAppState => {    const {appState} = this.state;    console.log('nextAppState -->', nextAppState);    console.log('appState -->', appState);    if (appState === 'active') {      // do this      this.showLoader();      await this.requestAndroidLocationPermission();    } else if (appState === 'background') {      // do that    } else if (appState === 'inactive') {      // do that other thing    }    this.setState({appState: nextAppState});  };requestAndroidLocationPermission = async () => {    try {      const granted = await PermissionsAndroid.request(        PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,        {},      );      if (granted === PermissionsAndroid.RESULTS.GRANTED) {        this.getLatitudeLongitude();      } else if (granted === PermissionsAndroid.RESULTS.NEVER_ASK_AGAIN) {        this.hideLoader();        this.setState({          errorMessage: 'Location permission is denied',          isLoading: false,        });      } else {        this.hideLoader();        this.requestAndroidLocationPermission();      }    } catch (err) {      console.warn(err);    }  };

It is keep on printing (loop) after denied permission with Don't show again

appState --> activenextAppState --> backgroundappState --> activenextAppState --> backgroundappState --> activenextAppState --> backgroundappState --> active

It goes on and never stop.

How to handle this? Any suggestions?

↧

React Native Android: Bouncing Scroll View

$
0
0

I know the regular scrollview on Android doesn't bounce, but I want this functionality. I am trying to use the package SpringScrollView, but when I replace my <ScrollView> components with <SpringScrollView> I receive the error

Requiring unknown module "94". If you are sure the module exists, try restarting Metro. You may also want to run 'yarn' or 'npm install'.

I don't really what Metro is, but if I just shut down the app, and rerun it using yarn install I get the same error


Update

I run into problems with the installation instructions in the documentation when I arrive at the part for MainApplication.java. The documentation specifies to modify my getPackages() function to be

@Overrideprotected List<ReactPackage> getPackages() {  return Arrays.<ReactPackage>asList(      new MainReactPackage(),      new SpringScrollViewPackage()  );}

My getPackages function for my MainApplication.java looked a little bit different

    @Override    protected List<ReactPackage> getPackages() {      List<ReactPackage> packages = new PackageList(this).getPackages();      packages.add(        new ModuleRegistryAdapter(mModuleRegistryProvider)      );      return packages;    }

So I tried to modify it to be

    @Override    protected List<ReactPackage> getPackages() {      List<ReactPackage> packages = new PackageList(this).getPackages();      packages.add(        new ModuleRegistryAdapter(mModuleRegistryProvider)      );      packages.add(new SpringScrollViewPackage());      return packages;    }

But when I do this, I receive this error when I build

error: cannot find symbol      packages.add(new SpringScrollViewPackage());                       ^  symbol: class SpringScrollViewPackage1 errorFAILURE: Build failed with an exception.* What went wrong:Execution failed for task ':app:compileDebugJavaWithJavac'.> Compilation failed; see the compiler error output for details.

I tried installing a version that was 0.* also, because it looks like the fancy instructions are only for the 2.* versions, but when I do that and use a SpringScrollView I get an error like

"You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports"
↧
↧

How to handle Android back button in Drawer navigator having stack nested inside

$
0
0

I have a Drawer Navigator on top of a Stack Navigator, then from any nested screen inside stack, on click of Hardware Back Button, root level Drawer Navigator Screen's BackHandler Listeners are getting called..

const Drawer = createDrawerNavigator();const DrawerNavigator = props => {  return (<Drawer.Navigator      drawerContent={props => <DrawerScreen {...props} />}      initialRouteName={'HomeScreen'}      drawerPosition={'right'}      drawerStyle={{width: '100%', backgroundColor: 'transparent'}}      screenOption={{backBehavior: 'order'}}><Drawer.Screen        name="App"        component={AppStackNavigator}        options={{gestureEnabled: false}}      /></Drawer.Navigator>  );};const RootStack = createSwitchNavigator(  {    Login: LoginStackNavigator,    Drawer: DrawerNavigator,    RouteNavigator: RouteNavigatorClass,    OnBoardStack: OnboardStackNavigator,    OTP: {      screen: OTPScreen,    },  },  {    initialRouteName: 'RouteNavigator',  },);

if I press hardware back button in any screen, Home Screen's back handler is getting called.. it started happening when I am upgrading react-navigation 2.x to 5.x

↧

React Native app (release build) crashes on start, works fine in debug. Why?

$
0
0

When I run app in debug mode, it works fine, but when i install release mode it crashes immediately after start. I didn't find a fix yet.

Currently I am using Samsung J6 for the app.

Here are the logs by adb logcat *:E:

03-30 14:03:08.718 32503 32556 E log     : error java.lang.ClassNotFoundException: Didn't find class "com.facebook.jni.NativeRunnable" on path: DexPathList[[zip file "/data/app/com.mindola-KM7-U7S64fvp4Oow2Wfasw==/base.apk"],nativeLibraryDirectories=[/data/app/com.mindola-KM7-U7S64fvp4Oow2Wfasw==/lib/arm, /data/app/com.mindola-KM7-U7S64fvp4Oow2Wfasw==/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]    03-30 14:03:08.720 32503 32556 E SoLoader: couldn't find DSO to load: libfbjni.so caused by: Didn't find class "com.facebook.jni.NativeRunnable" on path: DexPathList[[zip file "/data/app/com.mindola-KM7-U7S64fvp4Oow2Wfasw==/base.apk"],nativeLibraryDirectories=[/data/app/com.mindola-KM7-U7S64fvp4Oow2Wfasw==/lib/arm, /data/app/com.mindola-KM7-U7S64fvp4Oow2Wfasw==/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]    03-30 14:03:08.721 32503 32556 E AndroidRuntime: FATAL EXCEPTION: create_react_context    03-30 14:03:08.721 32503 32556 E AndroidRuntime: Process: com.mindola, PID: 32503    03-30 14:03:08.721 32503 32556 E AndroidRuntime: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libfbjni.so caused by: Didn't find class "com.facebook.jni.NativeRunnable" on path: DexPathList[[zip file "/data/app/com.mindola-KM7-U7S64fvp4Oow2Wfasw==/base.apk"],nativeLibraryDirectories=[/data/app/com.mindola-KM7-U7S64fvp4Oow2Wfasw==/lib/arm, /data/app/com.mindola-KM7-U7S64fvp4Oow2Wfasw==/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]    03-30 14:03:08.721 32503 32556 E AndroidRuntime:        at com.facebook.soloader.SoLoader.b(Unknown Source:368)    03-30 14:03:08.721 32503 32556 E AndroidRuntime:        at com.facebook.soloader.SoLoader.a(Unknown Source:106)    03-30 14:03:08.721 32503 32556 E AndroidRuntime:        at com.facebook.soloader.SoLoader.a(Unknown Source:108)    03-30 14:03:08.721 32503 32556 E AndroidRuntime:        at com.facebook.soloader.SoLoader.a(Unknown Source:1)    03-30 14:03:08.721 32503 32556 E AndroidRuntime:        at com.facebook.soloader.l.a(Unknown Source:0)    03-30 14:03:08.721 32503 32556 E AndroidRuntime:        at com.facebook.soloader.a.a.a(Unknown Source:10)    03-30 14:03:08.721 32503 32556 E AndroidRuntime:        at com.facebook.jni.HybridData.<clinit>(Unknown Source:2)    03-30 14:03:08.721 32503 32556 E AndroidRuntime:        at com.facebook.react.bridge.WritableNativeMap.initHybrid(Native Method)    03-30 14:03:08.721 32503 32556 E AndroidRuntime:        at com.facebook.react.bridge.WritableNativeMap.<init>(Unknown Source:0)    03-30 14:03:08.721 32503 32556 E AndroidRuntime:        at com.facebook.react.jscexecutor.a.create(Unknown Source:2)    03-30 14:03:08.721 32503 32556 E AndroidRuntime:        at c.b.m.H.run(Unknown Source:58)    03-30 14:03:08.721 32503 32556 E AndroidRuntime:        at java.lang.Thread.run(Thread.java:764)    03-30 14:03:08.850  2956  3031 E Netd    : getNetworkForDns: getNetId from enterpriseCtrl is netid 0    03-30 14:03:08.917  3297  3324 E WindowManager: RemoteException occurs on reporting focusChanged, w=Window{a61296f u0 com.mindola/com.mindola.MainActivity}    03-30 14:03:08.917  3297  3324 E WindowManager: android.os.DeadObjectException    03-30 14:03:08.917  3297  3324 E WindowManager:         at android.os.BinderProxy.transactNative(Native Method)    03-30 14:03:08.917  3297  3324 E WindowManager:         at android.os.BinderProxy.transact(Binder.java:1145)    03-30 14:03:08.917  3297  3324 E WindowManager:         at android.view.IWindow$Stub$Proxy.windowFocusChanged(IWindow.java:500)    03-30 14:03:08.917  3297  3324 E WindowManager:         at com.android.server.wm.WindowState.reportFocusChangedSerialized(WindowState.java:3966)    03-30 14:03:08.917  3297  3324 E WindowManager:         at com.android.server.wm.WindowManagerService$H.handleMessage(WindowManagerService.java:5497)    03-30 14:03:08.917  3297  3324 E WindowManager:         at android.os.Handler.dispatchMessage(Handler.java:106)    03-30 14:03:08.917  3297  3324 E WindowManager:         at android.os.Looper.loop(Looper.java:214)    03-30 14:03:08.917  3297  3324 E WindowManager:         at android.os.HandlerThread.run(HandlerThread.java:65)    03-30 14:03:08.917  3297  3324 E WindowManager:         at com.android.server.ServiceThread.run(ServiceThread.java:44)    03-30 14:03:08.930 32579 32579 E Zygote  : isWhitelistProcess - Process is Whitelisted    03-30 14:03:08.933 32579 32579 E Zygote  : accessInfo : 1    03-30 14:03:08.950  2956  3031 E FrameworkListener: read() failed (Connection reset by peer)    03-30 14:03:08.952 32579 32579 E android.dqagen: Not starting debugger since process cannot load the jdwp agent.    03-30 14:03:08.957 32590 32590 E Zygote  : isWhitelistProcess - Process is Whitelisted    03-30 14:03:08.960 32590 32590 E Zygote  : accessInfo : 1    03-30 14:03:08.962  3297 15116 E WindowManager: win=Window{a61296f u0 com.mindola/com.mindola.MainActivity EXITING} destroySurfaces: appStopped=false win.mWindowRemovalAllowed=true win.mRemoveOnExit=true win.mViewVisibility=0 caller=com.android.server.wm.AppWindowToken.destroySurfaces:888 com.android.server.wm.AppWindowToken.destroySurfaces:869 com.android.server.wm.WindowState.onExitAnimationDone:5460 com.android.server.wm.-$$Lambda$01bPtngJg5AqEoOWfW3rWfV7MH4.accept:2 java.util.ArrayList.forEach:1262 com.android.server.wm.AppWindowToken.onAnimationFinished:2422 com.android.server.wm.AppWindowToken.setVisibility:552    03-30 14:03:08.969 32590 32590 E oid.sm.provide: Not starting debugger since process cannot load the jdwp agent.    03-30 14:03:09.026  8108  8129 E SDHMS:SDHMS_UTIL_IO: e = /sys/class/input_booster/touchkey/time (Permission denied)    03-30 14:03:09.026  8108  8129 E SDHMS:SDHMS_UTIL_IO: e = /sys/class/input_booster/touchkey/time (Permission denied)    03-30 14:03:09.033 24346 24363 E PBSessionCacheImpl: sessionId[107076425850360534] not persisted.    03-30 14:03:09.062  3297  4215 E WindowManager: win=Window{60cb2a2 u0 Splash Screen com.mindola EXITING} destroySurfaces: appStopped=false win.mWindowRemovalAllowed=true win.mRemoveOnExit=true win.mViewVisibility=0 caller=com.android.server.wm.AppWindowToken.destroySurfaces:888 com.android.server.wm.AppWindowToken.destroySurfaces:869 com.android.server.wm.WindowState.onExitAnimationDone:5460 com.android.server.wm.WindowStateAnimator.onAnimationFinished:319 com.android.server.wm.WindowState.onAnimationFinished:5882 com.android.server.wm.-$$Lambda$yVRF8YoeNdTa8GR1wDStVsHu8xM.run:2 com.android.server.wm.SurfaceAnimator.lambda$getFinishedCallback$0:100    03-30 14:03:09.394 21699 30661 E WakeLock: GCM_HB_ALARM release without a matched acquire!

Here is my android/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    }    repositories {        google()        jcenter()        maven {            url 'https://maven.fabric.io/public'        }    }    dependencies {        classpath("com.android.tools.build:gradle:3.4.2")        classpath("com.google.gms:google-services:4.2.0")        classpath("io.fabric.tools:gradle:1.28.1")        // 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()        maven { url 'https://jitpack.io' }    }}

Here is my app/build.gradle:

apply plugin: "com.android.application"apply plugin: 'io.fabric'crashlytics {  enableNdk true}def useIntlJsc = falseimport com.android.build.OutputFileproject.ext.react = [    entryFile: "index.js",    enableHermes: false,  // clean and rebuild if changing]apply from: "../../node_modules/react-native/react.gradle"/** * Set this to true to create two separate APKs instead of one: *   - An APK that only works on ARM devices *   - An APK that only works on x86 devices * The advantage is the size of the APK is reduced by about 4MB. * Upload all the APKs to the Play Store and people will download * the correct one based on the CPU architecture of their device. */def enableSeparateBuildPerCPUArchitecture = true/** * Run Proguard to shrink the Java bytecode in release builds. */def enableProguardInReleaseBuilds = true/** * The preferred build flavor of JavaScriptCore. * * For example, to use the international variant, you can use: * `def jscFlavor = 'org.webkit:android-jsc-intl:+'` * * The international variant includes ICU i18n library and necessary data * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that * give correct results when using with locales other than en-US.  Note that * this variant is about 6MiB larger per architecture than default. */def jscFlavor = 'org.webkit:android-jsc:+'/** * Whether to enable the Hermes VM. * * This should be set on project.ext.react and mirrored here.  If it is not set * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode * and the benefits of using Hermes will therefore be sharply reduced. */def enableHermes = project.ext.react.get("enableHermes", false);android {    compileSdkVersion rootProject.ext.compileSdkVersion    compileOptions {        sourceCompatibility JavaVersion.VERSION_1_8        targetCompatibility JavaVersion.VERSION_1_8    }    defaultConfig {        applicationId "com.mindola"        minSdkVersion rootProject.ext.minSdkVersion        targetSdkVersion rootProject.ext.targetSdkVersion        versionCode 13        versionName "1.3"        multiDexEnabled true    }    splits {        abi {            reset()            enable enableSeparateBuildPerCPUArchitecture            universalApk false  // If true, also generate a universal APK            include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"        }    }    signingConfigs {        debug {            storeFile file('debug.keystore')            storePassword 'android'            keyAlias 'androiddebugkey'            keyPassword 'android'        }        release {            if (project.hasProperty('MYAPP_UPLOAD_STORE_FILE')) {                storeFile file(MYAPP_UPLOAD_STORE_FILE)                storePassword MYAPP_UPLOAD_STORE_PASSWORD                keyAlias MYAPP_UPLOAD_KEY_ALIAS                keyPassword MYAPP_UPLOAD_KEY_PASSWORD            }        }    }    buildTypes {        debug {            signingConfig signingConfigs.debug        }        release {            // Caution! In production, you need to generate your own keystore file.            // see https://facebook.github.io/react-native/docs/signed-apk-android.            signingConfig signingConfigs.release            minifyEnabled enableProguardInReleaseBuilds            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"        }    }    // applicationVariants are e.g. debug, release    applicationVariants.all { variant ->        variant.outputs.each { output ->            // For each separate APK per architecture, set a unique version code as described here:            // https://developer.android.com/studio/build/configure-apk-splits.html            def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]            def abi = output.getFilter(OutputFile.ABI)            if (abi != null) {  // null for the universal-debug, universal-release variants                output.versionCodeOverride =                        versionCodes.get(abi) * 1048576 + defaultConfig.versionCode            }        }    }    dexOptions {        javaMaxHeapSize "4g"    }}dependencies {    implementation project(':react-native-vector-icons')    implementation fileTree(dir: "libs", include: ["*.jar"])    implementation "com.facebook.react:react-native:+"  // From node_modules    implementation 'com.google.android.gms:play-services-ads:18.3.0'    compile 'com.android.support:multidex:1.0.3'    if (enableHermes) {        def hermesPath = "../../node_modules/hermes-engine/android/";        debugImplementation files(hermesPath +"hermes-debug.aar")        releaseImplementation files(hermesPath +"hermes-release.aar")    } else {        implementation jscFlavor    }    if (useIntlJsc) {        implementation 'org.webkit:android-jsc-intl:+'    } else {        implementation 'org.webkit:android-jsc:+'    }}// Run this once to be able to run the application with BUCK// puts all compile dependencies into folder libs for BUCK to usetask copyDownloadableDepsToLibs(type: Copy) {    from configurations.compile    into 'libs'}apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle");// iconsproject.ext.vectoricons = [    iconFontNames: [ 'FontAwesome5_Regular.ttf', 'FontAwesome5_Solid.ttf', 'FontAwesome.ttf' ] // Name of the font files you want to copy]apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"applyNativeModulesAppBuildGradle(project)apply plugin: 'com.google.gms.google-services'

In Firebase Crashlytics, i get this issue:

???com.facebook.soloader.SoLoader.b[Stack Trace]Fatal Exception: java.lang.UnsatisfiedLinkErrorcouldn't find DSO to load: libfbjni.so caused by: Didn't find class "com.facebook.jni.NativeRunnable" on path: DexPathList[[zip file "/data/app/com.mindola-KM7-U7S64fvp4Oow2Wfasw==/base.apk"],nativeLibraryDirectories=[/data/app/com.mindola-KM7-U7S64fvp4Oow2Wfasw==/lib/arm, /data/app/com.mindola-KM7-U7S64fvp4Oow2Wfasw==/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]

and

    ???        com.facebook.soloader.SoLoader.b        [Stack Trace]        Fatal Exception: java.lang.UnsatisfiedLinkErrorcouldn't find DSO to load: libhermes.so

I tried a few workarounds already after searching through similar questions, but none of them worked for me.

↧

Expo React Native - Emulator Debug menu shortcut suddenly stopped working on Windows

$
0
0

I am developing React Native App using Expo (not ejected) and Android Studio official AVD.

I am on Windows.

There is shortcut CTRL-M what opens Expo's (React Native's ??) debug menu for app inside emulator.

It was working for many days but today it suddenly stopped working...

ADB command still works...

Any ideas what should be bad? Expo or AVD problem?

↧

createMaterialTopTabNavigator with position bottom shifts up with keyboard

$
0
0

I am having difficulty in preventing my tabs from shifting up with the keyboard. I want the screens to "slide" in from the left or right when the tab is changed, and swiping on the screen to be able to change tabs and I found this so I used the createMaterialTopTabNavigator with tabBarPosition: 'bottom'. But the tab bar now moves up with the keyboard.

I also looked up on transitioners but I found it too complex for my understanding. Is there any easy alternative way to prevent the tabs from moving upward with the keyboard?

↧
↧

Expo SDK 37 and Configuring OTA Updates Issue

$
0
0

On March 31, 2020 Expo SDK 37 was released. I updated my app, however, now I am only receiving OTA updates on iOS devices and not on androids. Referencing the Expo SDK 37 Update API changes:

  1. Updates.fetchUpdateAsync no longer accepts any arguments. (It still resolves when an update is finished downloading.)
  2. The listener in Updates.addListener will only receive events about automatically downloaded updates, not downloads triggered manually by Updates.fetchUpdateAsync.
  3. Event names have changed.
  4. Updates.reloadFromCache has been renamed to Updates.reloadAsync, and Updates.reload has been removed.

My code that alerts a user if an OTA update is available, currently only working on iOS after SDK 37 upgrade.

await Updates.fetchUpdateAsync().then(manifest => manifest.isNew &&              Alert.alert("Update Available","A new OTA update is available and requires a refresh in order to continue.",                [                  {                    text: 'Refresh',                    style: 'cancel',                    onPress: () => {                      Updates.reloadFromCache()                    }                  }                ],                { cancelable: false },              )            )            :            this.setState({ isReady: true });

Based on the SDK 37 notes, replacing Updates.reloadFromCache() to Updates.reloadAsync() yields the following error:

Property 'reloadAsync' does not exist on type 'typeof import("c:/Users/Eri/Desktop/Levrx-Native-Members/node_modules/expo/build/Updates/Updates")'.ts(2339)

Using Typescript, I know typeof errors are common. Will this break my app if I publish a release with reloadAsync(), is this why it is not working on Androids?

Any help is appreciated. Thank you.

↧

React-Native how to give icon focus immediately when keyboard is up, instead of having to click on icon twice

$
0
0

I have created a standard "search" component, where there is an "x" and a "cancel" icon present. The "x" is meant to clear the field quickly if you want to change what you have previously typed into the field. The "cancel" is meant to just cancel the process of searching and revert to the page's default view. Both work respectively.

the problem is when the keyboard is up/open, a user is forced to tap on the "x" or "cancel" two times to get it to work, instead of it being clickable on the first time.

Both icons are currently wrapped in TouchableWithoutFeedback independently, and those are nested down into a View within a View.

So I know my issue is ultimately tied to the TextInput having the focus, as that's what keeps the keyboard up/open. I've read something about keyboardShouldPersistTaps but it seems to be only relevant to ScrollView I tried adding it to the View that wraps everything in this scenario but that doesn't appear to do anything.

All in all, I am looking for help coming up with a solution. Or an idea of where to start, in an attempt to fix this. All I need have done is have the "x" clear the field, reset the data on the view, and close the keyboard. With a single tap rather than a tap to clear the keyboard and another tap to actually do with its doing otherwise when the keyboard is down/closed.

↧

read ECONNRESET using expo build

$
0
0

I am building an apk for my application which is built by react native using expoI use expo build:android command in the terminal and after this I got a prompt to choose from:

? Would you like to upload a keystore or have us generate one for you?If you don't know what this means, let us handle it! :)

so i choosed that expo will handle it and I got the following steps

Publishing to channel 'default'...Building iOS bundleBuilding Android bundleAnalyzing assetsUploading assetsUploading \assets\alert.mp3Uploading \assets\images\splash.pngUploading \assets\images\icon.png

and then I got the follwing error

read ECONNRESETSet EXPO_DEBUG=true in your env to view the stack trace.

I also updated expo-cli to the latest version!and here is my app.json if it helps

 {"expo": {"name": "app name","slug": "app-name","platforms": ["android"    ],"version": "1.0.0","orientation": "portrait","icon": "./assets/images/icon.png","scheme": "myapp","splash": {"image": "./assets/images/splash.png","resizeMode": "contain","backgroundColor": "#ffffff"    },"updates": {"fallbackToCacheTimeout": 0    },"android": {"package": "com.el3ameed.appname","versionCode": 1,"adaptiveIcon": {"foregroundImage": "./assets/images/icon.png","backgroundColor": "#171717"      }    },"assetBundlePatterns": ["**/*"    ],"ios": {"bundleIdentifier": "com.el3ameed.appname","buildNumber": "1.0.0"    },"description": ""  }}
↧

Which React Native library I should use to scan devices with Bluetooth Classic and BLE with both iOS and Android?

$
0
0

I am interested in scan devices and not establish connections to exchange data.

Requirements are:

  • capability to read rssi values
  • compatibility with Bluetooth Classic
  • compatibility with BLE
  • working on iOS
  • working on Android

I found these libraries:

react-native-easy-bluetooth, but it doesn't meet requirements:

  • [ ] capability to read rssi values (unclear)
  • [x] compatibility with Bluetooth Classic
  • [x] compatibility with BLE
  • [ ] working on iOS
  • [x] working on Android

react-native-bluetooth-classic, but it doesn't meet requirements:

  • [ ] capability to read rssi values
  • [x] compatibility with Bluetooth Classic
  • [x] compatibility with BLE
  • [ ] working on iOS (specifying UISupportedExternalAccessoryProtocols strings is required)
  • [x] working on Android

react-native-ble-plx, but it doesn't meet requirements:

  • [x] capability to read rssi values 🎉
  • [ ] compatibility with Bluetooth Classic 😭
  • [x] compatibility with BLE
  • [x] working on iOS
  • [x] working on Android

It is quite frustrating not to be able to find a library with the mentioned requirements. Alternatively, I am thinking of studying Objective-C, while Java I know it quite well and write the respective native codes to me. However, before going to work, I would like to know if anyone knew a library compatible with the required requirements.

↧
↧

Recurrent local push notifications for react-native

$
0
0

I'm making a mobile app which needs heavy use of recurring notification settings (repeat daily, monthly, hourly, every weekdays, every weekends, every 2 hours, etc ...).

I've tried react-native-push-notification (only supports repeatType: week, day, hour, minute, time), and also checked react-native-notifications. But none of them allows me to make highly customized recurring notifications like that.

Have anyone done this using react-native without writing native code?

↧

Call Android Library in React Native

$
0
0

I have a following code in Native Android

package org.jitsi.example;import android.os.Bundle;import android.support.v4.app.FragmentActivity;import org.jitsi.meet.sdk.JitsiMeetView;import org.jitsi.meet.sdk.ReactActivityLifecycleCallbacks;// Example//public class MainActivity extends FragmentActivity implements JitsiMeetActivityInterface {    private JitsiMeetView view;    @Override    protected void onActivityResult(            int requestCode,            int resultCode,            Intent data) {        JitsiMeetActivityDelegate.onActivityResult(                this, requestCode, resultCode, data);    }    @Override    public void onBackPressed() {        JitsiMeetActivityDelegate.onBackPressed();    }    @Override    protected void onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        view = new JitsiMeetView(this);        JitsiMeetConferenceOptions options = new JitsiMeetConferenceOptions.Builder()            .setRoom("https://meet.jit.si/test123")            .build();        view.join(options);        setContentView(view);    }    @Override    protected void onDestroy() {        super.onDestroy();        view.dispose();        view = null;        JitsiMeetActivityDelegate.onHostDestroy(this);    }    @Override    public void onNewIntent(Intent intent) {        JitsiMeetActivityDelegate.onNewIntent(intent);    }    @Override    public void onRequestPermissionsResult(            final int requestCode,            final String[] permissions,            final int[] grantResults) {        JitsiMeetActivityDelegate.onRequestPermissionsResult(requestCode, permissions, grantResults);    }    @Override    protected void onResume() {        super.onResume();        JitsiMeetActivityDelegate.onHostResume(this);    }    @Override    protected void onStop() {        super.onStop();        JitsiMeetActivityDelegate.onHostPause(this);    }}

Also

JitsiMeetConferenceOptions options = new JitsiMeetConferenceOptions.Builder()    .setServerURL(new URL("https://meet.jit.si"))    .setRoom("test123")    .setAudioMuted(false)    .setVideoMuted(false)    .setAudioOnly(false)    .setWelcomePageEnabled(false)    .build();

React native doesnt well support this library so i am looking to call this android library inside of react native .So i have created following class

public class ToastModule extends ReactContextBaseJavaModule  {    private static final String DURATION_SHORT_KEY = "SHORT";    private static final String DURATION_LONG_KEY = "LONG";    public ToastModule(ReactApplicationContext reactContext) {        super(reactContext);    }    @Override    public String getName() {        return "CustomToastAndroid";    }    @Override    public Map<String, Object> getConstants() {        final Map<String, Object> constants = new HashMap<>();        constants.put(DURATION_SHORT_KEY, Toast.LENGTH_SHORT);        constants.put(DURATION_LONG_KEY, Toast.LENGTH_LONG);        return constants;    }    //this @ReactMethod will be available in javascript environment    @ReactMethod    public JitsiMeetConferenceOptions show(String message, int duration) {        Log.d(getName(),"toast called with "+message);        Toast.makeText(getReactApplicationContext(), "Yes John its coming from android", duration).show();        JitsiMeetConferenceOptions options=null;        try {            options = new JitsiMeetConferenceOptions.Builder()                   .setServerURL(new URL("https://meet.jit.si"))                   .setRoom("test123")                   .setAudioMuted(false)                   .setVideoMuted(false)                   .setAudioOnly(false)                   .setWelcomePageEnabled(false)                   .build();            Toast.makeText(getReactApplicationContext(), message, duration).show();        } catch (MalformedURLException e) {            e.printStackTrace();        }        return options;    }}

This below packager will communicate to react native

public class CustomReactPackage implements ReactPackage {    @Override    public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {        return Collections.emptyList();    }    @Override    public List<NativeModule> createNativeModules(            ReactApplicationContext reactContext) {        List<NativeModule> modules = new ArrayList<>();        modules.add(new ToastModule(reactContext));        return modules;    }}

if i call CustomToastAndroid.show("Testing this package from andorid",100); this i can see toast message in my app but i need to access jitsi meet features.can nay one help on integrating this to react native

Ref:https://github.com/jitsi/jitsi-meet/blob/master/android/README.md#use-pre-build-sdk-artifactsbinaries

↧

React native gradlew assembleRelease build failed. Execution failed for task ':app:mergeReleaseResources'

$
0
0

I'm encountering with this error, when run ./gradlew assembleRelease. I've tinkering about in some hours. Help pls. It was once builded successfully but, after my attempts of clearing something and combining different folders from my git history, nothing could rescue.

FAILURE: Build failed with an exception.* What went wrong:Execution failed for task ':app:mergeReleaseResources'.> [raw/app] /home/horhi/code/projects/ankilan/android/app/src/main/res/raw/app.json [raw/app] /home/horhi/code/projects/ankilan/android/app/build/generated/res/react/release/raw/app.json: Error: Duplicate resources  [raw/node_modules_reactnativevectoricons_glyphmaps_materialcommunityicons] /home/horhi/code/projects/ankilan/android/app/src/main/res/raw/node_modules_reactnativevectoricons_glyphmaps_materialcommunityicons.json[raw/node_modules_reactnativevectoricons_glyphmaps_materialcommunityicons] /home/horhi/code/projects/ankilan/android/app/build/generated/res/react/release/raw/node_modules_reactnativevectoricons_glyphmaps_materialcommunityicons.json: Error: Duplicate resources  [raw/node_modules_reactnativevectoricons_glyphmaps_fontawesome5free_meta] /home/horhi/code/projects/ankilan/android/app/src/main/res/raw/node_modules_reactnativevectoricons_glyphmaps_fontawesome5free_meta.json[raw/node_modules_reactnativevectoricons_glyphmaps_fontawesome5free_meta] /home/horhi/code/projects/ankilan/android/app/build/generated/res/react/release/raw/node_modules_reactnativevectoricons_glyphmaps_fontawesome5free_meta.json: Error: Duplicate resources  [raw/node_modules_reactnativevectoricons_glyphmaps_fontawesome] /home/horhi/code/projects/ankilan/android/app/src/main/res/raw/node_modules_reactnativevectoricons_glyphmaps_fontawesome.json[raw/node_modules_reactnativevectoricons_glyphmaps_fontawesome] /home/horhi/code/projects/ankilan/android/app/build/generated/res/react/release/raw/node_modules_reactnativevectoricons_glyphmaps_fontawesome.json: Error: Duplicate resources  [raw/node_modules_reactnativevectoricons_glyphmaps_fontisto] /home/horhi/code/projects/ankilan/android/app/src/main/res/raw/node_modules_reactnativevectoricons_glyphmaps_fontisto.json   [raw/node_modules_reactnativevectoricons_glyphmaps_fontisto] /home/horhi/code/projects/ankilan/android/app/build/generated/res/react/release/raw/node_modules_reactnativevectoricons_glyphmaps_fontisto.json: Error: Duplicate resources  [raw/node_modules_reactnativevectoricons_glyphmaps_feather] /home/horhi/code/projects/ankilan/android/app/src/main/res/raw/node_modules_reactnativevectoricons_glyphmaps_feather.json[raw/node_modules_reactnativevectoricons_glyphmaps_feather] /home/horhi/code/projects/ankilan/android/app/build/generated/res/react/release/raw/node_modules_reactnativevectoricons_glyphmaps_feather.json: Error: Duplicate resources  [raw/node_modules_reactnativevectoricons_glyphmaps_entypo] /home/horhi/code/projects/ankilan/android/app/src/main/res/raw/node_modules_reactnativevectoricons_glyphmaps_entypo.json   [raw/node_modules_reactnativevectoricons_glyphmaps_entypo] /home/horhi/code/projects/ankilan/android/app/build/generated/res/react/release/raw/node_modules_reactnativevectoricons_glyphmaps_entypo.json: Error: Duplicate resources  [raw/node_modules_reactnativevectoricons_glyphmaps_ionicons] /home/horhi/code/projects/ankilan/android/app/src/main/res/raw/node_modules_reactnativevectoricons_glyphmaps_ionicons.json   [raw/node_modules_reactnativevectoricons_glyphmaps_ionicons] /home/horhi/code/projects/ankilan/android/app/build/generated/res/react/release/raw/node_modules_reactnativevectoricons_glyphmaps_ionicons.json: Error: Duplicate resources  [raw/node_modules_reactnativevectoricons_glyphmaps_fontawesome5free] /home/horhi/code/projects/ankilan/android/app/src/main/res/raw/node_modules_reactnativevectoricons_glyphmaps_fontawesome5free.json   [raw/node_modules_reactnativevectoricons_glyphmaps_fontawesome5free] /home/horhi/code/projects/ankilan/android/app/build/generated/res/react/release/raw/node_modules_reactnativevectoricons_glyphmaps_fontawesome5free.json: Error: Duplicate resources  [raw/node_modules_reactnativevectoricons_glyphmaps_simplelineicons] /home/horhi/code/projects/ankilan/android/app/src/main/res/raw/node_modules_reactnativevectoricons_glyphmaps_simplelineicons.json[raw/node_modules_reactnativevectoricons_glyphmaps_simplelineicons] /home/horhi/code/projects/ankilan/android/app/build/generated/res/react/release/raw/node_modules_reactnativevectoricons_glyphmaps_simplelineicons.json: Error: Duplicate resources  [raw/node_modules_reactnativevectoricons_glyphmaps_evilicons] /home/horhi/code/projects/ankilan/android/app/src/main/res/raw/node_modules_reactnativevectoricons_glyphmaps_evilicons.json [raw/node_modules_reactnativevectoricons_glyphmaps_evilicons] /home/horhi/code/projects/ankilan/android/app/build/generated/res/react/release/raw/node_modules_reactnativevectoricons_glyphmaps_evilicons.json: Error: Duplicate resources  [raw/node_modules_reactnativevectoricons_glyphmaps_materialicons] /home/horhi/code/projects/ankilan/android/app/src/main/res/raw/node_modules_reactnativevectoricons_glyphmaps_materialicons.json [raw/node_modules_reactnativevectoricons_glyphmaps_materialicons] /home/horhi/code/projects/ankilan/android/app/build/generated/res/react/release/raw/node_modules_reactnativevectoricons_glyphmaps_materialicons.json: Error: Duplicate resources  [raw/node_modules_reactnativevectoricons_glyphmaps_antdesign] /home/horhi/code/projects/ankilan/android/app/src/main/res/raw/node_modules_reactnativevectoricons_glyphmaps_antdesign.json [raw/node_modules_reactnativevectoricons_glyphmaps_antdesign] /home/horhi/code/projects/ankilan/android/app/build/generated/res/react/release/raw/node_modules_reactnativevectoricons_glyphmaps_antdesign.json: Error: Duplicate resources  [raw/node_modules_reactnativevectoricons_glyphmaps_foundation] /home/horhi/code/projects/ankilan/android/app/src/main/res/raw/node_modules_reactnativevectoricons_glyphmaps_foundation.json   [raw/node_modules_reactnativevectoricons_glyphmaps_foundation] /home/horhi/code/projects/ankilan/android/app/build/generated/res/react/release/raw/node_modules_reactnativevectoricons_glyphmaps_foundation.json: Error: Duplicate resources  [raw/node_modules_reactnativevectoricons_glyphmaps_octicons] /home/horhi/code/projects/ankilan/android/app/src/main/res/raw/node_modules_reactnativevectoricons_glyphmaps_octicons.json   [raw/node_modules_reactnativevectoricons_glyphmaps_octicons] /home/horhi/code/projects/ankilan/android/app/build/generated/res/react/release/raw/node_modules_reactnativevectoricons_glyphmaps_octicons.json: Error: Duplicate resources  [raw/node_modules_nativebase_dist_src_basic_icon_nbicons] /home/horhi/code/projects/ankilan/android/app/src/main/res/raw/node_modules_nativebase_dist_src_basic_icon_nbicons.json [raw/node_modules_nativebase_dist_src_basic_icon_nbicons] /home/horhi/code/projects/ankilan/android/app/build/generated/res/react/release/raw/node_modules_nativebase_dist_src_basic_icon_nbicons.json: Error: Duplicate resources  [raw/node_modules_reactnativevectoricons_glyphmaps_zocial] /home/horhi/code/projects/ankilan/android/app/src/main/res/raw/node_modules_reactnativevectoricons_glyphmaps_zocial.json   [raw/node_modules_reactnativevectoricons_glyphmaps_zocial] /home/horhi/code/projects/ankilan/android/app/build/generated/res/react/release/raw/node_modules_reactnativevectoricons_glyphmaps_zocial.json: Error: Duplicate resources* Try:Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output. Run with --scan to get full insights.* Get more help at https://help.gradle.orgDeprecated 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_warningsBUILD FAILED in 58s65 actionable tasks: 11 executed, 54 up-to-date
↧
Viewing all 29511 articles
Browse latest View live