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

React-native-webview - app crash on file selection from the webview

$
0
0

I am using react native webview to render web content in react native app.but as soon as i try to upload file from the webview it opens the file manager and on selection of file app gets crashed

i have granted the read and write external storage.

error in android studio

E/WebEngage: App has crashed    java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1, result=-1, data=Intent { dat=content://com.android.providers.media.documents/document/document:19 flg=0x1 }} to activity {com.xyz.user.debug/com.xyz.user.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.os.Bundle.getString(java.lang.String)' on a null object reference
<WebView          androidLayerType={'hardware'}          source={{uri: "https://imgbb.com/#google_vignette"}}          renderLoading={() => <AnimatedLoader isFullPageLoader={true}/>}          startInLoadingState={true}          style={{            marginTop: 0,            marginHorizontal: 0,            backgroundColor: 'white',            flex:1          }}          onNavigationStateChange={(e) => onNavigationStateChange(e)}          onRenderProcessGone={syntheticEvent => {            const { nativeEvent } = syntheticEvent;            console.log('WebView Crashed: ',              nativeEvent.didCrash,            );          }}          domStorageEnabled={true}          allowFileAccessFromFileURLs={true}          allowUniversalAccessFromFileURLs={true}          allowFileAccess={true}          mediaCapturePermissionGrantType={"prompt"}          androidHardwareAccelerationDisabled={true}        /> 

I have taken storage permission


ReactNative can't locate Android SDK

$
0
0

I've followed the installation instructions for ReactNative on the official site but can't get my project to build and install on any device. The issue seems to be that ReactNative can't seem to locate my Android SDK.

If I open the Android specific part of the project in Android Studio I can start the app, so the SDK is properly installed. Maybe related is also that I'm working on a Flutter app simultaneously and Flutter has no problems locating the Android SDK.

Running nix react-native doctor gives me the following:

Common✓ Node.js✓ yarn✓ Watchman - Used for watching changes in the filesystem when in development modeAndroid✓ JDK✓ Android Studio - Required for building and installing your app on Android✖ Android SDK - Required for building and installing your app on Android   - Versions found: N/A   - Version supported: 29.0.2✓ ANDROID_HOMEiOS✓ Xcode - Required for building and installing your app on iOS✓ CocoaPods - Required for installing iOS dependencies✓ ios-deploy - Required for installing your app on a physical device with the CLIErrors:   1Warnings: 0Attempting to fix 1 issue...Android✖ Android SDK   Read more about how to download Android SDK at https://reactnative.dev/docs/getting-started

However trying to "fix" the issue just takes me to the getting started page, and as I mentioned before I've done the installation exactly as described. I even tried removing everything related to Android from my computer and reinstalling everything from scratch.

Runnit nix react-native info gives me the following:

info Fetching system and libraries information...System:    OS: macOS 10.15.4    CPU: (8) x64 Intel(R) Core(TM) i7-3720QM CPU @ 2.60GHz    Memory: 1.97 GB / 16.00 GB    Shell: 5.7.1 - /bin/zsh  Binaries:    Node: 12.16.3 - /usr/local/bin/node    Yarn: 1.22.4 - /usr/local/bin/yarn    npm: 6.14.4 - /usr/local/bin/npm    Watchman: 4.9.0 - /usr/local/bin/watchman  Managers:    CocoaPods: 1.9.3 - /usr/local/bin/pod  SDKs:    iOS SDK:      Platforms: iOS 13.5, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2    Android SDK: Not Found  IDEs:    Android Studio: 4.0 AI-193.6911.18.40.6514223    Xcode: 11.5/11E608c - /usr/bin/xcodebuild  Languages:    Java: 14.0.1 - /usr/bin/javac    Python: 2.7.16 - /usr/bin/python  npmPackages:    @react-native-community/cli: Not Found    react: 16.11.0 => 16.11.0    react-native: 0.62.2 => 0.62.2  npmGlobalPackages:    *react-native*: Not Found

Which just further "proves" that ReactNative can't find the Android SDK.

What I've tried so far:

Adding a local.properties with the content:

sdk.dir=/Users/[username]/Library/Android/sdk

(And yes the folder exists and is correct, it's the same one set in Android Studio)

Updating the .zshrc with:

export ANDROID_HOME=$HOME/Library/Android/sdkexport ANDROID_SDK_ROOT=$HOME/Library/Android/sdkexport PATH=$PATH:$ANDROID_HOME/emulatorexport PATH=$PATH:$ANDROID_HOME/toolsexport PATH=$PATH:$ANDROID_HOME/tools/binexport PATH=$PATH:$ANDROID_HOME/platform-tools

And in that sdk-folder (in platforms) I have android-28, android-29 and android-30.I've also (of course) looked at a number of posts here from people with the same issue, but one of these two fixes almost always seems to solve the issue, however it doesn't work for me. What else is there to test?

UPDATE:I can also add that when running npx react-native run-android and tget the error: Task 'installDebug' not found in project ':app'.. But this problem should also be solved with the properties.local, which doesn't work for me.

How to implement a solid box-shadow effect in React Native?

$
0
0

Has anyone one else attempted to achieve this effect in React Native?:

Pressable Component with "solid shadow" effect

A component with a solid shadow effect to give an illusion of depth.

As you may know React-Native does not support CSS box-shadow. It does have a very close equivalent though, the shadowOffset property, which only works on iOS (What was used for the above example). And from what I gather Android's elevation property does not have a setting for blur radius to have it be solid.

I have tried the react-native-shadow and the react-native-shadow-2 packages. Both seem to have problems shadowing the actual component, it instead does it to the margins and doesn't seem to handle borderRadius either. Maybe missed something.

The closest cross-platform solution I could get was to add a thicker bottom borderWidth. But as you can see the appearance is still a bit off:

Image showing Pressable Component with borderWidth solution

If you have a solution for this design problem on Android, please lmk. There is no way there isn't a simple way to get such a simple effect, right?

I got an error in REACT NATIVE CLI App Installing

$
0
0

AwesomeProject@0.0.1 androidreact-native run-android

info Installing the app...

Configure project :react-native-reanimatedAndroid gradle plugin: 8.2.1Gradle: 8.6

Task :app:generateDebugBuildConfig FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/8.6/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.8 actionable tasks: 4 executed, 4 up-to-date

info 💡 Tip: Make sure that you have set up your development environment correctly, by running npx react-native doctor. To read more about doctor command visit: https://github.com/react-native-community/cli/blob/main/packages/cli-doctor/README.md#doctor

FAILURE: Build failed with an exception.

  • What went wrong:Execution failed for task ':app:generateDebugBuildConfig'.

Cannot access output property 'sourceOutputDir' of task ':app:generateDebugBuildConfig'. Accessing unreadable inputs or outputs is not supported. Declare the task as untracked by using Task.doNotTrackState(). For more information, please refer to https://docs.gradle.org/8.6/userguide/incremental_build.html#sec:disable-state-tracking in the Gradle documentation.java.io.IOException: Cannot snapshot C:\Users\suren\OneDrive\Desktop\BLE FINAL\AwesomeProject\android\app\build\generated\source\buildConfig\debug\com\awesomeproject\BuildConfig.java: not a regular file

  • 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 7serror Failed to install the app. Command failed with exit code 1: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081 FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:generateDebugBuildConfig'. > Cannot access output property 'sourceOutputDir' of task ':app:generateDebugBuildConfig'. Accessing unreadable inputs or outputs is not supported. Declare the task as untracked by using Task.doNotTrackState(). For more information, please refer to https://docs.gradle.org/8.6/userguide/incremental_build.html#sec:disable-state-tracking in the Gradle documentation. > java.io.IOException: Cannot snapshot C:\Users\suren\OneDrive\Desktop\BLE FINAL\AwesomeProject\android\app\build\generated\source\buildConfig\debug\com\awesomeproject\BuildConfig.java: not a regular file * 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 7s.info Run CLI with --verbose flag for more details.

React Native New Architecture and release 0.74.1

$
0
0

Will React Native's new architecture release keep it as the best option for cross-platform mobile app development in the future?

Flutter aims to provide better performance than React Native, but with React Native's new architecture using JSI (JavaScript Interface) in C++ to replace the old bridge architecture, which relied on serialization and deserialization processes, there is surely a massive performance improvement.

Additionally, in the latest React Native version 0.74.1, the batch rendering process on onLayout updates is also contributing to performance improvements. The Bridgeless is now enabled by default in 0.74.1 version and you do't need to enable it manually if you use new architecture in project.

react-native-image-picker launchCamera in not working in android

$
0
0

I'm using "react-native-image-picker": "^3.0.1" in react native for capture image. but I got error while opening the camera in android 9.

I got error :

{"errorCode": "others", "errorMessage": "This library does not require Manifest.permission.CAMERA, if you add this permission in manifest then you have to obtain the same."}

here is my code

ImagePicker.launchCamera(          {            includeBase64: false,            mediaType: 'photo',            quality: 0.8,          },          async (response) => {            if (response.didCancel) {              console.log('User cancelled image picker');            } else if (response.error) {              console.log('ImagePicker Error: ', response.error);            } else {            }          },        );

How to create Android instant app in React Native?

$
0
0

It seems like there isn't any examples, tutorials or guides on the internet for creating Android instant app with react native.

I have an existing react native app and I want to create an Android instant app. The existing app that was created in react native resides in the directory app, and the instant app I created natively resides in the directory instantapp. I can run this instantapp as an instant app in Android Studio, and all it does is to show a text "Hello instant app" on a blank screen.

I can write Android native code to add more ui and features to this instantapp natively, but I would like to do that in react native and using javascript instead of writing native Android code. How can I do that?

How to ask for notifications permission on Android using react-native 0.68?

$
0
0

My project is running on react-native 0.68.5 and I can't upgrade it, is there a way to ask for notifications using this react native version?

Right now it's working with previous Android versions, but I want my app to ask for these kind of permissions on newer android versions.


How to different the two appState in react-native: app go to background, or app ask permission

$
0
0

I am developing a bank react-native app, try to implement a feature that every time the app goes from background/inactive to active status, users need to verify TOUCHID.

What I did is to check the AppState:

    if (OldappState.match(/inactive|background/) &&      nextAppState === 'active'    ) {      checkLocalAuth()    }

It works fine, but I find a funny problem: when app ask permission, the AppState will become inactive, when user granted the permission the AppState becomes active, that is exactly the same with the behavior of the action described above.

But I don't want to ask for TOUCHID when asking permission, so how to differ the two situations?

Expo React Native StatusBar hidden but still showing whitespace

$
0
0

I'm pretty sure this is my first question I'm posting on here, so I hope I do this properly and provide all of the relevant information.

Context:

This is a twofold personal project. I am building this app strictly for my partner and I, so no major constraints and I'm open to all suggestions/recommendations. Her and I both travel often and speak several foreign languages, but we are both still learning more everyday and wish for a personalized app we can both use and share together, so I began to create this app for our communication and language development skills.

This project also happens to be a great opportunity for me to learn and grow my skills with React Native & native Kotlin/Swift development (I tried JavaFx for a while, but I'm a full-time front end web developer so React Native seems like a much more natural approach for UI development and Kotlin/Swift for native/back end).

It's essentially just a study app, combining features I like from Quizlet, Anki, Pimsleur, etc.., and combining some chat functionality amongst other things, but that's out of scope for this issue. Please see my problem statement for the main issue.

Problem statement:

I am having an issue with the StatusBar at the top of the screen still leaving a blank white space after setting it to be hidden. This issue is persisting despite everything I've tried and researching already.

Goal:

I wish to have this display either the background color I desire when the StatusBar is hidden, or the ImageBackground depending on which activity/screen it's on. i.e. No white space or notch at the top of the screen.

What I've already tried:

  • I've already tried backgroundColor as transparent and set the translucent property to true.
  • In app.json I've tried configuring it to use dark for the userInterfaceStyle property.
  • I've tried using react-native-safe-area-context package with their SafeAreaProvider around the entire app and used SafeAreaView around the component itself (I'm aware that the regular SafeAreaView is for iOS only and I need this for Android specifically, I just thought maybe this context package was worth a shot though).
  • Set backgroundColor to black
  • Set style to dark and barStyle to dark-content
  • I've tried using expo-status-bar and react-native StatusBar (oddly enough, even though I'm using expo, I had even more styling issues with the expo-status-bar)

I'm running out of ideas to try.. None of the above did anything when implementing it. As soon as I hide the StatusBar, I always have that white space at the top and it's quite annoying.

Code:

app.json

{"expo": {"name": "...","slug": "...","version": "1.0.0","orientation": "portrait","icon": "./assets/icon.png","userInterfaceStyle": "dark","splash": {"image": "./assets/....gif","resizeMode": "contain","backgroundColor": "#000000"    },"assetBundlePatterns": ["**/*"    ],"ios": {"supportsTablet": true,"bundleIdentifier": "com...."    },"android": {"package": "com....","adaptiveIcon": {"foregroundImage": "./assets/....gif","backgroundColor": "#000000"      }    },"androidStatusBar": {"barStyle": "dark-content","backgroundColor": "#000000","hidden": true,"translucent": true    },"web": {"favicon": "./assets/favicon.png"    }  }}

Flashcards.js

import { useState, useEffect } from 'react';import { View, Text, Pressable, StyleSheet, FlatList, Dimensions, ImageBackground, StatusBar } from 'react-native';import { SafeAreaView } from 'react-native-safe-area-context';import Logo from '../assets/....gif';const DEVICE_WIDTH = Dimensions.get('window').width;const SAMPLE = [  {    id: 0,    name: "Русскиекарточки",    description: "These are sample Russian flashcards.",  },  {    id: 1,    name: "Flashcards tiếng Việt",    description: "These are sample Vietnamese flashcards.",  },  {    id: 2,    name: '中文抽認卡',    description: 'These are sample Chinese flashcards.',  },  {    id: 3,    name: 'כרטיסיפלאשבעברית',    description: 'These are sample Hebrew flashcards.',  },  {    id: 4,    name: 'Data structures',    description: 'These are sample data structure flashcards.',  },  {    id: 5,    name: 'Countries',    description: 'These are sample culture flashcards from countries around the world.',  },  {    id: 6,    name: 'Cultures',    description: 'These are sample cultural tradition flashcards.',  },  {    id: 7,    name: 'Exercises',    description: 'These are sample flashcards about healthy exercises.',  },  {    id: 8,    name: 'Final',    description: 'This is the final collection just being used to see if it will make it scrollable.',  }];export default function Flashcards({ navigation }) {  const [collections, setCollections] = useState([]);  const [selectedCollection, setSelectedCollection] = useState(null);  useEffect(() => {    setCollections(SAMPLE)  }, [])  const Item = ({ name, onPress, description }) => (<Pressable onPress={onPress} style={styles.item}><Text style={styles.itemTitle}>{name}</Text><Text style={styles.itemDescription}>{description}</Text></Pressable>  );  const handleClick = (item) => {    setSelectedCollection(item.id);    navigation.navigate('StudyMode', {      name: item.name,    });  };  return (<SafeAreaView style={styles.container}><StatusBar        hidden        backgroundColor="black"        // translucent        style="dark"        barStyle="dark-content"      /><ImageBackground        source={Logo}        style={styles.image}        resizeMode="cover"><View style={styles.titleContainer}><Text style={styles.title}>Flashcards</Text></View><View style={styles.collectionsContainer}><FlatList            data={SAMPLE}            style={styles.flatlist}            renderItem={({ item }) => {              return <Item onPress={() => handleClick(item)} name={item.name} description={item.description} />            }}            keyExtractor={item => item.id}          /></View></ImageBackground></SafeAreaView>  )}const styles = StyleSheet.create({  container: {    flex: 1,    flexDirection: 'column',    marginTop: StatusBar.currentHeight + 10 || 10,    backgroundColor: '#000000',    alignItems: 'center',    justifyContent: 'center',    paddingBottom: 60,  },  image: {    flex: 1,    justifyContent: 'center',    contentFit: 'cover',  },  titleContainer: {    borderBottomWidth: 6,    borderColor: 'red',    borderRadius: 12,    backgroundColor: 'black',    justifyContent: 'center',    alignItems: 'center',    marginLeft: 12,    marginRight: 12,    marginTop: 14,    marginBottom: 10,  },  title: {    color: 'white',    fontFamily: 'Agright',    fontSize: 32,  },  collectionsContainer: {    borderWidth: 6,    borderColor: 'red',    borderRadius: 12,    backgroundColor: 'black',    width: DEVICE_WIDTH - 10,  },  flatlist: {    flexGrow: 0,    height: '100%',  },  item: {    borderRadius: 12,    borderWidth: 2,    borderColor: 'red',    width: '99%',    alignItems: 'center',    marginLeft: 2,    marginRight: 2,    marginTop: 6,    marginBottom: 6,    paddingVertical: 6,    backgroundColor: '#000000',  },  itemTitle: {    fontFamily: 'Agright',    fontSize: 26,    color: 'white',  },  itemDescription: {    fontFamily: 'Agright',    fontSize: 13,    color: 'white',  }});

App.js

import { useState, useEffect, useContext } from 'react';import { NavigationContainer } from '@react-navigation/native';import { createNativeStackNavigator } from '@react-navigation/native-stack';import { SafeAreaProvider } from 'react-native-safe-area-context';import * as SplashScreen from 'expo-splash-screen';import * as Font from 'expo-font';import { Platform, NativeModules } from 'react-native';import { IntlProvider } from 'react-intl';import en from './locales/en.json';import he from './locales/he.json';import ru from './locales/ru.json';import uk from './locales/uk.json';import vi from './locales/vi.json';import zh from './locales/zh.json';/** * Components */import Login from './screens/Login';import Home from './screens/Home';import Flashcards from './screens/Flashcards';import StudyMode from './screens/StudyMode';import Texts from './screens/Texts';import Translator from './screens/Translator';import Dictionary from './screens/Dictionary';import Chat from './screens/Chat';/** * Hooks */import useFonts from './hooks/useFonts';/** * Context */import { LocaleContextProvider, LocaleContext } from './context/LocaleContext';import { DbContextProvider } from './database/DbContext';/** * Messages (Localization) */const messages = {'en': en,'en_US': en,'he': he,'ru': ru,'uk': uk,'vi': vi,'zh': zh,};const devicePlatform = Platform.OS;const _deviceLocale = devicePlatform === 'android' ?  NativeModules.I18nManager.localeIdentifier :  NativeModules.SettingsManager.settings.AppleLocale ||  NativeModules.SettingsManager.settings.AppleLanguages[0];const deviceLocale = _deviceLocale.split(/[-_]/)[0];SplashScreen.preventAutoHideAsync();const Stack = createNativeStackNavigator();const screenOptions = {  headerStyle: {    backgroundColor: '#000000',  },  headerTintColor: '#ffffff',  headerTitleStyle: {    fontFamily: 'Agright',    textAlign: 'center'  },  headerTitleAlign: 'center',};export default function App() {  const [appIsReady, setAppIsReady] = useState(false);  const [isAuthNd, setIsAuthNd] = useState(false);  const [isVisible, setIsVisible] = useState(false);  const [fontsLoaded] = Font.useFonts({    Agright: require('./assets/fonts/AgrightRegular-qZ5dr.otf'),  })  const { changeLanguage, currentLang } = useContext(LocaleContext);  const loadFonts = async () => {    try {      await Font.loadAsync({        Agright: require('./assets/fonts/AgrightRegular-qZ5dr.otf'),        Fridays: require('./assets/fonts/Fridays-AWjM.ttf'),        MyChemicalRomance: require('./assets/fonts/MyChemicalRomance-1X5Z.ttf'),        Toxia: require('./assets/fonts/Toxia-OwOA.ttf'),        Varukers: require('./assets/fonts/VarukersPersonalUse-K70Be.ttf'),      });    } catch (err) {      console.error(err, err.stack);    } finally {      setAppIsReady(true);    }  };  const loadHomeScreen = async () => {    if (appIsReady) {      await SplashScreen.hideAsync();    }  };  useEffect(() => {    if (fontsLoaded) {      setAppIsReady(true);    }  }, [fontsLoaded]);  useEffect(() => {    if (appIsReady) {      loadHomeScreen();    }  }, [appIsReady])  if (!fontsLoaded) {    return null;  }  return (<SafeAreaProvider><DbContextProvider><LocaleContextProvider><IntlProvider messages={messages[currentLang]} locale={deviceLocale} defaultLocale="en"><NavigationContainer><Stack.Navigator>                {!isAuthNd                  ? (<Stack.Screen                      name="Login"                      component={Login}                      options={{                        ...screenOptions,                        headerShown: false,                      }}                    />                  )                  : (<Stack.Screen                      name="Home"                      component={Home}                      options={{                        ...screenOptions,                        headerShown: false,                      }}                    />                  )                }<Stack.Screen                  name="Home"                  component={Home}                  options={{                    ...screenOptions,                    headerShown: false,                  }}                /><Stack.Screen                  name="Flashcards"                  component={Flashcards}                  options={{                    ...subScreenOptions,                    headerShown: false,                  }}                /><Stack.Screen                  name="StudyMode"                  component={StudyMode}                  options={{                    ...subScreenOptions,                    headerShown: false,                  }}                /><Stack.Screen                  name="Texts"                  component={Texts}                  options={{                    ...subScreenOptions,                    headerShown: false,                  }}                /><Stack.Screen                  name="Translator"                  component={Translator}                  options={{                    ...subScreenOptions,                    headerShown: false,                  }}                /><Stack.Screen                  name="Dictionary"                  component={Dictionary}                  options={{                    ...screenOptions,                    headerShown: false,                  }}                /><Stack.Screen                  name="Chat"                  component={Chat}                  options={{                    ...subScreenOptions,                    headerShown: false,                  }}                /></Stack.Navigator></NavigationContainer></IntlProvider></LocaleContextProvider></DbContextProvider></SafeAreaProvider>  );}

Using

"dependencies": {"@react-navigation/native": "^6.1.6","@react-navigation/native-stack": "^6.9.12","@react-oauth/google": "^0.11.0","axios": "^1.4.0","expo": "~48.0.15","expo-application": "~5.1.1","expo-asset": "~8.9.1","expo-auth-session": "~4.0.3","expo-crypto": "~12.2.1","expo-file-system": "~15.2.2","expo-font": "^11.1.1","expo-image": "~1.0.1","expo-splash-screen": "~0.18.2","expo-sqlite": "~11.1.1","expo-web-browser": "~12.1.1","isaac": "^0.0.5","react": "18.2.0","react-intl": "^6.4.4","react-native": "0.71.8","react-native-bcrypt": "^2.4.0","react-native-crypto": "^2.2.0","react-native-safe-area-context": "4.5.0","uuid": "^9.0.0","expo-system-ui": "~2.2.1"  },"devDependencies": {"@babel/core": "^7.20.0"  },

Thank you so much for your help!

How do I add a background image to my splash screen on android created with react-native-bootsplash?

$
0
0

I am trying to add a background image to my splash screen in my react native app, on IOS I added it manually on android I am getting some weird behavior.I am using react-native-bootsplash v5.4.1

I modified my styles.xml

<resources><!-- Base application theme. --><style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar"><!-- Customize your theme here. --><item name="android:editTextBackground">@drawable/rn_edit_text_material</item></style><style name="BootTheme" parent="Theme.BootSplash"><item name="bootSplashBackground">@color/bootsplash_background</item><item name="bootSplashLogo">@drawable/bootsplash_logo</item><item name="android:windowBackground">@drawable/bootsplash</item> //added this<item name="postBootSplashTheme">@style/AppTheme</item></style></resources>

And in my drawable I added bootsplash.xml

<?xml version="1.0" encoding="utf-8"?><layer-list xmlns:android="http://schemas.android.com/apk/res/android"><item><bitmap            android:gravity="fill"            android:src="@drawable/splash" /></item></layer-list>

My issue is that first I am seeing the splash screen created with react-native-bootsplash (just a background color and the logo) and after it hides I see my background image.

How can I make my background image appear together with the original splash, is this causing a double splash?

Why is my scrollview not scrolling with masked view

$
0
0
import MaskedView from '@react-native-masked-view/masked-view';import React, { useRef, useState } from 'react';import { View, Animated, Button, Image, Text } from 'react-native';import { ScrollView } from 'react-native-gesture-handler';const App = () => {  // Define animated values for flex and borderRadius  const flexValue = useRef(new Animated.Value(0.8)).current;  const borderRadiusValue = useRef(new Animated.Value(100)).current;  const marginTopValue = useRef(new Animated.Value(50)).current;  const marginHorzValue = useRef(new Animated.Value(20)).current;  // State to track the current state of animation  const [isAnimating, setIsAnimating] = useState(false);  // Function to toggle the animation  const toggleAnimation = () => {    // If animation is already running, stop it    if (isAnimating) {      // Start the animation for flex      Animated.timing(flexValue, {        toValue: 0.8, // target value for flex        duration: 1000,        useNativeDriver: false,      }).start();      // Start the animation for borderRadius      Animated.timing(borderRadiusValue, {        toValue: 100, // target value for borderRadius        duration: 1000,        useNativeDriver: false,      }).start();      Animated.timing(marginTopValue, {        toValue: 50, // target value for flex        duration: 1000,        useNativeDriver: false,      }).start();      // Start the animation for borderRadius      Animated.timing(marginHorzValue, {        toValue: 20, // target value for borderRadius        duration: 1000,        useNativeDriver: false,      }).start();    } else {      // Start the animation for flex      Animated.timing(flexValue, {        toValue: 1, // target value for flex        duration: 1000,        useNativeDriver: false,      }).start();      // Start the animation for borderRadius      Animated.timing(borderRadiusValue, {        toValue: 0, // target value for borderRadius        duration: 1000,        useNativeDriver: false,      }).start();      Animated.timing(marginTopValue, {        toValue: 0, // target value for flex        duration: 1000,        useNativeDriver: false,      }).start();      // Start the animation for borderRadius      Animated.timing(marginHorzValue, {        toValue: 0, // target value for borderRadius        duration: 1000,        useNativeDriver: false,      }).start();    }    // Toggle the animation state    setIsAnimating(!isAnimating);  };  return (<View style={{flex: 1}}><ScrollView contentContainerStyle={{flex: 1}}><View          style={{            flex: 0.8,            backgroundColor: '#2E6D3E', // "Edge" background            maxHeight: '100%',          }}><MaskedView            style={{ flex: 1 }}            maskElement={<View                style={{                  // Transparent background mask                  backgroundColor: '#0000001', // The '77' here sets the alpha                  flex: 1,                }}>                {/* Animated view for flex and borderRadius */}<Animated.View                  style={{                    // Solid background as the aperture of the lens-eye.                    backgroundColor: '#ff00ff',                    // If you have a set height or width, set this to half                    borderRadius: borderRadiusValue,                    flex: flexValue,                    marginTop: marginTopValue,                    marginHorizontal: marginHorzValue,                  }}                /></View>            }>            {/* Shows behind the mask, you can put anything here, such as an image */}<Image              source={{ uri: 'https://via.placeholder.com/300' }}              style={{ flex: 1, height: '100%' }}            /></MaskedView></View>        {/* Button to toggle animation */}<View          style={{            alignItems: 'center',            flex: 0.2,            // bottom: 20,            // left: 120,            // position: 'absolute',          }}><Button            title={isAnimating ? 'Stop Animation' : 'Start Animation'}            onPress={toggleAnimation}          /><Text>"Some Text"</Text><Text>"Some Text"</Text><Text>"Some Text"</Text><Text>"Some Text"</Text><Text>"Some Text"</Text><Text>"Some Text"</Text><Text>"Some Text"</Text><Text>"Some Text"</Text><Text>"Some Text"</Text><Text>"Some Text"</Text><Text>"Some Text"</Text><Text>"Some Text"</Text><Text>"Some Text"</Text><Text>"Some Text"</Text><Text>"Some Text"</Text><Text>"Some Text"</Text><Text>"Some Text"</Text><Text>"Some Text"</Text><Text>"Some Text"</Text><Text>"Some Text"</Text><Text>"Some Text"</Text><Text>"Some Text"</Text><Text>"Some Text"</Text><Text>"Some Text"</Text><Text>"Some Text"</Text><Text>"Some Text"</Text><Text>"Some Text"</Text><Text>"Some Text"</Text><Text>"Some Text"</Text><Text>"Some Text"</Text><Text>"Some Text"</Text><Text>"Some Text"</Text><Text>"Some Text"</Text><Text>"Some Text"</Text><Text>"Some Text"</Text><Text>"Some Text"</Text><Text>"Some Text"</Text><Text>"Some Text"</Text><Text>"Some Text"</Text><Text>"Some Text"</Text><Text>"Some Text"</Text><Text>"Some Text"</Text><Text>"Some Text"</Text><Text>"Some Text"</Text><Text>"Some Text"</Text><Text>"Some Text"</Text><Text>"Some Text"</Text><Text>"Some Text"</Text></View></ScrollView></View>  );};export default App;

Why is the above ScrollView not scrolling even though content height is extending beyond screen size?

Expo link: https://snack.expo.dev/@mmt10470/react-native-mask

React Native - Linking.openUrl() - Android 14

$
0
0

I'm getting this error [Error: Could not open URL 'micoope://app/cuenta/token': No Activity found to handle Intent { act=android.intent.action.VIEW dat=micoope://app/... }] trying to open a deeplink from my react native app. I know it is product of the new Security Policy described here

However I'm not sure if I should implement the modification of the creation of the explicit intent within my project (i don't even know in which file should i do it), or that should be done by the React Native development team. I'll appreciate any kind of help.

Here is my AndroidManifest file:

<activity    android:name=".MainActivity"    android:label="@string/app_name"    android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"    android:launchMode="singleTask"    android:windowSoftInputMode="adjustResize"    android:exported="false"    android:screenOrientation="portrait"><intent-filter><action android:name="android.intent.action.VIEW" /><category android:name="android.intent.category.DEFAULT" /><category android:name="android.intent.category.BROWSABLE" /><data android:scheme="micoope" android:host="app" /></intent-filter></activity>

Unable to find gradle-8.6-all.zip in React Native

$
0
0

I'm developing a mobile application using React Native, and when I run the react-native run-android command, I encounter the following error:

error Failed to install the app. Command failed with exit code 1: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081Exception in thread "main" java.io.FileNotFoundException: C:\Users\omers\OneDrive\Desktop\react_native\mymobileapp\android\gradle\wrapper\gradle-8.6-all.zip (Sistem belirtilen dosyay� bulam�yor) at java.base/java.io.FileInputStream.open0(Native Method) at java.base/java.io.FileInputStream.open(FileInputStream.java:213) at java.base/java.io.FileInputStream.<init>(FileInputStream.java:152) at java.base/java.io.FileInputStream.<init>(FileInputStream.java:106) at java.base/sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:84) at java.base/sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:180) at org.gradle.wrapper.Download.downloadInternal(Download.java:129) at org.gradle.wrapper.Download.download(Download.java:109) at org.gradle.wrapper.Install.forceFetch(Install.java:171) at org.gradle.wrapper.Install.fetchDistribution(Install.java:104) at org.gradle.wrapper.Install.access$400(Install.java:46) at org.gradle.wrapper.Install$1.call(Install.java:81) at org.gradle.wrapper.Install$1.call(Install.java:68) at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:69) at org.gradle.wrapper.Install.createDist(Install.java:68) at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:102) at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:66).

