React Native Tutorial - 13 - Pressable

preview_player
Показать описание

📱 Follow Codevolution

Pressable
React Native Tutorial
React Native Tutorial for Beginners
Рекомендации по теме
Комментарии
Автор

one small correction
order of events trigger
1.onPressIn
2.onPress
3.onPressOut

for long press
1.onPressIn
2.onLongPress
3.onPressOut

VetrivelDhanush
Автор

3:36
the correct flow is:
onPressIn => onPress => onPressOut

hunglemanh
Автор

I noticed images can't handle onPress events but Text can. So, I guess with Text, you would only use Pressable when you're want an onPress event on more than one consecutive Text component at a time.

MinisterGold
Автор

Also, is there any reason why you would use TouchableOpacity instead of Pressable or vice versa?

MinisterGold
Автор

Bro! you have the react native dedicated playlist for this? I'm currently at EP 26 of your react js. im planning to proceed on native😊

kevincliffpomar
Автор

How about TouchableOpacity and TouchableHighlight? Are these deprecated?

hunglemanh
Автор

What’s difference between Pressable and TouchableOpacity please ? And which it’s preferable to use ?

Azer_Oner
Автор

Can we differentiate ios and android press

ramakrishna-hwbg
Автор

import React, { useState } from "react";
import { Pressable, View, Text } from "react-native";

const MyComponent = () => {
const [count, setCount] = useState(0);

const onPress = () => {
setCount(count + 1);
};

return (
<View>
<Pressable onPress={onPress}>
<Text style={{fontsize: 20, padding: 50 }}>Press Me </Text>
</Pressable>
<Text style={{fontsize: 20, padding: 50}}>Count: {count}</Text>
</View>
)
}

export default MyComponent;

seddeknadhem
Автор

I tried <Text onPress ...
And it worked without {Pressable}
Why?

ryansatriayudha