From b9e223ad37d4c3a995c54c0324ca93a16b7d0d0a Mon Sep 17 00:00:00 2001 From: Marcos Rodriguez Date: Wed, 25 Dec 2019 13:17:14 -0600 Subject: [PATCH] REF: Release Notes uses Hooks --- screen/settings/releasenotes.js | 69 ++++++++++++--------------------- 1 file changed, 25 insertions(+), 44 deletions(-) diff --git a/screen/settings/releasenotes.js b/screen/settings/releasenotes.js index 328bda9ea..b854c0a94 100644 --- a/screen/settings/releasenotes.js +++ b/screen/settings/releasenotes.js @@ -1,51 +1,32 @@ -import React, { Component } from 'react'; +import React, { useState, useEffect } from 'react'; import { ScrollView } from 'react-native'; import { BlueLoading, SafeBlueArea, BlueCard, BlueText, BlueNavigationStyle } from '../../BlueComponents'; -import PropTypes from 'prop-types'; /** @type {AppStorage} */ -const notes = require('../../release-notes'); -export default class ReleaseNotes extends Component { - static navigationOptions = () => ({ - ...BlueNavigationStyle(), - title: 'Release notes', +const ReleaseNotes = () => { + const [isLoading, setIsLoading] = useState(true); + const notes = require('../../release-notes'); + + useEffect(() => { + setIsLoading(false); }); - constructor(props) { - super(props); - this.state = { - isLoading: true, - }; - } - - async componentDidMount() { - console.log(notes); - this.setState({ - isLoading: false, - notes: notes, - }); - } - - render() { - if (this.state.isLoading) { - return ; - } - - return ( - - - - {this.state.notes} - - - - ); - } -} - -ReleaseNotes.propTypes = { - navigation: PropTypes.shape({ - navigate: PropTypes.func, - goBack: PropTypes.func, - }), + return isLoading ? ( + () + ) : ( + ( + + + {notes} + + + ) + ); }; + +ReleaseNotes.navigationOptions = () => ({ + ...BlueNavigationStyle(), + title: 'Release notes', +}); + +export default ReleaseNotes;