Questions tagged [react-native]

React Native is a groundbreaking JavaScript framework designed to empower developers in creating cross-platform mobile applications using the power of React. With React Native, you can harness the full potential of your skills and effortlessly develop apps that seamlessly adapt to various platforms, allowing you to learn just once and write your code anywhere with utmost efficiency.

Npm issue. I'm unable to successfully install any packages as it keeps throwing an error

Issue: Error Encountered: Windows_NT 6.1.7601 Error occurred in the Windows_NT environment using the specified node and npm versions with error code EPEERINVALID. The package <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data ...

Ways to implement StackNavigator along with Redux?

Is there anyone who can assist me in integrating StackNavigator and Redux? It seems straightforward, but I'm encountering issues. index.ios.js import React from 'react' import { AppRegistry } from 'react-native' import { Provider } from 'react-redux' ...

React navigator appears stuck and unable to navigate between screens

I encounter an issue where my app closes when I press the switch screen button, but there is no error output displayed. I have checked for any version discrepancies and found no problem. The function I implemented for the button is functioning as expected ...

Unable to receive a response in React-Native after sending a post request

My current challenge involves sending a response back after successfully making a post request in react-native. Unfortunately, the response is not arriving as expected. router.route("/addUser").post((req, res) => { let name= req.body.name; connection ...

Experiencing difficulties in launching expo developer tools

I encountered an issue while attempting to run a scaffolded React Native program using the command NPM start. The error message is as follows: C:Users onDesktopproDoneWithIt>npm start > @ start C:Users onDesktopproDoneWithIt > expo st ...

The current iteration of '@react-navigation/native' does not align with React Navigation 5 and is therefore not compatible

After installing react-navigation using: npm install react-navigation I proceeded to install @react-navigation/native with the following command: npm install @react-navigation/native Unfortunately, I encountered an error message: The version of '@re ...

Integrate your React Native application with a Node.js backend on your local machine

My attempt to establish a connection between my react native app and my node.js app on a Windows system has hit a roadblock. While I am able to receive responses from the node API using Postman, the response from the react native app is coming back as unde ...

Is it possible to configure React JS and React Native together within a single project?

I'm looking to incorporate both React JS for web and React Native for mobile within the same project, utilizing redux and stylesheet. While exploring various repositories like ReactNativeWebHelloWorld, I encountered issues due to outdated versions that pr ...

Using material community icons in conjunction with react-native-vector-icons

I am facing an issue with displaying the store-front icon from the Material Community Icons library in my React Native app. Here is the code snippet causing the problem: import { StatusBar } from "expo-status-bar"; import React from "react&q ...

Encountering problems with unmet peer dependency in npm, specifically tied to react-native

I seem to be a bit confused about how npm handles dependencies. I came across this: npm list react-native <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c3b3b1aca9a6a0b783f3edf3edf2">[email protected]</a> /Users/ ...

Sending a signal from a descendant to a distant ancestor

As I dive into the world of React Native, I've been experimenting with passing events from child components to their parents. Here's an example setup that allows me to achieve this: In the Child component: <TouchableOpacity onPress={() => ...

Removing a comma from a dynamic loop of Material UI Text fields in React can be achieved by accessing

Have a question for you, Currently, I'm utilizing React's material UI Text Field component, When I iterate through the text field from a dynamic array and update the default value sourced from that same array, the default value ends up includin ...

Encountering problems while setting up React Native, receiving warnings when running the command "npm install -g

Attempting to set up the development environment for React Native by installing Expo CLI is proving challenging. Whenever I type "npm install -g expo-cli" into my terminal, I encounter this warning: npm WARN EBADENGINE required: { node: '>=12 < ...

Switching from Localstorage to AsyncStorage in React Native

I am working on storing a JSON object in both local storage and async storage. The following code snippet is for local storage and it works correctly in a web environment: useEffect(() => { const value = localStorage.getItem(`myData${id}`); cons ...

Leveraging package-lock.json in version control systems

We are currently working on a React Native project and utilizing GitHub for version control. One of the main challenges we have been facing revolves around managing npm dependencies. Whenever we push our changes to the master branch, conflicts with the p ...

Is there a permanent solution to fixing the error code -4094 that is repeatedly occurring during React Native startup?

When attempting to execute react-native start, an error occurred which has not been encountered before. The error message is as follows: ERROR ENCOUNTERED Loading dependency graph...events.js:287 throw er; // Unhandled 'error' event ...

Transferring information from a React Native app to a Node.js server using Express

Looking for advice on transferring data between React Native and Node.js (Express)? I'm currently developing an app using React Native and Node.js with Express, but struggling to establish communication for data exchange. Any tips would be greatly appreci ...

Expo: A guide on integrating expo code into an existing Android project

I'm looking to enhance my Android app (which is built in standard Java) by allowing users to create their own 3D models. To achieve this, I want to incorporate a 3D viewer within the app so that users can view and interact with their creations. My plan is ...

Unable to upgrade the Expo SDK version is not an option

I've been working on a project with React Native Expo, and I was testing it using Expo Go on my Android phone. However, after updating the mobile app, I encountered an issue when trying to scan the QR code to test the app. It turns out that the Expo S ...

React native shows an error message stating that expo cannot be located within the project

Currently undertaking a React Native project as part of my studies in collaboration with group members. One of my group mates, who developed the project, is able to run it without any issues. However, despite having expo installed globally, I am encounteri ...

The letter 'X' is not suitable for use as a JSX component because its return type 'Element[]' does not qualify as a valid JSX element

Currently, I am working on rendering two simple joke cards in TypeScript. The cards are displaying correctly in my browser, but I've encountered an error message that says: 'Jokes' cannot be used as a JSX component. Its return type 'Element[]' is not a val ...

Wrapper class for iOS and Android libraries in React-Native

Currently, I am exploring React Native and aiming to develop a unified interface (wrapper) for two libraries with similar functionalities but tailored for different platforms. For instance, DatePickerIOS & react-native-wheel-picker-android. I've experimen ...

Firebase is not updating the number

Having just started with Firebase, I have been following all the guidelines for web Firebase auth. I have successfully managed to login, log out, and update all data except for the phone number. Despite receiving a success message in the console, my phone ...

NPM currently does not support semantic versions that finish with '*-rc' (for example, release candidates), which can lead to issues with resolving dependencies. How do most developers typically address this problem?

Here's a straightforward example to demonstrate the issue. I am attempting to use <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="1c6e797d7f6831727d68756a795c2c3224316e7f">[email protected]</a> in conjunction ...

Single-select components in React Native

I am currently working on implementing a simple single selectable item feature, illustrated in the image provided below. https://i.stack.imgur.com/U2rJd.png At this moment, I have set up an array containing my data items and utilized the .map function to ...

Accessing props in react-native-testing-library and styled-components is not possible

I defined a styled-component as shown below: export const StyledButton = styled.TouchableOpacity<IButtonProps> height: 46px; width: 100%; display: flex; flex-direction: row; justify-content: center; align-items: center; height: 46px; ...

Utilizing React for Conditional Rendering and Navigation Bar Implementation

When developing my applications in react-native, I am using the state and a switch statement in the main render function to determine which component should be displayed on the screen. While this is a react structure question, it has implications for my sp ...

Implementing Material design using the Material-UI library in a

I have a straightforward inquiry. I am eager to delve into react native development. Uncertain about incorporating material-ui. Can it be integrated with react native? Your assistance is greatly appreciated. ...

How can I access the marker's on-screen location in react-native-maps?

Looking to create a unique custom tooltip with a semi-transparent background that can overlay a map. The process involves drawing the MapView first, then upon pressing a marker on top of the MapView, an overlay with a background color of "#00000033" is dra ...

Transferring information among React Native screens (From Screen A to Screen B to Screen C)

Imagine this particular situation. Essentially, a MaterialTopTabNavigator is nested within a StackNavigator. The challenge at hand is how to effectively pass data from a function all the way to the MaterialTopTabNavigator. Keep in mind that the data has t ...

When attempting to launch a React Native project, an error stating that the index.js file could not

As a newcomer to ReactNative, I am encountering an issue that I need assistance with. Upon attempting to run my ReactNative project using the command: react-native run-android I received the following error log: Error: The module ./index could not be ...

What is the best approach to modifying array elements using onChange and hooks in React?

I'm struggling to implement something simple, and the solutions I've found so far don't quite address my specific issue. Here's the state in question: const [formFields, setFormFields ] = useState({ formTitle: '', field: [ {name: '', option ...

How can I display 4 react components, such as custom buttons, in a manner that ensures the most recently pressed button appears on top?

I've been attempting to solve this problem, but I'm struggling to find a solution. My current approach involves grouping the 4 button components in an array and shifting their positions based on user input. Is there a more efficient way to accomplish thi ...

React Native is designed to easily stick an image to the bottom of the screen

I am struggling to make the image stick to the bottom of the app without any extra space underneath it. Despite trying various solutions from Stack Overflow, I have been unable to achieve the desired result. The issue is the large white space between the r ...

The current version of React Native does not support billing functionality

I recently encountered an issue with React Native billing library v3 while attempting to upload my build to the Google Play Console. The error message indicated that the version was not supported. Below are the build configurations I have implemented: ...

Discovering how to efficiently track and respond to changes in MobX state within a React

Within my react native project, I have observed that upon clicking a button, the state of my mobx app undergoes an update. To address this issue, I aim to employ a react lifecycle method that can monitor and automatically reflect this modification. For th ...

The property of undefined map cannot be read

import React from 'react'; import { Card, Text } from "react-native-paper"; import { SafeAreaView, } from "react-native"; class HackerNewsClone extends React.Component { constructor(props) { super(props); this.sta ...

Building a dropdown menu component in react native

Looking to implement a dropdown menu in React Native using TypeScript. Any suggestions on how to achieve this for both iOS and Android platforms? Check out this example of a dropdown menu ...

Display different screens depending on whether the user is authenticated in React Native

My goal is to dynamically render a React Native screen based on different conditions: 1) when the app is loading while checking authentication status, 2) if the user is already authenticated and show the home screen, or 3) if the user is not authenticated ...

Launching React Native in Visual Studio Code: launchReactNative.js

Struggling to get visual studio code to create the launchReactNative.js file in the ./vscode directory. I've been attempting to configure a react-native project with typescript on visual studio code to debug typescript files, but all my efforts have been ...

Button react-native press following textInput within scroll view aware of keyboard movements

I'm currently facing an issue where I have a TextInput and a button nested inside a KeyboardAwareScrollView. The goal is for the user to input some text and then tap the button created using TouchableOpacity, which should send the inputted text forwar ...

Capacitor implementation of NextJS Server-Side Rendering

We are currently using Next.js with server-side rendering (SSR) and we are looking to integrate Capacitor.js into our app in order to make it compatible with both Android and iOS devices. However, it seems that this integration is only possible with static ...

I have been working on creating an app with Expo, but out of nowhere, the 'npm' start command has stopped functioning for some unknown reason

As a beginner in the world of React Native, I have been exploring building basic apps using expo-cli. Although my understanding is still limited, I have been relying on online tutorials to guide me through the process. However, today I encountered an iss ...

Leveraging the power of React Native with embedded RapidAPI functionality in the source

I had previously used the following code to retrieve a JSON file containing personal data in my React Native source code: async componentDidMount() { try { const response = await fetch('mydomain.org/personaldata.json'); const responseJson ...

Using the fetch method to consume a RapidAPI JSON response

Currently, I am in the process of learning React Native and have initiated a project for that purpose. In this project, I have integrated RapidAPI (link: ) to fetch necessary data. Upon hitting the API, I receive a 200OK status, but unfortunately, I am fa ...

The concept of undefined does not hold any tangible form

TypeError: undefined is not an object (evaluating 'this.props.data.map') appContent: displayData(){ let info = this.props.data.map(function(dataItem, index) { return ( <Card> <CardItem> <Body> ...

Encountering "gyp ERR! find VS" error while installing npm in react-native

I had to transfer my react-native code from another PC, and when I attempted to run npm install, an error occurred. For a possible solution, you can check out this related answer: How can I solve the gyp error regarding msvs_version not being set? Please ...

React Native is facing difficulty in fetching pagination data which is causing rendering errors

Currently, I am working on fetching pagination data from an API. The process involves retrieving data from https://myapi/?page=1, then from https://myapi/?page=2, and so on. However, despite following this logic, I encountered an error that has left me puz ...

What is the best way to update the state of a response from an API call for a detailed object using React context, so that there is no need to retrigger the API call

I'm currently developing a react native typescript project. How can I assign the data received from an API call to my context object? I want to avoid making the API call every time the component is loaded. Instead, I want to check if the context already ...

Exploring the Benefits of Utilizing Fetch over XMLHttpRequest in React Native

Recently, I attempted to upload images to S3 from my react native app by following a guide provided by Heroku: https://devcenter.heroku.com/articles/s3-upload-node In essence, I utilized the aws-sdk on my express.js backend to generate pre-signed requests ...

Tips for concealing API endpoints in a React Native Android application

I've developed a nodejs, express, and mongodb API that is currently hosted on Heroku. My next step is to utilize this API URL within my React Native Android app. Unfortunately, I'm facing an issue where the API URL could potentially be exposed to ...

A guide on how to add an item to an array in React Native

Recently, I've started working with React and exploring a floating point feature that allows users to select different options. Depending on the selection made, specific information is added to an array, which is then used to populate a card displayed ...

Incorporate an Icon into a React Native Material UI Button

After implementing React Native Material UI in my project, I have successfully created a Button using the following code: <Button raised upperCase={false} text="Facebook"/> Now, I want to add an icon before the text on the button. Following the li ...

`Execution terminated: npm start unable to run properly due to error at FSEvent.FSWatcher._handle.onchange (internal/fs/watchers.js:135:

As a newcomer to the React/Node.js realm, I've been struggling for a few days. I recently installed node-v13.50.0-x64 and executed the following commands: npm install expo-cli --global expo init myproject After navigating to the [myproject] directo ...

Preserve the custom hook's return value in the component's state

I am currently facing a challenge in saving a value obtained from a custom hook, which fetches data from the server, into the state of a functional component using useState. This is necessary because I anticipate changes to this value, requiring a rerender ...

The React Component is limited to updating once

Exploring the React Native code below: import React from 'react'; import {Text, View, StyleSheet, Button} from 'react-native'; export default class Target extends React.Component { constructor(props){ super(props); this.state ={ isLo ...

The React Native application unexpectedly shuts down upon clicking on the RNPickerSelect component

Looking to populate a React Native dropdown (RNPickerSelect) with data, I implemented the following code: let year = new Date().getFullYear() - 4; let Years = [] for (var i = 0; i < 7; i++) { let item = { id: ...

The error message 'Cannot read property 'navigate' of undefined' is displayed because the function '_this.props.navigation.navigate' is not

I'm facing an issue trying to access 'Home' from Form.js. Despite my efforts in arrowF, routes, and other methods, the same error persists. How can I resolve this? In my Form.js file, when I call onPress=(), I have tried using functions, ...

Alert: Fiber Caution in React-Native

Out of the blue, my react-native app is now showing me a warning message that says: WARNING Unable to locate Fiber with id "21847" Can anybody explain what this means and suggest how I can resolve it? ...

Fetching all data from a SQLite database in a Listview using React Native

I have been utilizing the library found at https://github.com/andpor/react-native-sqlite-storage in my react native project. To retrieve a single row from the database, I use the following code: db.transaction((tx) => { tx.executeSql('SELECT * ...

Navigating in React Native with React Navigation or utilizing the power of React Hooks

When it comes to navigating between screens with React Native, how do the methods differ when using React Navigation compared to using hooks and functions for navigation? And is React Navigation the superior choice? ...

Expo React Native: Encounter problem while installing masked-view

I am currently developing an application using Expo and I am facing some challenges while trying to detect a user's internet connection. Specifically, I am having trouble installing NetInfo. I attempted to install it by running: expo install @react-na ...

Having trouble initiating a fresh Expo project | ISSUE: Node.js v12.4.0 is no longer compatible

Having trouble creating a react-native project with expo init projectName. I encountered an error that says Node.js v12.4.0 is no longer supported. Can someone help me fix this issue? expo-cli only supports the following versions of Node.js: =10.13.0 ...

What is the best way to select a specific option from an actionsheet in a React Native app?

I am a new React Native learner seeking some guidance. I have created an actionsheet with two options and a cancel option, but I am struggling to figure out how to trigger different actions for each option when pressed. Here's my code snippet: import Reac ...

Inject a function into the headerTitle component of React Navigation

I'm having trouble implementing a deletePost button in my header component. Here's the issue: export class PostScreen extends Component { // Custom headerTitle component. static navigationOptions = ({ navigation }) => { const { par ...

Installing NPM packages in a React Native project may encounter difficulties

Currently working on a project using react-native, I encountered an issue while trying to install an npm package. Here is the command I used to install it: $ npm install --save is-reachable Following the installation of the NPM package, I proceeded to run ...

Display an array containing date objects in a dropdown menu for users to select from

I am working with an API call that returns an array of objects. Each object in the array contains a date or timestamp in ISO format. Right after my render() method, I have the following code snippet: const pickerItems = this.props.currentData.trips.map(t ...

Determine whether to wrap a component with a <span> or <div> tag based on

How can I effectively wrap the component using logical operations? I want to add another span to enclose the Child component if showSpan is true. I've tried something like the following but it doesn't seem to be working as expected. const Child = () =&g ...

Accessing the inputValue of Autocomplete from Material UI using a reference like React.useRef

I am currently working on accessing the value inside the Autocomplete's inputValue. I passed a reference to the Autocomplete as a functional component, but I'm struggling to find a way to access the current value of inputValue in order to determine if it ...

What is the best way to retrieve the data from this date object?

How can I access the date and time in the code below? I've attempted using functions within the Text block without success. It's unclear to me what mistake I'm making or how to correctly access this object, or transform it into an object th ...

Upon attempting to install "expo-cli" using the command "npm install -g expo-cli," I encountered a series of vulnerabilities. After running "npm audit fix," I was faced with even more errors

Recently, I switched to a new laptop with Windows 11 and have been encountering errors while working on node.js and react native. For example, when I ran npm install -g <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="0b657b664b3 ...

When working with React Native, encountering an issue where passing props using the Map function results in an error stating "undefined is not a function" near the section of code involving the

Hey there! I'm currently facing an issue with fetching data from my Sanity CMS and passing it as props to a child component. Interestingly, the same code worked perfectly on another screen, but here I seem to be encountering an error. Although the data is ...

What are some strategies for ensuring that the API call waits for the necessary data to be retrieved?

Currently, I am working with React Native and Redux. The initial state of Redux includes emailExists being set to null: const INITIAL_STATE = { // ... emailExists: null, }; During user registration, I first check if the user already exists by sending ...

React Native - Scaling images dynamically

I have a responsive photo grid built within a mobile app. I want to display three images across the screen with equal spacing between them. All the images are squares. Unfortunately, using percentages for each image's width and height is not possible in t ...

My reselect function seems to be malfunctioning - I'm not receiving any output. Can anyone help me

I'm looking to implement reselect in my code to retrieve the shopping cart based on product ids. Here's my reselect.ts file: import { createSelector } from "reselect"; import { RootState } from "../store"; export const shopp ...