// write image to local path
NSString *path = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES).firstObject;
NSString *filePath = [path stringByAppendingPathComponent:[NSString stringWithFormat:@"a.jpg"]];
[UIImagePNGRepresentation(image)writeToFile:filePath atomically:YES]
// under iOS (it works great)
[UIImage imageWithContentsOfFile: filePath];
// under react native (Could not find image filePath)
<Image source={{ uri: filePath }} />
This is the result no image
Anyone has the same issues?
I gave this a shot, but no good!
<Image style={{width:100, height:100}} source={{ uri: 'file://' + RNFS.DocumentDirectoryPath + '/myAwesomeSubDir/my.png', scale:1}} />
I knew why Image doesn't render the source, cuz the source path has no extension name! Image doesn't render local source (path with no extension name)