Generate a View using a loop with React Native. Example: Dynamic Menu.

Generate a View using a loop with React Native. Example: Dynamic Menu.

Tiempo de lectura: 2 minutos Translated content in English: The first thing we have to do is create the component (if you don’t know what a component is, I recommend this post Create a component in React Native) that will represent our menu. In this case, I call it menu.js import React from “react”; import { StyleSheet, View } from … Read more

Add Top Tab Navigation using React Native

Add Top Tab Navigation using React Native

Tiempo de lectura: 2 minutos Reading time: < 1 minutes If you want to add a Top Tab Navigation using React Native to achieve the result shown in this image: First, you need to install the necessary dependency (remember to install React Navigation first): npm install npm install @react-navigation/material-top-tabs react-native-tab-view --save Once installed, it is used in the same way ... Read more

Open tab or screen inside another NavigationContainer React Native

Open tab or screen inside another NavigationContainer React Native

Tiempo de lectura: < 1 minuto Reading time: < 1 minute If you encounter the following error when opening a tab or screen within a NavigationContainer: Looks like you have nested a ‘NavigationContainer’ inside another. Normally you need only one container at the root of the app, so this was probably an error. If this was intentional, pass ‘independent={true}’ explicitly. Note … Read more

Adjust WebView width: 100% in React Native

Adjust WebView width: 100% in React Native

Tiempo de lectura: < 1 minuto Reading time: < 1 minutes The react-native-webview plugin has an issue that prevents adapting the screen to 100% using styles. In this case, we have installed it using Expo. It’s also important to remember that this plugin only works on Android or iOS, not on the web. Therefore, if we apply the style: webview: { ... Read more

Delete all npm packages or plugins (dependencies) in React or React Native

Delete all npm packages or plugins (dependencies) in React or React Native

Tiempo de lectura: < 1 minuto Reading time: < 1 minute If we want to delete the project-level (not global) installed dependencies within our React project, we need to do the following: Delete the folder called node_modules.rm node_modules Delete package-lock.json:rm package-lock.json Now, if we want to reinstall the dependencies, we need to execute: npm install This way, we can restore the ... Read more

Solucionar conflicto con paquete npm install

Solucionar conflicto con paquete npm install

Tiempo de lectura: 2 minutos Reading time: < 1 minute If you encounter an error message like the following when installing a package: npm WARN config global --global, --local are deprecated. Use --location=global instead.npm ERR! code ERESOLVEnpm ERR! ERESOLVE could not resolvenpm ERR!npm ERR! While resolving: @react-navigation/stack@6.2.2npm ERR! Found: @react-navigation/native@5.9.8npm ERR! node_modules/@react-navigation/nativenpm ERR! @react-navigation/native@”^5.9.8″ from the root projectnpm ERR!npm ERR! ... Read more

Creating a Screen with React Native

Creating a Screen with React Native

Tiempo de lectura: 2 minutos Reading Time: 2 minutes Screens in React Native function as standalone objects constructed with various components. In this example, I will show you how to create a Screen. First, create a screens folder where we will place the screens. Inside this folder, create a .js file called Login.js. Inside the Login.js file, we will have … Read more

Navigating Between Screens with React Native

Navigating Between Screens with React Native

Tiempo de lectura: 3 minutos Reading Time: 3 minutes In React Native, each screen is a stackable object that is added to the top of the stack. This means that if we open a screen and then close it, the screen that appears is the previously opened screen. To manage screens, we will use the react-navigation plugin (https://reactnative.dev/docs/navigation). First, we … Read more