React Native Invariant Violation Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Hide keyboard in react-nativeWhat is the difference between using constructor vs getInitialState in React / React Native?What is the difference between React Native and React?Android UI Components still running when React component is unmounted with react-router-nativeInvariant Violation: App(…): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return nullfetch data in react native from mlabNot able to navigate to other page in react nativeModalFilterPicker load more on scrollnavigate from another screen on click navigationDrawerLayout menuforms component of react-native-elements cause “Invariant Violation” error

Can a new player join a group only when a new campaign starts?

How to write the following sign?

Is it fair for a professor to grade us on the possession of past papers?

What is a fractional matching?

Is it possible for SQL statements to execute concurrently within a single session in SQL Server?

How to tell that you are a giant?

Disembodied hand growing fangs

What do you call the main part of a joke?

Is there any word for a place full of confusion?

Why does it sometimes sound good to play a grace note as a lead in to a note in a melody?

Converted a Scalar function to a TVF function for parallel execution-Still running in Serial mode

Generate an RGB colour grid

How were pictures turned from film to a big picture in a picture frame before digital scanning?

How fail-safe is nr as stop bytes?

What is the topology associated with the algebras for the ultrafilter monad?

Why should I vote and accept answers?

What's the meaning of "fortified infraction restraint"?

Putting class ranking in CV, but against dept guidelines

How do living politicians protect their readily obtainable signatures from misuse?

Why is it faster to reheat something than it is to cook it?

Central Vacuuming: Is it worth it, and how does it compare to normal vacuuming?

Time to Settle Down!

Find 108 by using 3,4,6

Effects on objects due to a brief relocation of massive amounts of mass



React Native Invariant Violation



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern)
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!Hide keyboard in react-nativeWhat is the difference between using constructor vs getInitialState in React / React Native?What is the difference between React Native and React?Android UI Components still running when React component is unmounted with react-router-nativeInvariant Violation: App(…): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return nullfetch data in react native from mlabNot able to navigate to other page in react nativeModalFilterPicker load more on scrollnavigate from another screen on click navigationDrawerLayout menuforms component of react-native-elements cause “Invariant Violation” error



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








1















I've been following a guide about making use of FlatLists. I have copied code from this GitHub repo: https://github.com/ReactNativeSchool/react-native-flatlist-demo/blob/master/FlatListDemo.js



I'm getting an issue however...



Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s%s, 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.


Here is my code:



import React, Component from "react";
import View, FlatList, ActivityIndicator from "react-native";
import List, ListItem, SearchBar from "react-native-elements";

class SettingsScreen extends Component
constructor(props)
super(props);

this.state =
loading: false,
data: [],
page: 1,
seed: 1,
error: null,
refreshing: false
;


componentDidMount()
this.makeRemoteRequest();


makeRemoteRequest = () =>
const page, seed = this.state;
const url = `https://randomuser.me/api/?
seed=$seed&page=$page&results=20`;
this.setState( loading: true );

fetch(url)
.then(res => res.json())
.then(res =>
this.setState( null,
loading: false,
refreshing: false
);
)
.catch(error =>
this.setState( error, loading: false );
);
;

handleRefresh = () =>
this.setState(

page: 1,
seed: this.state.seed + 1,
refreshing: true
,
() =>
this.makeRemoteRequest();

);
;

handleLoadMore = () =>
this.setState(

page: this.state.page + 1
,
() =>
this.makeRemoteRequest();

);
;

renderSeparator = () =>
return (
<View
style=
height: 1,
width: "86%",
backgroundColor: "#CED0CE",
marginLeft: "14%"

/>
);
;

renderHeader = () =>
return <SearchBar placeholder="Type Here..." lightTheme round />;
;

renderFooter = () =>
if (!this.state.loading) return null;

return (
<View
style=
paddingVertical: 20,
borderTopWidth: 1,
borderColor: "#CED0CE"

>
<ActivityIndicator animating size="large" />
</View>
);
;

render()
return (
<List containerStyle= borderTopWidth: 0, borderBottomWidth: 0 >
<FlatList
data=this.state.data
renderItem=( item ) => (
<ListItem
roundAvatar
title=`$item.name.first $item.name.last`
subtitle=item.email
avatar= uri: item.picture.thumbnail
containerStyle= borderBottomWidth: 0
/>
)
keyExtractor=item => item.email
ItemSeparatorComponent=this.renderSeparator
ListHeaderComponent=this.renderHeader
ListFooterComponent=this.renderFooter
onRefresh=this.handleRefresh
refreshing=this.state.refreshing
onEndReached=this.handleLoadMore
onEndReachedThreshold=50
/>
</List>
);



