寻找类似于:

代码推送.VersionLabel类似于"v6",显示在code-push deployment ls <MyApp>

我想在我的登录屏幕底部显示这个.

推荐答案

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)

React-native相关问答推荐

如何更改分隔底部标签和屏幕内容的线的 colored颜色 ?React Native Tab导航器

TypeError:未定义不是对象(判断'theme.spacing [radius]')

useState 函数似乎阻止了 Animated.timing 事件?

错误发生意外错误:https://registry.yarnpkg.com/react-native-template-react-native-template-typescript:未找到

我可以在状态内有一个函数来响应吗?

'React native run android' 在模拟器中启动应用程序后立即停止

使用 React-Native 将 content:// URI 转换为 Android 的实际路径

如何运行 React-Native 示例?

自从升级到 Xcode 10.2 我不能再通过 cli 运行 react-native run-ios

如何判断 goBack() 函数在react-navigation 中是否可行?

如何使用react钩子设置状态数组

如何从 React Native-App 中的 res/drawable-folder 加载图像?

try 添加包时出现错误duplicate entry:com/google/android/gms/internal/zzble.class

获取没有地理位置 API React-native 的国家/城市?

如何使用 Typescript 在无状态组件上设置 navigationOptions

如何使用特定目标运行 react-native run-ios

通过 IOS 中的 Linking.openURL React Native Open 设置

ListView 和 FlatList 有什么区别?

Xcode 12 - 没有要编译的架构(ONLY_ACTIVE_ARCH=YES,active arch=x86_64,VALID_ARCHS=arm64e armv7s arm64 arm7)

类型 androidx.appcompat.resources.R$dimen 被定义了多次