mbasso / react-decoration

A collection of decorators for React Components
MIT License
630 stars 24 forks source link

React-Native Compatibility #8

Closed robertherber closed 7 years ago

robertherber commented 7 years ago

General Information

Description

react-addons-perf is not compatible with React-Native. The best would be if @perf provided alternative functionality that worked with React-Native.

Right now you'll have to import each decorator directly to not trigger an import of react-addons-perf - a decent first step would be to import it dynamically so you only need to install react-addons-perf for the @perf decorator.

Steps to reproduce

  1. Install react-decoration
  2. Don't install react-addons-perf
  3. Import any decorator from the main export.

Versions

mbasso commented 7 years ago

Hi robert, thank you for opening this issue, I'll look for a solution as soon as possible.

react-addons-perf is not compatible with React-Native. The best would be if @perf provided alternative functionality that worked with React-Native.

I've found this page that say that react-addons-perf is compatible with react-native, is it an error in the doc or are you referring to an older version (<0.45)? Have you any idea about alternative functionality? Are you using others packages to do that in react-native?

I've found this in a lot of answers on stackoverflow and github:

import Perf from 'ReactPerf';

does this code represent the right way to import performance utils in react-native?

Right now you'll have to import each decorator directly to not trigger an import of react-addons-perf - a decent first step would be to import it dynamically so you only need to install react-addons-perf for the @perf decorator.

This is a problem that have to be resolved shortly. Have you any links about optional dependencies? docs, blog posts... I know that webpack has a dynamic import but I think that the package has to be installed anyway...

mbasso commented 7 years ago

I'll close this issue because react-addons-perf no longer works with react@16. we'll create a new decorator after that the react team will release a new version of this tool in the future