Skip to content

Commit c395403

Browse files
committed
import from previous codebase
1 parent 0820055 commit c395403

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+7016
-0
lines changed

.github/workflows/build.yml

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

.gitignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
*.log
2+
3+
# macOS crap
4+
.DS_Store
5+
6+
# node
7+
node_modules
8+
9+
# npm unused lock file (we use yarn.lock)
10+
package-lock.json
11+
12+
# Ocaml / Reason / BuckleScript artifacts
13+
*.bs.js
14+
.bsb.lock
15+
**/lib/bs
16+
**/lib/ocaml
17+
**/.merlin
18+
19+
# website build artifacts
20+
build
21+
dist

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,15 @@
11
# reason-react-native.github.io
2+
23
Website for reason-react-native
4+
5+
---
6+
7+
## Contribute
8+
9+
Read the [contribution guidelines](https://github.com/reason-react-native/.github/blob/master/CONTRIBUTING.md) before contributing.
10+
11+
## Code of Conduct
12+
13+
We want this community to be friendly and respectful to each other. Please read
14+
[our full code of conduct](https://github.com/reason-react-native/.github/blob/master/CODE_OF_CONDUCT.md) so that you can understand what
15+
actions will and will not be tolerated.

ReasonReactNative.sketch

428 KB
Binary file not shown.
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
---
2+
id: 2019-06-17-hello-reason-react-native
3+
title: Hello Reason React Native
4+
author: MoOx
5+
---
6+
7+
Today is a big day for the ReasonML community as we are releasing the fruits of
8+
a long effort started about 4 months ago.
9+
10+
As more and more people were starting to use ReasonML on production apps using
11+
React Native, we wanted to make the BuckleScript bindings for React Native,
12+
known has `bs-react-native`, more accessible. This would have involved several
13+
breaking changes in order to simplify some APIs that have been designed with a
14+
high level of security in mind, but at some costs. The cost of being harder to
15+
start with (for newcomers to ReasonML) as well as the cost in terms of code size
16+
and performance.
17+
18+
While some of us were thinking about some simplifications, some others, involved
19+
in Reason React incoming changes, directly started a new approach for this
20+
bindings, following
21+
[the zero-cost approach offered by reason-react 0.7.0](https://reasonml.github.io/reason-react/blog/2019/04/10/react-hooks).
22+
23+
[CCA](https://www.cca.io) started this effort on what is now know as the new
24+
`reason-react-native` bindings, that eliminates a huge part of the additional
25+
JavaScript code produced by the bindings.
26+
27+
## Zero-cost
28+
29+
By zero-cost, we means zero additional cost. The JavaScript code BuckleScript
30+
produces using this bindings will most of the time directly hit React Native
31+
JavaScript code without creating an unnecessary abstraction above it 🙌.
32+
33+
Here are some random examples:
34+
35+
- [`bs-react-native` `View`](https://github.com/reason-react-native/reason-react-native/blob/958cd4e3a5ffa303304a0b2404cd53b5f49e649f/bs-react-native/src/components/ViewProps.bs.js)
36+
vs
37+
[`reason-react-native` `View`](https://github.com/reason-react-native/reason-react-native/blob/958cd4e3a5ffa303304a0b2404cd53b5f49e649f/reason-react-native/src/components/View.bs.js)
38+
- [`bs-react-native` `Style`](https://github.com/reason-react-native/reason-react-native/blob/958cd4e3a5ffa303304a0b2404cd53b5f49e649f/bs-react-native/src/style.bs.js)
39+
vs
40+
[`reason-react-native` `Style`](https://github.com/reason-react-native/reason-react-native/blob/958cd4e3a5ffa303304a0b2404cd53b5f49e649f/reason-react-native/src/apis/Style.bs.js)
41+
- [`bs-react-native` `Platform`](https://github.com/reason-react-native/reason-react-native/blob/958cd4e3a5ffa303304a0b2404cd53b5f49e649f/bs-react-native/src/platform.bs.js)
42+
vs
43+
[`reason-react-native` `Platform`](https://github.com/reason-react-native/reason-react-native/blob/958cd4e3a5ffa303304a0b2404cd53b5f49e649f/reason-react-native/src/apis/Platform.bs.js)
44+
45+
Some modules are even empty or with some minor `require()` that can be
46+
themselves almost empty and easily removed by some JavaScript bundlers.
47+
48+
How cool is that?
49+
50+
## But why `reason-react-native` ?
51+
52+
`bs-react-native` already had multiple breaking changes in the past and we
53+
didn't really want to offer a poor experience by creating a new release with
54+
tons of changes that won't be easy to codemod (or would require much more work
55+
from us).
56+
57+
On top of that, `reason-react` latest release already added an important
58+
breaking change with
59+
[JSX 3](https://reasonml.github.io/reason-react/docs/en/jsx).
60+
61+
That's why we had this idea about offering an easy and smooth transition by
62+
offering 2 packages to say goodbye to `bs-react-native` without pain.
63+
64+
- `bs-react-native-jsx3-compat` (0.11.1)
65+
- `reason-react-native`
66+
([0.60.0](/en/docs/install/#note-about-reason-react-native-version-number))
67+
68+
## Wait, what is `bs-react-native-jsx3-compat` ?
69+
70+
`bs-react-native` is using JSX 2 so in order to use it with JSX 3 we would have
71+
to create an additional layer on top of the current bindings to offer both JSX 2
72+
and 3 bindings. And since we wanted to do away with some current APIs of
73+
`bs-react-native` we started to think about a new approach.
74+
75+
We knew that we wanted to:
76+
77+
- offer to `bs-react-native` users a migration plan, so they can start very
78+
easily to use JSX 3 and new `reason-react` (so they can use hooks),
79+
- offer new `reason-react-native` bindings, more accessible and with a zero cost
80+
approach.
81+
- offer a smooth transition between these two packages so people can slowly
82+
upgrade their codebase without having to make an insane PR that switches from
83+
one to the other.
84+
85+
We don't want your co-workers to hate you with a PR that comes directly from
86+
hell 😅.
87+
88+
That's where we thought about offering `bs-react-native-jsx3-compat`. It's a
89+
package that has the same APIs `bs-react-native` has but that uses
90+
`reason-react-native` under the hood.
91+
92+
**This means you will have to make a migration from JSX 2 to 3**. That's the
93+
only thing you will have to do, then with a single change from `bs-react-native`
94+
with `bs-react-native-jsx3-compat` in your `bs-dependencies` you will be ready
95+
to use hooks and directly benefit of (almost) zero-cost bindings!
96+
97+
And since we care about you and don't want you to upgrade from JSX 2 to 3 by
98+
hand, we got you covered with a script made with love to help you with that.
99+
100+
[You will find all the required instructions to migrate from `bs-react-native` to `bs-react-native-jsx3-compat` in our documentation](/en/docs/migration/jsx3/).
101+
102+
## tl;dr
103+
104+
- `bs-react-native` has now entered a frozen state and won't receive any upgrade
105+
- `bs-react-native-jsx3-compat` allows you to use existing code based on
106+
`bs-react-native` with `reason-react` 0.7.0 and JSX 3
107+
- `reason-react-native` package contains the new bindings for React Native, that
108+
offers more accessible APIs and that is almost zero-cost
109+
- [We offer you an easy and smooth migration plan so you can start using `reason-react-native` and slowly say bye to `bs-react-native`](/en/docs/migration/jsx3/).
110+
111+
## Thanks
112+
113+
This required effort has been keeping us busy for weeks and wouldn't have been
114+
possible without the following people:
115+
116+
- CCA team and especially [@cknitt](https://github.com/cknitt) for leading us to
117+
the right direction for the new zero-cost bindings and all the contributions
118+
that come with this move
119+
- [@sgny](https://github.com/sgny) for all his contributions to the new bindings
120+
- [@MoOx](https://github.com/MoOx) for leading the effort, the compat layer and
121+
the new website you are seeing here
122+
- [@bloodyowl](https://github.com/bloodyowl) for his magical
123+
[reason-react-compat](https://github.com/bloodyowl/reason-react-compat) layer
124+
and
125+
[the alternate JSX 3 upgrade path](https://bloodyowl.github.io/blog/2019-04-19-an-alternative-migration-path-for-reason-react/)
126+
that goes with it
127+
- all the people that helped us on Discord and GitHub in various code reviews
128+
and improvements like the react native template (thanks
129+
[@dawee](https://github.com/dawee))
130+
131+
## What's next?
132+
133+
Now that `reason-react-native` is ready to be used and that our migration plan
134+
is usable, we will probably be focused on documentation as lots of APIs and
135+
Components need to be documented. We really want to offer the best developer
136+
experience possible and that's definitely part of it.
137+
138+
👉Now it's time for you to check our
139+
[Getting Started with Reason React Native documentation](/en/docs/)

bsconfig.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"name": "reason-react-native.github.io",
3+
"refmt": 3,
4+
"reason": {
5+
"react-jsx": 3
6+
},
7+
"package-specs": {
8+
"module": "commonjs",
9+
"in-source": true
10+
},
11+
"suffix": ".bs.js",
12+
"sources": [
13+
{
14+
"dir": "src",
15+
"subdirs": true
16+
},
17+
{
18+
"dir": "scripts",
19+
"subdirs": true
20+
}
21+
],
22+
"bsc-flags": ["-bs-no-version-header"],
23+
"bs-dependencies": [
24+
"reason-future",
25+
"reason-react",
26+
"react-from-svg",
27+
"reason-react-native",
28+
"@moox/bs-react-helmet",
29+
"react-multiversal"
30+
]
31+
}

0 commit comments

Comments
 (0)