Abstract

React Native Firebase is a React Native library that fully supports Firebase cloud services.

Snipplets

Change remote config fetch interval

By default Firebase Remote Config has a fetch interval of 12 hours, which makes things a little difficult to test in a development environment. In the snippet below we are forcing it to fetch and activate the remote config in real time.

import remoteConfig from '@react-native-firebase/remote-config';
import Config from 'react-native-config';
 
export const initializeRemoteConfig = async () => {
	remoteConfig().setDefaults({
		awesomeFeature: false,
	});
 
	if (Config.ENV === "development") {
		await remoteConfig().setConfigSettings({
			minimumFetchIntervalMillis: 0,
		});
	}
 
	const activated = await remoteConfig().fetchAndActivate();
	if (activated) {
		console.log('Configs were activated');
	} else {
		console.log('No configs were activated');
	}
};