@@ -6,7 +6,9 @@ import glamorous from 'glamorous-native'
66import { Platform } from 'react-native'
77import { iOSUIKit , material } from 'react-native-typography'
88
9- const image = require ( '../../../images/about/IconTrans.png' )
9+ import { icons as appIcons } from '../../../images/icon-images'
10+ import * as Icons from '@hawkrives/react-native-alternate-icons'
11+ import type { TopLevelViewPropsType } from '../types'
1012
1113const Container = glamorous . scrollView ( {
1214 backgroundColor : c . white ,
@@ -56,22 +58,49 @@ const Contributors = glamorous(About)({
5658
5759const formatPeopleList = arr => arr . map ( w => w . replace ( ' ' , ' ' ) ) . join ( ' • ' )
5860
59- export default function CreditsView ( ) {
60- return (
61- < Container contentInsetAdjustmentBehavior = "automatic" >
62- < Logo source = { image } />
61+ export default class CreditsView extends React . Component < Props , State > {
62+ static navigationOptions = {
63+ title : 'Credits' ,
64+ }
6365
64- < Title > { credits . name } </ Title >
65- < About > { credits . content } </ About >
66+ state = {
67+ supported : false ,
68+ iconType : null ,
69+ }
6670
67- < Heading > Contributors</ Heading >
68- < Contributors > { formatPeopleList ( credits . contributors ) } </ Contributors >
71+ componentWillMount ( ) {
72+ this . checkIfCustomIconsSupported ( )
73+ this . getIcon ( )
74+ }
6975
70- < Heading > Acknowledgements</ Heading >
71- < Contributors > { formatPeopleList ( credits . acknowledgements ) } </ Contributors >
72- </ Container >
73- )
74- }
75- CreditsView . navigationOptions = {
76- title : 'Credits' ,
76+ checkIfCustomIconsSupported = async ( ) => {
77+ const supported = await Icons . isSupported ( )
78+ this . setState ( ( ) => ( { supported} ) )
79+ }
80+
81+ getIcon = async ( ) => {
82+ const name = await Icons . getIconName ( )
83+ this . setState ( ( ) => ( { iconType : name } ) )
84+ }
85+
86+ render ( ) {
87+ const image = this . state . supported
88+ ? this . state . iconType === 'default' ? appIcons . oldMain : appIcons . windmill
89+ : appIcons . oldMain
90+
91+ return (
92+ < Container contentInsetAdjustmentBehavior = "automatic" >
93+ < Logo source = { image } />
94+
95+ < Title > { credits . name } </ Title >
96+ < About > { credits . content } </ About >
97+
98+ < Heading > Contributors</ Heading >
99+ < Contributors > { formatPeopleList ( credits . contributors ) } </ Contributors >
100+
101+ < Heading > Acknowledgements</ Heading >
102+ < Contributors > { formatPeopleList ( credits . acknowledgements ) } </ Contributors >
103+ </ Container >
104+ )
105+ }
77106}
0 commit comments