
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
@callstack/react-native-brownfield
Advanced tools
A set of helpers to make your brownfield integration smooth and easy.
The React Native Brownfield library is intended to be installed in a React Native app that is later consumed as a framework artifact by your native iOS or Android app.
In your React Native project run:
npm install @callstack/react-native-brownfield
First, we need to package our React Native app as an XCFramework or Fat-AAR.
Follow Integrating with Native Apps steps in RNEF docs and run:
rnef package:ios
for iOSrnef package:aar
for AndroidInstead of using RNEF, you can create your own custom packaging scripts. Here are base versions for iOS and Android that you'll need to adjust for your project-specific setup:
In your native iOS app, initialize React Native and display it where you like. For example, to display React Native views in SwiftUI, use the provided ReactNativeView
component:
import SwiftUI
import ReactBrownfield # exposed by RN app framework
@main
struct MyApp: App {
init() {
ReactNativeBrownfield.shared.startReactNative {
print("React Native bundle loaded")
}
}
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
struct ContentView: View {
var body: some View {
NavigationView {
VStack {
Text("Welcome to the Native App")
.padding()
NavigationLink("Push React Native Screen") {
ReactNativeView(moduleName: "ReactNative")
.navigationBarHidden(true)
}
}
}
}
}
For more detailed instructions and API for iOS, see docs for:
In your native Android app, create a new RNAppFragment.kt
:
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import com.callstack.rnbrownfield.RNViewFactory # exposed by RN app framework
class RNAppFragment : Fragment() {
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?,
): View? =
this.context?.let {
RNViewFactory.createFrameLayout(it)
}
}
Add a button to your activity_main.xml
:
<Button
android:id="@+id/show_rn_app_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Show RN App"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
Add a fragment container:
<FrameLayout
android:id="@+id/fragmentContainer"
android:layout_width="match_parent"
android:layout_height="match_parent" />
Update your MainActivity
to initialize React Native and show the fragment:
class MainActivity : AppCompatActivity() {
private lateinit var showRNAppBtn: Button
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
ReactNativeHostManager.shared.initialize(this.application)
showRNAppBtn = findViewById(R.id.show_rn_app_btn)
showRNAppBtn.setOnClickListener {
supportFragmentManager
.beginTransaction()
.replace(R.id.fragmentContainer, RNAppFragment())
.commit()
}
}
}
For more detailed instructions and API for Android, see docs for:
Besides native components, we are exposing JavaScript functions to control the behavior of those components from React Native app.
To use the module, import it:
import ReactNativeBrownfield from '@callstack/react-native-brownfield';
and use the available methods:
A method used to toggle iOS native back gesture and Android hardware back button.
ReactNativeBrownfield.setNativeBackGestureAndButtonEnabled(true);
A method to pop to native screen used to push React Native experience.
ReactNativeBrownfield.popToNative(true);
Note: These methods work only with native components provided by this library.
React Native Brownfield is an open source project and will always remain free to use. If you think it's cool, please star it 🌟. Callstack is a group of React and React Native geeks, contact us at hello@callstack.com if you need any help with these or just want to say hi!
Like the project? ⚛️ Join the team who does amazing stuff for clients and drives React Native Open Source! 🔥
Thanks goes to these wonderful people (emoji key):
Michał Chudziak 💻 📖 🤔 | Piotr Drapich 💻 🤔 |
---|
This project follows the all-contributors specification. Contributions of any kind welcome!
FAQs
Brownfield helpers for React Native
The npm package @callstack/react-native-brownfield receives a total of 1,333 weekly downloads. As such, @callstack/react-native-brownfield popularity was classified as popular.
We found that @callstack/react-native-brownfield demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.