Skip to content

Instantly share code, notes, and snippets.

@tenwy tenwy/image.js
Last active Feb 12, 2018

What would you like to do?
Upload image to Skygear in React Native
let message = this.state.text;
const {
} = this.state;
const imageAsset = new skygear.Asset({
name: 'image.jpg',
file: {
uri: imgResponse.uri,
name: 'image.jpg',
type: 'image/jpeg',
size: imgResponse.fileSize,
skygearChat.createMessage(this.state.conversation, message, null, imageAsset)
.then(function (result) {
console.log('Message sent!', result);
}).catch((err)=> {
console.error('fail to sent message:', err);
//imgResponse is the response of image picker (
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.