React & React Native

Pressable & buttons

Në shqip: Butonat në React Native

ShpjegimiSQ

Në React Native, gjërat që preken bëhen me <Pressable> (ose TouchableOpacity i vjetër), dhe ngjarja quhet onPress, jo onClick. Mund të ndryshosh stilin kur gishti e shtyp.

EnglishEN

In React Native, tappable things are made with <Pressable> (or the older TouchableOpacity), and the event is onPress, not onClick. You can change the style while the finger presses it.

Si ta mendosh

Si një buton ashensori që ndriçon kur e prek.

Lexoje në anglisht

Like a lift button that lights up when you touch it.

Shembull kodijavascript

<Pressable onPress={ruaj} style={({ pressed }) => ({ opacity: pressed ? 0.6 : 1 })}>
  <Text>Ruaj</Text>
</Pressable>

Terma të lidhur