[英]Touchable Opacity not working with iPhone 6,6s,8 but working with iPhone 11
我不知道為什么,但我有這個 1 可觸摸的不透明標簽,它似乎在 iPhone 11 中有效,但在 iPhone 6s、6、8 中無效。 不同 iPhone 的使用方式有區別嗎? 此標簽在 android 中也能完美運行,但似乎不適用於舊款 iPhone。 任何幫助,將不勝感激。 謝謝你。 我已經從react-native
導入了可觸摸的不透明度。
代碼。
<TouchableOpacity disabled={disabled} activeOpacity={opacity} style={buttonStyles} >
{renderContent()}
</TouchableOpacity>
這是工作,但你的TouchableOpacity不在父塊內
如果您想測試是否有效,請嘗試這樣的TouchableOpacity
只是Dimension的問題
return (
<View style={{ flex: 1, backgroundColor: 'red' }}>
<TouchableOpacity style={{ width: 150, height: 60, justifyContent: 'center', alignItems: 'center' }}
onPress={() => {alert("it's work")}}>
<Text>Press Me</Text>
</TouchableOpacity>
</View>
)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.