React native course,problem with ListItem and library


i can’t find the reason,why it doesn’t work
who can help? and who had the same problem?
i already tried to delete node_modules and pacakage lock and with npm download

I also get this error I don’t why. I just run npm i and that solves the problem. Just don’t delete anything.

1 Like

npm install? or another command?
sorry for my bad english,i’m from Russia
thank you for your respond

Yeah, npm i or npm install. Both work. In addition if the issue persists, just refresh your metro by pressing (ctrl + c ) to exit then (npm start) to start again

1 Like

thanks,but my doesn’t work
i don’t why,but in course it works
i just can’t swipe
can you help me please?
There is my ListItem Code
import React from “react”;
import { Image, View, StyleSheet, TouchableHighlight } from “react-native”;
import AppText from “./AppText”;
import colors from “…/config/colors”;
import Swipeable from ‘react-native-gesture-handler/Swipeable’;

function Listitem({renderRightActions, title, subTitle, image, onPress }) {
return (





{title}
{subTitle}




);
}

const styles = StyleSheet.create({
container: {
flexDirection: “row”,
paddingTop: 20,
paddingLeft: 20,
},
image: {
width: 70,
height: 70,
borderRadius: 35,
marginRight: 10,
},
title: {
fontWeight: “500”,
},
subTitle: {
color: colors.medium,
},
});

export default Listitem;

and my MessageScreen code

import { setStatusBarBackgroundColor } from “expo-status-bar”;
import React from “react”;
import {
FlatList,
StyleSheet,
Text,
View,
Image,
} from “react-native”;
import Screen from ‘…/components/Screen’
import Listitem from “…/components/Listitem”;
import ListItemSeparator from “…/components/ListItemSeparator”;

const messages = [
{
id: 1,
title: “T1”,
description: “D1”,
image: require("…/assets/mosh.jpg"),
},
{
id: 2,
title: “T2”,
description: “D2”,
image: require("…/assets/mosh.jpg"),
},
];

function MessageScreen(props) {
return (

<FlatList
data={messages}
keyExtractor={(message) => message.id.toString()}
renderItem={({ item }) => (
<Listitem
renderRightActions={() => {
<View style={{
backgroundColor : ‘green’,
width : 70
}}>
}}
title={item.title}
subTitle={item.description}
image={item.image}
onPress={() => console.log(‘pressed’,item)}
/>
)}
ItemSeparatorComponent={ListItemSeparator}
/>

);
}

const styles = StyleSheet.create({

});

export default MessageScreen;

In your List Item Component, I think there are a lot of things missing in your return statement.

Secondly, in your Message Screen component, I’m not familiar with this statement" import { setStatusBarBackgroundColor } from “expo-status-bar

1 Like


Here is my List Item Component you can take a look.

2 Likes


My Message Screen component. I hope it will help you.

2 Likes

in List Item i don’t have missing because i’m still watching course
now i’m on section Lists, 6 lesson - Handling Swipes
so it’s the first problem with course
and i just need to copy your code?

1 Like

Ok, you do so and see if it works

1 Like

so i tried,but it doesn’t works

Try and build the whole component from scratch. Step by step. You may realise where the problem is.

damn,i find an bug it was here

renderRightActions={() => {
<View style={{
backgroundColor : ‘green’,
width : 70
}}>
}}

and we need
renderRightActions={() => (
<View style={{
backgroundColor : ‘green’,
width : 70
}}>
)}

that’s crazy

1 Like

Bingo, Stuck with same issue and same mistake i did, fix worked, Thanks

1 Like

Hello,
I’m not having the same issue but same behavior, swipeable doesn’t work : i don’t see red ‘zone’ and it just doesnt swipe.
Is there a particular way to import React-native-gesture-handler ?
I had to use this cmdline :

npm i react-native-gesture-handler --save && react-native link

Here are my 2 screenshots, im stuck with this since 2 hours :x

Update1 : I did the lesson ( 6- Handling Swipes) again from scratch today and i have no swipe available @3’45. This seems to be so basic i can’t understand :frowning: anyone can help ?