Skip to content
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

feat(windows): add New Architecture support #1147

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
b3739e6
upgrade to work on 0.74
Yajur-Grover Jul 23, 2024
73e701f
codegen config changes
Yajur-Grover Jul 24, 2024
b231d74
changes from codegen-windows
Yajur-Grover Jul 24, 2024
7967f29
rename example to sample and run the cpp-lib template
Yajur-Grover Jul 25, 2024
7e5116e
add method stubs for turbomodule
Yajur-Grover Aug 7, 2024
beb94d5
fix where codegen runs
Yajur-Grover Aug 12, 2024
10b538b
bump RNTA and fix package.json
Yajur-Grover Aug 14, 2024
36a9635
fix project to include correct module code
Yajur-Grover Aug 14, 2024
f289477
revert sample back to example
Yajur-Grover Aug 15, 2024
50e5255
register turbomodules and fix config issues
Yajur-Grover Aug 22, 2024
66c9429
re-add paper dependencies
Yajur-Grover Sep 23, 2024
b01454d
fix pch.h and untrack ExperimentalFeatures.props
Yajur-Grover Sep 24, 2024
1ea1df7
remove unused asyncstorage files
Yajur-Grover Sep 24, 2024
015b4ab
remove unused testapp directories
Yajur-Grover Sep 25, 2024
6f1d52f
revert some changes
Yajur-Grover Sep 27, 2024
5e055bc
revert according to feedback
Yajur-Grover Sep 27, 2024
a794eb1
delete more unused files
Yajur-Grover Sep 27, 2024
f1fc1d4
address comments
Yajur-Grover Sep 27, 2024
8387705
fix packageprovider
Yajur-Grover Sep 27, 2024
123b3fd
fix turbomodule usage
Yajur-Grover Sep 27, 2024
8dade8c
fix typos
Yajur-Grover Oct 9, 2024
8acb3b0
revert changes
Yajur-Grover Oct 9, 2024
e50e5e1
revert some changes
Yajur-Grover Oct 9, 2024
be17698
remove default-storage/windows/packages/*
Yajur-Grover Oct 9, 2024
3782d55
revert gradlew
Yajur-Grover Oct 9, 2024
539a4c1
revert bad ios change
Yajur-Grover Oct 9, 2024
00913a6
revert bad macos change
Yajur-Grover Oct 9, 2024
e49a0ef
revert yarn.lock
Yajur-Grover Oct 9, 2024
35b24a1
remove resource.h and ReactNativeAsyncStorage.rc
Yajur-Grover Oct 9, 2024
452ed6f
remove unnecessary dependencies
Yajur-Grover Oct 10, 2024
dabd92a
address feedback
Yajur-Grover Oct 10, 2024
66e0c92
run yarn format
Yajur-Grover Oct 10, 2024
ad9ce4d
remove unused imports
Yajur-Grover Oct 10, 2024
456d9fa
revert packageprovider.h
Yajur-Grover Oct 10, 2024
b6bfb3b
update WindowsSDK versions
Yajur-Grover Oct 10, 2024
b9f2e55
test updated yarn.lock
Yajur-Grover Oct 11, 2024
dd5b0fb
change call to asyncstoragetestsupport
Yajur-Grover Oct 14, 2024
eef71c1
test props and targets import changes
Yajur-Grover Oct 16, 2024
ce96c4b
import props
Yajur-Grover Oct 16, 2024
ee87b26
set rnw to 0.75.5 min and fix vcxproj
Yajur-Grover Oct 16, 2024
f79f198
update AsyncStorageTestSupport declaration
Yajur-Grover Oct 16, 2024
ef227e7
remove unused packageproviders
Yajur-Grover Oct 16, 2024
a1d931c
update props and targets files checks
Yajur-Grover Oct 16, 2024
9bc5354
apply changes from feedback
Yajur-Grover Oct 21, 2024
67526ce
fix formatting
Yajur-Grover Oct 21, 2024
c3c8874
update tests
Yajur-Grover Oct 22, 2024
8099d49
format
Yajur-Grover Oct 22, 2024
dd1dbac
fix error conditions
Yajur-Grover Oct 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/default-storage/example/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ local.properties
/windows/AppPackages
/windows/ExperimentalFeatures.props
/windows/NuGet.Config
/windows/ReactApp.Package

# node.js
#
Expand Down
7 changes: 5 additions & 2 deletions packages/default-storage/example/examples/Functional.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ import AsyncStorage from "@react-native-async-storage/async-storage";
import React, { useEffect, useState } from "react";
import isEqual from "lodash/isEqual";
import {
NativeModules,
Platform,
ScrollView,
StyleSheet,
Text,
TurboModuleRegistry,
View,
} from "react-native";
import type { AsyncStorageTestSupport } from "./types";
import type { TestStep, TestValue } from "./tests";
import tests from "./tests";

Expand Down Expand Up @@ -130,7 +131,9 @@ function Functional(): JSX.Element {
})
.then(async () => {
const AsyncStorageTestSupport =
NativeModules["AsyncStorageTestSupport"];
TurboModuleRegistry.get<AsyncStorageTestSupport>(
"AsyncStorageTestSupport"
);

for (const [currentName, test] of Object.entries(tests)) {
const name = currentName + " with delegate";
Expand Down
26 changes: 9 additions & 17 deletions packages/default-storage/example/examples/MergeItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ import AsyncStorage from "@react-native-async-storage/async-storage";
import React, { useCallback, useState } from "react";
import {
Button,
NativeModules,
StyleSheet,
Text,
TextInput,
TurboModuleRegistry,
View,
} from "react-native";
import type { AsyncStorageTestSupport } from "./types";

type Personalia = {
age: string;
Expand Down Expand Up @@ -102,6 +103,9 @@ function Merge(): JSX.Element {

const { trait1, trait2 } = traits;

const AsyncStorageTestSupport =
TurboModuleRegistry.get<AsyncStorageTestSupport>("AsyncStorageTestSupport");

return (
<View>
<View>
Expand Down Expand Up @@ -174,26 +178,14 @@ function Merge(): JSX.Element {
<Button
testID="setDelegate_button"
title="Set native delegate"
disabled={
!NativeModules["AsyncStorageTestSupport"] ||
!NativeModules["AsyncStorageTestSupport"].test_setDelegate
}
onPress={() =>
NativeModules["AsyncStorageTestSupport"].test_setDelegate(() => {})
}
disabled={!AsyncStorageTestSupport?.test_setDelegate}
onPress={() => AsyncStorageTestSupport?.test_setDelegate(() => {})}
/>
<Button
testID="unsetDelegate_button"
title="Unset native delegate"
disabled={
!NativeModules["AsyncStorageTestSupport"] ||
!NativeModules["AsyncStorageTestSupport"].test_unsetDelegate
}
onPress={() =>
NativeModules["AsyncStorageTestSupport"].test_unsetDelegate(
() => {}
)
}
disabled={!AsyncStorageTestSupport?.test_unsetDelegate}
onPress={() => AsyncStorageTestSupport?.test_unsetDelegate(() => {})}
/>
</View>

Expand Down
8 changes: 8 additions & 0 deletions packages/default-storage/example/examples/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import type { TurboModule } from "react-native";

type AsyncStorageDelegate = (value?: boolean) => void;

export type AsyncStorageTestSupport = TurboModule & {
test_setDelegate: (delegate: AsyncStorageDelegate) => void;
test_unsetDelegate: (delegate: AsyncStorageDelegate) => void;
};
7 changes: 7 additions & 0 deletions packages/default-storage/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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'",
Expand Down Expand Up @@ -73,6 +74,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",
Expand Down Expand Up @@ -122,6 +124,11 @@
"jsSrcsDir": "./src",
"android": {
"javaPackageName": "com.reactnativecommunity.asyncstorage"
},
"windows": {
"namespace": "RNCAsyncStorage",
"outputDirectory": "windows/code/codegen",
"separateDataTypes": true
}
}
}
Loading
Loading