-
Notifications
You must be signed in to change notification settings - Fork 168
Implement small spinner #377
Conversation
Mmmh. Probably good enough for a first iteration. Let me test it out. |
tanx
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made a few minor changes. Can you get it to scale?
| .addDecorator(story => ( | ||
| <MainContent style={{ justifyContent: 'center' }}>{story()}</MainContent> | ||
| )) | ||
| .add('SmallSpinner', () => <SmallSpinner />); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to set height/width via the style attribute but I couldn't scale it 🤔
|
Added scaling :) I was thinking of making the percentage-based medium spinners using this tutorial: https://cmichel.io/react-native-progress-circle LMK if you think that's not a good idea |
db42cc6 to
8b9bedd
Compare
|
@tanx Hey, using the ART library I couldn't get the linear gradient to work. are you opposed to using this library? https://github.com/godaddy/svgs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking of making the percentage-based medium spinners using this tutorial: https://cmichel.io/react-native-progress-circle LMK if you think that's not a good idea
That looks really promising.
@tanx Hey, using the ART library I couldn't get the linear gradient to work. are you opposed to using this library? https://github.com/godaddy/svgs
Sounds good. Looks like we'll need svgs anyway for this #289. I sent a PR to create-react-app a while back to add support for svgs facebook/create-react-app#4224
I also rebased this branch on the current master and added some comments in my review.
| endDegree >= 180 | ||
| ); | ||
| return p; | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| StyleSheet, | ||
| View, | ||
| ART, | ||
| } from 'react-native'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like there are currently linter errors in the build https://travis-ci.org/lightninglabs/lightning-app/jobs/394053652#L4509
b40dc20 to
67bc896
Compare
|
@tanx got the gradient working! still working on how to modularize the components to make them reusable for the remaining spinners |
tanx
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool. Haven’t tested it yet. Just one comment so far...
src/component/spinner.js
Outdated
| import { color, font } from './style'; | ||
| import Icon from '../component/icon'; | ||
| import Text from '../component/text'; | ||
| import Svg, { Path, Circle, Defs, Stop, LinearGradient } from 'svgs'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that svgs is web only, I’d wrap it and re-export it in an svg.js component. That way we can implement a svg.ios.js and svg.android.js components that re-export react-native-svg. See https://facebook.github.io/react-native/docs/platform-specific-code.html
tanx
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a few comments
| "react-native-web": "^0.6.0", | ||
| "react-scripts": "^1.1.1" | ||
| "react-scripts": "^1.1.1", | ||
| "svgs": "^3.2.1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha, i'll switch versions
src/component/spinner.js
Outdated
| Defs, | ||
| Stop, | ||
| LinearGradient, | ||
| } from '../component/svg'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
./svg from the components dir (for text/icon too)
| export const LinearGradient = LinearGradientJS; | ||
|
|
||
| const Svg = SvgJS; | ||
| export default Svg; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should re-export all here. Try
export * from 'svgs';
See https://stackoverflow.com/questions/29844074/es6-export-all-values-from-object
| "prop-types": "15.6.1", | ||
| "rip-out": "1.0.0" | ||
| } | ||
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@valentinewallace I removed the changes and rebased the branch.
|
Also, I was getting a warning in the cobsole in storybook. |
working on it... can't seem to properly import |
Ok cool. |
|
Plan is to move the |
src/component/spinner.js
Outdated
| }); | ||
| export const SmallSpinner = ({ ...props }) => ( | ||
| <ActivityIndicator | ||
| sizeM="small" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@valentinewallace this prop does not exist. Only size https://facebook.github.io/react-native/docs/activityindicator#size
61078ac to
7a2b913
Compare
tanx
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks really good 👍 I made some minor resize changes and have just a small comment on the storybook entry.
stories/component/spinner.js
Outdated
| <Background | ||
| color={color.blackDark} | ||
| style={{ flexDirection: 'row', width: '100%' }} | ||
| > |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're wrapping a Background inside of a MainContent. They're meant to be used the other way around. You wouldn't need to specify the width in that case.
39dbe40 to
d7b546a
Compare
tanx
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made a few more minor changes. But looks good now.

@tanx what do you think about using these for our purple spinners? they can't do the gradient from the invision project but they should be able to scale to the correct size
Closes #279