Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #213 #214

Merged
merged 1 commit into from
Dec 15, 2017
Merged

fix #213 #214

merged 1 commit into from
Dec 15, 2017

Conversation

KimDal-hyeong
Copy link
Contributor

@KimDal-hyeong KimDal-hyeong commented Dec 7, 2017

#213

initWithAttributedString is undefined in version 48.
So, I used initWithEncodedAttributedString instead of initWithAttributedString.

But,I think this bug may be a problem of sketch48.
This PR is not needed if 'Sketch' fix this bug...

`initWithAttributedString` is undefined in version 48.
I used `initWithEncodedAttributedString` instead of `initWithAttributedString`.
@LincMitch
Copy link

Thanks @KimDal-hyeong. In what file do you change initWithAttributedString to initWithEncodedAttributedString?

@thierryc
Copy link
Contributor

thierryc commented Dec 7, 2017

Thank you @KimDal-hyeong.
Tested ! fix #213 Rocks for me.

@LincMitch
Copy link

Found the file locally, made the edit but same error.
Then tried to do an npm i at the route and in the basic-setup example.
Then ran npm run render

Sill nothing. Am I doing this right?

@mathieudutour
Copy link
Collaborator

That’s not a bug in Sketch. Sketch is a living code base so we do change it... this is using the internals so obviously, it’s going to change when we update Sketch

@thierryc
Copy link
Contributor

thierryc commented Dec 8, 2017

@LincMitch you can use temporarily KimDal-hyeong or my react-sketchapp forks.

KimDal-hyeong fix #213 works for me (sketch 48.1).

npm install https://github.com/{USER}/{REPO}/tarball/{BRANCH}

Our forks

https://github.com/KimDal-hyeong/react-sketchapp/tree/KimDal-hyeong-fix-%23213
https://github.com/anotherplanet-io/react-sketchapp

Or:

  • fork react-sketchapp
  • merge KimDal-hyeong fix
  • clone it locally
  • do npm link in react-sketchapp folder.
  • go to your project folder
  • do npm link react-sketchappto use your fork

@LincMitch
Copy link

LincMitch commented Dec 8, 2017

@thierryc I upgraded to Sketch 48.1. Then downloaded and tried out both forks just like how I would with the main branch. Not sure if thats the correct way as you provided this and I wasn't sure how to interpret:
npm install https://github.com/{USER}/{REPO}/tarball/{BRANCH}
Could it be:
USER=KimDal-hyeong
REPO=react-sketchapp
tarball=???
BRANCH= tree/KimDal-hyeong-fix-%23213

Anyhow, I got the same error:

TypeError: MSAttributedString.alloc().initWithAttributedString is not a function. (In 'MSAttributedString.alloc().initWithAttributedString(attribStr)', 'MSAttributedString.alloc().initWithAttributedString' is undefined) line: 2957 sourceURL: /Users/lincolnmitchel/Documents/ReactSketchApp/react-sketchapp-KimDal-hyeong-fix-213/examples/basic-setup/basic-setup.sketchplugin/Contents/Sketch/my-command.js column: 72 stack: makeAttributedString@/Users/lincolnmitchel/Documents/ReactSketchApp/react-sketchapp-KimDal-hyeong-fix-213/examples/basic-setup/basic-setup.sketchplugin/Contents/Sketch/my-command.js:2957:72 makeTextLayer@/Users/lincolnmitchel/Documents/ReactSketchApp/react-sketchapp-KimDal-hyeong-fix-213/examples/basic-setup/basic-setup.sketchplugin/Contents/Sketch/my-command.js:15333:66 renderBackingLayers@/Users/lincolnmitchel/Documents/ReactSketchApp/react-sketchapp-KimDal-hyeong-fix-213/examples/basic-setup/basic-setup.sketchplugin/Contents/Sketch/my-command.js:15284:44 flexToSketchJSON@/Users/lincolnmitchel/Documents/ReactSketchApp/react-sketchapp-KimDal-hyeong-fix-213/examples/basic-setup/basic-setup.sketchplugin/Contents/Sketch/my-command.js:6193:51 map@[native code] flexToSketchJSON@/Users/lincolnmitchel/Documents/ReactSketchApp/react-sketchapp-KimDal-hyeong-fix-213/examples/basic-setup/basic-setup.sketchplugin/Contents/Sketch/my-command.js:6195:31 map@[native code] flexToSketchJSON@/Users/lincolnmitchel/Documents/ReactSketchApp/react-sketchapp-KimDal-hyeong-fix-213/examples/basic-setup/basic-setup.sketchplugin/Contents/Sketch/my-command.js:6195:31 renderToSketch@/Users/lincolnmitchel/Documents/ReactSketchApp/react-sketchapp-KimDal-hyeong-fix-213/examples/basic-setup/basic-setup.sketchplugin/Contents/Sketch/my-command.js:5104:45 /Users/lincolnmitchel/Documents/ReactSketchApp/react-sketchapp-KimDal-hyeong-fix-213/examples/basic-setup/basic-setup.sketchplugin/Contents/Sketch/my-command.js:7297:30 __skpm_run@/Users/lincolnmitchel/Documents/ReactSketchApp/react-sketchapp-KimDal-hyeong-fix-213/examples/basic-setup/basic-setup.sketchplugin/Contents/Sketch/my-command.js:19102:17 __skpm_run@[native code]

