react-native-image-base64 icon indicating copy to clipboard operation
react-native-image-base64 copied to clipboard

What is my error? TypeError: null is not an object

Open ved08 opened this issue 4 years ago • 5 comments

This is my code:

import ImgToBase64 from 'react-native-image-base64';
sendData = async (uri) => {
  ImgToBase64.getBase64String(uri)
      .then(base64String => {
        console.log(base64String)
      })
      .catch(err => console.log("Error Occured", err));
}

someFunction = async () => {
...function content...
this.sendData(result.uri) //here result.uri is the path to that image i.e file://...
}

With this, I am getting an error saying "TypeError: null is not an object". Please solve my error Thanks!

ved08 avatar Sep 21 '20 10:09 ved08

Same

dylancl avatar Jan 20 '22 17:01 dylancl

same error

React-native: v0.64.3 react-native-image-base64: v0.1.4 expo: ~44.0.0

[Unhandled promise rejection: TypeError: null is not an object (evaluating '_reactNativeImageBase.default.getBase64String')]

0x1h avatar Apr 30 '22 10:04 0x1h

same any solution ?

iamtheretronerd avatar May 05 '22 06:05 iamtheretronerd

@iamtheretronerd I didn't find any solution for react-native-image-base64 but you can use expo-file-system

import * as FileSystem from 'expo-file-system';

const getBase64 = async (path) => {
   await FileSystem.readAsStringAsync(path, { encoding: 'base64' })
    .then(base64 => console.log(base44))
    .catch(err => console.log(err))
}

0x1h avatar May 07 '22 19:05 0x1h

this guy is fucking right trust him ( in my opinion )

BekaBerua avatar May 07 '22 19:05 BekaBerua