Skip to main content

setIsReactNative

Sets the React Native environment flag for FCL. This function should be called during initialization of React Native applications to inform FCL that it's running in a React Native environment. This enables React Native-specific behaviors and optimizations.

Import

You can import the entire package and access the function:


_10
import * as fcl from "@onflow/fcl-core"
_10
_10
fcl.setIsReactNative(value)

Or import directly the specific function:


_10
import { setIsReactNative } from "@onflow/fcl-core"
_10
_10
setIsReactNative(value)

Usage


_11
// Set React Native flag during app initialization
_11
import * as fcl from "@onflow/fcl"
_11
_11
// In your React Native app's entry point (e.g., App.js)
_11
fcl.setIsReactNative(true)
_11
_11
// Configure FCL for React Native
_11
fcl.config({
_11
"accessNode.api": "https://rest-testnet.onflow.org",
_11
"discovery.wallet": "https://fcl-discovery.onflow.org/api/testnet/authn"
_11
})

Parameters

value

  • Type: boolean
  • Description: True to indicate React Native environment, false otherwise

Returns

void


Rate this page