bs-react-native-action-sheet

1.0.0 • Public • Published

bs-react-native-action-sheet

Greenkeeper badge Build Status

BS bindings for @expo/react-native-action-sheet

Install

yarn add bs-react-native-action-sheet @expo/react-native-action-sheet

And then update your bsconfig.json with it Also do the normal setup as you would do for the JS one. Add the ActionSheetProvider somewhere in the top of your components tree.

Usage

let component = ReasonReact.statelessComponent("ListItem");
let handlePress = (showActionSheetWithOptions, ()) =>
  showActionSheetWithOptions(
    /* We'll probably make these variants in the next release */
    ~options=["Edit", "Delete", "Cancel"],
    ~destructiveButtonIndex=1,
    ~cancelButtonIndex=2,
    ~callback=
      (buttonIndex) =>
        switch buttonIndex {
        | 0 => ()
        | _ => ()
        }
  );
let make = (~label, ~image, ~onPress=ignore, _children) => {
  ...component,
  render: (_self) =>
    <ActionSheet>
      (
        (~showActionSheetWithOptions) =>
          <Wrapper onPress>
            <HGroup>
              <ListIcon source=image />
              <Text
                ellipsizeMode=`tail
                style=Style.(style([fontSize(15.), marginLeft(20.)]))
                value=label
              />
            </HGroup>
            <TouchableOpacity onPress=(handlePress(showActionSheetWithOptions))>
              <MaterialCommunityIcons name="dots-vertical" color=AppTheme.Colors.greyLight />
            </TouchableOpacity>
          </Wrapper>
      )
    </ActionSheet>
};

Readme

Keywords

none

Package Sidebar

Install

npm i bs-react-native-action-sheet

Weekly Downloads

2

Version

1.0.0

License

MIT

Unpacked Size

42.1 kB

Total Files

19

Last publish

Collaborators

  • gabrielrubens
  • medson10