Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
@thirdweb-dev/react-native-adapter
Advanced tools
This package is required to run the thirdweb connect SDK in React Native.
This package is required to run the thirdweb connect SDK in React Native.
Using your favorite pacakge manager, install all the require dependencies
npx expo install thirdweb @thirdweb-dev/react-native-adapter
Since react native requires installing native dependencies directly, you also have to install these required peer dependencies:
npx expo install react-native-get-random-values @react-native-community/netinfo expo-application @react-native-async-storage/async-storage expo-web-browser react-native-aes-gcm-crypto react-native-quick-crypto@0.7.0-rc.6 amazon-cognito-identity-js
Here's an explanation of each peer dependency and why its needed:
// needed for wallet connect
react-native-get-random-values
@react-native-community/netinfo
expo-application
// needed wallet connect + in-app wallet
@react-native-async-storage/async-storage
// needed for inapp wallet
expo-web-browser // for oauth flows
amazon-cognito-identity-js // for authentication
react-native-aes-gcm-crypto // for encryption
react-native-quick-crypto@0.7.0-rc.6 //for fast hashing
metro.config.js
If you don't already have a metro.config.file.js
in your project, you can create one by running:
npx expo customize metro.config.js
Then, you need to add 2 properties to the metro resolver: unstable_enablePackageExports
and unstable_conditionNames
. This is to tell metro to resolve named exports
properly.
// file: metro.config.js
// Learn more https://docs.expo.io/guides/customizing-metro
const { getDefaultConfig } = require("expo/metro-config");
/** @type {import('expo/metro-config').MetroConfig} */
const config = getDefaultConfig(__dirname);
// ADD THESE 2 PROPERTIES
config.resolver.unstable_enablePackageExports = true;
config.resolver.unstable_conditionNames = [
"react-native",
"browser",
"require",
];
module.exports = config;
@thirdweb-dev/react-native-adapter
at the top of your App.tsx
This will polyfill all the required functionality needed.
// this needs to be imported before anything else
import "@thirdweb-dev/react-native-adapter";
// the rest of your app
If you're using expo-router
, you need to polyfill before the router entry:
app/index.ts
This will be the new entrypoint to your app, ensuring the polyfills happen before any routing.
// file: app/index.ts
// this needs to be imported before expo-router
import "@thirdweb-dev/react-native-adapter";
import "expo-router/entry";
package.json
Now you can replace expo-router/entry
with ./app/index
as your main entrypoint.
// package.json
"main": "./app/index",
react-native-aes-gcm-crypto
requires minSDK 26
for android, you can edit this in your build.gradle
filethirdweb
package in React NativeOnce all the setup above is all done, you can use the most of functionality in the thirdweb
package out of the box, without having to do any react native specific code.
This means that you can follow all the React documentation and expect it all to be exactly the same.
Examples:
import { ThirdwebProvider } form "thirdweb/react";
FAQs
This package is required to run the thirdweb connect SDK in React Native.
The npm package @thirdweb-dev/react-native-adapter receives a total of 196 weekly downloads. As such, @thirdweb-dev/react-native-adapter popularity was classified as not popular.
We found that @thirdweb-dev/react-native-adapter 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.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.