77 */
88
99import React , { useState } from 'react' ;
10- import { Alert , Button , SafeAreaView , ScrollView , StatusBar , StyleSheet , Text , TextInput , View } from 'react-native' ;
10+ import { Alert , Button , ScrollView , StyleSheet , Text , TextInput , View } from 'react-native' ;
1111// import {Picker} from '@react-native-picker/picker'; Need to remove this package as it is not supported in Windows New Architecture
1212
1313import { Colors } from 'react-native/Libraries/NewAppScreen' ;
@@ -489,8 +489,7 @@ const App: () => React$Node = () => {
489489 // App ************************************************************************
490490 return (
491491 < >
492- < StatusBar barStyle = "dark-content" />
493- < SafeAreaView >
492+ < View >
494493 < ScrollView contentInsetAdjustmentBehavior = "automatic" style = { styles . scrollView } >
495494 { global . HermesInternal == null ? null : (
496495 < View style = { styles . engine } >
@@ -604,46 +603,116 @@ const App: () => React$Node = () => {
604603 </ View >
605604
606605 < View style = { styles . body } >
607- < View style = { styles . sectionContainer } >
608- < Text style = { styles . sectionTitle } > { 'Hash - hash()' } </ Text >
609- < View style = { styles . sectionDescription } >
610- < TextInput style = { styles . input } placeholder = "Source path" onChangeText = { ( hashPathParam ) => setHashPathParam ( hashPathParam ) } placeholderTextColor = "#9a73ef" autoCapitalize = "none" />
611- </ View >
612- < Button title = "Hash File" color = "#9a73ef" onPress = { hashCall } />
606+ < View style = { styles . sectionContainer } >
607+ < Text style = { styles . sectionTitle } > { 'Hash - hash()' } </ Text >
608+ < View style = { styles . sectionDescription } >
609+ < TextInput
610+ style = { styles . input }
611+ placeholder = "Source path"
612+ onChangeText = { setHashPathParam }
613+ placeholderTextColor = "#9a73ef"
614+ autoCapitalize = "none"
615+ />
616+ < View style = { styles . buttonGroup } >
617+ { [ 'md5' , 'sha1' , 'sha224' , 'sha256' , 'sha384' , 'sha512' ] . map ( ( alg ) => (
618+ < Button
619+ key = { alg }
620+ title = { alg . toUpperCase ( ) }
621+ color = { hashAlgValue === alg ? '#7a42f4' : '#ccc' }
622+ onPress = { ( ) => setHashAlgValue ( alg ) }
623+ />
624+ ) ) }
613625 </ View >
626+ </ View >
627+ < Button title = "Hash File" color = "#9a73ef" onPress = { hashCall } />
628+ </ View >
614629 </ View >
615630
616631 < View style = { styles . body } >
617- < View style = { styles . sectionContainer } >
618- < Text style = { styles . sectionTitle } > { 'write - writeFile(), appendFile()' } </ Text >
619- < View style = { styles . sectionDescription } >
620- < TextInput style = { styles . input } placeholder = "Source path" onChangeText = { ( writeParam ) => setWriteParam ( writeParam ) } placeholderTextColor = "#9a73ef" autoCapitalize = "none" />
621- < TextInput style = { styles . input } placeholder = "Source path" onChangeText = { ( writeURIParam ) => setWriteURIParam ( writeURIParam ) } placeholderTextColor = "#9a73ef" autoCapitalize = "none" />
622- </ View >
623- < Button title = "Write" color = "#9a73ef" onPress = { writeFileCall } />
624- < Button title = "Append" color = "#9a73ef" onPress = { appendFileCall } />
632+ < View style = { styles . sectionContainer } >
633+ < Text style = { styles . sectionTitle } > { 'write - writeFile(), appendFile()' } </ Text >
634+ < View style = { styles . sectionDescription } >
635+ < TextInput
636+ style = { styles . input }
637+ placeholder = "Source path"
638+ onChangeText = { setWriteParam }
639+ placeholderTextColor = "#9a73ef"
640+ autoCapitalize = "none"
641+ />
642+ < TextInput
643+ style = { styles . input }
644+ placeholder = "Destination path"
645+ onChangeText = { setWriteURIParam }
646+ placeholderTextColor = "#9a73ef"
647+ autoCapitalize = "none"
648+ />
649+ < View style = { styles . buttonGroup } >
650+ { [ 'utf8' , 'base64' , 'ascii' , 'uri' ] . map ( ( enc ) => (
651+ < Button
652+ key = { enc }
653+ title = { enc . toUpperCase ( ) }
654+ color = { writeEncodeParam === enc ? '#7a42f4' : '#ccc' }
655+ onPress = { ( ) => setWriteEncodeParam ( enc ) }
656+ />
657+ ) ) }
625658 </ View >
659+ </ View >
660+ < Button title = "Write" color = "#9a73ef" onPress = { writeFileCall } />
661+ < Button title = "Append" color = "#9a73ef" onPress = { appendFileCall } />
662+ </ View >
626663 </ View >
627664
628665 < View style = { styles . body } >
629- < View style = { styles . sectionContainer } >
630- < Text style = { styles . sectionTitle } > { 'WriteStream - writeStream()' } </ Text >
631- < View style = { styles . sectionDescription } >
632- < TextInput style = { styles . input } placeholder = "Source path" onChangeText = { ( writeStreamParam ) => setWriteStreamParam ( writeStreamParam ) } placeholderTextColor = "#9a73ef" autoCapitalize = "none" />
633- </ View >
634- < Button title = "Write" color = "#9a73ef" onPress = { writeStreamCall } />
635- < Button title = "Append" color = "#9a73ef" onPress = { appendStreamCall } />
666+ < View style = { styles . sectionContainer } >
667+ < Text style = { styles . sectionTitle } > { 'WriteStream - writeStream()' } </ Text >
668+ < View style = { styles . sectionDescription } >
669+ < TextInput
670+ style = { styles . input }
671+ placeholder = "Source path"
672+ onChangeText = { setWriteStreamParam }
673+ placeholderTextColor = "#9a73ef"
674+ autoCapitalize = "none"
675+ />
676+ < View style = { styles . buttonGroup } >
677+ { [ 'utf8' , 'base64' , 'ascii' ] . map ( ( enc ) => (
678+ < Button
679+ key = { enc }
680+ title = { enc . toUpperCase ( ) }
681+ color = { writeEncodeStreamParam === enc ? '#7a42f4' : '#ccc' }
682+ onPress = { ( ) => setWriteStreamEncodeParam ( enc ) }
683+ />
684+ ) ) }
636685 </ View >
686+ </ View >
687+ < Button title = "Write" color = "#9a73ef" onPress = { writeStreamCall } />
688+ < Button title = "Append" color = "#9a73ef" onPress = { appendStreamCall } />
689+ </ View >
637690 </ View >
638691
639692 < View style = { styles . body } >
640- < View style = { styles . sectionContainer } >
641- < Text style = { styles . sectionTitle } > { 'ReadStream - readStream()' } </ Text >
642- < View style = { styles . sectionDescription } >
643- < TextInput style = { styles . input } placeholder = "Source path" onChangeText = { ( readStreamParam ) => setReadStreamParam ( readStreamParam ) } placeholderTextColor = "#9a73ef" autoCapitalize = "none" />
644- </ View >
645- < Button title = "Read" color = "#9a73ef" onPress = { readStreamCall } />
693+ < View style = { styles . sectionContainer } >
694+ < Text style = { styles . sectionTitle } > { 'ReadStream - readStream()' } </ Text >
695+ < View style = { styles . sectionDescription } >
696+ < TextInput
697+ style = { styles . input }
698+ placeholder = "Source path"
699+ onChangeText = { setReadStreamParam }
700+ placeholderTextColor = "#9a73ef"
701+ autoCapitalize = "none"
702+ />
703+ < View style = { styles . buttonGroup } >
704+ { [ 'utf8' , 'base64' , 'ascii' ] . map ( ( enc ) => (
705+ < Button
706+ key = { enc }
707+ title = { enc . toUpperCase ( ) }
708+ color = { readEncodeStreamParam === enc ? '#7a42f4' : '#ccc' }
709+ onPress = { ( ) => setReadStreamEncodeParam ( enc ) }
710+ />
711+ ) ) }
646712 </ View >
713+ </ View >
714+ < Button title = "Read" color = "#9a73ef" onPress = { readStreamCall } />
715+ </ View >
647716 </ View >
648717
649718 < View style = { styles . body } >
@@ -659,7 +728,7 @@ const App: () => React$Node = () => {
659728 </ View >
660729 </ View >
661730 </ ScrollView >
662- </ SafeAreaView >
731+ </ View >
663732 </ >
664733 ) ;
665734} ;
@@ -701,6 +770,12 @@ const styles = StyleSheet.create({
701770 paddingRight : 12 ,
702771 textAlign : 'right' ,
703772 } ,
773+ buttonGroup : {
774+ flexDirection : 'row' ,
775+ flexWrap : 'wrap' ,
776+ gap : 8 ,
777+ marginVertical : 8 ,
778+ } ,
704779} ) ;
705780
706781export default App ;
0 commit comments