Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# https://EditorConfig.org
root = true

[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
indent_style = space
indent_size = 2
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Tell github that .re and .rei files are Reason, sometimes recognized as C/C++
*.re linguist-language=Reason
*.rei linguist-language=Reason
31 changes: 31 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Build

on: [push]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version:
- 8.x
- 10.x
- 12.x

steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install
run: |
yarn install \
--non-interactive \
--frozen-lockfile
- name: Test
run: yarn test
env:
CI: true
19 changes: 12 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
# Ocaml / Reason / BuckleScript artifacts
.bsb.lock
**/lib/bs
**/lib/ocaml
**/.merlin
*.log

# macos crap
# macOS crap
.DS_Store

# node
node_modules

# npm unused lock file (we use yarn.lock)
package-lock.json
package-lock.json

# Ocaml / Reason / BuckleScript artifacts
#*.bs.js # we do want this files to ensure zero-cost
.bsb.lock
**/lib/bs
**/lib/ocaml
**/.merlin
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
12
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.bs.js
package.json
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Changelog of `@reason-react-native/checkbox`

## 0.2.0 - 2019-10-05

Initial release.

As part of the Lean Core effort, `CheckBox` has been ejected from React Native.
You may refer to the relevant
[issue](https://github.com/facebook/react-native/issues/23313) for further
information.
78 changes: 78 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to make participation in our project and our
community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and
expression, level of experience, education, socio-economic status, nationality,
personal appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

- The use of sexualized language or imagery and unwelcome sexual attention or
advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic
address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, or to ban temporarily or permanently any
contributor for other behaviors that they deem inappropriate, threatening,
offensive, or harmful.

## Scope

This Code of Conduct applies within all project spaces, and it also applies when
an individual is representing the project or its community in public spaces.
Examples of representing a project or community include using an official
project e-mail address, posting via an official social media account, or acting
as an appointed representative at an online or offline event. Representation of
a project may be further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at <opensource-conduct@moox.io>. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an
incident. Further details of specific enforcement policies may be posted
separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 1.4, available at
https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
97 changes: 97 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Contributing Guide to `@reason-react-native/checkbox`

We love your input! We want to make contributing to this project as easy and
transparent as possible, whether it's:

- Reporting a bug
- Discussing the current state of the code
- Submitting a fix
- Proposing new features
- Becoming a maintainer

We use GitHub to

- host code
- track issues and feature requests
- accept pull requests.
- tag & publish release as well as pushing those to npm.

## Reporting bugs or requesting a feature

We use GitHub issues to track public bugs or discuss about new features. Please
write bug reports or feature requests with detail, background, and sample code
if necessary.

Just try to
[open a new issue](https://github.com/reason-react-native/checkbox/issues/new/choose)
& follow the instructions that should be prefilled for
[bug](.github/ISSUE_TEMPLATE/bug.md) or
[feature request](.github/ISSUE_TEMPLATE/feature.md).

People _love_ thorough bug reports. Not even kidding.

## Fixing bugs & implementing features

We use [Github flow](https://guides.github.com/introduction/flow/index.html), so
most code changes happen through Pull Requests.

[Pull Requests](https://help.github.com/en/articles/about-pull-requests) are the
best way to propose changes to the codebase since they notify watchers & allow
contributors to discuss about changes.

We actively welcome your pull requests.

To make a pull request, you need to:

1. [Fork the repo](https://help.github.com/en/articles/fork-a-repo)
2. Clone it and install dependencies

```console
git clone https://github.com/reason-react-native/checkbox
cd checkbox
yarn
```

3. Create a local branch, from `master` (unless specified differently)

```console
git checkout -b <name-of-your-branch>
```

4. Add your changes!

- If you've added code that should be tested, add tests.
- If you've changed APIs, update the documentation.

5. Ensure the everything is still fine.

```console
yarn test
```

6. Commit & push your branch online

```console
git add -A .
git commit -m "Your commit message"
```

7. [Create a pull request](https://help.github.com/en/articles/creating-a-pull-request)

_If you are new to Git or GitHub, we encourage you to have a look to
[makeapullrequest.com](http://makeapullrequest.com)._

## Code styling

Everything as been automated: as soon as you commit, everything should be
automatically reformated if necessary (thanks to a transparent git hook) so we
don't have to think about it!

## Licensing

By contributing, you agree that your contributions will be licensed under our
MIT License.

When you submit code changes, your submissions are understood to be under the
same [MIT License](./LICENSE) that covers the project. Feel free to contact the
maintainers if that's a concern.
126 changes: 124 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,124 @@
# checkbox
ReasonML / BuckleScript bindings for @react-native-community/checkbox
# `@reason-react-native/checkbox`

[![Build Status](https://github.com/reason-react-native/checkbox/workflows/Build/badge.svg)](https://github.com/reason-react-native/checkbox/actions)
[![Version](https://img.shields.io/npm/v/@reason-react-native/checkbox.svg)](https://www.npmjs.com/@reason-react-native/checkbox)
[![Chat](https://img.shields.io/discord/235176658175262720.svg?logo=discord&colorb=blue)](https://reasonml-community.github.io/reason-react-native/discord/)

[ReasonML](https://reasonml.github.io) /
[BuckleScript](https://bucklescript.github.io) bindings for
[`@react-native-community/react-native-checkbox`](https://github.com/react-native-community/react-native-checkbox).

The module will be exposed as `ReactNativeCheckbox`.

Version x.y.z of `@reason-react-native/checkbox` is intended to be compatible
with version x.y.z of `@react-native-community/react-native-checkbox`.

## Installation

When
[`@react-native-community/react-native-checkbox`](`https://github.com/react-native-community/react-native-checkbox`)
is properly installed & configured by following their installation instructions,
you can install the bindings:

```console
npm install @reason-react-native/checkbox
# or
yarn add @reason-react-native/checkbox
```

`@reason-react-native/checkbox` should be added to `bs-dependencies` in your
`bsconfig.json`. For example,

```diff
{
//...
"bs-dependencies": [
"reason-react",
"reason-react-native",
// ...
+ "@reason-react-native/checkbox"
],
//...
}
```

## Usage

### Types

#### `checkBoxEvent`

```reason
type checkBoxEvent =
ReactNative.Event.syntheticEvent({
.
"target": int,
"value": bool,
});
```

`value` represents value of the checkbox as updated by the event.

#### `element`

Type to be used in `ref` and with `NativeMethods`, as with other components in
React Native bindings.

#### `ref`

is an alias for `React.Ref.t(Js.nullable(element))`.

### Props

All props are optional.

#### `value: bool`

Value of the checkbox. When `true`, checkbox will be checked. Default value is
`false`.

#### `disabled: bool`

When `true`, user will not be able to toggle the checkbox. Default value is
`false`.

#### `onChange: checkBoxEvent => unit`

Returns a [native event](#checkBoxEvent).

#### `onValueChange`

Returns the new `bool` value.

#### `tintColors`

```reason
tintColors:
(~_true: ReactNative.Color.t=?, ~_false: ReactNative.Color.t=?, unit) => tintColors
```

Value for `_true` will be used when the checkbox is checked, and value for
`_false` will be used when it is not checked.

### `View` props

Refer to
[`@reason-react-native/react-native`](https://github.com/reason-react-native/react-native)
[documentation](https://reasonml-community.github.io/reason-react-native/en/docs/components/View/).

---

## Changelog

Check the [changelog](./CHANGELOG.md) for more information about recent
releases.

## Contribute

Read the [contribution guidelines](./CONTRIBUTING.md) before contributing.

## Code of Conduct

We want this community to be friendly and respectful to each other. Please read
[our full code of conduct](./CODE_OF_CONDUCT.md) so that you can understand what
actions will and will not be tolerated.
Loading