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

add the ability to create triangles using css tricks #5911

Closed
wants to merge 10 commits into from
Closed

add the ability to create triangles using css tricks #5911

wants to merge 10 commits into from

Conversation

hyugit
Copy link

@hyugit hyugit commented Feb 13, 2016

  • modify ReactViewBackgroundDrawable.java to make each border a trapezoid
  • disable anti-alias to eliminate white spaces between borders
  • add examples to BorderExample.js (see last one)

 - modify ReactViewBackgroundDrawable.java to make each border a trapezoid
 - disable anti-alias to eliminate white spaces between borders
 - add examples to BorderExample.js (see last one)
@facebook-github-bot
Copy link
Contributor

By analyzing the blame information on this pull request, we identified @mkonicek, @nicklockwood and @a2 to be potential reviewers.

@facebook-github-bot facebook-github-bot added GH Review: review-needed CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. labels Feb 13, 2016
Huang Yu and others added 2 commits February 13, 2016 14:39
 - modify ReactViewBackgroundDrawable.java to make each border a trapezoid
 - disable anti-alias to eliminate white spaces between borders
 - add examples to BorderExample.js (see last one)
@hyugit
Copy link
Author

hyugit commented Feb 13, 2016

1
2

@hyugit
Copy link
Author

hyugit commented Feb 13, 2016

The screenshots above are from UIExplorer - BorderExample page

@nicklockwood
Copy link
Contributor

Does the example also work on iOS?

@hyugit
Copy link
Author

hyugit commented Feb 14, 2016

here is a screenshot on iOS:
3

@browniefed
Copy link
Contributor

Theoretically yes:
http://browniefed.com/blog/2015/09/10/the-shapes-of-react-native/

@nicklockwood
Copy link
Contributor

Cool, well I'm happy with this then. I'm not really qualified to review the Java code though. Maybe @dmmiller can weigh in?

@satya164
Copy link
Contributor

So cool!

if (borderLeft > 0 && colorLeft != Color.TRANSPARENT) {
mPaint.setColor(colorLeft);
canvas.drawRect(0, borderTop, borderLeft, height - borderBottom, mPaint);
Path leftBorderPath = new Path();

Choose a reason for hiding this comment

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

Instead of allocating a new Path() each time, can you reset() and reuse? Generally better to avoid allocations while drawing.

Huang Yu and others added 2 commits February 15, 2016 10:04
 - modify ReactViewBackgroundDrawable.java to make each border a trapezoid
 - disable anti-alias to eliminate white spaces between borders
 - add examples to BorderExample.js (see last one)
@facebook-github-bot
Copy link
Contributor

@trave7er updated the pull request.

@facebook-github-bot
Copy link
Contributor

@trave7er updated the pull request.

@facebook-github-bot
Copy link
Contributor

@trave7er updated the pull request.

@hyugit
Copy link
Author

hyugit commented Feb 16, 2016

Thanks @satya164 .

@dmmiller I've updated the PR based on your comments.


mPaint.setAntiAlias(false);

Path borderPath = new Path();

Choose a reason for hiding this comment

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

Can you just allocate this once up in the constructor and reset it each time it is used?

@facebook-github-bot
Copy link
Contributor

@trave7er updated the pull request.

@dmmiller
Copy link

@facebook-github-bot shipit

@facebook-github-bot
Copy link
Contributor

Thanks for importing. If you are an FB employee go to Phabricator to review.

@ghost ghost closed this in a6a4389 Feb 19, 2016
pglotov pushed a commit to pglotov/react-native that referenced this pull request Mar 15, 2016
Summary:- modify ReactViewBackgroundDrawable.java to make each border a trapezoid
 - disable anti-alias to eliminate white spaces between borders
 - add examples to BorderExample.js (see last one)
Closes facebook#5911

Differential Revision: D2953734

Pulled By: dmmiller

fb-gh-sync-id: dd103d80dec53ad35c9539ab1ceb93ef857feeb9
shipit-source-id: dd103d80dec53ad35c9539ab1ceb93ef857feeb9
machard pushed a commit to machard/react-native that referenced this pull request Mar 29, 2016
Summary:- modify ReactViewBackgroundDrawable.java to make each border a trapezoid
 - disable anti-alias to eliminate white spaces between borders
 - add examples to BorderExample.js (see last one)
Closes facebook#5911

Differential Revision: D2953734

Pulled By: dmmiller

fb-gh-sync-id: dd103d80dec53ad35c9539ab1ceb93ef857feeb9
shipit-source-id: dd103d80dec53ad35c9539ab1ceb93ef857feeb9
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants