-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
feat: support loading indicator for FAB #985
Conversation
Hey @sritharanpalani, thank you for your pull request 🤗. The documentation from this branch can be viewed here. Please remember to update Typescript types if you changed API. |
ba9555a
to
3543afb
Compare
src/components/FAB/FAB.js
Outdated
@@ -42,7 +42,11 @@ type Props = $RemoveChildren<typeof Surface> & {| | |||
/** | |||
* Whether `FAB` is currently visible. | |||
*/ | |||
visible: boolean, | |||
visible?: boolean, |
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.
Guessing this one does not need to be changed?
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.
optional removed :)
@sritharanpalani can you add a screenshot or gif on how this looks? |
src/components/FAB/FAB.js
Outdated
@@ -256,6 +270,10 @@ const styles = StyleSheet.create({ | |||
disabled: { | |||
elevation: 0, | |||
}, | |||
icon: { |
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.
Remove this, it's not needed
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.
Done.
src/components/FAB/FAB.js
Outdated
{icon && loading !== true ? ( | ||
<CrossFadeIcon source={icon} size={24} color={foregroundColor} /> | ||
) : null} | ||
{loading ? ( |
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.
Only display it when label
prop is specified (only for extended FAB)
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.
Done.
src/components/FAB/FAB.js
Outdated
) : null} | ||
{loading ? ( | ||
<ActivityIndicator | ||
size="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.
Pass size={18}
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.
Done.
src/components/FAB/FAB.js
Outdated
@@ -2,7 +2,7 @@ | |||
|
|||
import color from 'color'; | |||
import * as React from 'react'; | |||
import { Animated, View, StyleSheet } from 'react-native'; | |||
import { Animated, View, StyleSheet, ActivityIndicator } 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.
Use ActivityIndicator
from paper please.
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.
Done.
src/components/FAB/FAB.js
Outdated
<ActivityIndicator | ||
size="small" | ||
color={foregroundColor} | ||
style={styles.icon} |
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 don't need to pass any styles here
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.
Done.
- refactor: remove icon from FAB.js - fix: pass size 18 for ActivityIndicator in FAB.js - fix: add FAB example for loading in FABExample.js - fix: use ActivityIndicator from paper - fix: show loadin only if label & loading is specified
@ferrannp screenshot added, let me know if this is sufficient? And btw, apologize for addressing CR comments very late. |
Motivation
It is nice to have a loading indicator for a fab button
Test plan
1 - open example app in expo
2 -click on FAB example
3 -you can see the example of FAB with loading indicator as similar to a normal button
4 - try out ->