我在屏幕中央有一个应用程序登录页面。当我在win服务器上使用expo在本地进行测试,并且在模拟器上也测试了mac时,它都可以正常运行,但是当我执行build-ios并将其放到appstore并使用testflight进行测试时,则无法正常工作。
此代码也适用于android。 我在做什么错了?
您可以使用master分支https://github.com/saricabasak/keyholder在github上查看完整代码。 我还分享了下面的相关代码,您可以快速查看
查看我在本地运行expo的情况:
在飞行测试中:
app.json
{
"expo": {
"name": "key-holder",
"slug": "key-holder",
"privacy": "public",
"sdkVersion": "35.0.0",
"platforms": [
"ios",
"android",
"web"
],
"version": "1.1.0",
"orientation": "portrait",
"icon": "./assets/kilit_logo_logo_500x500.png",
"splash": {
"image": "./assets/kilit_logo_logo_1000x1000.png",
"resizeMode": "contain",
"backgroundColor": "#DAD7C5"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": [
"**/*"
],
"ios": {
"supportsTablet": false,
"bundleIdentifier": "com.coderals.keyholder",
"buildNumber": "1.0.0"
},
"android": {
"package": "com.coderals.keyholder",
"versionCode": 1
},
"androidStatusBar": {
"barStyle": "light-content",
"backgroundColor": "#334393"
},
"description": ""
}
}
图片代码:
import logo from '../../assets/transparentLogo.png';
export default class KeyHolderContainer extends Component {
render() {
let renderLogo;
let renderText;
if (this.props.isLogin) {
renderLogo = (
<Image
source={logo}
style={container.logoStyle}
resizeMode="center"
/>
);
renderText = (
<Text style={container.titleStyle}>
{translate("KeyHolderWelcome")}
</Text>
);
}
return (
<Container style={container.containerStyle}>
{renderLogo}
{renderText}
{this.props.children}
</Container>
);
}
}
样式:
export const container = StyleSheet.create({
containerStyle: {
width: "100%",
height: "100%",
backgroundColor: getStyle("container.backgroundColor")
},
logoStyle: {
width: "40%",
height: "40%",
alignSelf: "center"
},
titleStyle: {
color: getStyle("container.titleColor"),
fontSize:20,
fontWeight: "bold",
alignSelf: "center"
}
});
图片大小:素材资源文件夹上500 x 500。
答案 0 :(得分:1)
经过长时间的努力,我在下面针对ios进行了更改并解决了。
<Image
source={logo}
style={container.logoStyle}
resizeMode="center"
/>
到
<Image
source={logo}
style={container.logoStyle}
resizeMode="contain"
/>