This error indicates that Gradle cannot find the gradle-8.6-all.zip file. However, when I check the file path, I can see that the file exists.

I have updated the distributionUrl in the gradle-wrapper.properties file to gradle-8.6-all.zip.I have checked my internet connection and verified that there are no issues.I have tried running CMD as an administrator, but the issue persists.What can I do to resolve this issue?

Environment:

  • Windows 10
  • React Native
  • Gradle 8.6

React Native Module - Unable to Retrieve Phone Number

$
0
0

I have implemented a React Native module (PhoneNumberHintModule) to retrieve phone numbers using the Smart Lock for Passwords API. The native module appears to be correctly implemented, and I have added the necessary event listener in my React Native code. However, I am facing an issue where the phone number is not being retrieved successfully.

Here is my PhoneNumberHintModule native module code:

public class PhoneNumberHintModule extends ReactContextBaseJavaModule {    private static ReactApplicationContext reactContext;    private static final int CREDENTIAL_PICKER_REQUEST = 1;    private static Promise mPromise;    private static final String EVENT_PHONE_NUMBER_SELECTED = "phoneNumberSelected";    private final BaseActivityEventListener activityEventListener = new BaseActivityEventListener() {        @Override        public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) {            PhoneNumberHintModule.this.onActivityResult(requestCode, resultCode, data);        }    };    public PhoneNumberHintModule(ReactApplicationContext context) {        super(context);        reactContext = context;        if (reactContext != null) {            reactContext.addActivityEventListener(activityEventListener);        }    }    @NonNull    @Override    public String getName() {        return "PhoneNumberHintModule";    }    @ReactMethod    public void getPhoneNumberHint(final Promise promise) {        mPromise = promise;        final Activity currentActivity = getCurrentActivity();        if (currentActivity == null) {            promise.reject("ACTIVITY_NOT_AVAILABLE", "Activity is not available");            return;        }        Context context = getReactApplicationContext();        HintRequest hintRequest = new HintRequest.Builder()                .setPhoneNumberIdentifierSupported(true)                .build();        IntentSender intent = Credentials.getClient(context).getHintPickerIntent(hintRequest).getIntentSender();        try {            currentActivity.startIntentSenderForResult(                    intent,                    CREDENTIAL_PICKER_REQUEST,                    null,                    0,                    0,                    0,                    new Bundle()            );        } catch (IntentSender.SendIntentException e) {            e.printStackTrace();            sendErrorToReactNative("SEND_INTENT_ERROR", e.getMessage());        }    }    private void onActivityResult(int requestCode, int resultCode, Intent data) {        if (requestCode == CREDENTIAL_PICKER_REQUEST) {            if (resultCode == Activity.RESULT_OK) {                handleCredentialResult(data);            } else {                sendErrorToReactNative("RESULT_NOT_OK", "Result code is not OK");            }        }    }    private void handleCredentialResult(Intent data) {        if (data != null) {            Credential credential = data.getParcelableExtra(Credential.EXTRA_KEY);            if (credential != null) {                String phoneNumber = credential.getId();                if (phoneNumber != null) {                    emitPhoneNumberSelectedEvent(phoneNumber);                    if (mPromise != null) {                        mPromise.resolve(phoneNumber);                    }                } else {                    sendErrorToReactNative("PHONE_NUMBER_NULL", "Phone number is null");                }            } else {                sendErrorToReactNative("CREDENTIAL_NULL", "Credential is null");            }        } else {            sendErrorToReactNative("DATA_NULL", "Intent data is null");        }    }    private void emitPhoneNumberSelectedEvent(String phoneNumber) {        if (reactContext != null) {            reactContext                    .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)                    .emit(EVENT_PHONE_NUMBER_SELECTED, phoneNumber);        }    }    private void sendErrorToReactNative(String code, String message) {        if (mPromise != null) {            mPromise.reject(code, message);        }    }}