export default SettingsScreen;


Through looking at sources online I can see it is probably my imports that are breaking the code but I can't see it myself. Any suggestions?



Thanks










share|improve this question






















  • What version of react-native-elements are you using?

    – Pritish Vaidya
    Mar 22 at 10:09












  • @Pritish Inside the package.json I see "_id": "react-native-elements@1.1.0" I ran the command npm install --save react-native-elements I assume this would pull in the latest version?

    – mk1
    Mar 22 at 10:14












  • Not sure about the older versions but the newer versions don't use List anymore, you can use a View instead

    – Pritish Vaidya
    Mar 22 at 10:17











  • Thank you so much, Im new to SO so I'm not sure what to do here. I could edit the question and give the solution at the bottom or delete it? I essentially removed the List import completely and just left the View import from react-native. I then replaced my <List> tags with <View> tags as you advised :)

    – mk1
    Mar 22 at 10:21











  • Yes, you can add the solution and tick it for other people's reference

    – Pritish Vaidya
    Mar 22 at 10:22

















1















I've been following a guide about making use of FlatLists. I have copied code from this GitHub repo: https://github.com/ReactNativeSchool/react-native-flatlist-demo/blob/master/FlatListDemo.js



I'm getting an issue however...



Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s%s, 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.


Here is my code:



import React, Component from "react";
import View, FlatList, ActivityIndicator from "react-native";
import List, ListItem, SearchBar from "react-native-elements";

class SettingsScreen extends Component
constructor(props)
super(props);

this.state =
loading: false,
data: [],
page: 1,
seed: 1,
error: null,
refreshing: false
;


componentDidMount()
this.makeRemoteRequest();


makeRemoteRequest = () =>
const page, seed = this.state;
const url = `https://randomuser.me/api/?
seed=$seed&page=$page&results=20`;
this.setState( loading: true );

fetch(url)
.then(res => res.json())
.then(res =>
this.setState( null,
loading: false,
refreshing: false
);
)
.catch(error =>
this.setState( error, loading: false );
);
;

handleRefresh = () =>
this.setState(

page: 1,
seed: this.state.seed + 1,
refreshing: true
,
() =>
this.makeRemoteRequest();

);
;

handleLoadMore = () =>
this.setState(

page: this.state.page + 1
,
() =>
this.makeRemoteRequest();

);
;

renderSeparator = () =>
return (
<View
style=
height: 1,
width: "86%",
backgroundColor: "#CED0CE",
marginLeft: "14%"

/>
);
;

renderHeader = () =>
return <SearchBar placeholder="Type Here..." lightTheme round />;
;

renderFooter = () =>
if (!this.state.loading) return null;

return (
<View
style=
paddingVertical: 20,
borderTopWidth: 1,
borderColor: "#CED0CE"

>
<ActivityIndicator animating size="large" />
</View>
);
;

render()
return (
<List containerStyle= borderTopWidth: 0, borderBottomWidth: 0 >
<FlatList
data=this.state.data
renderItem=( item ) => (
<ListItem
roundAvatar
title=`$item.name.first $item.name.last`
subtitle=item.email
avatar= uri: item.picture.thumbnail
containerStyle= borderBottomWidth: 0
/>
)
keyExtractor=item => item.email
ItemSeparatorComponent=this.renderSeparator
ListHeaderComponent=this.renderHeader
ListFooterComponent=this.renderFooter
onRefresh=this.handleRefresh
refreshing=this.state.refreshing
onEndReached=this.handleLoadMore
onEndReachedThreshold=50
/>
</List>
);



export default SettingsScreen;


Through looking at sources online I can see it is probably my imports that are breaking the code but I can't see it myself. Any suggestions?



Thanks










share|improve this question






















  • What version of react-native-elements are you using?

    – Pritish Vaidya
    Mar 22 at 10:09












  • @Pritish Inside the package.json I see "_id": "react-native-elements@1.1.0" I ran the command npm install --save react-native-elements I assume this would pull in the latest version?

    – mk1
    Mar 22 at 10:14












  • Not sure about the older versions but the newer versions don't use List anymore, you can use a View instead

    – Pritish Vaidya
    Mar 22 at 10:17











  • Thank you so much, Im new to SO so I'm not sure what to do here. I could edit the question and give the solution at the bottom or delete it? I essentially removed the List import completely and just left the View import from react-native. I then replaced my <List> tags with <View> tags as you advised :)

    – mk1
    Mar 22 at 10:21











  • Yes, you can add the solution and tick it for other people's reference

    – Pritish Vaidya
    Mar 22 at 10:22













