wix / react-native-ui-lib

UI Components Library for React Native

Home Page:https://wix.github.io/react-native-ui-lib/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Button Component is undefined

zh925 opened this issue · comments

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 react-native-ui-lib@7.12.1

Affected platforms

  • Android
  • iOS
  • Web

I have the same problem on iOS

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

Running into the same issue
image

commented

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

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"
},

same issue here

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!!