React Native: Text onPress not working on android

I have the following code: <Text onPress={() => console.log(‘this won\’t print’)}>Dumb text</Text> According to React Native’s documentation, this works great in both iOS and Android, however when I run it myself, it only works on iOS, while Android acts as if the onPress prop doesn’t exist at all. I know I can use TouchableOpacity (all… Read More React Native: Text onPress not working on android

Undefined is not an object (evaluating 'navigation.navigate') when trying to navigate between two sites React Native

I try to navigate between two pages in a React Native app. I keep getting errors for my implementations but I don’t know why. I have the following setup for a "Home" and "Settings" site in the React Native app with Navigator adjusted from the documentation: App.js import Home from "./Home"; import { NavigationContainer }… Read More Undefined is not an object (evaluating 'navigation.navigate') when trying to navigate between two sites React Native

Using useEffect with async?

I’m using this code: useFocusEffect( useCallback(async () => { const user = JSON.parse(await AsyncStorage.getItem("user")); if (user.uid) { const dbRef = ref(dbDatabase, "/activity/" + user.uid); onValue(query(dbRef, limitToLast(20)), (snapshot) => { console.log(snapshot.val()); }); return () => { off(dbRef); }; } }, []) ); I’m getting this error: An effect function must not return anything besides a function,… Read More Using useEffect with async?

How can i get json in axios with react native?

I’m trying to get json in axios but if i use my code this error and warning occured How can i get response.json ?? response.json is not a function this is my code // url="https://yts.lt/api/v2/list_movies.json?sort_by=like_count&order_by=desc&limit=5&quot; url is props useEffect(() => { axios .get(url) .then((response) => response.json()) .then((json) => { console.log(‘json’, json); setData(json.data.movies); }) .catch((error) =>… Read More How can i get json in axios with react native?

Using TypeScript generic with `…rest` operator

This is what I am doing: export default <T extends { color: string },>(props: T) => ( <Svg height="20px" width="20px" version="1.1" viewBox="0 0 20 20" {…props:T}> <G id="Icons-/-16-/-Arrow-Left" fill="none" fillRule="evenodd" stroke="none" strokeWidth="1" > <Path id="icon" d="M7.34243727,10.0024497 L14.8286235,2.93169993 C15.04831,2.7247463 15.0578735,2.37909552 14.8510294,2.15985572 C14.6436388,1.94061593 14.2753088,1.9529021 14.0558955,2.15985572 L6.17132265,9.60547002 C6.0620259,9.70867381 6,9.8520124 6,10.0024497 C6,10.1526139 6.0620259,10.2962255 6.17132265,10.3994293 L14.0558955,17.8510106 C14.2753088,18.0579642 14.621233,18.0481353 14.8286235,17.8288955 C15.0354676,17.6096557… Read More Using TypeScript generic with `…rest` operator

React Native Flatlist with Typescript:Property 'data' is optional in type but required in type 'Readonly<FlatListProps<string>

Here’s my FlatList: <FlatList {…omit(this.props, [ "id", "loading", ])} nestedScrollEnabled renderItem={this.renderItem} onEndReached={this.onEndReached} ListFooterComponent={this.renderFooter} /> Here’s a renderItem: @autobind renderItem< I extends ILVITem, IX extends { toString: () => string } >({ item, index }: { item: I; index: IX }) { if (!isFunction(this.props.itemConfig)) { return null; } const itemConfig = this.props.itemConfig(item); if (isEmpty(itemConfig)) { return… Read More React Native Flatlist with Typescript:Property 'data' is optional in type but required in type 'Readonly<FlatListProps<string>