Skip to content

Latest commit

 

History

History
91 lines (74 loc) · 3.48 KB

File metadata and controls

91 lines (74 loc) · 3.48 KB

BlackBerry-Dynamics-for-React-Native-Text

BlackBerry-Dynamics-for-React-Native-Text enables Data Leakage Prevention (DLP) within <Text /> UI component for Android platform. More details about DLP on Android can be found here.

NOTE: on iOS platform DLP is supported by default via Dynamics runtime after BlackBerry-Dynamics-for-React-Native-Base module is installed and linked. More details about DLP on iOS can be found here.

Supportability

React Native

  • 0.66.x (deprecated)
  • 0.67.x (deprecated)
  • 0.68.x (deprecated)
  • 0.69.x (deprecated)
  • 0.70.x
  • 0.71.x
  • 0.72.x

Preconditions

BlackBerry-Dynamics-for-React-Native-Text is dependent on BlackBerry-Dynamics-for-React-Native-Base module.

Please install BlackBerry-Dynamics-for-React-Native-Base first.

Installation

NOTE: BlackBerry-Dynamics-for-React-Native-Text should be the last package added to your project dependencies. Adding modules or UI components after BlackBerry-Dynamics-for-React-Native-Text can override some important configurations that may cause following exception during application launch: "Text strings must be rendered within a <Text> component". If this is the case please run yarn set-text-config command to put needed configurations back. This action should be repeated when add/remove other packages. For more details please take a look at examples in DLP sample application.

$ yarn add <path>/ui-components/BlackBerry-Dynamics-for-React-Native-Text
...
$ yarn set-text-config
iOS
$ cd ios
$ pod install
$ cd ..
$ npx react-native run-ios
Android
$ npx react-native run-android

react-native-elements support

react-native-elements is cross-platform React Native UI toolkit. There are many ready-to-use UI components that can extend React Native application.

react-native-elements are implemented using original Text and TextInput components which means DLP is not supported by default. In order to enable DLP within react-native-elements it is required to update imports in <app_name>/node_modules/react-native-elements/src/* according to following principle:

import {Text, TextInput} from 'react-native'; 

should be replaced with

import Text from 'BlackBerry-Dynamics-for-React-Native-Text';
import TextInput from 'BlackBerry-Dynamics-for-React-Native-TextInput';

Usage

vanilla

IMPORTANT: please apply the changes described above to enable DLP within react-native-elements

// ...
import Text from 'BlackBerry-Dynamics-for-React-Native-Text';

// ...

export default class App extends Component {
    // ...
    render() {
        <Text selectable={true}>Content from this component cannot be copied to non-GD apps if DLP is on ...</Text>
    }
}

from react-native-elements

// ...
import { Text } from 'react-native-elements';

// ...

export default class App extends Component {
    // ...
    render() {
        <Text h1>Content from this component cannot be copied to non-GD apps if DLP is on ...</Text>
    }
}

Uninstallation

$ cd <appFolder>
$ yarn remove BlackBerry-Dynamics-for-React-Native-Text
iOS
$ cd ios
$ pod install
$ cd ..