forked from vergnet/application-amicale
Fixed purecomponent not updating
This commit is contained in:
parent
38b1a158c8
commit
a10d357d8f
2 changed files with 6 additions and 10 deletions
|
@ -16,6 +16,7 @@ type Props = {
|
||||||
renderSectionHeader: React.Node,
|
renderSectionHeader: React.Node,
|
||||||
stickyHeader: boolean,
|
stickyHeader: boolean,
|
||||||
createDataset: Function,
|
createDataset: Function,
|
||||||
|
updateData: number,
|
||||||
}
|
}
|
||||||
|
|
||||||
type State = {
|
type State = {
|
||||||
|
@ -28,19 +29,15 @@ type State = {
|
||||||
|
|
||||||
const MIN_REFRESH_TIME = 5 * 1000;
|
const MIN_REFRESH_TIME = 5 * 1000;
|
||||||
/**
|
/**
|
||||||
* Custom component defining a material icon using native base
|
* This is a pure component, meaning it will only update if a shallow comparison of state and props is different.
|
||||||
*
|
* To force the component to update, change the value of updateData.
|
||||||
* @prop active {boolean} Whether to set the icon color to active
|
|
||||||
* @prop icon {string} The icon string to use from MaterialCommunityIcons
|
|
||||||
* @prop color {string} The icon color. Use default theme color if unspecified
|
|
||||||
* @prop fontSize {number} The icon size. Use 26 if unspecified
|
|
||||||
* @prop width {number} The icon width. Use 30 if unspecified
|
|
||||||
*/
|
*/
|
||||||
export default class WebSectionList extends React.PureComponent<Props, State> {
|
export default class WebSectionList extends React.PureComponent<Props, State> {
|
||||||
|
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
renderSectionHeader: null,
|
renderSectionHeader: null,
|
||||||
stickyHeader: false,
|
stickyHeader: false,
|
||||||
|
updateData: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
webDataManager: WebDataManager;
|
webDataManager: WebDataManager;
|
||||||
|
@ -88,8 +85,6 @@ export default class WebSectionList extends React.PureComponent<Props, State> {
|
||||||
this.onRefresh();
|
this.onRefresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Refresh data when focusing the screen and setup a refresh interval if asked to
|
* Refresh data when focusing the screen and setup a refresh interval if asked to
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -464,7 +464,8 @@ class ProxiwashScreen extends React.Component<Props, State> {
|
||||||
renderItem={this.getRenderItem}
|
renderItem={this.getRenderItem}
|
||||||
renderSectionHeader={this.getRenderSectionHeader}
|
renderSectionHeader={this.getRenderSectionHeader}
|
||||||
autoRefreshTime={REFRESH_TIME}
|
autoRefreshTime={REFRESH_TIME}
|
||||||
refreshOnFocus={true}/>
|
refreshOnFocus={true}
|
||||||
|
updateData={this.state.machinesWatched.length}/>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue