/bs-react-native

Write your React Native apps with Reason

Primary LanguageOCamlMIT LicenseMIT

BuckleScript bindings for React Native

Build Status Version React Native All Contributors Chat

BuckleScript bindings for React Native allows to use ReasonML with ReasonReact to make your iOS, Android and Web apps.

🚨 Usage from Git repo

If you use this bindings from the git repo, be sure to use

{
  // ...
  "bs-dependencies": [
    // BsReactNative, current "stable" bindings
    "bs-react-native-monorepo/bs-react-native",
    // ReactNative, WIP on zero-cost bindings (require bs-platform 5.0.0 & and reason-react hooks branch)
    "bs-react-native-monorepo/reason-react-native"
  },
  // When used from git with the following path, bs-platform will use path that won't be working
  // (because deps are pointing to folder in folder)`
  // Your bundler (metro or webpack) will say that it can find `bs-react-native/whatever` and/or
  // `reason-react-native/whatever`
  // which is correct because it should be `bs-react-native/bs-react-native/whatever` / `bs-react-native/reason-react-native/whatever`
  // the trick below will correct path in generated JavaScript files
  // and will just need to be removed when you won't use git directly anymore
  "js-post-build": {
    "cmd": "./node_modules/bs-react-native-monorepo/git-monorepo-usage-trick"
  }
}

Did you notice that this way, you can use both bindings to slowly migrate?

Next ReactNative zero-cost bindings are still WIP, so use carefully at your own risk.

⚠️ ReactNative zero-cost bindings setup with Reason React hooks

Things you need

  • package.json dep: "bs-platform": "^5.0.1"
  • package.json dep: "reason-react": "^0.7.0"
  • bsconfig.json: "reason": { "react-jsx": 3 }

Getting Started

Check our getting started guide for details.

You can run the playground with Expo: https://expo.io/@grabbou/bs-react-native.

Documentation

See https://reasonml-community.github.io/bs-react-native.

Usage

See https://github.com/reasonml-community/bs-react-native/tree/master/example

Contribute

Read the contribution guidelines before contributing.

Changelog

Check the changelog for more informations about recent releases.

Code of Conduct

We want this community to be friendly and respectful to each other. Please read the full text so that you can understand what actions will and will not be tolerated.