React-sketchapp: Sketch crashes when using <Image source={require('../path/to/asset.png')} /> instead of an URL

Created on 3 Nov 2017  路  6Comments  路  Source: airbnb/react-sketchapp

_I am..._
Carlos Santiago

| Reporting a bug or issue

Expected behavior:
Load local image from an Assets folder

Observed behavior:
when running the script, Sketch crashes

How to reproduce:
use {require('./path/to/local/asset.png')} as image source

Sketch version:
47.1

Most helpful comment

I started a new install and still have the same issue

All 6 comments

I believe images only work with the beta version. Latest version being 'v1.0.0-beta.5'? Are you using the beta version?

Hi @LincMitch and thanks for the reply, yes im using "react-sketchapp": "^1.0.0-beta.5" as of right now, they work fine when uring an URL tho

reopening due to having same issue after updating (unless im missing something)

I tried:

<Image source={require('./path/to/image.png')} />

second attempt:

const ImageTest = require('./path/to/image.png');

<Image source={ImageTest} />

I do appreciate the help and many thanks for looking into this!!

what version of skpm are you using?

the SKPM/Builder?

"@skpm/builder": "^0.2.0"

skpm version: skpm 1.0.10

I started a new install and still have the same issue

Was this page helpful?
0 / 5 - 0 ratings

Related issues

blechatellier picture blechatellier  路  7Comments

vjpr picture vjpr  路  7Comments

jongold picture jongold  路  8Comments

kirill-konshin picture kirill-konshin  路  7Comments

yu-tou picture yu-tou  路  5Comments