1












1








1








I've been following a guide about making use of FlatLists. I have copied code from this GitHub repo: https://github.com/ReactNativeSchool/react-native-flatlist-demo/blob/master/FlatListDemo.js



I'm getting an issue however...



Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s%s, 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.


Here is my code:



import React, Component from "react";
import View, FlatList, ActivityIndicator from "react-native";
import List, ListItem, SearchBar from "react-native-elements";

class SettingsScreen extends Component
constructor(props)
super(props);

this.state =
loading: false,
data: [],
page: 1,
seed: 1,
error: null,
refreshing: false
;


componentDidMount()
this.makeRemoteRequest();


makeRemoteRequest = () =>
const page, seed = this.state;
const url = `https://randomuser.me/api/?
seed=$seed&page=$page&results=20`;
this.setState( loading: true );

fetch(url)
.then(res => res.json())
.then(res =>
this.setState( null,
loading: false,
refreshing: false
);
)
.catch(error =>
this.setState( error, loading: false );
);
;

handleRefresh = () =>
this.setState(

page: 1,
seed: this.state.seed + 1,
refreshing: true
,
() =>
this.makeRemoteRequest();

);
;

handleLoadMore = () =>
this.setState(

page: this.state.page + 1
,
() =>
this.makeRemoteRequest();

);
;

renderSeparator = () =>
return (
<View
style=
height: 1,
width: "86%",
backgroundColor: "#CED0CE",
marginLeft: "14%"

/>
);
;

renderHeader = () =>
return <SearchBar placeholder="Type Here..." lightTheme round />;
;

renderFooter = () =>
if (!this.state.loading) return null;

return (
<View
style=
paddingVertical: 20,
borderTopWidth: 1,
borderColor: "#CED0CE"

>
<ActivityIndicator animating size="large" />
</View>
);
;

render()
return (
<List containerStyle= borderTopWidth: 0, borderBottomWidth: 0 >
<FlatList
data=this.state.data
renderItem=( item ) => (
<ListItem
roundAvatar
title=`$item.name.first $item.name.last`
subtitle=item.email
avatar= uri: item.picture.thumbnail
containerStyle= borderBottomWidth: 0
/>
)
keyExtractor=item => item.email
ItemSeparatorComponent=this.renderSeparator
ListHeaderComponent=this.renderHeader
ListFooterComponent=this.renderFooter
onRefresh=this.handleRefresh
refreshing=this.state.refreshing
onEndReached=this.handleLoadMore
onEndReachedThreshold=50
/>
</List>
);



export default SettingsScreen;


Through looking at sources online I can see it is probably my imports that are breaking the code but I can't see it myself. Any suggestions?



Thanks










share|improve this question














I've been following a guide about making use of FlatLists. I have copied code from this GitHub repo: https://github.com/ReactNativeSchool/react-native-flatlist-demo/blob/master/FlatListDemo.js



I'm getting an issue however...



Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s%s, 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.


Here is my code:



import React, Component from "react";
import View, FlatList, ActivityIndicator from "react-native";
import List, ListItem, SearchBar from "react-native-elements";

class SettingsScreen extends Component
constructor(props)
super(props);

this.state =
loading: false,
data: [],
page: 1,
seed: 1,
error: null,
refreshing: false
;


componentDidMount()
this.makeRemoteRequest();


makeRemoteRequest = () =>
const page, seed = this.state;
const url = `https://randomuser.me/api/?
seed=$seed&page=$page&results=20`;
this.setState( loading: true );

fetch(url)
.then(res => res.json())
.then(res =>
this.setState( null,
loading: false,
refreshing: false
);
)
.catch(error =>
this.setState( error, loading: false );
);
;

handleRefresh = () =>
this.setState(

page: 1,
seed: this.state.seed + 1,
refreshing: true
,
() =>
this.makeRemoteRequest();

);
;

handleLoadMore = () =>
this.setState(

page: this.state.page + 1
,
() =>
this.makeRemoteRequest();

);
;

renderSeparator = () =>
return (
<View
style=
height: 1,
width: "86%",
backgroundColor: "#CED0CE",
marginLeft: "14%"

/>
);
;

renderHeader = () =>
return <SearchBar placeholder="Type Here..." lightTheme round />;
;

renderFooter = () =>
if (!this.state.loading) return null;

