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

Button Component is undefined #2848

Closed
2 of 7 tasks
zh925 opened this issue Dec 11, 2023 · 10 comments
Closed
2 of 7 tasks

Button Component is undefined #2848

zh925 opened this issue Dec 11, 2023 · 10 comments
Labels
bug a bug in one of the components

Comments

@zh925
Copy link

zh925 commented Dec 11, 2023

Description

I import Button and render it, has an Error.

 Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

Then I console.log(Button), it was an undefined in my logs.

Related to

  • Components
  • Demo
  • Docs
  • Typings

Steps to reproduce

import { View, Button } from 'react-native-ui-lib'

export default function MyScreen() {
    return (
        <View>
            <Button label="click" />
        </View>
    )
}

Expected behavior

render the button

Actual behavior

throw an error

More Info

Code snippet

import { View, Button } from 'react-native-ui-lib'

export default function MyScreen() {
    return (
        <View>
            <Button label="click" />
        </View>
    )
}

Screenshots/Video

Environment

  • React Native version: 0.72.7
  • React Native UI Lib version: 7.12.0

it was same on [email protected]

Affected platforms

  • Android
  • iOS
  • Web
@zh925 zh925 added the bug a bug in one of the components label Dec 11, 2023
@zh925 zh925 closed this as completed Dec 11, 2023
@zh925 zh925 reopened this Dec 11, 2023
@JacobWennebro
Copy link

I have the same problem on iOS

@PavelPolyakov
Copy link

PavelPolyakov commented Jan 4, 2024

Same thing, an example from the documentation: https://wix.github.io/react-native-ui-lib/docs/getting-started/usage does not work. For View, Text and TextField it does, but fails on Button.

upd.

To me it helped to make sure that react-native-reanimated is installed following this guide: https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/getting-started/

Specifically, run npx expo start -c afterwards

@andrewvmail
Copy link

Running into the same issue
image

@zp342519261
Copy link

I had the same problem,It's not just Button, there are other components that have this problem as well

@alvaromirandamita
Copy link

I updated the libraries recommended by Expo, and it worked.

"dependencies": {
"expo": "~50.0.6",
"expo-status-bar": "~1.11.1",
"react": "18.2.0",
"react-native": "0.73.4",
"react-native-calendars": "^1.1303.0",
"react-native-gesture-handler": "~2.14.0",
"react-native-reanimated": "~3.6.2",
"react-native-ui-lib": "^7.16.0"
},
"devDependencies": {
"@babel/core": "^7.20.0"
},

@Aymenoob
Copy link

same issue here

@jami-yashwanth
Copy link

jami-yashwanth commented Apr 10, 2024

I updated the libraries recommended by Expo, and it worked.

"dependencies": { "expo": "~50.0.6", "expo-status-bar": "~1.11.1", "react": "18.2.0", "react-native": "0.73.4", "react-native-calendars": "^1.1303.0", "react-native-gesture-handler": "~2.14.0", "react-native-reanimated": "~3.6.2", "react-native-ui-lib": "^7.16.0" }, "devDependencies": { "@babel/core": "^7.20.0" },

Updated libraries...Working!!

@paulamurta
Copy link

paulamurta commented Jul 24, 2024

did anyone came up with any solutions? dealing with the same issue when trying to use <TextField>

@mateusz-
Copy link

mateusz- commented Oct 2, 2024

I had to add react-native-reanimated Babel plugin to babel.config.js:

  module.exports = {
    presets: [
      ... // don't add it here :)
    ],
    plugins: [
      ...
      'react-native-reanimated/plugin',
    ],
  };

https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/getting-started/#step-2-add-reanimateds-babel-plugin

Copy link

stale bot commented Jan 31, 2025

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added wontfix and removed wontfix labels Jan 31, 2025
@zh925 zh925 closed this as completed Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug a bug in one of the components
Projects
None yet
Development

No branches or pull requests

10 participants