🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

react-native-interactions

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-interactions

React Native InteractionManager helpers

0.4.0
latest
Source
npm
Version published
Maintainers
1
Created
Source

React Native Interactions NPM version

React Native InteractionManager helpers.

Demo

import {AfterInteractions} from 'react-native-interactions';

function MyComponent() {
  return (
    <AfterInteractions>
      <ExpensiveComponent/>
    </AfterInteractions>
  );
}

Installation

npm i --save react-native-interactions

Usage

AfterInteractions

A component that only renders children after InteractionManager.runAfterInteractions(). Wrap top-level Navigator scenes with this component to improve animation perfomance.

import {AfterInteractions} from 'react-native-interactions';

function MyScene() {
  return (
    <AfterInteractions placeholder={<CheapPlaceholder/>}>
      <ExpensiveComponent/>
    </AfterInteractions>
  );
}

Props:

proptypedefaultdescription
placeholderreact elementnull(optional) prerendered placeholder content
renderPlaceholderfunctionnull(optional) placeholder renderer

renderAfterInteractions

Same as AfterInteractions component, but in the form of a decorator.

import {renderAfterInteractions} from 'react-native-interactions';

@renderAfterInteractions
class ExpensiveComponent extends Component {

  static placeholder = <CheapPlaceholder/>;

  render() {
    // expensive stuff
  }
}

or:

@renderAfterInteractions({placeholder: <CheapPlaceholder/>})
class ExpensiveComponent extends Component {
  // expensive stuff
}

or:

class ExpensiveComponent extends Component {
  // expensive stuff
}

export default renderAfterInteractions(ExpensiveComponent);

Options:

optiontypedefaultdescription
hoistStaticsbooleantrue(optional) copy non-react static props to composed component
placeholderreact elementnull(optional) prerendered placeholder content
renderPlaceholderfunctionnull(optional) placeholder renderer

License

MIT

Keywords

react

FAQs

Package last updated on 08 Jul 2017

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