@thierryc
Copy link
Contributor

thierryc commented Dec 8, 2017

Sorry tarball is for tag !

try :

npm install https://github.com/anotherplanet-io/react-sketchapp.git --save

To remove it:

rm -rf ./node_modules/react-sketchapp
npm install react-sketchapp --save

@LincMitch
Copy link

I tried:
npm install https://github.com/anotherplanet-io/react-sketchapp.git --save

Which produces:
a node_modules directory
and a package-lock.json file.

Not sure why its not a package.json file as unfortunately it causes this error:

`npm WARN saveError ENOENT: no such file or directory, open '/Users/lincolnmitchel/Documents/ReactSketchApp/Thierry/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/Users/lincolnmitchel/Documents/ReactSketchApp/Thierry/package.json'
npm WARN react-sketchapp@1.0.0-beta.5 requires a peer of react@* but none is installed. You must install peer dependencies yourself.
npm WARN react-sketchapp@1.0.0-beta.5 requires a peer of react-test-renderer@* but none is installed. You must install peer dependencies yourself.
npm WARN Thierry No description
npm WARN Thierry No repository field.
npm WARN Thierry No README data
npm WARN Thierry No license field.

  • react-sketchapp@1.0.0-beta.5
    updated 1 package in 3.446s`

Let me know If this is purely NPM related and nothing to do with react-sketchapp, and I'll post to stack overflow To fix this issue.

@thierryc
Copy link
Contributor

Just warning ! try to use it.

Personally I use the forks and link.

  1. fork react-sketchapp
  2. merge KimDal-hyeong fix
  3. clone it locally
  4. do npm link in react-sketchapp folder.
  5. go to your project folder
  6. do npm link react-sketchappto use your fork

Sketch 47 can be an option too.

Copy link

@johanpedroo johanpedroo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

working on v48

Copy link
Contributor

@thierryc thierryc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working on Sketch v48

Copy link
Contributor

@jemgold jemgold left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@jemgold jemgold merged commit 6bd3526 into airbnb:master Dec 15, 2017
@thierryc
Copy link
Contributor

Thank you Jon.

@KimDal-hyeong KimDal-hyeong deleted the KimDal-hyeong-fix-#213 branch December 16, 2017 18:48
@LincMitch
Copy link

LincMitch commented Dec 17, 2017

Symbols example still gets same err in v1.0.0 in Sketch 48.1:

TypeError: MSAttributedString.alloc().initWithAttributedString is not a function. (In 'MSAttributedString.alloc().initWithAttributedString(attribStr)', 'MSAttributedString.alloc().initWithAttributedString' is undefined)

@mathieudutour
Copy link
Collaborator

because the examples haven't been updated to 1.0.0. You can send a PR maybe, it's an easy fix :)

@thierryc
Copy link
Contributor

PR #223

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants