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

v5 breaks support for functional components with hooks in accessories #1015

Closed
Photonios opened this issue Apr 13, 2020 · 1 comment
Closed
Labels
🐛 Bug 📱 Components components module-specific

Comments

@Photonios
Copy link
Contributor

Photonios commented Apr 13, 2020

🐛 Bug Report

v5 breaks support for rendering components with hooks in props such as accessoryLeft due to the implementation of: https://github.com/akveo/react-native-ui-kitten/blob/next/src/components/devsupport/components/falsyFC/falsyFC.component.tsx

FalsyFC should not make the assumption that components are plain functions. It should properly use React.createElement so hooks continue working.

To Reproduce

const MyHookComponent = () => {
        const [name, setName] = React.useState('');
        React.useEffect(() => {
              setName('test');
        });

        return <Text>{name}</Text>;
};

const MyApp = () => (
        <TopNavigation
                accessoryLeft={MyHookComponent}
                title={"test"}
          />
);

Expected behavior

For FalsyFC to render components with hooks by properly using React.createElement.

UI Kitten and Eva version

Package Version
@eva-design/eva 2.0.0-alpha.1
@ui-kitten/components 5.0.0-alpha.1
@artyorsh
Copy link
Collaborator

@Photonios thanks for reporting and pointing for the possible solution.

As a workaround, you may create a function that renders a function component: https://snack.expo.io/AAtTzHId3

@artyorsh artyorsh added 🐛 Bug 📱 Components components module-specific labels Apr 13, 2020
Photonios added a commit to SectorLabs/react-native-ui-kitten that referenced this issue Apr 25, 2020
Photonios added a commit to SectorLabs/react-native-ui-kitten that referenced this issue Apr 25, 2020
@artyorsh artyorsh mentioned this issue Apr 25, 2020
2 tasks
Photonios added a commit to SectorLabs/react-native-ui-kitten that referenced this issue Apr 25, 2020
Photonios added a commit to SectorLabs/react-native-ui-kitten that referenced this issue Apr 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug 📱 Components components module-specific
Projects
None yet
Development

No branches or pull requests

2 participants