Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

native-base components forces its children to re-render #33

Open
hsjoberg opened this issue Aug 13, 2019 · 0 comments
Open

native-base components forces its children to re-render #33

hsjoberg opened this issue Aug 13, 2019 · 0 comments
Labels
bug Something isn't working low prio This issue has low priority upstream Issue relates to upstream projects or code

Comments

@hsjoberg
Copy link
Owner

Consider this simple component:

import React from "react";
import { Container, Button } from "native-base";

export default ()  => {
  const [_, set] = useState(0);
  const Rerender = () => {
    console.log("RENDER");
    return (<></>);
  };

  rerender = useMemo(() => {
    return (<Rerender />);
  }, []);

  return (
    <Container>
      <Button onPress={() => set(Math.random()) } />
      {rerender}
    </Container>
  );
}

Pressing on the button so that the state changes causes Rerender component to re-render.
Replacing Container with react-natives View will solve the issue -- Rerender will not re-render if the button is pressed.

Perhaps check with up-stream?

@hsjoberg hsjoberg added bug Something isn't working low prio This issue has low priority labels Aug 13, 2019
@hsjoberg hsjoberg added the upstream Issue relates to upstream projects or code label Sep 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working low prio This issue has low priority upstream Issue relates to upstream projects or code
Projects
None yet
Development

No branches or pull requests

1 participant