Load a FlatList from the End to Display a Chat in React Native

Load a FlatList from the End to Display a Chat in React Native

Tiempo de lectura: < 1 minuto Reading time: < 1 minutes Today I’m going to show you how you can load a flatlist in reverse order to display a conversation (chat) using React Native. We are using the FlatList library that comes with the React Native package. import {FlatList} from 'react-native'; To display the items in reverse order (loaded from the ... Read more

Get location in React Native and Expo

Get location in React Native and Expo

Tiempo de lectura: 2 minutos Reading Time: 2 minutes Today I’m going to show you how to obtain location using React Native and Expo: We’re going to use the library expo-location (https://docs.expo.dev/versions/latest/sdk/location/) First, let’s install it: expo install expo-location This library automatically adds the necessary permissions to the Android Manifest (required to use location): ACCESS_COARSE_LOCATION: for approximate device location ACCESS_FINE_LOCATION: … Read more

Create a Select (Picker) Component in React Native

Create a Select (Picker) Component in React Native

Tiempo de lectura: 2 minutos Reading time: 2 minutes In today’s React tutorial, I will show you how to create a select (combo or picker) where you can choose different options. The first thing we need to do is import the library we are going to use (react-native-picker-select): npm install react-native-picker-select Once imported, let’s create the component. First, we import … Read more

Error when loading an image with svg extension (Flutter-Dart): Failed to detect image file format using the file header – Invalid image data.

Error when loading an image with svg extension (Flutter-Dart): Failed to detect image file format using the file header – Invalid image data.

Tiempo de lectura: 2 minutos Reading time: 2 minutes When trying to display an image with the svg extension, I encountered the following error: @override Widget build(BuildContext context) { return Scaffold( body: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Text(“WELCOME to DevCodeLight”), Container( width: 200.0, height: 200.0, child: Image.asset(‘lib/images/android/splahs_android.svg’)), ], ), ), ); } I solved it by adding the … Read more

Adding Location Permissions in React Native

Adding Location Permissions in React Native

Tiempo de lectura: 2 minutos Reading time: 2 minutes Good afternoon, In today’s tutorial, I’m going to show you how to enable location permissions on your device. Let’s get started First, we import the API import * as Location from ‘expo-location’; Inside our component, we add the following function that will be responsible for enabling location permissions. const [errorMsg, setErrorMsg] … Read more

Adding color to a BodyComponent element using Flame in Flutter

Adding color to a BodyComponent element using Flame in Flutter

Tiempo de lectura: 2 minutos Reading time: 2 minutes In this tutorial, I’m going to explain how you can add colors to BodyComponent elements in Flame Engine (https://examples.flame-engine.org). In this example, I’m going to add a BodyComponent representing a blue bar. class BlueBar extends BodyComponent { // Passed parameters final double positionX; final double positionY; final double angularVelocity; // Constructor … Read more

Send an Email or Make a Phone Call from Your React Native App

Send an Email or Make a Phone Call from Your React Native App

Tiempo de lectura: < 1 minuto Reading time: < 1 minute Today I’m going to show you how to send an email or make a phone call from React Native. To use this function, we’ll import the Linking library from React Native: https://reactnative.dev/docs/linking import { Linking } from "react-native"; To implement a phone call, we’ll use the same syntax as in ... Read more

Remove accents in a Javascript string

Remove accents in a Javascript string

Tiempo de lectura: < 1 minuto Reading time: < 1 minute To remove accents (diacritics) from a String using Javascript, follow these steps: We have the following String: var text = "Camión"; To remove punctuation marks, we need to use the following function (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize): function stripAccents(s) { return s.normalize("NFD").replace(/[\u0300-\u036f]/g, ""); } This way, when using the function, we can remove the ... Read more