
Research
Security News
Lazarus Strikes npm Again with New Wave of Malicious Packages
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
bs-react-native-web
Advanced tools
[](https://travis-ci.org/reasonml-community/bs-react-native)
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.
bs-react-native
:# substitute yarn with npm if you prefer
yarn add bs-platform reason-react bs-react-native
re
folder (there will be your Reason code)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
}
package.json
add to the "scripts"
section two scripts:"scripts": {
...
"build": "bsb -make-world -clean-world",
"watch": "bsb -make-world -clean-world -w"
}
yarn build
performs a single buildyarn watch
enters the watch modere/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.
index.ios.js
/ index.android.js
to look like thisimport { 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;
Now go to a new tab and start your app with react-native run-ios
or react-native run-android
.
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:
Yes! Check out the Seattle JS Conf App for a real world App written with Reason.
There are some components and APIs missing. But fear not; you still can use uncovered APIs through JS ffi. 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+.
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(String("#6698FF")),
Style.marginTop(Pt(5.))
])
)
/>;
/* inline styles with a local open */
<View style=Style.(style([flexDirection(Column), backgroundColor(String("#6698FF")), marginTop(Pt(5.))])) />;
/* StyleSheets with a local open */
let styles =
StyleSheet.create(
Style.({"wrapper": style([flexDirection(Column), backgroundColor(String("#6698FF")), marginTop(Pt(5.))])})
);
<View style=styles##wrapper />;
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))]))
)
/>;
Native module cannot be null
with create-react-native-appCurrently 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"
}
]
}
FAQs
[](https://travis-ci.org/reasonml-community/bs-react-native)
The npm package bs-react-native-web receives a total of 0 weekly downloads. As such, bs-react-native-web popularity was classified as not popular.
We found that bs-react-native-web demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.
Security News
Opengrep continues building momentum with the alpha release of its Playground tool, demonstrating the project's rapid evolution just two months after its initial launch.