airbnb / react-sketchapp

render React components to Sketch ⚛️💎
http://airbnb.io/react-sketchapp/
MIT License
14.94k stars 821 forks source link

Support fixed position for prototypes #507

Open macintoshhelper opened 4 years ago

macintoshhelper commented 4 years ago

I am...

------------------------------------------------------------------------------------------------- Requesting a new feature

Proposal/Feature-request:

Would be great to support some kind of version of position: fixed; to be used in Sketch prototypes. Fixed position translates nicely to Sketch's Fix position when scrolling. This would allow for having bottom navigation tab bars, etc in prototypes.

React Native doesn't support position: fixed; though, so if the same component/styling is used in a React Native app, it may break it. Some alternative ideas that should solve that:

mathieudutour commented 4 years ago

I think the easiest is to extend the flow prop to include fixOnScroll (or something similar). Would there be any downside? It's already Sketch specific

macintoshhelper commented 4 years ago

Hmm, that could work. flow requires targetId, target and animationType at the moment and will register a flow connection if it's truthy, so would need to make them optional and return only { isFixedToViewport } if target is missing.

mathieudutour commented 4 years ago

Yeah. I like having all of them in a flow namespace so that the API surface doesn't expand too much. If Sketch decides to add more stuff related to prototyping later, we can stick it in there as well

macintoshhelper commented 4 years ago

Great, will open a PR then. Maybe worth creating a new docs page on prototyping too? I think it's a really interesting use-case for React Sketch.app – creating Sketch Cloud web or Sketch Mirror prototypes for React Native codebases.

mathieudutour commented 4 years ago

Sounds good. Your react-sketchapp-router could be a good addition to that page