Skip to content

Commit 7bce780

Browse files
committed
0.6.0
1 parent 4db11fc commit 7bce780

File tree

8 files changed

+282
-66
lines changed

8 files changed

+282
-66
lines changed

CHANGELOG.md

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,5 @@
1-
# Changelog of `@reason-react-native/__template__`
1+
# Changelog of `@reason-react-native/safe-area-context`
22

3-
## X.Y.Z - 20YY-MM-DD
3+
## 0.6.0 - 2019-12-19
44

5-
Short & concise description
6-
7-
### 💥 Breaking changes
8-
9-
- Something, in [1234567](<link to commit on github>) by @<usename>
10-
11-
### 🐛 Fixes
12-
13-
- Something else, in [1234567](<link to commit on github>) by @<usename>
14-
15-
### Internal changes
16-
17-
(If worth mentioning)
5+
Initial release

README.md

Lines changed: 78 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,33 @@
1-
**How to use this template**
2-
3-
- Put your bindings in `src/ReactNativeSomething` & rename accordingly or use
4-
`bsconfig.json` `"namespace"` field (more on this below),
5-
- Update all occurences of
6-
7-
- `@reason-react-native/__template__`
8-
- `https://github.com/reason-react-native/__template__`
9-
- `__template__`
10-
- `@react-native-community/something`
11-
- `https://github.com/react-native-community/something`
12-
- `ReactNativeSomething`. If you have more than a file exposed, you should
13-
consider using BuckleScript custom namespace by adjusting `bsconfig.json`
14-
and adding a `"namespace": "react-native-something"` (note that it will be
15-
converted to `ReactNativeSomething`)
16-
17-
- Add your `@react-native-community/something` (adjusted) in `peerDependencies`
18-
& `devDependencies` section
19-
- Adjust the changelog (and/or clean it)
20-
- Remove this part ⬆ & keep everything below ⬇
1+
# `@reason-react-native/safe-area-context`
212

