Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

201
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda