Skip to content

Realm React v0.10.0

Compare
Choose a tag to compare
@github-actions github-actions released this 15 Aug 17:44
· 34 commits to main since this release
b3005de

Enhancements

  • Added useProgress hook which provides a convenient way to access Realm's progress information. It works in a similar way as realm.addProgressNotification. (#6797)
import { RealmProvider, ProgressDirection, ProgressMode } from "@realm/react";

const ProgressText = () => {
	const progress = useProgress({ direction: ProgressDirection.Download, mode: ProgressMode.ReportIndefinitely });

    return <Text>Loading: {(100 * progress).toFixed()}%</Text>;  
}

const MyApp() = () => {
  return (
    <RealmProvider sync={...}> 
      <ProgressText />
    </RealmProvider>
  );
}
  • Added the ability to get progress information in fallback component of RealmProvider when opening a synced Realm. (#6785)
import { RealmProvider, RealmProviderFallback } from "@realm/react";

const Fallback: RealmProviderFallback = ({ progress }) => {
	return <Text>Loading:{(100 * progress).toFixed()}%</Text>;
}

const MyApp() = () => {
  return (
    <RealmProvider sync={...} fallback={Fallback}> 
      ...
    </RealmProvider>
  );
}

Compatibility

  • Realm JavaScript >= v12.12.0.
  • React Native >= v0.71.4
  • Realm Studio v15.0.0.
  • File format: generates Realms with format v24 (reads and upgrades file format v10).