22-
---
23-
24-
# `@reason-react-native/__template__`
25-
26-
[![Build Status](https://github.com/reason-react-native/__template__/workflows/Build/badge.svg)](https://github.com/reason-react-native/__template__/actions)
27-
[![Version](https://img.shields.io/npm/v/@reason-react-native/__template__.svg)](https://www.npmjs.com/@reason-react-native/__template__)
3+
[![Build Status](https://github.com/reason-react-native/safe-area-context/workflows/Build/badge.svg)](https://github.com/reason-react-native/safe-area-context/actions)
4+
[![Version](https://img.shields.io/npm/v/@reason-react-native/safe-area-context.svg)](https://www.npmjs.com/@reason-react-native/safe-area-context)
285
[![Chat](https://img.shields.io/discord/235176658175262720.svg?logo=discord&colorb=blue)](https://reasonml-community.github.io/reason-react-native/discord/)
296

307
[ReasonML](https://reasonml.github.io) /
318
[BuckleScript](https://bucklescript.github.io) bindings for
32-
[`@react-native-community/something`](https://github.com/react-native-community/something).
9+
[`react-native-safe-area-context`](https://github.com/th3rdwave/react-native-safe-area-context).
3310

34-
Exposed as `ReactNativeSomething` module.
11+
Exposed as `ReactNativeSafeAreaContext` module.
3512

36-
`@reason-react-native/__template__` X.y._ means it's compatible with
37-
`@react-native-community/something` X.y._
13+
`@reason-react-native/safe-area-context` X.y._ means it's compatible with
14+
`react-native-safe-area-context` X.y._
3815

3916
## Installation
4017

4118
When
42-
[`@react-native-community/something`](https://github.com/react-native-community/something)
19+
[`react-native-safe-area-context`](https://github.com/th3rdwave/react-native-safe-area-context)
4320
is properly installed & configured by following their installation instructions,
4421
you can install the bindings:
4522

4623
```console
47-
npm install @reason-react-native/__template__
24+
npm install @reason-react-native/safe-area-context
4825
# or
49-
yarn add @reason-react-native/__template__
26+
yarn add @reason-react-native/safe-area-context
5027
```
5128

52-
`@reason-react-native/__template__` should be added to `bs-dependencies` in your
53-
`bsconfig.json`. Something like
29+
`@reason-react-native/safe-area-context` should be added to `bs-dependencies` in
30+
your `bsconfig.json`. Something like
5431

5532
```diff
5633
{
@@ -59,7 +36,7 @@ yarn add @reason-react-native/__template__
5936
"reason-react",
6037
"reason-react-native",
6138
// ...
62-
+ "@reason-react-native/__template__"
39+
+ "@reason-react-native/safe-area-context"
6340
],
6441
//...
6542
}
@@ -69,15 +46,76 @@ yarn add @reason-react-native/__template__
6946

7047
### Types
7148

72-
#### `ReactNativeSomething.t`
49+
#### `ReactNativeSafeAreaContext.insets`
7350

74-
...
51+
```re
52+
type insets = {
53+
.
54+
"top": float,
55+
"bottom": float,
56+
"left": float,
57+
"right": float,
58+
};
59+
```
7560

7661
### Methods
7762

78-
#### `ReactNativeSomething.method`
63+
#### `<ReactNativeSafeAreaContext.SafeAreaProvider>`
64+
65+
```re
66+
open ReactNative;
67+
open ReactNativeSafeAreaContext;
68+
69+
[@react.component]
70+
let make = () => {
71+
<SafeAreaProvider>
72+
// your app...
73+
<View />
74+
<SafeAreaProvider>;
75+
}
76+
```
77+
78+
#### `ReactNativeSafeAreaContext.useSafeArea(): insets`
79+
80+
```re
81+
open ReactNative;
82+
open ReactNativeSafeAreaContext;
83+
84+
[@react.component]
85+
let make = () => {
86+
let insets = useSafeArea();
87+
<View style=Style.(style(~paddingTop=insets##top, ())) />;
88+
}
89+
```
90+
91+
#### `<ReactNativeSafeAreaContext.SafeAreaConsumer>`
7992

80-
...
93+
```re
94+
open ReactNative;
95+
open ReactNativeSafeAreaContext;
96+
97+
[@react.component]
98+
let make = () => {
99+
<SafeAreaConsumer>
100+
// your component, handy for classes
101+
{insets => <View style=Style.(style(~paddingTop=insets##top, ())) />}
102+
<SafeAreaConsumer>;
103+
}
104+
```
105+
106+
#### `<ReactNativeSafeAreaContext.SafeAreaView>`
107+
108+
```re
109+
open ReactNative;
110+
open ReactNativeSafeAreaContext;
111+
112+
[@react.component]
113+
let make = () => {
114+
<SafeAreaView>
115+
<View />
116+
<SafeAreaView>;
117+
}
118+
```
81119

82120
---
83121

bsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "@reason-react-native/__template__",
2+
"name": "@reason-react-native/safe-area-context",
33
"refmt": 3,
44
"reason": {
55
"react-jsx": 3
@@ -16,5 +16,5 @@
1616
}
1717
],
1818
"bsc-flags": ["-bs-no-version-header", "-warn-error @a"],
19-
"bs-dependencies": []
19+
"bs-dependencies": ["reason-react", "reason-react-native"]
2020
}

package.json

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
{
2-
"name": "@reason-react-native/__template__",
3-
"version": "0.0.0",
2+
"name": "@reason-react-native/safe-area-context",
3+
"version": "0.6.0",
44
"publishConfig": {
55
"access": "public"
66
},
77
"peerDependencies": {
8+
"reason-react": "^0.7.0",
9+
"reason-react-native": "^0.61.0",
10+
"react-native-safe-area-context": "^0.6.0"
811
},
9-
"repository": "https://github.com/reason-react-native/__template__.git",
12+
"repository": "https://github.com/reason-react-native/safe-area-context.git",
1013
"license": "MIT",
1114
"keywords": [
1215
"reason",
@@ -39,7 +42,9 @@
3942
"husky": "^1.3.0",
4043
"lint-staged": "^8.1.0",
4144
"npmpub": "^5.0.0",
42-
"prettier": "^1.18.0"
45+
"prettier": "^1.18.0",
46+
"reason-react": "^0.7.0",
47+
"reason-react-native": "^0.61.0"
4348
},
4449
"prettier": {
4550
"trailingComma": "all",

src/ReactNativeSafeAreaContext.bs.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
'use strict';
2+
3+
var View$ReactNative = require("reason-react-native/src/components/View.bs.js");
4+
5+
var SafeAreaProvider = { };
6+
7+
var SafeAreaConsumer = { };
8+
9+
var SafeAreaView = { };
10+
11+
exports.SafeAreaProvider = SafeAreaProvider;
12+
exports.SafeAreaConsumer = SafeAreaConsumer;
13+
exports.SafeAreaView = SafeAreaView;
14+
/* View-ReactNative Not a pure module */

src/ReactNativeSafeAreaContext.re

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
module SafeAreaProvider = {
2+
[@react.component] [@bs.module "react-native-safe-area-context"]
3+
external make: (~children: React.element=?) => React.element =
4+
"SafeAreaProvider";
5+
};
6+
7+
type insets = {
8+
.
9+
"top": float,
10+
"bottom": float,
11+
"left": float,
12+
"right": float,
13+
};
14+
15+
[@bs.module "react-native-safe-area-context"]
16+
external useSafeArea: unit => insets = "useSafeArea";
17+
18+
module SafeAreaConsumer = {
19+
[@react.component] [@bs.module "react-native-safe-area-context"]
20+
external make: (~children: insets => React.element=?) => React.element =
21+
"SafeAreaConsumer";
22+
};
23+
24+
module SafeAreaView = {
25+
open ReactNative;
26+
include View;
27+
28+
[@react.component] [@bs.module "react-native-safe-area-context"]
29+
external make:
30+
(
31+
~ref: ref=?,
32+
// View props
33+
~accessibilityComponentType: [@bs.string] [
34+
| `none
35+
| `button
36+
| `radiobutton_checked
37+
| `radiobutton_unchecked
38+
]
39+
=?,
40+
~accessibilityElementsHidden: bool=?,
41+
~accessibilityHint: string=?,
42+
~accessibilityIgnoresInvertColors: bool=?,
43+
~accessibilityLabel: string=?,
44+
~accessibilityLiveRegion: [@bs.string] [ | `none | `polite | `assertive]
45+
=?,
46+
~accessibilityRole: [@bs.string] [
47+
| `none
48+
| `button
49+
| `link
50+
| `search
51+
| `image
52+
| `keyboardkey
53+
| `text
54+
| `adjustable
55+
| `header
56+
| `summary
57+
| `imagebutton
58+
]
59+
=?,
60+
~accessibilityStates: array(AccessibilityState.t)=?,
61+
~accessibilityTraits: array(AccessibilityTrait.t)=?,
62+
~accessibilityViewIsModal: bool=?,
63+
~accessible: bool=?,
64+
~collapsable: bool=?,
65+
~hitSlop: edgeInsets=?,
66+
~importantForAccessibility: [@bs.string] [
67+
| `auto
68+
| `yes
69+
| `no
70+
| [@bs.as "no-hide-descendants"]
71+
`noHideDescendants
72+
]
73+
=?,
74+
~nativeID: string=?,
75+
~needsOffscreenAlphaCompositing: bool=?,
76+
~onAccessibilityEscape: unit => unit=?,
77+
~onAccessibilityTap: unit => unit=?,
78+
~onLayout: Event.layoutEvent => unit=?,
79+
~onMagicTap: unit => unit=?,
80+
// Gesture Responder props
81+
~onMoveShouldSetResponder: Event.pressEvent => bool=?,
82+
~onMoveShouldSetResponderCapture: Event.pressEvent => bool=?,
83+
~onResponderEnd: Event.pressEvent => unit=?,
84+
~onResponderGrant: Event.pressEvent => unit=?,
85+
~onResponderMove: Event.pressEvent => unit=?,
86+
~onResponderReject: Event.pressEvent => unit=?,
87+
~onResponderRelease: Event.pressEvent => unit=?,
88+
~onResponderStart: Event.pressEvent => unit=?,
89+
~onResponderTerminate: Event.pressEvent => unit=?,
90+
~onResponderTerminationRequest: Event.pressEvent => bool=?,
91+
~onStartShouldSetResponder: Event.pressEvent => bool=?,
92+
~onStartShouldSetResponderCapture: Event.pressEvent => bool=?,
93+
~pointerEvents: [@bs.string] [
94+
| `auto
95+
| `none
96+
| [@bs.as "box-none"] `boxNone
97+
| [@bs.as "box-only"] `boxOnly
98+
]
99+
=?,
100+
~removeClippedSubviews: bool=?,
101+
~renderToHardwareTextureAndroid: bool=?,
102+
~shouldRasterizeIOS: bool=?,
103+
~style: Style.t=?,
104+
~testID: string=?,
105+
~children: React.element=?
106+
) =>
107+
React.element =
108+
"SafeAreaView";
109+
};

src/ReactNativeSomething.re

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)