Skip to content

Commit d20b42b

Browse files
authored
add documentation (#2)
1 parent a7449a7 commit d20b42b

File tree

12 files changed

+856
-3393
lines changed

12 files changed

+856
-3393
lines changed

.editorconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# https://EditorConfig.org
2+
root = true
3+
4+
[*]
5+
end_of_line = lf
6+
insert_final_newline = true
7+
charset = utf-8
8+
indent_style = space
9+
indent_size = 2

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Tell github that .re and .rei files are Reason, sometimes recognized as C/C++
2+
*.re linguist-language=Reason
3+
*.rei linguist-language=Reason

.github/workflows/build.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Build
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
8+
runs-on: ubuntu-latest
9+
10+
strategy:
11+
matrix:
12+
node-version:
13+
- 8.x
14+
- 10.x
15+
- 12.x
16+
17+
steps:
18+
- uses: actions/checkout@v1
19+
- name: Use Node.js ${{ matrix.node-version }}
20+
uses: actions/setup-node@v1
21+
with:
22+
node-version: ${{ matrix.node-version }}
23+
- name: Install
24+
run: |
25+
yarn install \
26+
--non-interactive \
27+
--frozen-lockfile
28+
- name: Test
29+
run: yarn test
30+
env:
31+
CI: true

.gitignore

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
1-
# Ocaml / Reason / BuckleScript artifacts
2-
.bsb.lock
3-
**/lib/bs
4-
**/lib/ocaml
5-
**/.merlin
1+
*.log
62

7-
# macos crap
3+
# macOS crap
84
.DS_Store
5+
96
# node
107
node_modules
8+
119
# npm unused lock file (we use yarn.lock)
12-
package-lock.json
10+
package-lock.json
11+
12+
# Ocaml / Reason / BuckleScript artifacts
13+
#*.bs.js # we do want this files to ensure zero-cost
14+
.bsb.lock
15+
**/lib/bs
16+
**/lib/ocaml
17+
**/.merlin

.node-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
12

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.bs.js
2+
package.json

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Changelog of `@reason-react-native/checkbox`
2+
3+
## 0.2.0 - 2019-10-05
4+
5+
Initial release.
6+
7+
As part of the Lean Core effort, `CheckBox` has been ejected from React Native.
8+
You may refer to the relevant
9+
[issue](https://github.com/facebook/react-native/issues/23313) for further
10+
information.

CODE_OF_CONDUCT.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as
6+
contributors and maintainers pledge to make participation in our project and our
7+
community a harassment-free experience for everyone, regardless of age, body
8+
size, disability, ethnicity, sex characteristics, gender identity and
9+
expression, level of experience, education, socio-economic status, nationality,
10+
personal appearance, race, religion, or sexual identity and orientation.
11+
12+
## Our Standards
13+
14+
Examples of behavior that contributes to creating a positive environment
15+
include:
16+
17+
- Using welcoming and inclusive language
18+
- Being respectful of differing viewpoints and experiences
19+
- Gracefully accepting constructive criticism
20+
- Focusing on what is best for the community
21+
- Showing empathy towards other community members
22+
23+
Examples of unacceptable behavior by participants include:
24+
25+
- The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
- Trolling, insulting/derogatory comments, and personal or political attacks
28+
- Public or private harassment
29+
- Publishing others' private information, such as a physical or electronic
30+
address, without explicit permission
31+
- Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
33+
34+
## Our Responsibilities
35+
36+
Project maintainers are responsible for clarifying the standards of acceptable
37+
behavior and are expected to take appropriate and fair corrective action in
38+
response to any instances of unacceptable behavior.
39+
40+
Project maintainers have the right and responsibility to remove, edit, or reject
41+
comments, commits, code, wiki edits, issues, and other contributions that are
42+
not aligned to this Code of Conduct, or to ban temporarily or permanently any
43+
contributor for other behaviors that they deem inappropriate, threatening,
44+
offensive, or harmful.
45+
46+
## Scope
47+
48+
This Code of Conduct applies within all project spaces, and it also applies when
49+
an individual is representing the project or its community in public spaces.
50+
Examples of representing a project or community include using an official
51+
project e-mail address, posting via an official social media account, or acting
52+
as an appointed representative at an online or offline event. Representation of
53+
a project may be further defined and clarified by project maintainers.
54+
55+
## Enforcement
56+
57+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
58+
reported by contacting the project team at <[email protected]>. All
59+
complaints will be reviewed and investigated and will result in a response that
60+
is deemed necessary and appropriate to the circumstances. The project team is
61+
obligated to maintain confidentiality with regard to the reporter of an
62+
incident. Further details of specific enforcement policies may be posted
63+
separately.
64+
65+
Project maintainers who do not follow or enforce the Code of Conduct in good
66+
faith may face temporary or permanent repercussions as determined by other
67+
members of the project's leadership.
68+
69+
## Attribution
70+
71+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
72+
version 1.4, available at
73+
https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
74+
75+
[homepage]: https://www.contributor-covenant.org
76+
77+
For answers to common questions about this code of conduct, see
78+
https://www.contributor-covenant.org/faq

CONTRIBUTING.md

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# Contributing Guide to `@reason-react-native/checkbox`
2+
3+
We love your input! We want to make contributing to this project as easy and
4+
transparent as possible, whether it's:
5+
6+
- Reporting a bug
7+
- Discussing the current state of the code
8+
- Submitting a fix
9+
- Proposing new features
10+
- Becoming a maintainer
11+
12+
We use GitHub to
13+
14+
- host code
15+
- track issues and feature requests
16+
- accept pull requests.
17+
- tag & publish release as well as pushing those to npm.
18+
19+
## Reporting bugs or requesting a feature
20+
21+
We use GitHub issues to track public bugs or discuss about new features. Please
22+
write bug reports or feature requests with detail, background, and sample code
23+
if necessary.
24+
25+
Just try to
26+
[open a new issue](https://github.com/reason-react-native/checkbox/issues/new/choose)
27+
& follow the instructions that should be prefilled for
28+
[bug](.github/ISSUE_TEMPLATE/bug.md) or
29+
[feature request](.github/ISSUE_TEMPLATE/feature.md).
30+
31+
People _love_ thorough bug reports. Not even kidding.
32+
33+
## Fixing bugs & implementing features
34+
35+
We use [Github flow](https://guides.github.com/introduction/flow/index.html), so
36+
most code changes happen through Pull Requests.
37+
38+
[Pull Requests](https://help.github.com/en/articles/about-pull-requests) are the
39+
best way to propose changes to the codebase since they notify watchers & allow
40+
contributors to discuss about changes.
41+
42+
We actively welcome your pull requests.
43+
44+
To make a pull request, you need to:
45+
46+
1. [Fork the repo](https://help.github.com/en/articles/fork-a-repo)
47+
2. Clone it and install dependencies
48+
49+
```console
50+
git clone https://github.com/reason-react-native/checkbox
51+
cd checkbox
52+
yarn
53+
```
54+
55+
3. Create a local branch, from `master` (unless specified differently)
56+
57+
```console
58+
git checkout -b <name-of-your-branch>
59+
```
60+
61+
4. Add your changes!
62+
63+
- If you've added code that should be tested, add tests.
64+
- If you've changed APIs, update the documentation.
65+
66+
5. Ensure the everything is still fine.
67+
68+
```console
69+
yarn test
70+
```
71+
72+
6. Commit & push your branch online
73+
74+
```console
75+
git add -A .
76+
git commit -m "Your commit message"
77+
```
78+
79+
7. [Create a pull request](https://help.github.com/en/articles/creating-a-pull-request)
80+
81+
_If you are new to Git or GitHub, we encourage you to have a look to
82+
[makeapullrequest.com](http://makeapullrequest.com)._
83+
84+
## Code styling
85+
86+
Everything as been automated: as soon as you commit, everything should be
87+
automatically reformated if necessary (thanks to a transparent git hook) so we
88+
don't have to think about it!
89+
90+
## Licensing
91+
92+
By contributing, you agree that your contributions will be licensed under our
93+
MIT License.
94+
95+
When you submit code changes, your submissions are understood to be under the
96+
same [MIT License](./LICENSE) that covers the project. Feel free to contact the
97+
maintainers if that's a concern.

README.md

Lines changed: 124 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,124 @@
1-
# checkbox
2-
ReasonML / BuckleScript bindings for @react-native-community/checkbox
1+
# `@reason-react-native/checkbox`
2+
3+
[![Build Status](https://github.com/reason-react-native/checkbox/workflows/Build/badge.svg)](https://github.com/reason-react-native/checkbox/actions)
4+
[![Version](https://img.shields.io/npm/v/@reason-react-native/checkbox.svg)](https://www.npmjs.com/@reason-react-native/checkbox)
5+
[![Chat](https://img.shields.io/discord/235176658175262720.svg?logo=discord&colorb=blue)](https://reasonml-community.github.io/reason-react-native/discord/)
6+
7+
[ReasonML](https://reasonml.github.io) /
8+
[BuckleScript](https://bucklescript.github.io) bindings for
9+
[`@react-native-community/react-native-checkbox`](https://github.com/react-native-community/react-native-checkbox).
10+
11+
The module will be exposed as `ReactNativeCheckbox`.
12+
13+
Version x.y.z of `@reason-react-native/checkbox` is intended to be compatible
14+
with version x.y.z of `@react-native-community/react-native-checkbox`.
15+
16+
## Installation
17+
18+
When
19+
[`@react-native-community/react-native-checkbox`](`https://github.com/react-native-community/react-native-checkbox`)
20+
is properly installed & configured by following their installation instructions,
21+
you can install the bindings:
22+
23+
```console
24+
npm install @reason-react-native/checkbox
25+
# or
26+
yarn add @reason-react-native/checkbox
27+
```
28+
29+
`@reason-react-native/checkbox` should be added to `bs-dependencies` in your
30+
`bsconfig.json`. For example,
31+
32+
```diff
33+
{
34+
//...
35+
"bs-dependencies": [
36+
"reason-react",
37+
"reason-react-native",
38+
// ...
39+
+ "@reason-react-native/checkbox"
40+
],
41+
//...
42+
}
43+
```
44+
45+
## Usage
46+
47+
### Types
48+
49+
#### `checkBoxEvent`
50+
51+
```reason
52+
type checkBoxEvent =
53+
ReactNative.Event.syntheticEvent({
54+
.
55+
"target": int,
56+
"value": bool,
57+
});
58+
```
59+
60+
`value` represents value of the checkbox as updated by the event.
61+
62+
#### `element`
63+
64+
Type to be used in `ref` and with `NativeMethods`, as with other components in
65+
React Native bindings.
66+
67+
#### `ref`
68+
69+
is an alias for `React.Ref.t(Js.nullable(element))`.
70+
71+
### Props
72+
73+
All props are optional.
74+
75+
#### `value: bool`
76+
77+
Value of the checkbox. When `true`, checkbox will be checked. Default value is
78+
`false`.
79+
80+
#### `disabled: bool`
81+
82+
When `true`, user will not be able to toggle the checkbox. Default value is
83+
`false`.
84+
85+
#### `onChange: checkBoxEvent => unit`
86+
87+
Returns a [native event](#checkBoxEvent).
88+
89+
#### `onValueChange`
90+
91+
Returns the new `bool` value.
92+
93+
#### `tintColors`
94+
95+
```reason
96+
tintColors:
97+
(~_true: ReactNative.Color.t=?, ~_false: ReactNative.Color.t=?, unit) => tintColors
98+
```
99+
100+
Value for `_true` will be used when the checkbox is checked, and value for
101+
`_false` will be used when it is not checked.
102+
103+
### `View` props
104+
105+
Refer to
106+
[`@reason-react-native/react-native`](https://github.com/reason-react-native/react-native)
107+
[documentation](https://reasonml-community.github.io/reason-react-native/en/docs/components/View/).
108+
109+
---
110+
111+
## Changelog
112+
113+
Check the [changelog](./CHANGELOG.md) for more information about recent
114+
releases.
115+
116+
## Contribute
117+
118+
Read the [contribution guidelines](./CONTRIBUTING.md) before contributing.
119+
120+
## Code of Conduct
121+
122+
We want this community to be friendly and respectful to each other. Please read
123+
[our full code of conduct](./CODE_OF_CONDUCT.md) so that you can understand what
124+
actions will and will not be tolerated.

0 commit comments

Comments
 (0)