And here is my React Native code:

useEffect(() => {    const subscription = phoneNumberHintModuleEventEmitter.addListener('phoneNumberSelected',      phoneNumber => {        console.log('Received phone number:', phoneNumber);      },    );    return () => {      subscription.remove();    };  }, []);  const handleOpenHint = async () => {    try {      const phoneNumber = await PhoneNumberHintModule.getPhoneNumberHint();      console.log('Selected phone number:', phoneNumber);    } catch (error) {      console.error('Error fetching phone number hint:', error);    }  };

I have added the event listener in my React Native code to listen for the 'phoneNumberSelected' event, but the callback is not being triggered.

I suspect the issue might be related to the native module or the way I am handling the event in React Native. Can someone please review my code and provide insights into why the phone number might not be retrieved successfully?

Thank you in advance for your assistance!


import io.invertase.firebase.crashlytics.ReactNativeFirebaseCrashlyticsNativeHelper;

$
0
0

Using react native firebase crashlytics.. While importing this library: "import io.invertase.firebase.crashlytics.ReactNativeFirebaseCrashlyticsNativeHelper;"`the 'io' line is underlined with error: expected = and unable to import and use the further code:I tried to import Crashlytics library from firebase but its not working.

<Button title="Crash Button"     onPress={    try {    //...    } catch (Exception e) {    ReactNativeFirebaseCrashlyticsNativeHelper.recordNativeException(e);    return null;    }}  />

How can I call activity written in JS (hybrid) from Native code through an intent

$
0
0

In a hybrid mobile app, I used a native component for an App Widget. How can I call an activity written in JavaScript as intent from my native side?

Any suggestions how to call it with Plugins, JS bridge, HeadlessJS or WebView

Problem with android build for expo reactnative app

$
0
0

I have problem with react-native android build with gradle.I fixed some of them but i don't know how to fix this problem.The gradel get error from line 5 of settings.gradle files. that dosnt have any problem.

My project is a expo react-native 0.73.4 project. and the gradel version is 7.3.1 and expo version is ~50.0.7

Settings file 'F:\Projects\ReactNative\nativeapp\android\settings.gradle' line: 5A problem occurred evaluating settings 'MyApp'.> Using dependency catalogs requires the activation of the matching feature preview.  See the documentation at https://docs.gradle.org/7.3.1/userguide/platforms.html#sub:central-declaration-of-dependencies* Try:> Run with --info or --debug option to get more log output.> Run with --scan to get full insights.* Exception is:org.gradle.api.GradleScriptException: A problem occurred evaluating settings 'MyApp'.    at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:93)    at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.lambda$apply$0(DefaultScriptPluginFactory.java:133)    at org.gradle.configuration.DefaultScriptTarget.addConfiguration(DefaultScriptTarget.java:74)    at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:136)    at org.gradle.configuration.BuildOperationScriptPlugin$1.run(BuildOperationScriptPlugin.java:65)    at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)    at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)    at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)    at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)    at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)    at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)    at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:47)    at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:68)    at org.gradle.configuration.BuildOperationScriptPlugin.lambda$apply$0(BuildOperationScriptPlugin.java:62)    at org.gradle.configuration.internal.DefaultUserCodeApplicationContext.apply(DefaultUserCodeApplicationContext.java:44)    at org.gradle.configuration.BuildOperationScriptPlugin.apply(BuildOperationScriptPlugin.java:62)    at org.gradle.initialization.ScriptEvaluatingSettingsProcessor.applySettingsScript(ScriptEvaluatingSettingsProcessor.java:74)    at org.gradle.initialization.ScriptEvaluatingSettingsProcessor.process(ScriptEvaluatingSettingsProcessor.java:67)    at org.gradle.initialization.SettingsEvaluatedCallbackFiringSettingsProcessor.process(SettingsEvaluatedCallbackFiringSettingsProcessor.java:34)    at org.gradle.initialization.RootBuildCacheControllerSettingsProcessor.process(RootBuildCacheControllerSettingsProcessor.java:47)    at org.gradle.initialization.BuildOperationSettingsProcessor$2.call(BuildOperationSettingsProcessor.java:50)    at org.gradle.initialization.BuildOperationSettingsProcessor$2.call(BuildOperationSettingsProcessor.java:47)    at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204)    at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:199)    at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)    at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)    at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)    at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)    at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53)    at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:73)    at org.gradle.initialization.BuildOperationSettingsProcessor.process(BuildOperationSettingsProcessor.java:47)    at org.gradle.initialization.DefaultSettingsLoader.findSettingsAndLoadIfAppropriate(DefaultSettingsLoader.java:136)    at org.gradle.initialization.DefaultSettingsLoader.findAndLoadSettings(DefaultSettingsLoader.java:62)    at org.gradle.initialization.SettingsAttachingSettingsLoader.findAndLoadSettings(SettingsAttachingSettingsLoader.java:34)    at org.gradle.internal.composite.CommandLineIncludedBuildSettingsLoader.findAndLoadSettings(CommandLineIncludedBuildSettingsLoader.java:34)    at org.gradle.internal.composite.ChildBuildRegisteringSettingsLoader.findAndLoadSettings(ChildBuildRegisteringSettingsLoader.java:48)    at org.gradle.internal.composite.CompositeBuildSettingsLoader.findAndLoadSettings(CompositeBuildSettingsLoader.java:35)    at org.gradle.initialization.InitScriptHandlingSettingsLoader.findAndLoadSettings(InitScriptHandlingSettingsLoader.java:34)    at org.gradle.initialization.GradlePropertiesHandlingSettingsLoader.findAndLoadSettings(GradlePropertiesHandlingSettingsLoader.java:39)    at org.gradle.initialization.DefaultSettingsPreparer.prepareSettings(DefaultSettingsPreparer.java:31)    at org.gradle.initialization.BuildOperationFiringSettingsPreparer$LoadBuild.doLoadBuild(BuildOperationFiringSettingsPreparer.java:62)    at org.gradle.initialization.BuildOperationFiringSettingsPreparer$LoadBuild.run(BuildOperationFiringSettingsPreparer.java:57)    at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)    at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)    at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)    at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)    at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)    at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)    at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:47)    at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:68)    at org.gradle.initialization.BuildOperationFiringSettingsPreparer.prepareSettings(BuildOperationFiringSettingsPreparer.java:45)    at org.gradle.initialization.VintageBuildModelController.lambda$prepareSettings$0(VintageBuildModelController.java:89)    at org.gradle.internal.build.StateTransitionController.lambda$doTransition$1(StateTransitionController.java:222)    at org.gradle.internal.build.StateTransitionController.doTransition(StateTransitionController.java:243)    at org.gradle.internal.build.StateTransitionController.doTransition(StateTransitionController.java:221)    at org.gradle.internal.build.StateTransitionController.transitionIfNotPreviously(StateTransitionController.java:190)    at org.gradle.initialization.VintageBuildModelController.prepareSettings(VintageBuildModelController.java:89)    at org.gradle.initialization.VintageBuildModelController.doBuildStages(VintageBuildModelController.java:73)    at org.gradle.initialization.VintageBuildModelController.getLoadedSettings(VintageBuildModelController.java:52)    at org.gradle.internal.build.StateTransitionController.notInStateIgnoreOtherThreads(StateTransitionController.java:89)    at org.gradle.internal.build.DefaultBuildLifecycleController.getLoadedSettings(DefaultBuildLifecycleController.java:92)    at org.gradle.internal.build.AbstractBuildState.ensureProjectsLoaded(AbstractBuildState.java:60)    at org.gradle.plugins.ide.internal.tooling.GradleBuildBuilder.create(GradleBuildBuilder.java:58)    at org.gradle.plugins.ide.internal.tooling.GradleBuildBuilder.create(GradleBuildBuilder.java:38)    at org.gradle.tooling.provider.model.internal.DefaultToolingModelBuilderRegistry$BuildScopedBuilder.build(DefaultToolingModelBuilderRegistry.java:205)    at org.gradle.tooling.provider.model.internal.DefaultToolingModelBuilderRegistry$LockAllProjectsBuilder.lambda$build$0(DefaultToolingModelBuilderRegistry.java:317)    at org.gradle.api.internal.project.DefaultProjectStateRegistry.withMutableStateOfAllProjects(DefaultProjectStateRegistry.java:160)    at org.gradle.tooling.provider.model.internal.DefaultToolingModelBuilderRegistry$LockAllProjectsBuilder.build(DefaultToolingModelBuilderRegistry.java:317)    at org.gradle.tooling.provider.model.internal.DefaultToolingModelBuilderRegistry$BuildOperationWrappingBuilder$1.call(DefaultToolingModelBuilderRegistry.java:338)    at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204)    at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:199)    at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)    at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)    at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)    at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)    at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53)    at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:73)    at org.gradle.tooling.provider.model.internal.DefaultToolingModelBuilderRegistry$BuildOperationWrappingBuilder.build(DefaultToolingModelBuilderRegistry.java:335)    at org.gradle.tooling.internal.provider.runner.DefaultBuildController.getModel(DefaultBuildController.java:102)    at org.gradle.tooling.internal.consumer.connection.ParameterAwareBuildControllerAdapter.getModel(ParameterAwareBuildControllerAdapter.java:39)    at org.gradle.tooling.internal.consumer.connection.UnparameterizedBuildController.getModel(UnparameterizedBuildController.java:113)    at org.gradle.tooling.internal.consumer.connection.NestedActionAwareBuildControllerAdapter.getModel(NestedActionAwareBuildControllerAdapter.java:31)    at org.gradle.tooling.internal.consumer.connection.UnparameterizedBuildController.getModel(UnparameterizedBuildController.java:76)    at org.gradle.tooling.internal.consumer.connection.NestedActionAwareBuildControllerAdapter.getModel(NestedActionAwareBuildControllerAdapter.java:31)    at org.gradle.tooling.internal.consumer.connection.UnparameterizedBuildController.getBuildModel(UnparameterizedBuildController.java:71)    at org.gradle.tooling.internal.consumer.connection.NestedActionAwareBuildControllerAdapter.getBuildModel(NestedActionAwareBuildControllerAdapter.java:31)    at org.jetbrains.plugins.gradle.model.ProjectImportAction.execute(ProjectImportAction.java:116)    at org.jetbrains.plugins.gradle.model.ProjectImportAction.execute(ProjectImportAction.java:42)    at org.gradle.tooling.internal.consumer.connection.InternalBuildActionAdapter.execute(InternalBuildActionAdapter.java:64)    at org.gradle.tooling.internal.provider.runner.AbstractClientProvidedBuildActionRunner$ActionAdapter.runAction(AbstractClientProvidedBuildActionRunner.java:131)    at org.gradle.tooling.internal.provider.runner.AbstractClientProvidedBuildActionRunner$ActionAdapter.beforeTasks(AbstractClientProvidedBuildActionRunner.java:99)    at org.gradle.internal.buildtree.DefaultBuildTreeModelCreator.beforeTasks(DefaultBuildTreeModelCreator.java:57)    at org.gradle.internal.buildtree.DefaultBuildTreeLifecycleController.lambda$fromBuildModel$1(DefaultBuildTreeLifecycleController.java:72)    at org.gradle.internal.buildtree.DefaultBuildTreeLifecycleController.lambda$runBuild$4(DefaultBuildTreeLifecycleController.java:103)    at org.gradle.internal.build.StateTransitionController.lambda$transition$0(StateTransitionController.java:145)    at org.gradle.internal.build.StateTransitionController.doTransition(StateTransitionController.java:243)    at org.gradle.internal.build.StateTransitionController.transition(StateTransitionController.java:145)    at org.gradle.internal.buildtree.DefaultBuildTreeLifecycleController.runBuild(DefaultBuildTreeLifecycleController.java:100)    at org.gradle.internal.buildtree.DefaultBuildTreeLifecycleController.fromBuildModel(DefaultBuildTreeLifecycleController.java:71)    at org.gradle.tooling.internal.provider.runner.AbstractClientProvidedBuildActionRunner.runClientAction(AbstractClientProvidedBuildActionRunner.java:43)    at org.gradle.tooling.internal.provider.runner.ClientProvidedPhasedActionRunner.run(ClientProvidedPhasedActionRunner.java:53)    at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)    at org.gradle.internal.buildtree.ProblemReportingBuildActionRunner.run(ProblemReportingBuildActionRunner.java:49)    at org.gradle.launcher.exec.BuildOutcomeReportingBuildActionRunner.run(BuildOutcomeReportingBuildActionRunner.java:69)    at org.gradle.tooling.internal.provider.FileSystemWatchingBuildActionRunner.run(FileSystemWatchingBuildActionRunner.java:114)    at org.gradle.launcher.exec.BuildCompletionNotifyingBuildActionRunner.run(BuildCompletionNotifyingBuildActionRunner.java:41)    at org.gradle.launcher.exec.RootBuildLifecycleBuildActionExecutor.lambda$execute$0(RootBuildLifecycleBuildActionExecutor.java:40)    at org.gradle.composite.internal.DefaultRootBuildState.run(DefaultRootBuildState.java:155)    at org.gradle.launcher.exec.RootBuildLifecycleBuildActionExecutor.execute(RootBuildLifecycleBuildActionExecutor.java:40)    at org.gradle.internal.buildtree.DefaultBuildTreeContext.execute(DefaultBuildTreeContext.java:40)    at org.gradle.launcher.exec.BuildTreeLifecycleBuildActionExecutor.lambda$execute$0(BuildTreeLifecycleBuildActionExecutor.java:65)    at org.gradle.internal.buildtree.BuildTreeState.run(BuildTreeState.java:53)    at org.gradle.launcher.exec.BuildTreeLifecycleBuildActionExecutor.execute(BuildTreeLifecycleBuildActionExecutor.java:65)    at org.gradle.launcher.exec.RunAsBuildOperationBuildActionExecutor$3.call(RunAsBuildOperationBuildActionExecutor.java:61)    at org.gradle.launcher.exec.RunAsBuildOperationBuildActionExecutor$3.call(RunAsBuildOperationBuildActionExecutor.java:57)    at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204)    at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:199)    at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)    at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)    at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)    at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)    at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53)    at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:73)    at org.gradle.launcher.exec.RunAsBuildOperationBuildActionExecutor.execute(RunAsBuildOperationBuildActionExecutor.java:57)    at org.gradle.launcher.exec.RunAsWorkerThreadBuildActionExecutor.lambda$execute$0(RunAsWorkerThreadBuildActionExecutor.java:38)    at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:211)    at org.gradle.launcher.exec.RunAsWorkerThreadBuildActionExecutor.execute(RunAsWorkerThreadBuildActionExecutor.java:38)    at org.gradle.tooling.internal.provider.ContinuousBuildActionExecutor.execute(ContinuousBuildActionExecutor.java:103)    at org.gradle.tooling.internal.provider.SubscribableBuildActionExecutor.execute(SubscribableBuildActionExecutor.java:64)    at org.gradle.internal.session.DefaultBuildSessionContext.execute(DefaultBuildSessionContext.java:46)    at org.gradle.tooling.internal.provider.BuildSessionLifecycleBuildActionExecuter$ActionImpl.apply(BuildSessionLifecycleBuildActionExecuter.java:100)    at org.gradle.tooling.internal.provider.BuildSessionLifecycleBuildActionExecuter$ActionImpl.apply(BuildSessionLifecycleBuildActionExecuter.java:88)    at org.gradle.internal.session.BuildSessionState.run(BuildSessionState.java:69)    at org.gradle.tooling.internal.provider.BuildSessionLifecycleBuildActionExecuter.execute(BuildSessionLifecycleBuildActionExecuter.java:62)    at org.gradle.tooling.internal.provider.BuildSessionLifecycleBuildActionExecuter.execute(BuildSessionLifecycleBuildActionExecuter.java:41)    at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:36)    at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:25)    at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:63)    at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:31)    at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:58)    at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:42)    at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:47)    at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:31)    at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:65)    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:37)    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)    at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:39)    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)    at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:29)    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)    at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:35)    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)    at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.create(ForwardClientInput.java:78)    at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.create(ForwardClientInput.java:75)    at org.gradle.util.internal.Swapper.swap(Swapper.java:38)    at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:75)    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)    at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)    at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:63)    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:37)    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)    at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:84)    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:37)    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)    at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:52)    at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:297)    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)    at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)    at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:61)Caused by: org.gradle.api.InvalidUserCodeException: Using dependency catalogs requires the activation of the matching feature preview.See the documentation at https://docs.gradle.org/7.3.1/userguide/platforms.html#sub:central-declaration-of-dependencies    at org.gradle.internal.management.DefaultVersionCatalogBuilderContainer.create(DefaultVersionCatalogBuilderContainer.java:85)    at org.gradle.internal.management.DefaultVersionCatalogBuilderContainer.create(DefaultVersionCatalogBuilderContainer.java:46)    at org.gradle.api.internal.AbstractNamedDomainObjectContainer.create(AbstractNamedDomainObjectContainer.java:71)    at org.gradle.api.internal.NamedDomainObjectContainerConfigureDelegate._configure(NamedDomainObjectContainerConfigureDelegate.java:39)    at org.gradle.internal.metaobject.ConfigureDelegate.invokeMethod(ConfigureDelegate.java:65)    at settings_ctjz2n7lk6bi1gpv0a0s7c0ao$_run_closure1$_closure2.doCall(F:\Projects\ReactNative\nativeapp\android\settings.gradle:5)    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)    at org.gradle.util.internal.ClosureBackedAction.execute(ClosureBackedAction.java:72)    at org.gradle.util.internal.ConfigureUtil.configureTarget(ConfigureUtil.java:155)    at org.gradle.util.internal.ConfigureUtil.configureSelf(ConfigureUtil.java:143)    at org.gradle.api.internal.AbstractNamedDomainObjectContainer.configure(AbstractNamedDomainObjectContainer.java:91)    at org.gradle.api.internal.AbstractNamedDomainObjectContainer.configure(AbstractNamedDomainObjectContainer.java:38)    at org.gradle.util.internal.ConfigureUtil.configure(ConfigureUtil.java:104)    at org.gradle.util.internal.ConfigureUtil$WrappedConfigureAction.execute(ConfigureUtil.java:167)    at org.gradle.internal.management.DefaultDependencyResolutionManagement.versionCatalogs(DefaultDependencyResolutionManagement.java:134)    at org.gradle.internal.management.DefaultDependencyResolutionManagement_Decorated.versionCatalogs(Unknown Source)    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)    at org.gradle.internal.metaobject.BeanDynamicObject$MetaClassAdapter.invokeMethod(BeanDynamicObject.java:484)    at org.gradle.internal.metaobject.BeanDynamicObject.tryInvokeMethod(BeanDynamicObject.java:196)    at org.gradle.internal.metaobject.CompositeDynamicObject.tryInvokeMethod(CompositeDynamicObject.java:98)    at org.gradle.internal.extensibility.MixInClosurePropertiesAsMethodsDynamicObject.tryInvokeMethod(MixInClosurePropertiesAsMethodsDynamicObject.java:34)    at org.gradle.internal.metaobject.ConfigureDelegate.invokeMethod(ConfigureDelegate.java:56)    at settings_ctjz2n7lk6bi1gpv0a0s7c0ao$_run_closure1.doCall(F:\Projects\ReactNative\nativeapp\android\settings.gradle:4)    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)    at org.gradle.util.internal.ClosureBackedAction.execute(ClosureBackedAction.java:72)    at org.gradle.util.internal.ConfigureUtil.configureTarget(ConfigureUtil.java:155)    at org.gradle.util.internal.ConfigureUtil.configure(ConfigureUtil.java:106)    at org.gradle.util.internal.ConfigureUtil$WrappedConfigureAction.execute(ConfigureUtil.java:167)    at org.gradle.initialization.DefaultSettings.dependencyResolutionManagement(DefaultSettings.java:371)    at org.gradle.initialization.DefaultSettings_Decorated.dependencyResolutionManagement(Unknown Source)    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)    at org.gradle.internal.metaobject.BeanDynamicObject$MetaClassAdapter.invokeMethod(BeanDynamicObject.java:484)    at org.gradle.internal.metaobject.BeanDynamicObject.tryInvokeMethod(BeanDynamicObject.java:196)    at org.gradle.internal.metaobject.CompositeDynamicObject.tryInvokeMethod(CompositeDynamicObject.java:98)    at org.gradle.internal.extensibility.MixInClosurePropertiesAsMethodsDynamicObject.tryInvokeMethod(MixInClosurePropertiesAsMethodsDynamicObject.java:34)    at org.gradle.groovy.scripts.BasicScript$ScriptDynamicObject.tryInvokeMethod(BasicScript.java:135)    at org.gradle.internal.metaobject.AbstractDynamicObject.invokeMethod(AbstractDynamicObject.java:163)    at org.gradle.groovy.scripts.BasicScript.invokeMethod(BasicScript.java:84)    at settings_ctjz2n7lk6bi1gpv0a0s7c0ao.run(F:\Projects\ReactNative\nativeapp\android\settings.gradle:3)    at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:91)    ... 169 more

settings.gradle file:

rootProject.name = 'MyApp'dependencyResolutionManagement {  versionCatalogs {    reactAndroidLibs {      from(files(new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim(), "../gradle/libs.versions.toml")))    }  }}apply from: new File(["node", "--print", "require.resolve('expo/package.json')"].execute(null, rootDir).text.trim(), "../scripts/autolinking.gradle");useExpoModules()apply from: new File(["node", "--print", "require.resolve('@react-native-community/cli-platform-android/package.json', { paths: [require.resolve('react-native/package.json')] })"].execute(null, rootDir).text.trim(), "../native_modules.gradle");applyNativeModulesSettingsGradle(settings)include ':app'includeBuild(new File(["node", "--print", "require.resolve('@react-native/gradle-plugin/package.json', { paths: [require.resolve('react-native/package.json')] })"].execute(null, rootDir).text.trim()).getParentFile())

how can i handle Login Modal when switching in different tabs like olx in react native expo?

$
0
0

how can i handle login modal , i m on home tab the content of the home tab should be display it does not matter user is logged in or not, i click on different tabs it will display login modal form home tab and when i click on close button on that modal it will render me to home tab and and then again i m going to another tab rather then home tab it will again display me login modal from home tab.

i have tried so many ways but it will done only for the first time but when i m coming on second time on that tab it will not display the login modal. why? i used useEffect and also useFocusEffect in react native expo.

Downloading and Opening PDF file in React Native

$
0
0

I'm trying to download a PDF file from my app when a button is clicked and open it immediately after the download completes. I'm using expo-file-system to save the downloaded file and I'm using expo-linking to trigger the opening of the file after it's downloaded for iOS device. I'm also using the expo-intent-launcher to trigger the opening of the file on an android device. This works perfectly for android but this doesn't work on iOS and I've been on this for hours. I'm unsure what I'm not doing right. My code snippets is shown below:

import * as FileSystem from "expo-file-system";import * as Linking from "expo-linking";import * as IntentLauncher from "expo-intent-launcher";import { Button } from "react-native"export default function PdfDocumentsScreen() {   const { isAndroid } = useDevicePlatform();   const downloadPDF = async () => {    try {      const uri ="https://${name}.s3.amazonaws.com/${bucket_name}/Certificate1.pdf";      const fileUri = FileSystem.documentDirectory +"Certificate.pdf";      const downloadObject = FileSystem.createDownloadResumable(uri, fileUri);      const response = await downloadObject.downloadAsync();      console.log(response);      if (response?.status === 200) {        openPDF(fileUri);      } else {        console.error("Failed to download the PDF");      }    } catch (error) {      console.error("Error downloading the PDF: ", error);    }  }; const openPDF = async (fileUri: string) => {    try {      const contentUri = await FileSystem.getContentUriAsync(fileUri);      console.log("Content URI: ", contentUri);      if (!isAndroid) {        if (await Linking.canOpenURL(contentUri)) {          Linking.openURL(contentUri);        }      } else {        IntentLauncher.startActivityAsync("android.intent.action.VIEW", {          data: contentUri,          flags: 1,        });      }    } catch (error) {      console.error("Error opening the PDF: ", error);    }  };  return (<Button title="Download PDF" onPress={downloadPDF} />  )}
Viewing all 29594 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>