【发布时间】:2023-03-21 22:15:02
【问题描述】:
我为我的 React Native 应用程序实现了 ImageBackground,当我运行模拟器时,它不允许按下按钮。按钮事先经过测试并正常运行。 我觉得这与组件的订购有关,但在重新订购时没有成功。
export function TitleScreen({navigation: navigation}) {
return (
<ImageBackground source={require('../assets/space_background_reduced_v1.png')} style={globalStyles.background}>
<Image source = {require('../assets/logo.png')} style={globalStyles.logo}/>
<View style={globalStyles.Buttons}>
<Button title={"Random Race"} onPress={() => navigation.navigate('RandomRaceOptionsScreen')}/>
<Button title={"Create"} onPress={() => navigation.navigate('CreateMenu')}/>
<Button title={"Race Lore"} onPress={() => navigation.navigate('RaceLoreListScreen')}/>
</View>
</ImageBackground>
);
}
样式:
export const globalStyles = StyleSheet.create({
Buttons: {
zIndex:5,
width: 120,
marginLeft: "33%",
marginTop:90
},
``
【问题讨论】:
-
您还需要与我们分享样式。样式破坏了按钮的可按下功能。
-
道歉,现在分享
-
其实你也需要分享
background风格。我正在为你准备一个例子。稍等一下。
标签: android typescript react-native