Skip to content
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

Support fixed position for prototypes #507

Open
macintoshhelper opened this issue May 5, 2020 · 5 comments
Open

Support fixed position for prototypes #507

macintoshhelper opened this issue May 5, 2020 · 5 comments

Comments

@macintoshhelper
Copy link
Contributor

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 macintoshhelper changed the title Support fixed position for prototypes [Proposal] Support fixed position for prototypes May 5, 2020
@mathieudutour
Copy link
Collaborator

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
Copy link
Contributor Author

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
Copy link
Collaborator

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
Copy link
Contributor Author

macintoshhelper commented May 5, 2020

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
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants