Relative Content

Tag Archive for javascriptreactjsreact-native

Context Load before Client? react-native

i created a context to start up the socket
but before that it validate the token sending a request to the server.
there is an issue that i can’t really figure it out.

React Native why is my screen not scrolling on Iphone 11 but it works on Iphone7?

<SafeAreaView style={styles.container}> <FlatList data={postList} keyExtractor={(item) => item.id} renderItem={({ item }) => ( <Card title={item.title} difficulty={item.difficulty} image={item.image} /> )} ItemSeparatorComponent={<View style={{ height: 16 }} />} ListEmptyComponent={<Text>No items found</Text>} contentContainerStyle={styles.contentContainerStyle} /> </SafeAreaView> const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: “#f5f5f5”, marginTop: StatusBar.currentHeight, }, card: { backgroundColor: “#fff”, borderRadius: 8, overflow: “hidden”, borderWidth: 1, marginBottom: 15, […]

Twitter clone doesn’t show new posts after adding new ones unless the app is restarted – React Native

I’m creating a twitter clone as a small project to get better with IOS development, everything is going smoothly besides the fact that whenever i add a post, the app won’t reflect those changes unless it is restarted, I’m almost 100% sure its because the fetch call that grabs the post information isn’t in the components return statement and so it isn’t running on render, but when I try to put the fetch call inside of the function, it doesn’t recognize the variable anymore… If anyone could tell me why this is happening it would be greatly appreciated!

Slight delay in updating the ui

In my deleteOrSubstractQuantity when the first if statement gets called where I set the quantity to 0 essentially deleting the item’s quantity and the “expanded view” closes the quantity in the de-expanded view is shown as 0 and after a second or two it shows the correct “+” sign. Here’s my code in the UI that does this: When the quantity is bigger or equal to minOrderQuantity it should show the quantity in the circle, or else it mush show a “+” sign

Global dynamic variables in react native

I’m new to react native. I need to transfer a web game written on canvas to a mobile application.
I encountered the following problem: all variables in a web application are global, they can be used anywhere, but react native has different properties.
I’m building the layout of my application, using components, and functions to calculate physics in regular modules.
I need to get global variables that store the game state.
I found for the following 3 ways:

Why isn’t my useEffect running on render?

In my code (React Native) to avoid the “Too many re-renders” error I used a useEffect hook. I would expect the useEffect to run when the component PracticeTest first runs but it doesn’t. Can someone explain how I can fix it?

Why isn’t my useEffect running on render? (React Native)

In my code (React Native) to avoid the “Too many re-renders” error I used a useEffect hook. I would expect the useEffect to run when the component PracticeTest first runs but it doesn’t. Can someone explain how I can fix it?