Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.
This repository was archived by the owner on May 20, 2025. It is now read-only.

Pure component or hooks version of codePushStatusDidChange #1786

@MaffooBristol

Description

@MaffooBristol

Expected Behaviour

CodePush should have a version of codePushStatusDidChange that does not require using stateful components in React.

I'd assume the syntax would be something similar to this:

import codePush, { useCodePush } from 'react-native-code-push';

function Router() {
  const { SyncStatus } = useCodePush();
  switch (SyncStatus) {
    case SyncStatus.CHECKING_FOR_UPDATE:
      console.log("Checking for updates.");
      break;
    // ...
  }
  return <Foo />;
}

const App = codePush({
  checkFrequency: codePush.CheckFrequency.ON_APP_RESUME,
  installMode: codePush.InstallMode.ON_NEXT_RESUME,
})(Router);

AppRegistry.registerComponent(appName, () => App);

This may already be up for consideration, or already vetoed, and I know it would be a large architectural change throughout the codebase. Just thought I would see what the situation is. Thanks!

  • react-native-code-push version: 6.0.0
  • react-native version: 0.61.4
  • iOS/Android/Windows version: Any
  • Does this reproduce on a debug build or release build? Any
  • Does this reproduce on a simulator, or only on a physical device? Any

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions