skip to Main Content

React Native – useState not updating immediatly

I'm trying to update my state when onLongPress triggered. I'm printing the result right after the setState but it shows nothing (on the first press) Code: const [pressedImagesm setPressedImages] = useState([]); ... onLongPress={() => { setPressedImages(oldArray => [...oldArray, { [index]:…

VIEW QUESTION

Screen title not centered – React native

This is my HomeScreen.js: import * as React from 'react'; import HomeScreenStyle from '../styles/ScreenStyles'; import { View, TouchableOpacity, Text, Image, StyleSheet } from 'react-native'; const HomeScreen = ({ navigation }) => { return ( <View style={HomeScreenStyle.container}> <Image source = {require("../assets/AppLogo.jpg")}/>…

VIEW QUESTION

React Native dropdown api value not selected

I am using react-native-element-dropdown in react native app. It works fine with default value if set in useState but it's not work with set api response value and not selected in dropdown import { Dropdown } from "react-native-element-dropdown"; const Profile…

VIEW QUESTION
Back To Top
Search