necolas / react-native-web

Cross-platform React UI packages
https://necolas.github.io/react-native-web
MIT License
21.67k stars 1.79k forks source link

Error with react-native-vector-icons #1558

Closed moonjava2005 closed 4 years ago

moonjava2005 commented 4 years ago

Attempted import error: 'ToolbarAndroid' is not exported from './react-native'. But, when downgrade to 0.11.7, it works

pruthvip commented 4 years ago

I think, since ToolbarAndroid is deprecated(removed) from react-native hence the same has been removed from the rnw new verision. It is mentioned in the release notes.

bikashsahucbnits commented 4 years ago

It seems to be an issue that React-native 0.61 removed the reference to ToolbarAndroid but gesture-handler is still referencing to it.

Seems to be fixed in version 1.5.5 version

necolas commented 4 years ago

Yeah that export is gone

aviemet commented 4 years ago

Sorry to bump this after it's closed, but I don't see a solution in this thread. I have a project with this exact issue. react-native: 0.61.5, react-native-vector-icons: 6.6.0, react-native-web: 0.12.2.

I had to downgrade to 0.11.7 to ditch the error, but would prefer to be on the latest version. react-native-gesture-handler doesn't seem to exist in my yarn.lock file, even as a secondary dependency. I installed the latest version to see if it would make a difference, but no dice. Can you please tell me what I'm missing?

Thanks

littlehome-eugene commented 4 years ago

same as @aviemet , what's the solution other than downgrading to 0.11.7?

actually it was from vector icons ..


 diff --git a/node_modules/react-native-vector-icons/lib/toolbar-android.js b/node_modules/react-native-vector-icons/lib/toolbar-android.js
 index c0287dd..f98c30d 100644
 --- a/node_modules/react-native-vector-icons/lib/toolbar-android.js
 +++ b/node_modules/react-native-vector-icons/lib/toolbar-android.js
 @@ -3,7 +3,8 @@ import isEqual from 'lodash/isEqual';
  import pick from 'lodash/pick';
  import React, { PureComponent } from 'react';
  import PropTypes from 'prop-types';
 -import { ToolbarAndroid } from './react-native';
 +// import { ToolbarAndroid } from './react-native';
 +import ToolbarAndroid from '@react-native-community/toolbar-android';

  const ICON_PROP_NAMES = ['iconSize', 'iconColor', 'titleColor'];
  const LOGO_ICON_PROP_NAMES = [...ICON_PROP_NAMES, 'logoName'];
bikashsahucbnits commented 4 years ago

To allow more customization, I do not use ToolbarAndroid, however, this library might be what you are looking for instead of ToolbarAndroid. Here is an example that describes about the use of the library. https://reactnativeexample.com/an-android-like-action-bar-for-react-native/

adiffmike commented 4 years ago

Just in case anyone lands here - this is not a react-native-web issue. Its an issue with react-native-vector-icons.

There's a workaround here: https://github.com/oblador/react-native-vector-icons/issues/1104#issuecomment-599393489

Unfortunately for some reason react-native-vector-icons has fixed this issue in the codebase but not yet published the fix to npm so you can also try installing from github instead.