寻找类似的东西:<Text>VERSION={CodePush.VersionLabel}</Text>
其中CodePush.VersionLabel类似于code-push deployment ls <MyApp>中显示的"v6“
我想在我的登录屏幕底部显示这个。
发布于 2016-10-02 05:39:38
componentDidMount(){
codePush.getUpdateMetadata().then((metadata) =>{
this.setState({label: metadata.label, version: metadata.appVersion, description: metadata.description});
});
}
render() {
return(
<Text>{this.state.version}.{this.state.label}</Text>
);
}注意:.label属性是CodePush使用的内部构建号(例如v24)
发布于 2019-06-24 05:27:01
如果没有可用的更新,getUpdateMetadata()将返回null.
解决办法:
import codePush from "react-native-code-push";
async function getAppVersion() {
const [{ appVersion }, update] = await Promise.all([
codePush.getConfiguration(),
codePush.getUpdateMetadata()
]);
if (!update) {
return `v${appVersion}`;
}
const label = update.label.substring(1);
return `v${appVersion} rev.${label}`;
};
export { getAppVersion };示例输出:v1.4.4"或v1.4.4 re.5“取决于状态。
发布于 2016-12-29 02:46:04
componentDidMount() {
CodePush.getCurrentPackage().then((update)=> {
console.log('####### CodePush', update);
});
}https://stackoverflow.com/questions/39796511
复制相似问题