question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

requireNativeComponent is not a function with react-native-web

See original GitHub issue

Environment

react-native-web, storybook

Description

“requireNativeComponent is not a function” when using 3.0.0-rc.2 and react-native-web

Reproducible Demo

https://github.com/penx/react-mixer/tree/6126b45efefb9bd4b4e600d9a4e6191616d7a8c3

Steps to recreate:

  • npm init -y
  • npx -p @storybook/cli sb init --type react
  • add react-native-web to dependencies and in storybook webpack alias
  • add import Slider from '@react-native-community/slider'; to a story
TypeError: (0 , _reactNative.requireNativeComponent) is not a function
    at Object../node_modules/@react-native-community/slider/dist/RNCSliderNativeComponent.js (http://localhost:6006/vendors~main.164a2871296ea09f7f00.bundle.js:115:255)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:7
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
arthurpankiewiczcommented, Oct 22, 2020

I’m also running into this problem with a few tests, particularly

react-native-safe-area-context
react-native-calendars
react-native-gesture-handler

I’m thinking this might be more of a react-native-web problem though

2reactions
younesshakkycommented, May 28, 2022

any news on this one? @penx did you resolve it somehow?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix import error : 'requireNativeComponent' from 'react ...
Attempted import error: 'requireNativeComponent' is not exported from 'react-native-web/dist/index'. Please tell me why this is happening and ...
Read more >
Storybook Issue: 'requireNativeComponent' is not a function #13
It's done in the webpack config file. You'd need to add 'react-native-linear-gradient': 'react-native-web-linear-gradient' .
Read more >
Prerequisites for Libraries - React Native
The following steps will help ensure your modules and components are ready for the New Architecture.
Read more >
react-native-safe-area-context - npm
A flexible way to handle safe area, also works on Android and web.. Latest version: 4.4.1, last published: 3 months ago.
Read more >
React, how to fix the TypeError: resolver is not a function error
React, how to fix the TypeError: resolver is not a function error. Published in 2021. Psssst! The 2023 WEB DEVELOPMENT BOOTCAMP is starting...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found