-
Notifications
You must be signed in to change notification settings - Fork 11
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(exoflex): fix unable to change inner bar height #159
Conversation
nathaniaelvina
commented
Oct 29, 2019
- change some styling so it's more similar to RNP
- enable the user to change inner bar height
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 great!
let borderRadius = (style && style.borderRadius) || roundness; | ||
|
||
let onLayout = (event: LayoutChangeEvent) => | ||
setWidth(event.nativeEvent.layout.width); |
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.
Can't we just use flex: 1
or width: '100%'
instead?
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.
Actually, I just mimic how paper implemented it. we can change back to 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.
Hmm, I think I get what Paper wants to by using onLayout. Could you please check it on a browser and resize the browser width?
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.
I thought width: '100%'
won't work well on desktop browser. But actually, it works better than onLayout
.
let height = (style && style.height) || 8; | ||
let borderRadius = (style && style.borderRadius) || roundness; |
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 think we shouldn't access style object directly.
Either we flatten it first or use a different approach.
Quiz time! What happen if the user pass in something like style={[styles.foo, { height: 7 }]}
?
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.
Right, my point is in the style.borderRadius
part. We're not supposed to access it directly.
On older version of RN, the style prop could be an array or an object, or even a number!
Can you guess where the number came from? 😉
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.
righttt, the StyleSheet.create
returns number
a5c0a2f
to
fcfbc26
Compare
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.
🐑 it
@@ -20,7 +20,10 @@ export default function ProgressBar(props: Props) { | |||
duration: 500, | |||
}); | |||
|
|||
let height = (style && style.height) || 8; | |||
let flattenedStyle = StyleSheet.flatten<ViewStyle>(style); |
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.
let flattenedStyle = StyleSheet.flatten<ViewStyle>(style); | |
let flattenedStyle = StyleSheet.flatten<ViewStyle>(style) || {}; |
So we can drop the flattenedStyle &&
* style(exoflex): change progress bar styling * docs(exoflex): update example