Skip to content

Commit b3ac3a3

Browse files
authored
Merge pull request #414 from anupriya13/user/anuverma/windows
Add Support for Windows New Arch Thank you very much!
2 parents a7243ee + 6a3b2a9 commit b3ac3a3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+15150
-6430
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ project.xcworkspace
3131
Podfile*
3232
contents.xcworkspacedata
3333

34+
# packages
35+
windows/packages/
36+
3437
# VSCode
3538
#
3639
.vscode
@@ -52,3 +55,5 @@ buck-out/
5255
android/app/libs
5356
android/keystores/debug.keystore
5457
/ios/ReactNativeBlobUtil.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
58+
59+
**/msbuild.binlog

NuGet.config

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<packageSources>
4+
<clear />
5+
<add key="react-native" value="https://pkgs.dev.azure.com/ms/react-native/_packaging/react-native-public/nuget/v3/index.json" />
6+
<add key="Nuget.org" value="https://api.nuget.org/v3/index.json" />
7+
</packageSources>
8+
<disabledPackageSources>
9+
<clear />
10+
</disabledPackageSources>
11+
</configuration>

examples/ReactNativeBlobUtil/.gitignore

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,66 @@ buck-out/
5757

5858
# CocoaPods
5959
/ios/Pods/
60+
61+
# OSX
62+
#
63+
.DS_Store
64+
65+
# Xcode
66+
#
67+
build/
68+
*.pbxuser
69+
!default.pbxuser
70+
*.mode1v3
71+
!default.mode1v3
72+
*.mode2v3
73+
!default.mode2v3
74+
*.perspectivev3
75+
!default.perspectivev3
76+
xcuserdata
77+
*.xccheckout
78+
*.moved-aside
79+
DerivedData
80+
*.hmap
81+
*.ipa
82+
*.xcuserstate
83+
84+
# Android/IntelliJ
85+
#
86+
build/
87+
.idea
88+
.gradle
89+
local.properties
90+
*.iml
91+
92+
# node.js
93+
#
94+
node_modules/
95+
npm-debug.log
96+
yarn-error.log
97+
98+
# packages
99+
windows/packages/
100+
101+
# BUCK
102+
buck-out/
103+
\.buckd/
104+
*.keystore
105+
!debug.keystore
106+
107+
# fastlane
108+
#
109+
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
110+
# screenshots whenever they are needed.
111+
# For more information about the recommended setup visit:
112+
# https://docs.fastlane.tools/best-practices/source-control/
113+
114+
*/fastlane/report.xml
115+
*/fastlane/Preview.html
116+
*/fastlane/screenshots
117+
118+
# Bundle artifact
119+
*.jsbundle
120+
121+
# CocoaPods
122+
/ios/Pods/

examples/ReactNativeBlobUtil/App.js

Lines changed: 107 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
*/
88

99
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
1212

1313
import {Colors} from 'react-native/Libraries/NewAppScreen';
1414

@@ -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,72 +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-
<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+
))}
621625
</View>
626+
</View>
627+
<Button title="Hash File" color="#9a73ef" onPress={hashCall} />
628+
</View>
622629
</View>
623630

624631
<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>
639659
</View>
660+
<Button title="Write" color="#9a73ef" onPress={writeFileCall} />
661+
<Button title="Append" color="#9a73ef" onPress={appendFileCall} />
662+
</View>
640663
</View>
641664

642665
<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+
))}
656685
</View>
686+
</View>
687+
<Button title="Write" color="#9a73ef" onPress={writeStreamCall} />
688+
<Button title="Append" color="#9a73ef" onPress={appendStreamCall} />
689+
</View>
657690
</View>
658691

659692
<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+
))}
672712
</View>
713+
</View>
714+
<Button title="Read" color="#9a73ef" onPress={readStreamCall} />
715+
</View>
673716
</View>
674717

675718
<View style={styles.body}>
@@ -685,7 +728,7 @@ const App: () => React$Node = () => {
685728
</View>
686729
</View>
687730
</ScrollView>
688-
</SafeAreaView>
731+
</View>
689732
</>
690733
);
691734
};
@@ -727,6 +770,12 @@ const styles = StyleSheet.create({
727770
paddingRight: 12,
728771
textAlign: 'right',
729772
},
773+
buttonGroup: {
774+
flexDirection: 'row',
775+
flexWrap: 'wrap',
776+
gap: 8,
777+
marginVertical: 8,
778+
},
730779
});
731780

732781
export default App;
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<packageSources>
4+
<clear />
5+
<add key="Nuget.org" value="https://api.nuget.org/v3/index.json" />
6+
</packageSources>
7+
<disabledPackageSources>
8+
<clear />
9+
</disabledPackageSources>
10+
</configuration>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = {
2-
presets: ['module:metro-react-native-babel-preset'],
2+
presets: ['module:@react-native/babel-preset'],
33
};
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const config = {};
2+
3+
module.exports = require('@rnx-kit/jest-preset')('windows', config);

0 commit comments

Comments
 (0)