cloudinary / cloudinary-react-native

MIT License
13 stars 6 forks source link

Error on using AdvancedImage in expo #29

Closed PrayagJoshi10 closed 2 months ago

PrayagJoshi10 commented 2 months ago

When using AdvancedImage component the app throws error "Cannot convert null value to object"

Issue Type (Can be multiple)

[ ] Build - Can’t install or import the SDK [ ] Performance - Performance issues [✅] Behaviour - Functions aren’t working as expected (Such as generate URL) [ ] Documentation - Inconsistency between the docs and behaviour [ ] Other (Specify)

Steps to reproduce

Create a new expo project npm i cloudinary-react-native

` import React from 'react'; import { SafeAreaView } from 'react-native'; import { AdvancedImage } from 'cloudinary-react-native'; import { Cloudinary } from "@cloudinary/url-gen";

// Create a Cloudinary instance and set your cloud name. const cld = new Cloudinary({ cloud: { cloudName: 'demo' } });

export default function App() {

// cld.image returns a CloudinaryImage with the configuration set.
const myImage = cld.image('sample');

// The URL of the image is: https://res.cloudinary.com/demo/image/upload/sample

// Render the image in a React component.
return (
    <SafeAreaView>
        <AdvancedImage cldImg={myImage} style={{ width: 300, height: 200 }} />
    </SafeAreaView>
)

}; `

Error screenshots or Stack Trace (if applicable)

Simulator Screen Shot - iPhone 14 Pro Max - 2024-09-13 at 13 09 12

Is the issue reproducible only on a specific device?

[ ✅] No [ ] Yes (specify device model + iOS/Android version)

Versions and Libraries (fill in the version numbers)

React Native Cloudinary SDK version - "@cloudinary/url-gen": "^1.21.0", "cloudinary-react-native": "^1.0.0",

tommyg-cld commented 2 months ago

@PrayagJoshi10 can you confirm you have followed the steps in https://cloudinary.com/documentation/react_integration#get_started_with_react as well? Did you install @cloudinary/url-gen as well?

We also have Sample projects that may help you.

PrayagJoshi10 commented 2 months ago

@PrayagJoshi10 can you confirm you have followed the steps in https://cloudinary.com/documentation/react_integration#get_started_with_react as well? Did you install @cloudinary/url-gen as well?

We also have Sample projects that may help you.

I had followed the React Native guide. https://cloudinary.com/documentation/react_native_integration

I did install @cloudinary/url-gen

PrayagJoshi10 commented 2 months ago

Recently when I created a completely new project today it just worked fine. But I get the error in my old project I suspect there might be some other error.

I have also added the below dependencies in my project that might be causing some issue.

"expo-image-picker": "~15.0.7",
"tailwindcss": "^3.4.10",
"nativewind": "4.0.1",
 "react-native-reanimated": "~3.10.1",

I'll check whats the issue, as of now the SDK works fine in a fresh project.