Module Button-BsReactNative

let make: ?⁠accessibilityLabel:string => ?⁠color:string => ?⁠disabled:bool => onPress:(unit => unit) => ?⁠testID:string => title:string => array(ReasonReact.reactElement) => ReasonReact.component(ReasonReact.stateless, ReasonReact.noRetainedProps, unit);

Button in React Native, has two required props title and onPress, so in order to render a Button component you need to provide them:

Example

default

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

let make = _children => {
  ...component,
  render: _self =>
    <Button title="Press me" onPress=(() => Js.log("pressed")) />,
};

color

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

let make = _children => {
  ...component,
  render: _self =>
    <Button
      color="tomato"
      title="Press me"
      onPress=(() => Js.log("pressed"))
    />,
};

hex colors

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

let make = _children => {
  ...component,
  render: _self =>
    <Button
      color="#ff00ff"
      title="Press me"
      onPress=(() => Js.log("pressed"))
    />,
};

rgb colors

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

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

let make = _children => {
  ...component,
  render: _self =>
    <Button
      color="rgb(255, 34, 11)"
      title="Press me"
      onPress=(() => Js.log("pressed"))
    />,
};

disabled

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

let make = _children => {
  ...component,
  render: _self =>
    <Button
      disabled=true
      title="Press me"
      onPress=(() => Js.log("pressed"))
    />,
};

Props

accessibilityLabel

~accessibilityLabel: string=?

color

~color: string=?

disabled

~disabled: bool=?

onPress

~onPress: unit => unit

testID

~testID: string=?

title

~title: string