Skip to content

Commit

Permalink
Merge branch 'main' into @szydlovsky/composeHandlers/hook
Browse files Browse the repository at this point in the history
  • Loading branch information
szydlovsky committed May 10, 2024
2 parents 6593bd4 + 6cb1a66 commit 734358e
Show file tree
Hide file tree
Showing 196 changed files with 168,153 additions and 18,274 deletions.
5 changes: 0 additions & 5 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
.eslintrc.js
scripts/*.js
docs/*
plugin/*
eslintrc.js
jest.config.js
eslintPlugin/*
mock.js
77 changes: 43 additions & 34 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,49 @@
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
parserOptions: {
project: true,
tsconfigRootDir: __dirname,
},
overrides: [
{
files: ['*.ts', '*.tsx'],
parser: '@typescript-eslint/parser',
parserOptions: {
project: true,
tsconfigRootDir: __dirname,
},
extends: ['plugin:@typescript-eslint/recommended-type-checked'],
rules: {
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/ban-ts-comment': [
'error',
{
'ts-ignore': 'allow-with-description',
'ts-expect-error': 'allow-with-description',
},
],
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_' },
],
'@typescript-eslint/no-var-requires': 'warn',
'@typescript-eslint/consistent-type-imports': [
'error',
{ prefer: 'type-imports' },
],
'@typescript-eslint/consistent-type-exports': [
'error',
{ fixMixedExportsWithInlineTypeSpecifier: false },
],
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-duplicate-type-constituents': 'error',
'@typescript-eslint/no-shadow': 'error',
},
},
],
extends: [
'standard',
'plugin:@typescript-eslint/recommended-type-checked',
'prettier',
'plugin:import/typescript',
'plugin:react-hooks/recommended',
Expand All @@ -32,43 +68,16 @@ module.exports = {
},
},
rules: {
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-explicit-any': 'warn',
'object-shorthand': 'error',
curly: 'error',
curly: ['error', 'all'],
'no-case-declarations': 'error',
'@typescript-eslint/no-shadow': 'error',
'import/no-unresolved': 'error',
'import/consistent-type-specifier-style': ['error', 'prefer-top-level'],
'react/jsx-uses-vars': 'error',
'react/jsx-uses-react': 'error',
'no-use-before-define': 'off',
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/ban-ts-comment': [
'error',
{
'ts-ignore': 'allow-with-description',
'ts-expect-error': 'allow-with-description',
},
],
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'@typescript-eslint/no-var-requires': 'warn',
// '@typescript-eslint/no-duplicate-type-constituents': 'error', // TODO this currently breaks ESLint for VSCode in plugin
eqeqeq: 'error',
'no-unreachable': 'error',
'@typescript-eslint/consistent-type-imports': [
'error',
{ prefer: 'type-imports' },
],
'@typescript-eslint/consistent-type-exports': [
'error',
{ fixMixedExportsWithInlineTypeSpecifier: false },
],
'tsdoc/syntax': 'error',
'@typescript-eslint/no-non-null-assertion': 'off',
},
};
2 changes: 1 addition & 1 deletion .github/workflows/build-monorepo-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ on:
jobs:
build:
if: github.repository == 'software-mansion/react-native-reanimated'
runs-on: ${{ inputs.platform == 'iOS' && 'macos-13' || 'ubuntu-latest' }}
runs-on: ${{ inputs.platform == 'iOS' && 'macos-14' || 'ubuntu-latest' }}
concurrency:
group: ${{ inputs.concurrency_group }}
cancel-in-progress: true
Expand Down
37 changes: 23 additions & 14 deletions .github/workflows/check-expo-dev-client-nightly.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Check Expo dev-client nightly build
env:
YARN_ENABLE_HARDENED_MODE: 0
SCRIPT_PATH: reanimated_repo/.github/workflows/helper/configureDevClient.js
SCRIPT_PATH: ${{github.workspace}}/reanimated_repo/.github/workflows/helper/configureDevClient.js
on:
pull_request:
paths:
Expand All @@ -13,7 +13,7 @@ on:
jobs:
build_ios:
if: github.repository == 'software-mansion/react-native-reanimated'
runs-on: macos-13
runs-on: macos-14
strategy:
matrix:
react-native-architecture: ['Paper', 'Fabric']
Expand All @@ -27,32 +27,34 @@ jobs:
with:
path: 'reanimated_repo'
- name: Create Expo app
run: npx create-expo-app app
run: npx create-expo-app ExpoApp
- name: Install expo-dev-client
working-directory: app
working-directory: ExpoApp
run: |
if npm view expo dist-tags | grep -q 'next:' ; then
npm install expo@next
else
npm install expo@latest
fi
- name: Setup configuration
working-directory: ExpoApp
run: node ${{ env.SCRIPT_PATH }} setBundleIdentifier
- name: Expo prebuild
working-directory: app
working-directory: ExpoApp
run: npx expo prebuild
- name: Install Reanimated
working-directory: app
working-directory: ExpoApp
run: npm install react-native-reanimated@nightly
- name: Set Fabric
working-directory: ExpoApp
if: ${{ matrix.react-native-architecture == 'Fabric' }}
run: node ${{ env.SCRIPT_PATH }} setupFabricIOS
- name: Install Pods
working-directory: app/ios
working-directory: ExpoApp/ios
run: pod install
- name: Build app
working-directory: app
run: yarn react-native run-ios --simulator='iPhone 14'
working-directory: ExpoApp
run: npx react-native run-ios --simulator='iPhone 14' --terminal='Terminal'

build_android:
if: github.repository == 'software-mansion/react-native-reanimated'
Expand All @@ -70,26 +72,33 @@ jobs:
with:
path: 'reanimated_repo'
- name: Create Expo app
run: npx create-expo-app app
run: npx create-expo-app ExpoApp
- name: Setup Java 17
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 17
- name: Install expo-dev-client
working-directory: app
working-directory: ExpoApp
run: |
if npm view expo dist-tags | grep -q 'next:' ; then
npm install expo@next
else
npm install expo@latest
fi
- name: Setup configuration
working-directory: ExpoApp
run: node ${{ env.SCRIPT_PATH }} setBundleIdentifier
- name: Expo prebuild
working-directory: app
working-directory: ExpoApp
run: npx expo prebuild
- name: Install Reanimated
working-directory: app
working-directory: ExpoApp
run: npm install react-native-reanimated@nightly
- name: Set Fabric
working-directory: ExpoApp
if: ${{ matrix.react-native-architecture == 'Fabric' }}
run: node ${{ env.SCRIPT_PATH }} setupFabricAndroid
- name: Build app
working-directory: app/android
working-directory: ExpoApp/android
run: ./gradlew assembleDebug --console=plain
2 changes: 1 addition & 1 deletion .github/workflows/check-react-native-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
jobs:
build_ios:
if: github.repository == 'software-mansion/react-native-reanimated'
runs-on: macos-13
runs-on: macos-14
strategy:
matrix:
react-native-architecture: ['Paper', 'Fabric']
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check-static-framework-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
jobs:
build:
if: github.repository == 'software-mansion/react-native-reanimated'
runs-on: macos-13
runs-on: macos-14
strategy:
matrix:
react-native-architecture: ['Paper', 'Fabric']
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/helper/configureDevClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,29 @@ const command = process.argv[2];

if (command === 'setBundleIdentifier') {
patchFile(
'app/app.json',
'app.json',
'"ios": {',
'"ios": {"bundleIdentifier":"com.swmansion.app",'
);

patchFile(
'app/app.json',
'app.json',
'"android": {',
'"android": {"package": "com.swmansion.app",'
);
}

if (command === 'setupFabricIOS') {
patchFile(
'app/ios/Podfile.properties.json',
'ios/Podfile.properties.json',
'"expo.jsEngine"',
'"newArchEnabled":"true","expo.jsEngine"'
);
}

if (command === 'setupFabricAndroid') {
patchFile(
'app/android/gradle.properties',
'android/gradle.properties',
'newArchEnabled=false',
'newArchEnabled=true'
);
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ios-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ on:
jobs:
build:
if: github.repository == 'software-mansion/react-native-reanimated'
runs-on: macos-13
runs-on: macos-14
strategy:
matrix:
working-directory: [Example, FabricExample]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/macos-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ on:
jobs:
build:
if: github.repository == 'software-mansion/react-native-reanimated'
runs-on: macos-13
runs-on: macos-14
env:
WORKING_DIRECTORY: MacOSExample
concurrency:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tvos-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ on:
jobs:
build:
if: github.repository == 'software-mansion/react-native-reanimated'
runs-on: macos-13
runs-on: macos-14
env:
WORKING_DIRECTORY: TVOSExample
concurrency:
Expand Down
3 changes: 2 additions & 1 deletion Common/cpp/Fabric/ShadowTreeCloner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ ShadowNode::Unshared cloneShadowTreeWithNewProps(
const auto props = source->getComponentDescriptor().cloneProps(
propsParserContext, source->getProps(), std::move(rawProps));

auto newChildNode = source->clone({/* .props = */ props});
auto newChildNode = source->clone({/* .props = */ props, ShadowNodeFragment::childrenPlaceholder(), source->getState()});

