Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object

I am using Pressable instead of Touchable opacity but I am getting the above mentioned error. I have tried all possible solutions in import & export but still I am getting the error.

`

import React, { useState, useEffect } from 'react';
import { StyleSheet,View,Dimensions,Image } from 'react-native';
import Pressable from 'react-native';
import MapView, { PROVIDER_GOOGLE, Marker } from 'react-native-maps';
import * as Location from 'expo-location';
import { Button } from 'react-native-paper';
import { useSelector } from 'react-redux'
import { location1 } from '../../src/store/action/location';
import { connect } from "react-redux"

`

And here is my pressable

Screenshot 2020-09-03 at 9 28 00 PM

export default connect(null, { location1 })(Home);

my package.json

"dependencies": { "@react-native-community/async-storage": "^1.11.0", "@react-native-community/masked-view": "^0.1.10", "axios": "^0.19.2", "expo": "~38.0.8", "expo-linear-gradient": "~8.2.1", "expo-location": "~8.2.1", "expo-status-bar": "^1.0.2", "react": "16.13.1", "react-dom": "~16.11.0", "react-native": "0.62.2", "react-native-animatable": "^1.3.3", "react-native-gesture-handler": "^1.6.0", "react-native-get-random-values": "^1.4.0", "react-native-google-places-autocomplete": "^1.8.0", "react-native-maps": "0.27.1", "react-native-maps-directions": "^1.8.0", "react-native-paper": "^4.0.1", "react-native-reanimated": "~1.9.0", "react-native-safe-area-context": "~3.0.7", "react-native-screens": "~2.9.0", "react-native-vector-icons": "^7.0.0", "react-native-web": "~0.11.7", "react-navigation": "^4.4.0", "react-navigation-stack": "^2.8.2", "react-redux": "^7.2.1", "redux": "^4.0.5", "redux-thunk": "^2.3.0" },

Here is the error I am getting : –

Simulator Screen Shot - iPhone 11 - 2020-09-03 at 21 15 52

1 possible answer(s) on “Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object

  1. I have the exact same issue, basically the problem is easy to reproduce:

    1. create an expo project
    2. import { Pressable } from “react-native”;
    3. use your Pressable component in the return part
    4. error appears

    Apparently from what I’ve been able to find, the reason is that currently expo (SDK38) is React Native v0.62 and Pressable component has been added in React Native v0.63, so it does not yet exist in the current expo SDK version. (That is so unfortunate as I just started learning RN and was trying to use this Pressable component, but found out it’s not yet available…)