return (
<View
style=
paddingVertical: 20,
borderTopWidth: 1,
borderColor: "#CED0CE"

>
<ActivityIndicator animating size="large" />
</View>
);
;

render()
return (
<List containerStyle= borderTopWidth: 0, borderBottomWidth: 0 >
<FlatList
data=this.state.data
renderItem=( item ) => (
<ListItem
roundAvatar
title=`$item.name.first $item.name.last`
subtitle=item.email
avatar= uri: item.picture.thumbnail
containerStyle= borderBottomWidth: 0
/>
)
keyExtractor=item => item.email
ItemSeparatorComponent=this.renderSeparator
ListHeaderComponent=this.renderHeader
ListFooterComponent=this.renderFooter
onRefresh=this.handleRefresh
refreshing=this.state.refreshing
onEndReached=this.handleLoadMore
onEndReachedThreshold=50
/>
</List>
);



export default SettingsScreen;


Through looking at sources online I can see it is probably my imports that are breaking the code but I can't see it myself. Any suggestions?



Thanks







react-native react-native-elements






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 22 at 10:06









mk1mk1

425




425












  • What version of react-native-elements are you using?

    – Pritish Vaidya
    Mar 22 at 10:09












  • @Pritish Inside the package.json I see "_id": "react-native-elements@1.1.0" I ran the command npm install --save react-native-elements I assume this would pull in the latest version?

    – mk1
    Mar 22 at 10:14












  • Not sure about the older versions but the newer versions don't use List anymore, you can use a View instead

    – Pritish Vaidya
    Mar 22 at 10:17











  • Thank you so much, Im new to SO so I'm not sure what to do here. I could edit the question and give the solution at the bottom or delete it? I essentially removed the List import completely and just left the View import from react-native. I then replaced my <List> tags with <View> tags as you advised :)

    – mk1
    Mar 22 at 10:21











  • Yes, you can add the solution and tick it for other people's reference

    – Pritish Vaidya
    Mar 22 at 10:22

















  • What version of react-native-elements are you using?

    – Pritish Vaidya
    Mar 22 at 10:09












  • @Pritish Inside the package.json I see "_id": "react-native-elements@1.1.0" I ran the command npm install --save react-native-elements I assume this would pull in the latest version?

    – mk1
    Mar 22 at 10:14












  • Not sure about the older versions but the newer versions don't use List anymore, you can use a View instead

    – Pritish Vaidya
    Mar 22 at 10:17











  • Thank you so much, Im new to SO so I'm not sure what to do here. I could edit the question and give the solution at the bottom or delete it? I essentially removed the List import completely and just left the View import from react-native. I then replaced my <List> tags with <View> tags as you advised :)

    – mk1
    Mar 22 at 10:21











  • Yes, you can add the solution and tick it for other people's reference

    – Pritish Vaidya
    Mar 22 at 10:22
















What version of react-native-elements are you using?

– Pritish Vaidya
Mar 22 at 10:09






What version of react-native-elements are you using?

– Pritish Vaidya
Mar 22 at 10:09














@Pritish Inside the package.json I see "_id": "react-native-elements@1.1.0" I ran the command npm install --save react-native-elements I assume this would pull in the latest version?

– mk1
Mar 22 at 10:14






@Pritish Inside the package.json I see "_id": "react-native-elements@1.1.0" I ran the command npm install --save react-native-elements I assume this would pull in the latest version?

– mk1
Mar 22 at 10:14














Not sure about the older versions but the newer versions don't use List anymore, you can use a View instead

– Pritish Vaidya
Mar 22 at 10:17





Not sure about the older versions but the newer versions don't use List anymore, you can use a View instead

– Pritish Vaidya
Mar 22 at 10:17













Thank you so much, Im new to SO so I'm not sure what to do here. I could edit the question and give the solution at the bottom or delete it? I essentially removed the List import completely and just left the View import from react-native. I then replaced my <List> tags with <View> tags as you advised :)

– mk1
Mar 22 at 10:21





Thank you so much, Im new to SO so I'm not sure what to do here. I could edit the question and give the solution at the bottom or delete it? I essentially removed the List import completely and just left the View import from react-native. I then replaced my <List> tags with <View> tags as you advised :)

– mk1
Mar 22 at 10:21













Yes, you can add the solution and tick it for other people's reference

– Pritish Vaidya
Mar 22 at 10:22





Yes, you can add the solution and tick it for other people's reference

– Pritish Vaidya
Mar 22 at 10:22












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55297216%2freact-native-invariant-violation%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55297216%2freact-native-invariant-violation%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현