Skip to content
This repository has been archived by the owner on May 2, 2019. It is now read-only.
/ restyled Public archive

Styled Components concept for Reason React, only works with bs-react-native for now

License

Notifications You must be signed in to change notification settings

Astrocoders/restyled

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bs-restyled

Greenkeeper badge Build Status

Styled Components concept for Reason

Install

  • yarn add bs-restyled
  • Then add it to your bs-dependencies
{
  "name": "myapp",
  "reason": {
    "react-jsx": 2
  },
  "bs-dependencies": [
    "bs-react-native",
    "reason-react",
    "bs-restyled"
  ],
  "bsc-flags": ["-bs-super-errors"],
}

Usage

module Wrapper = Styled.View {
  type styleParams = unit;
  let style (_) => Style.(style([flex(1), flexDirection(`column), justifyContent(`center)]));
};

let component = ReasonReact.statelessComponent("MyView");

let make = (_children) => {
  ...component,
  render: (_self) =>
    <Wrapper>
      ...anything else...
    </Wrapper>
}

Take a look in the REStyled.re for more

Acknowledgments

Thanks everyone in Reason Discord for pointing me directions and specially to Jared who proposed this usage to me here https://gist.github.com/jaredly/a5e0102c060b7a1b40525d41f87843a8