npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@jaredly/bs-react-native

v0.5.2

Published

[![Build Status](https://travis-ci.org/reasonml-community/bs-react-native.svg?branch=master)](https://travis-ci.org/reasonml-community/bs-react-native)

Readme

BuckleScript bindings for React Native

Build Status

Getting started

Great that you want to use Reason with React Native! To get everything running are just a couple of steps. Let's assume that you already have a React Native project. Otherwise follow the React Native instructions until you have your app running.

  1. Install Bucklescript (the Reason -> JS compiler), Reason-React and bs-react-native:
# substitute yarn with npm if you prefer
yarn add bs-platform reason-react bs-react-native
  1. Create a re folder (there will be your Reason code)
  2. Create a bsconfig.json with the following content file in your project root
{
    "name": "my-awesome-app",
    "reason": {
        "react-jsx": 2
    },
    "bsc-flags": ["-bs-super-errors"],
    "bs-dependencies": ["bs-react-native", "reason-react"],
    "sources": [{
        "dir": "re"
    }],
    "refmt": 3
}
  1. You are nearly done, the last configuration before we get to the fun stuff. In your package.json add to the "scripts" section two scripts:
"scripts": {
  ...
  "build": "bsb -make-world -clean-world",
  "watch": "bsb -make-world -clean-world -w"
}
  1. Now you can build all your (so far nonexsisting) Reason in two modes:
  • yarn build performs a single build
  • yarn watch enters the watch mode
  1. Now we come to the fun stuff! Create a new file re/app.re and make it look like this:
open BsReactNative;

let app = () =>
  <View style=Style.(style([flex(1.), justifyContent(Center), alignItems(Center)]))>
    <Text value="Reason is awesome!" />
  </View>;

and start the watcher with yarn run watch if you haven't done it yet.

  1. We are nearly done! We now have to adopt the index.ios.js / index.android.js to look like this
import { app } from "./lib/js/re/app.js";
import React from "react";
import {
  AppRegistry
} from 'react-native';

AppRegistry.registerComponent('MyAwesomeProject', () => app);

Note: Make sure that the first argument to AppRegistry.registerComponent is your correct project name.

If you are using react-native-scripts, then you will need to modify App.js to be like this

import { app } from "./lib/js/re/app.js";

export default app;
  1. Now go to a new tab and start your app with react-native run-ios or react-native run-android.

  2. Great you are all set up! Check the source of bs-react-native to find out more about the implemented APIs and Components. If you get stuck just ask on our Discord Server! Happy Hacking!

Here are some more things which will be probably useful for you:

Can I really build my React Native app with Reason?

Yes! Check out the Seattle JS Conf App for a real world App written with Reason.

Disclaimer

There are some components and APIs missing. You can find an overview of the implemented components and APIs here. Contributions of Components and APIs are very welcome! The bindings are targeted to React Native 0.46+.

Style

Since we have a proper type system we can make styles typesafe! Therefore styles are a little bit different declared than in JavaScript:

open BsReactNative;

/* inline styles */
<View
  style=(
    Style.style([
      Style.flexDirection(Column),
      Style.backgroundColor("#6698FF"),
      Style.marginTop(Pt(5.))
    ])
  )
/>;

/* inline styles with a local open */
<View style=Style.(style([flexDirection(Column), backgroundColor("#6698FF"), marginTop(Pt(5.))])) />;

/* StyleSheets with a local open */
let styles =
  StyleSheet.create(
    Style.({"wrapper": style([flexDirection(Column), backgroundColor("#6698FF"), marginTop(Pt(5.))])})
  );

<View style=styles##wrapper />;

Animations

open BsReactNative;

[...]
type state = {animatedValue: Animated.Value.t};
let component = ReasonReact.reducerComponent("Example");

initialState: () => {animatedValue: Animated.Value.create((-100.))},

/* Start animation in method */
Animated.CompositeAnimation.start(
  Animated.Timing.animate(
    ~value=state.animatedValue,
    ~toValue=`raw(0.),
    ()
  ),
  ()
);
[...]

/* Styles with an animated value */

<Animated.View
  style=Style.(style([flexDirection(Column), backgroundColor("#6698FF"), top(Animated(state.animatedValue))]))
  )
/>;

Troubleshooting

Native module cannot be null with create-react-native-app

Currently BuckleScript can generate import * as ReactNative from 'react-native', which breaks create-react-native-app. To get around this you can force BuckleScript to generate CommonJS modules instead of ES Modules using:

/* bsconfig.json */
{
  /* ... */
  "package-specs": [
    {
      "module": "commonjs"
    }
  ]
}