7
7
*/
8
8
9
9
import React , { useState } from 'react' ;
10
- import { Alert , Button , SafeAreaView , ScrollView , StatusBar , StyleSheet , Text , TextInput , View } from 'react-native' ;
11
- import { Picker } from '@react-native-picker/picker' ;
10
+ import { Alert , Button , ScrollView , StyleSheet , Text , TextInput , View } from 'react-native' ;
11
+ // import {Picker} from '@react-native-picker/picker'; Need to remove this package as it is not supported in Windows New Architecture
12
12
13
13
import { Colors } from 'react-native/Libraries/NewAppScreen' ;
14
14
@@ -489,8 +489,7 @@ const App: () => React$Node = () => {
489
489
// App ************************************************************************
490
490
return (
491
491
< >
492
- < StatusBar barStyle = "dark-content" />
493
- < SafeAreaView >
492
+ < View >
494
493
< ScrollView contentInsetAdjustmentBehavior = "automatic" style = { styles . scrollView } >
495
494
{ global . HermesInternal == null ? null : (
496
495
< View style = { styles . engine } >
@@ -604,72 +603,116 @@ const App: () => React$Node = () => {
604
603
</ View >
605
604
606
605
< 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
- < Picker hashAlgValue = { hashAlgValue } onChangeText = { ( readPositionParam ) => setReadPositionParam ( readPositionParam ) } style = { { height : 50 , width : 150 } } onValueChange = { ( itemValue , itemIndex ) => setHashAlgValue ( itemValue ) } >
612
- < Picker . Item label = "MD5" value = "md5" />
613
- < Picker . Item label = "SHA1" value = "sha1" />
614
- < Picker . Item label = "SHA224" value = "sha224" />
615
- < Picker . Item label = "SHA256" value = "sha256" />
616
- < Picker . Item label = "SHA384" value = "sha384" />
617
- < Picker . Item label = "SHA512" value = "sha512" />
618
- </ Picker >
619
- </ View >
620
- < 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
+ ) ) }
621
625
</ View >
626
+ </ View >
627
+ < Button title = "Hash File" color = "#9a73ef" onPress = { hashCall } />
628
+ </ View >
622
629
</ View >
623
630
624
631
< View style = { styles . body } >
625
- < View style = { styles . sectionContainer } >
626
- < Text style = { styles . sectionTitle } > { 'write - writeFile(), appendFile()' } </ Text >
627
- < View style = { styles . sectionDescription } >
628
- < TextInput style = { styles . input } placeholder = "Source path" onChangeText = { ( writeParam ) => setWriteParam ( writeParam ) } placeholderTextColor = "#9a73ef" autoCapitalize = "none" />
629
- < TextInput style = { styles . input } placeholder = "Source path" onChangeText = { ( writeURIParam ) => setWriteURIParam ( writeURIParam ) } placeholderTextColor = "#9a73ef" autoCapitalize = "none" />
630
- < Picker writeEncodeStreamParam = { writeEncodeParam } onChangeText = { ( readPositionParam ) => setReadPositionParam ( readPositionParam ) } style = { { height : 50 , width : 150 } } onValueChange = { ( itemValue , itemIndex ) => setWriteEncodeParam ( itemValue ) } >
631
- < Picker . Item label = "UTF8" value = "utf8" />
632
- < Picker . Item label = "Base64" value = "base64" />
633
- < Picker . Item label = "ASCII" value = "ascii" />
634
- < Picker . Item label = "URI" value = "uri" />
635
- </ Picker >
636
- </ View >
637
- < Button title = "Write" color = "#9a73ef" onPress = { writeFileCall } />
638
- < 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
+ ) ) }
658
+ </ View >
639
659
</ View >
660
+ < Button title = "Write" color = "#9a73ef" onPress = { writeFileCall } />
661
+ < Button title = "Append" color = "#9a73ef" onPress = { appendFileCall } />
662
+ </ View >
640
663
</ View >
641
664
642
665
< View style = { styles . body } >
643
- < View style = { styles . sectionContainer } >
644
- < Text style = { styles . sectionTitle } > { 'WriteStream - writeStream()' } </ Text >
645
- < View style = { styles . sectionDescription } >
646
- < TextInput style = { styles . input } placeholder = "Source path" onChangeText = { ( writeStreamParam ) => setWriteStreamParam ( writeStreamParam ) } placeholderTextColor = "#9a73ef" autoCapitalize = "none" />
647
-
648
- < Picker writeEncodeStreamParam = { writeEncodeStreamParam } onChangeText = { ( readPositionParam ) => setReadPositionParam ( readPositionParam ) } style = { { height : 50 , width : 150 } } onValueChange = { ( itemValue , itemIndex ) => setWriteStreamEncodeParam ( itemValue ) } >
649
- < Picker . Item label = "UTF8" value = "utf8" />
650
- < Picker . Item label = "Base64" value = "base64" />
651
- < Picker . Item label = "ASCII" value = "ascii" />
652
- </ Picker >
653
- </ View >
654
- < Button title = "Write" color = "#9a73ef" onPress = { writeStreamCall } />
655
- < 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
+ ) ) }
656
685
</ View >
686
+ </ View >
687
+ < Button title = "Write" color = "#9a73ef" onPress = { writeStreamCall } />
688
+ < Button title = "Append" color = "#9a73ef" onPress = { appendStreamCall } />
689
+ </ View >
657
690
</ View >
658
691
659
692
< View style = { styles . body } >
660
- < View style = { styles . sectionContainer } >
661
- < Text style = { styles . sectionTitle } > { 'ReadStream - readStream()' } </ Text >
662
- < View style = { styles . sectionDescription } >
663
- < TextInput style = { styles . input } placeholder = "Source path" onChangeText = { ( readStreamParam ) => setReadStreamParam ( readStreamParam ) } placeholderTextColor = "#9a73ef" autoCapitalize = "none" />
664
-
665
- < Picker readEncodeStreamParam = { readEncodeStreamParam } onChangeText = { ( readPositionParam ) => setReadPositionParam ( readPositionParam ) } style = { { height : 50 , width : 150 } } onValueChange = { ( itemValue , itemIndex ) => setReadStreamEncodeParam ( itemValue ) } >
666
- < Picker . Item label = "UTF8" value = "utf8" />
667
- < Picker . Item label = "Base64" value = "base64" />
668
- < Picker . Item label = "ASCII" value = "ascii" />
669
- </ Picker >
670
- </ View >
671
- < 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
+ ) ) }
672
712
</ View >
713
+ </ View >
714
+ < Button title = "Read" color = "#9a73ef" onPress = { readStreamCall } />
715
+ </ View >
673
716
</ View >
674
717
675
718
< View style = { styles . body } >
@@ -685,7 +728,7 @@ const App: () => React$Node = () => {
685
728
</ View >
686
729
</ View >
687
730
</ ScrollView >
688
- </ SafeAreaView >
731
+ </ View >
689
732
</ >
690
733
) ;
691
734
} ;
@@ -727,6 +770,12 @@ const styles = StyleSheet.create({
727
770
paddingRight : 12 ,
728
771
textAlign : 'right' ,
729
772
} ,
773
+ buttonGroup : {
774
+ flexDirection : 'row' ,
775
+ flexWrap : 'wrap' ,
776
+ gap : 8 ,
777
+ marginVertical : 8 ,
778
+ } ,
730
779
} ) ;
731
780
732
781
export default App ;
0 commit comments