cleanup and fix fading

This commit is contained in:
Bastian Ike
2020-07-17 09:28:02 +02:00
committed by Bastian
parent ed2a4241b8
commit 40e7dd709a
13 changed files with 538 additions and 1295 deletions

View File

@@ -1,30 +1,4 @@
// import React from 'react';
// todo fix this mess
// const _callSetTitle = (props) => {
// if (typeof props.onSetTitle === 'function' && props.title) {
// props.onSetTitle(props.title);
// }
// };
// class _SetTitle extends React.Component {
// constructor(props) {
// super(props);
// _callSetTitle(props);
// }
// componentWillReceiveProps(nextProps) {
// if (nextProps.title !== this.props.title) {
// _callSetTitle(nextProps);
// }
// }
// render() {
// return null;
// }
// }
import {useState} from "react";
type SetTitleProps = {
title: string
@@ -32,9 +6,15 @@ type SetTitleProps = {
}
export default function SetTitle({title, onSetTitle}: SetTitleProps) {
const [onSetTitleState, setOnSetTitleState] = useState(() => onSetTitle)
if (onSetTitle) {
onSetTitle(title)
}
setOnSetTitleState(onSetTitle)
}
if (onSetTitleState) {
onSetTitleState(title)
}
return null;
}