-
Notifications
You must be signed in to change notification settings - Fork 474
feat(windows): add New Architecture support #1147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 21 commits
b3739e6
73e701f
b231d74
7967f29
7e5116e
beb94d5
10b538b
36a9635
f289477
50e5255
66c9429
b01454d
1ea1df7
015b4ab
6f1d52f
5e055bc
a794eb1
f1fc1d4
8387705
123b3fd
8dade8c
8acb3b0
e50e5e1
be17698
3782d55
539a4c1
00913a6
e49a0ef
35b24a1
452ed6f
dabd92a
66e0c92
ad9ce4d
456d9fa
b6bfb3b
b9f2e55
dd5b0fb
eef71c1
ce96c4b
ee87b26
f79f198
ef227e7
a1d931c
9bc5354
67526ce
c3c8874
8099d49
dd1dbac
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please revert this. |
Yajur-Grover marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
module.exports = { | ||
presets: ["module:@react-native/babel-preset"], | ||
plugins: ["@babel/plugin-transform-runtime"] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this really needed? It should already be included by the preset. |
||
}; |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -14,6 +14,7 @@ import { | |||||
StyleSheet, | ||||||
Text, | ||||||
TextInput, | ||||||
TurboModuleRegistry, | ||||||
View, | ||||||
} from "react-native"; | ||||||
|
||||||
|
@@ -175,22 +176,20 @@ function Merge(): JSX.Element { | |||||
testID="setDelegate_button" | ||||||
title="Set native delegate" | ||||||
disabled={ | ||||||
!NativeModules["AsyncStorageTestSupport"] || | ||||||
!NativeModules["AsyncStorageTestSupport"].test_setDelegate | ||||||
!TurboModuleRegistry.get('AsyncStorageTestSupport')?.test_setDelegate | ||||||
} | ||||||
onPress={() => | ||||||
NativeModules["AsyncStorageTestSupport"].test_setDelegate(() => {}) | ||||||
TurboModuleRegistry.get('AsyncStorageTestSupport')?.test_setDelegate(() => {}) | ||||||
} | ||||||
/> | ||||||
<Button | ||||||
testID="unsetDelegate_button" | ||||||
title="Unset native delegate" | ||||||
disabled={ | ||||||
!NativeModules["AsyncStorageTestSupport"] || | ||||||
!NativeModules["AsyncStorageTestSupport"].test_unsetDelegate | ||||||
TurboModuleRegistry.get('AsyncStorageTestSupport')?.test_unsetDelegate | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This check needs to be inverted back:
Suggested change
|
||||||
} | ||||||
onPress={() => | ||||||
NativeModules["AsyncStorageTestSupport"].test_unsetDelegate( | ||||||
TurboModuleRegistry.get('AsyncStorageTestSupport')?.test_unsetDelegate( | ||||||
() => {} | ||||||
) | ||||||
} | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is unrelated and unnecessary. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you mean I should add the file back? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is unrelated to the Windows changes. Please revert. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reverted. |
This file was deleted.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is unrelated and unnecessary. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is unrelated to the Windows changes. Please revert. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reverted. |
This file was deleted.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is already handled by There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is unrelated to the Windows changes. Please revert. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should also be reverted. Please note that all text files must end with an EOL: https://www.baeldung.com/linux/files-end-with-newlines |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,4 +17,4 @@ module.exports = makeMetroConfig({ | |
}, | ||
}), | ||
}, | ||
}); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,6 +46,7 @@ | |
"start:macos": "react-native run-macos --project-path example/macos --scheme AsyncStorageExample", | ||
"start:web": "expo start --web", | ||
"start:windows": "install-windows-test-app -p example/windows && react-native run-windows --root example --logging --no-packager --no-telemetry", | ||
"start:windows:fabric": "install-windows-test-app -p example/windows --use-fabric && react-native run-windows --root example --logging --no-packager --no-telemetry", | ||
"build:e2e:android": "scripts/android_e2e.sh 'build'", | ||
"build:e2e:ios": "scripts/ios_e2e.sh 'build'", | ||
"build:e2e:macos": "scripts/macos_e2e.sh 'build'", | ||
|
@@ -63,16 +64,19 @@ | |
"hoistingLimits": "workspaces" | ||
}, | ||
"dependencies": { | ||
"@babel/runtime": "^7.25.0", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this really needed? |
||
"merge-options": "^3.0.4" | ||
}, | ||
"peerDependencies": { | ||
"react-native": "^0.0.0-0 || >=0.65 <1.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.20.0", | ||
"@babel/plugin-transform-runtime": "^7.24.7", | ||
"@babel/preset-env": "^7.20.0", | ||
"@react-native/babel-preset": "^0.75.0", | ||
"@react-native/metro-config": "^0.75.0", | ||
"@rnx-kit/jest-preset": "^0.1.16", | ||
"@rnx-kit/metro-config": "^2.0.0", | ||
"@types/lodash": "^4.14.184", | ||
"@types/mocha": "^10.0.1", | ||
|
@@ -122,6 +126,11 @@ | |
"jsSrcsDir": "./src", | ||
"android": { | ||
"javaPackageName": "com.reactnativecommunity.asyncstorage" | ||
}, | ||
"windows": { | ||
"namespace": "RNCAsyncStorage", | ||
"outputDirectory": "windows/code/codegen", | ||
"separateDataTypes": true | ||
} | ||
} | ||
} |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Revert this file. Now we have an unused import and a formatting issue. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
import { NativeModules } from "react-native"; | ||
import { NativeModules, TurboModuleRegistry } from "react-native"; | ||
|
||
export function shouldFallbackToLegacyNativeModule(): boolean { | ||
const expoConstants = | ||
NativeModules["NativeUnimoduleProxy"]?.modulesConstants?.ExponentConstants; | ||
TurboModuleRegistry.get('NativeUnimoduleProxy')?.getConstants()?.modulesConstants?.ExponentConstants; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is Expo related code. Did you check that it works with Expo? |
||
|
||
if (expoConstants) { | ||
/** | ||
|
Uh oh!
There was an error while loading. Please reload this page.