react-sketchapp icon indicating copy to clipboard operation
react-sketchapp copied to clipboard

Support fixed position for prototypes

Open macintoshhelper opened this issue 4 years ago • 5 comments

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:

  • Create a new react-sketchapp only styling prop: e.g. prototypePosition: 'fixed'
  • Use position: 'fixed', but document that this could be platform specific (`position: Platform.OS === 'sketch' ? 'fixed' : 'relative')
  • Implement a new ScrollView component, and have an Artboard prop that makes anything not inside this component fixed. Not sure how much value this would have though for code re-use between web and React Native though when components like FlatList are more likely to be used.

macintoshhelper avatar May 05 '20 11:05 macintoshhelper

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

mathieudutour avatar May 05 '20 12:05 mathieudutour

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.

macintoshhelper avatar May 05 '20 12:05 macintoshhelper

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

mathieudutour avatar May 05 '20 12:05 mathieudutour

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.

macintoshhelper avatar May 05 '20 12:05 macintoshhelper

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

mathieudutour avatar May 05 '20 12:05 mathieudutour