Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

200
Vistas
Sharing components made with Native-Base between ReactJs and React Native Projects

I am trying to share components between a ReactJs and React Native project. I have been successful in being able to share components that use React Native, but project that use Native Base get errors. My setup is this:

I have a mono repo that holds the project. I installed React Native Web in my web project I made a shared folder in in my React Native code base. I made a symlink from my web src folder to the shared folder I updated babel configs to compile items in the shared folder

Here is an example of a component I am trying to share. Nothing too special ;)

import {Center, Text} from 'native-base';

const Test = () => {
  return (
    <Center>
      <Text>hello world!</Text>
    </Center>
  );
};

export default Test;

I see this in devtools console:

Uncaught Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:

  1. You might have mismatching versions of React and the renderer (such as React DOM)
  2. You might be breaking the Rules of Hooks
  3. You might have more than one copy of React in the same app

The above error occurred in the <ForwardRef(Center)> component:

Any idea how I can get components with native base to work in web. I should note that it works fine on mobile, where there is not a symlink.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

The only way to share components between web and native mobile is with expo, or with react-native-web. I use react-native-web, and I am happy with the technology. Write once play everywhere (web, android & ios)

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda