[英]Expo react native app image not work properly on testflight ios
我有一個以屏幕為中心的應用程序登錄頁面。 當我在 win 服務器上使用 expo 進行本地測試並在模擬器上測試 mac 時,它運行良好,但是當我構建 ios 並將其放入 appstore 並使用 testflight 進行測試時,它無法正常工作。
此代碼也適用於 android。 我究竟做錯了什么?
您可以使用 master 分支在 github 上檢查完整代碼: https : //github.com/saricabasak/keyholder我也在下面分享相關代碼,您可以快速檢查
查看我在本地運行 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。
經過長時間的努力,我確實在下面為ios進行了更改並解決了。
<Image
source={logo}
style={container.logoStyle}
resizeMode="center"
/>
到
<Image
source={logo}
style={container.logoStyle}
resizeMode="contain"
/>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.