Methods - React Native
reloadData
const momentsGridRef = useRef<BlazeViewComponentMethods | null>(null);
const handleReloadData = () => {
if (momentsGridRef?.current) {
momentsGridRef?.current.reloadData();
}
};
return (
<Button title="Reload Data" onPress={handleReloadData} />
<BlazeMomentsGridView
ref={momentsGridRef} ...>
Description
Reloads the data to be displayed in the widget in current configuration.
updateDataSource
method signature
const momentsGridRef = useRef<BlazeViewComponentMethods | null>(null);
const handleUpdateDataSource = () => {
const newDataSource = {
/* Your updated data source */
labels: BlazeWidgetLabel.atLeastOneOf('messi', 'ronaldo'),
};
if (momentsGridRef?.current) {
momentsGridRef?.current?.updateDataSource(newDataSource, false);
};
return (
<Button title="Update Data Source" onPress={handleUpdateDataSource} />
<BlazeMomentsGridView
ref={momentsGridRef} ...>
Updates the dataSourceType and Reloads the data for the widget.
Parameters:
- dataSourceType:
BlazeDataSourceType - isSilentRefresh: A flag indicating if the refresh is silent. This can be used to determine if the UI should display a loading skeleton animation or perform the refresh silently in the background.
play
method signature
const momentsGridRef = useRef<BlazeViewComponentMethods | null>(null);
const handlePlayWidget = () => {
if (momentsGridRef?.current) {
momentsGridRef?.current?.play();
};
}
return (
<Button title="Play Widget" onPress={handlePlayWidget} />
<BlazeMomentsGridView
ref={momentsGridRef} ...>Calls the widget to play its contents, starting from the first item.
Use this method to manually play a widget's content that has been successfully preloaded.
Note: Manually calling play on a widget means you gain control but also the responsibility to call this method only after the widget's onDataLoadComplete has been called successfully. Otherwise, the widget has no content to play.
updateOverrideStyles
method signature
const momentsGridRef = useRef<BlazeViewComponentMethods | null>(null);
// Mock function to demonstrate style overrides:
function updateWidgetStyleOverrides(): Map<BlazeWidgetItemCustomMapping, BlazeWidgetItemStyleOverrides> {
const teamMapping: BlazeWidgetItemCustomMapping = {
// key: "teamId",
// value: "1610612738"
key: "gameId",
value: "123"
};
const playerMapping: BlazeWidgetItemCustomMapping = {
key: "playerId",
value: "456"
};
const updateStyleOverrides: BlazeWidgetItemStyleOverrides = {
statusIndicator: {
isVisible: true,
position: {
xPosition: 'LeadingToLeading',
yPosition: 'BottomToBottom',
},
},
imageBorder: {
isVisible: true,
liveReadBorder: {
isVisible: true,
color: '#FF6347',
margin: 2,
width: 30,
},
liveUnreadBorder: {
isVisible: true,
color: '#4682B4',
margin: 2,
width: 30,
},
readBorder: {
isVisible: true,
color: '#32CD32',
margin: 2,
width: 30,
},
unreadBorder: {
isVisible: true,
color: '#FFD700',
margin: 2,
width: 30,
},
},
badge: {
isVisible: true,
text: 'Updated State',
backgroundColor: '#32CD32',
width: 20,
height: 20,
position: {
xPosition: 'CenterX',
yPosition: 'TopToTop',
},
margins: {
top: 5,
leading: 5,
bottom: 5,
trailing: 5,
},
borderColor: '#4682B4',
borderWidth: 10,
},
};
const styleMap = new Map<BlazeWidgetItemCustomMapping, BlazeWidgetItemStyleOverrides>();
styleMap.set(teamMapping, updateStyleOverrides);
styleMap.set(playerMapping, updateStyleOverrides);
return styleMap;
}
return (
<Button title="Update style overrides" onPress={updateWidgetStyleOverrides} />
<BlazeMomentsGridView
ref={momentsGridRef} ...>Updates style overrides for multiple items within the widget based on custom mappings and optionally refreshes the widget's UI to reflect these changes.
This method supports bulk updates to the styles of multiple items, allowing for efficient customization of the widget's appearance.
Passing null as a style for an item removes the existing override for that item.
Parameters:
- perItemStyleOverrides: A map of
BlazeWidgetItemCustomMappingobjects to optionalBlazeWidgetItemStyleOverrides. Each entry specifies the custom mapping for an item and the new style to be applied. Passnullas the value to remove the current override for the corresponding item.. - shouldUpdateUi: A Boolean value indicating whether the widget's UI should be updated immediately to reflect the style changes. The default is
true.
Moments tabs reload
Available from React Native SDK 1.20.0 on BlazeMomentsRowView and BlazeMomentsGridView widgets that use tabsConfiguration. These methods reload the content of the fullscreen Moments tabs player the widget opens. See Moments widget to tabs.
method signature
const momentsRowRef = useRef<BlazeMomentsRowView | null>(null);
const handleReloadTabs = () => {
if (momentsRowRef?.current) {
momentsRowRef?.current?.reloadAllTabs();
momentsRowRef?.current?.reloadNonActiveTabs();
momentsRowRef?.current?.reloadTab(0);
momentsRowRef?.current?.reloadTabByContainerId('highlights');
};
}
return (
<Button title="Reload tabs" onPress={handleReloadTabs} />
<BlazeMomentsRowView
ref={momentsRowRef} ...>reloadAllTabs
Reloads the content of every tab in the container, including the active one.
reloadNonActiveTabs
Reloads the content of every tab except the active one, leaving the tab the viewer is currently on undisturbed.
reloadTab
Reloads the content of a single tab, by index.
Parameters:
- at: The index of the tab to reload. An index outside the container's range does nothing.
Note: iOS only. On Android this method does nothing — the widget's tabs controller there does not expose per-tab reload.
reloadTabByContainerId
Reloads the content of a single tab, by container id.
Parameters:
- containerId: The
containerIdof the tab to reload, as set on that tab intabsConfiguration. An id that matches no tab does nothing.
Note: iOS only. On Android this method does nothing — the widget's tabs controller there does not expose per-tab reload.
Updated 22 days ago
