How to use react-native-branch - 10 common examples

To help you get started, we’ve selected a few react-native-branch examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github expo / expo / apps / native-component-list / src / screens / ExpoApisScreen.tsx View on Github external
import React from 'react';
import { Notifications } from 'expo';
import { Alert, Platform } from 'react-native';
import { EventSubscription } from 'fbemitter';
import ComponentListScreen from './ComponentListScreen';
import { Screens } from '../navigation/ExpoApis';

try {
  require('react-native-branch').default.subscribe((bundle: any) => {
    if (bundle && bundle.params && !bundle.error) {
      Alert.alert('Opened Branch link', JSON.stringify(bundle.params, null, 2));
    }
  });
} catch (e) {
  // Branch is not available, do nothing
}

export default class ExpoApisScreen extends React.Component {
  static path = '';

  static navigationOptions = {
    title: 'APIs in Expo SDK',
  };

  _notificationSubscription?: EventSubscription;
github MetaMask / metamask-mobile / app / components / Views / BrowserTab / index.js View on Github external
Engine.context.PersonalMessageManager.hub.on('unapprovedMessage', messageParams => {
			if (!this.isTabActive()) return false;
			this.setState({ signMessage: true, signMessageParams: messageParams, signType: 'personal' });
		});
		Engine.context.TypedMessageManager.hub.on('unapprovedMessage', messageParams => {
			if (!this.isTabActive()) return false;
			this.setState({ signMessage: true, signMessageParams: messageParams, signType: 'typed' });
		});

		Engine.context.AssetsController.hub.on('pendingSuggestedAsset', suggestedAssetMeta => {
			if (!this.isTabActive()) return false;
			this.setState({ watchAsset: true, suggestedAssetMeta });
		});

		Branch.subscribe(this.handleDeeplinks);

		if (Platform.OS === 'ios') {
			this.state.scrollAnim.addListener(({ value }) => {
				const diff = value - this.scrollValue;
				this.scrollValue = value;
				this.clampedScrollValue = Math.min(Math.max(this.clampedScrollValue + diff, 0), BOTTOM_NAVBAR_HEIGHT);
			});

			this.state.offsetAnim.addListener(({ value }) => {
				this.offsetValue = value;
			});
		} else {
			this.keyboardDidHideListener = Keyboard.addListener('keyboardDidHide', this.keyboardDidHide);
		}

		// Listen to network changes
github expo / expo / packages / expo / src / Branch.ts View on Github external
import Branch, { BranchEvent } from 'react-native-branch';

// Branch has a default and named export, add `BranchEvent` to the default export so it looks
// similar.
Branch.BranchEvent = BranchEvent;

export default Branch;
github expo / expo / apps / native-component-list / src / screens / BranchScreen.tsx View on Github external
import React from 'react';
import { Alert, Button, StyleSheet, Text, View, Platform } from 'react-native';
import Constants from 'expo-constants';

let Branch = null;
if (Platform.OS !== 'web') {
  try {
    Branch = require('react-native-branch').default;
  } catch (e) {
    console.log('Branch is not supported on this platform.', e);
  }
}

export default class BranchScreen extends React.Component {
  static navigationOptions = {
    title: 'Branch',
  };

  _branchUniversalObject?: any;

  async _getOrCreateBranchObjectAsync() {
    if (this._branchUniversalObject) {
      return this._branchUniversalObject;
    }
github MetaMask / metamask-mobile / app / components / Views / Entry / index.js View on Github external
componentDidMount() {
		DeeplinkManager.init(this.props.navigation);
		this.unsubscribeFromBranch = Branch.subscribe(this.handleDeeplinks);

		setTimeout(async () => {
			const existingUser = await AsyncStorage.getItem('@MetaMask:existingUser');
			if (existingUser !== null) {
				await this.unlockKeychain();
			} else {
				this.animateAndGoTo('OnboardingRootNav');
			}
		}, 100);
	}
github sovrin-foundation / connector-app / app / deep-link / index.js View on Github external
componentDidMount() {
    branch.subscribe(this.onDeepLinkData)
  }
github letsdoitworld / World-Cleanup-Day / mobile-app / src / screens / TrashPoint / TrashPointMenu / TrashPointMenu.js View on Github external
pressShare = async () => {
    const { trashPoint, photo } = this.props;

    const description = trashPoint.composition[0];
    const branchUniversalObject = await branch
      .createBranchUniversalObject(trashPoint.id, {
        locallyIndex: true,
        title: trashPoint.name,
        contentDescription: description,
        contentImageUrl: photo,
        contentMetadata: {
          ratingAverage: 4.2,
          customMetadata: {
            type: 'trashpoint',
            name: trashPoint.name,
            address: trashPoint.address,
            amount: trashPoint.amount,
            areas: trashPoint.areas.join(),
            composition: trashPoint.composition.join(),
            counter: trashPoint.counter.toString(),
            createdAt: trashPoint.createdAt,
github letsdoitworld / World-Cleanup-Day / mobile-app / src / screens / EventDetails / EventsMenu / EventMenu.js View on Github external
pressShare = async () => {
    const { event, photo } = this.props;
    const branchUniversalObject = await branch.createBranchUniversalObject(event.id, {
      locallyIndex: true,
      title: event.name,
      contentDescription: event.description,
      contentImageUrl: photo,
    });
    const linkProperties = {
      feature: 'share',
      channel: 'RNApp',
    };

    const controlParams = {
      $desktop_url: 'https://www.worldcleanupday.org/map-it/',
      $uri_redirect_mode: 2,
      type: 'event',
    };

react-native-branch

Branch Metrics React Native SDK

MIT
Latest version published 2 months ago

Package Health Score

87 / 100
Full package analysis