Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@screeb/react-native

Package Overview
Dependencies
Maintainers
1
Versions
77
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@screeb/react-native

A react-native module to integrate Screeb mobile sdk for Android and/or iOS.

Source
npmnpm
Version
0.4.0
Version published
Weekly downloads
433
18.31%
Maintainers
1
Weekly downloads
 
Created
Source

@screeb/react-native

A react-native module to integrate Screeb mobile sdk for Android and/or iOS.

Installation

npm install @screeb/react-native

iOS specific configuration

You should set IOS target build configuration BUILD_LIBRARY_FOR_DISTRIBUTION to YES in your Podfile to avoid runtime crash:

post_install do |installer|
  ...
  installer.pods_project.targets.each do |target|
    ...

    target.build_configurations.each do |config|
      ...
      config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
    end
  end
end

Android specific configuration

First, you should use MultidexApplication if not yet to avoid compilation issues.

defaultConfig {
    (...)
    multiDexEnabled true
}
(...)
dependencies {
   (...)
   implementation 'androidx.multidex:multidex:2.0.1'
}

Then, the Android sdk needs to be notified of activities lifecycle changes to be correctly started.

It is mandatory to pass the Application context to the module in your custom Application class in the onCreate function :

override fun onCreate() {
    super.onCreate()
    ScreebModuleModule.setAppContext(this)
}

Usage

import { initSdk, trackScreen, trackEvent, setProperties, setIdentity } from "@screeb/react-native";

// Init the sdk at app start (useEffect hook used here, but componentDidMount is fine)
React.useEffect(() => {
   initSdk(
      "<android-channel-id>",
      "<ios-channel-id>",
      "<user-identity>",
      {
         'example-prop1': false,
         'example-prop2': 29,
         'example-prop3' : 'iPhone 13',
      }
   );
}, []);

(...)

// SetIdentity command :
setIdentity(
    '<user-identity>',
    {
        'example-prop1': false,
        'example-prop2': 29,
        'example-prop3' : 'iPhone 13',
    }
);

(...)

// trackEvent command :
trackEvent(
    '<event-name>',
    {
        'example-prop1': false,
        'example-prop2': 29,
        'example-prop3' : 'iPhone 13',
    }
);

(...)

// trackScreen command :
trackScreen(
    '<screen-name>',
    {
        'example-prop1': false,
        'example-prop2': 29,
        'example-prop3' : 'iPhone 13',
    }
);

(...)

// setProperties command :
setProperties(
    {
        'example-prop1': false,
        'example-prop2': 29,
        'example-prop3' : 'iPhone 13',
    }
);

License

MIT

Keywords

react-native

FAQs

Package last updated on 22 Mar 2022

Did you know?

Socket

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.

Install

Related posts