for (auto it = ancestors.rbegin(); it != ancestors.rend(); ++it) {
auto &parentNode = it->first.get();
Expand All @@ -53,6 +53,7 @@ ShadowNode::Unshared cloneShadowTreeWithNewProps(
newChildNode = parentNode.clone({
ShadowNodeFragment::propsPlaceholder(),
std::make_shared<ShadowNode::ListOfShared>(children),
parentNode.getState()
});
}

Expand Down
15 changes: 11 additions & 4 deletions Common/cpp/NativeModules/NativeReanimatedModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,16 @@ void NativeReanimatedModule::unregisterEventHandler(

#ifdef RCT_NEW_ARCH_ENABLED
static inline std::string intColorToHex(const int val) {
std::stringstream ss;
ss << '#' << std::setfill('0') << std::setw(6) << std::hex << (val);
return ss.str();
std::stringstream
invertedHexColorStream; // By default transparency is first, color second
invertedHexColorStream << std::setfill('0') << std::setw(8) << std::hex
<< val;

auto invertedHexColor = invertedHexColorStream.str();
auto hexColor =
"#" + invertedHexColor.substr(2, 6) + invertedHexColor.substr(0, 2);

return hexColor;
}

std::string NativeReanimatedModule::obtainPropFromShadowNode(
Expand Down Expand Up @@ -545,7 +552,7 @@ bool NativeReanimatedModule::handleRawEvent(
double currentTime) {
const EventTarget *eventTarget = rawEvent.eventTarget.get();
if (eventTarget == nullptr) {
// after app reload scrollview is unmounted and its content offset is set
// after app reload scrollView is unmounted and its content offset is set
// to 0 and view is thrown into recycle pool setting content offset
// triggers scroll event eventTarget is null though, because it's
// unmounting we can just ignore this event, because it's an event on
Expand Down
Loading

0 comments on commit 734358e

Please sign in to comment.