@@ -604,46 +604,116 @@ const App: () => React$Node = () => {
604604 </ View >
605605
606606 < 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 } />
607+ < View style = { styles . sectionContainer } >
608+ < Text style = { styles . sectionTitle } > { 'Hash - hash()' } </ Text >
609+ < View style = { styles . sectionDescription } >
610+ < TextInput
611+ style = { styles . input }
612+ placeholder = "Source path"
613+ onChangeText = { setHashPathParam }
614+ placeholderTextColor = "#9a73ef"
615+ autoCapitalize = "none"
616+ />
617+ < View style = { styles . buttonGroup } >
618+ { [ 'md5' , 'sha1' , 'sha224' , 'sha256' , 'sha384' , 'sha512' ] . map ( ( alg ) => (
619+ < Button
620+ key = { alg }
621+ title = { alg . toUpperCase ( ) }
622+ color = { hashAlgValue === alg ? '#7a42f4' : '#ccc' }
623+ onPress = { ( ) => setHashAlgValue ( alg ) }
624+ />
625+ ) ) }
613626 </ View >
627+ </ View >
628+ < Button title = "Hash File" color = "#9a73ef" onPress = { hashCall } />
629+ </ View >
614630 </ View >
615631
616632 < 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 } />
633+ < View style = { styles . sectionContainer } >
634+ < Text style = { styles . sectionTitle } > { 'write - writeFile(), appendFile()' } </ Text >
635+ < View style = { styles . sectionDescription } >
636+ < TextInput
637+ style = { styles . input }
638+ placeholder = "Source path"
639+ onChangeText = { setWriteParam }
640+ placeholderTextColor = "#9a73ef"
641+ autoCapitalize = "none"
642+ />
643+ < TextInput
644+ style = { styles . input }
645+ placeholder = "Destination path"
646+ onChangeText = { setWriteURIParam }
647+ placeholderTextColor = "#9a73ef"
648+ autoCapitalize = "none"
649+ />
650+ < View style = { styles . buttonGroup } >
651+ { [ 'utf8' , 'base64' , 'ascii' , 'uri' ] . map ( ( enc ) => (
652+ < Button
653+ key = { enc }
654+ title = { enc . toUpperCase ( ) }
655+ color = { writeEncodeParam === enc ? '#7a42f4' : '#ccc' }
656+ onPress = { ( ) => setWriteEncodeParam ( enc ) }
657+ />
658+ ) ) }
625659 </ View >
660+ </ View >
661+ < Button title = "Write" color = "#9a73ef" onPress = { writeFileCall } />
662+ < Button title = "Append" color = "#9a73ef" onPress = { appendFileCall } />
663+ </ View >
626664 </ View >
627665
628666 < 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 } />
667+ < View style = { styles . sectionContainer } >
668+ < Text style = { styles . sectionTitle } > { 'WriteStream - writeStream()' } </ Text >
669+ < View style = { styles . sectionDescription } >
670+ < TextInput
671+ style = { styles . input }
672+ placeholder = "Source path"
673+ onChangeText = { setWriteStreamParam }
674+ placeholderTextColor = "#9a73ef"
675+ autoCapitalize = "none"
676+ />
677+ < View style = { styles . buttonGroup } >
678+ { [ 'utf8' , 'base64' , 'ascii' ] . map ( ( enc ) => (
679+ < Button
680+ key = { enc }
681+ title = { enc . toUpperCase ( ) }
682+ color = { writeEncodeStreamParam === enc ? '#7a42f4' : '#ccc' }
683+ onPress = { ( ) => setWriteStreamEncodeParam ( enc ) }
684+ />
685+ ) ) }
636686 </ View >
687+ </ View >
688+ < Button title = "Write" color = "#9a73ef" onPress = { writeStreamCall } />
689+ < Button title = "Append" color = "#9a73ef" onPress = { appendStreamCall } />
690+ </ View >
637691 </ View >
638692
639693 < 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 } />
694+ < View style = { styles . sectionContainer } >
695+ < Text style = { styles . sectionTitle } > { 'ReadStream - readStream()' } </ Text >
696+ < View style = { styles . sectionDescription } >
697+ < TextInput
698+ style = { styles . input }
699+ placeholder = "Source path"
700+ onChangeText = { setReadStreamParam }
701+ placeholderTextColor = "#9a73ef"
702+ autoCapitalize = "none"
703+ />
704+ < View style = { styles . buttonGroup } >
705+ { [ 'utf8' , 'base64' , 'ascii' ] . map ( ( enc ) => (
706+ < Button
707+ key = { enc }
708+ title = { enc . toUpperCase ( ) }
709+ color = { readEncodeStreamParam === enc ? '#7a42f4' : '#ccc' }
710+ onPress = { ( ) => setReadStreamEncodeParam ( enc ) }
711+ />
712+ ) ) }
646713 </ View >
714+ </ View >
715+ < Button title = "Read" color = "#9a73ef" onPress = { readStreamCall } />
716+ </ View >
647717 </ View >
648718
649719 < View style = { styles . body } >
@@ -701,6 +771,12 @@ const styles = StyleSheet.create({
701771 paddingRight : 12 ,
702772 textAlign : 'right' ,
703773 } ,
774+ buttonGroup : {
775+ flexDirection : 'row' ,
776+ flexWrap : 'wrap' ,
777+ gap : 8 ,
778+ marginVertical : 8 ,
779+ } ,
704780} ) ;
705781
706782export default App ;
0 commit comments