feat: add AnimatedFAB improvements - #2907
lukewalczak merged 52 commits into
Conversation
|
@lukewalczak I noticed two things:
|
The FAB should not return to an extended FAB until the user scrolls back to the top of the page. like on the video from MD
|
0d96eb4 to
184ce29
Compare
80fa1f5 to
a573c04
Compare
…ct-native-paper into feat/animated-extended-fab-improvements
a637f14 to
fcaefef
Compare
p-syche
left a comment
There was a problem hiding this comment.
Great job improving this component!
I left you a few comments to consider, and a few nitpicks ;)
One important note is that you have a FlatList without keys which definitely needs to be fixed. I also don't love the hardcoded SIZE.
Other than that this is solid work, nice usage of types 👍
| /** | ||
| * Label for extended `FAB`. | ||
| */ | ||
| label: string; |
There was a problem hiding this comment.
It would be preferable to add some string length constraints to your label.
There was a problem hiding this comment.
That's a good idea, however we didn't yet choose what the allowed label size is. I think for now we'll allow any size and in future iterations we can improve on that. WDYT @lukewalczak ?
There was a problem hiding this comment.
Actually, I think we should leave that responsibility to the user.
| testID?: string; | ||
| }; | ||
|
|
||
| const SIZE = 56; |
There was a problem hiding this comment.
Hardcoded size may become a real headache when Apple comes up with a new super small or super-duper large display 😂 Consider using something more future-proof, for example check screen size and calculate a percentage of it.
There was a problem hiding this comment.
I agree with you. The size comes from the Material Design Guidelines, but I'm also aware that we use many hacks to just make it "look good". While I think we shouldn't make the Icon responsive (nor derive it from screen), I think we still could do a better job and avoid hacks. I'll leave it as it is, but for sure this could be improved in the future
| ...defaultPositionStyles, | ||
| }, | ||
| absoluteFill: {}, | ||
| }; |
There was a problem hiding this comment.
I'm not sure I see the point of creating CombinedStyles, it adds a bit of complexity. Can you tell me why you decided to create this const this way?
There was a problem hiding this comment.
My main goal was to move dynamic styles logic to a function, that I can later move to a separate file to clean up the JSX and component logic. Thanks for pointing this out, as I forgot to do it before requesting code review 😄 Please take a look at my recent changes
| }), | ||
| }, | ||
| ]; | ||
| } |
There was a problem hiding this comment.
This whole block may be more readable as a switch statement instead of multiple ifs.
There was a problem hiding this comment.
I've tried implementing it with switch statement, but I think it's kind of the same. Ideally I would use something like Immer here to mutate the objects, but that's what we're left with for now
…ct-native-paper into feat/animated-extended-fab-improvements
|
@p-syche Thank you so much for your feedback! I really appreciate it 👍🏻 I answered your questions and implemented requested changes. There are also some small refactor commits to improve code readability. I think the PR is ready for your final review @p-syche @lukewalczak |
|
@Drakeoon thank you for following up on my notes. |
|
@Drakeoon could you please also:
to unblock that component in prod? |
Summary
This PR introduces fixes and improvements to original AnimatedFAB pull request
animateFor: "left"propertyAdd integration tests for AnimatedFAB component (new properties)Test plan
iOS
AnimatedFAB.iOS.mp4
Android
AnimatedFAB.Android.mp4