On react native I have 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.
Code:
import React, { Component } from "react";
import { collection } from "@cuba-platform/react-core";
import { ActivityIndicator, ScrollView, StyleSheet, Text } from "react-native";
import { PredefinedView } from "@cuba-platform/rest";
import { observer } from "mobx-react";
import { colors } from "../styles/palette";
import { StmObj, StmObjView } from "../cuba/entities/pros_StmObj";
import {DataTable, buttons} from "@cuba-platform/react-ui";
import {injectIntl, WrappedComponentProps} from 'react-intl';
const styles = StyleSheet.create({
list: {
marginTop: 16
},
item: {
fontSize: 16,
color: colors.textPrimary,
marginTop: 4,
marginBottom: 4
},
title: {
fontSize: 18,
fontWeight: "bold",
marginTop: 16
}
});
@observer
export class Example extends React.Component {
usersData = collection<StmObjView<"_base">>(StmObj.NAME, {
view: PredefinedView.BASE,
limit: 5
});
render() {
const { status, items } = this.usersData;
if (status !== "DONE") {
return <ActivityIndicator color={colors.textPrimary} />;
}
return (
<>
<Text style={styles.title}>Список систем телеметрии:</Text>
<ScrollView style={styles.list}>
{items.map(item => (
<Text style={styles.item} key={item.id}>
{item._instanceName}
</Text>
))}
<DataTable dataCollection={collection}
columnDefinitions={[
'item',
'manufacturer',
{
field: 'price',
columnProps: {
align: 'right'
}
}
]}
onSelectedRowChange={this.onSelectedRowChange}
buttons={buttons}
tableProps={{
bordered: true
}}
/>
</ScrollView>
</>
);
}
}
const Telemetry = injectIntl(Example);
export default Telemetry;