Skip to content

Commit

Permalink
Merge origin/main
Browse files Browse the repository at this point in the history
  • Loading branch information
tomekzaw committed Aug 7, 2023
2 parents c3ead49 + 5868489 commit 458eb37
Show file tree
Hide file tree
Showing 38 changed files with 544 additions and 141 deletions.
83 changes: 83 additions & 0 deletions .github/workflows/check-expo-dev-client-nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Check Expo dev-client nightly build
on:
pull_request:
paths:
- .github/workflows/check-expo-dev-client-nightly.yml
schedule:
- cron: '37 19 * * *'
workflow_dispatch:

env:
SCRIPT_PATH: reanimated_repo/.github/workflows/helper/configureDevClient.js

jobs:
build_ios:
runs-on: macos-12
strategy:
matrix:
react-native-architecture: ['Paper', 'Fabric']
fail-fast: false
concurrency:
group: ios-expo-dev-client-${{ matrix.react-native-architecture }}-${{ github.ref }}
cancel-in-progress: true
steps:
- name: Check out reanimated repository
uses: actions/checkout@v3
with:
path: 'reanimated_repo'
- name: Create Expo app
run: npx create-expo-app app
- name: Install expo-dev-client
working-directory: app
run: npm install expo-dev-client@next
- name: Setup configuration
run: node ${{ env.SCRIPT_PATH }} setBundleIdentifier
- name: Expo prebuild
working-directory: app
run: npx expo prebuild
- name: Install Reanimated
working-directory: app
run: npm install github:software-mansion/react-native-reanimated
- name: Set Fabric
if: ${{ matrix.react-native-architecture == 'Fabric' }}
run: node ${{ env.SCRIPT_PATH }} setupFabricIOS
- name: Install Pods
working-directory: app/ios
run: pod install
- name: Build app
working-directory: app
run: yarn react-native run-ios --simulator='iPhone 14'

build_android:
runs-on: ubuntu-latest
strategy:
matrix:
react-native-architecture: ['Paper', 'Fabric']
fail-fast: false
concurrency:
group: android-expo-dev-client-${{ matrix.react-native-architecture }}-${{ github.ref }}
cancel-in-progress: true
steps:
- name: Check out reanimated repository
uses: actions/checkout@v3
with:
path: 'reanimated_repo'
- name: Create Expo app
run: npx create-expo-app app
- name: Install expo-dev-client
working-directory: app
run: npm install expo-dev-client@next
- name: Setup configuration
run: node ${{ env.SCRIPT_PATH }} setBundleIdentifier
- name: Expo prebuild
working-directory: app
run: npx expo prebuild
- name: Install Reanimated
working-directory: app
run: npm install github:software-mansion/react-native-reanimated
- name: Set Fabric
if: ${{ matrix.react-native-architecture == 'Fabric' }}
run: node ${{ env.SCRIPT_PATH }} setupFabricAndroid
- name: Build app
working-directory: app/android
run: ./gradlew assembleDebug --console=plain
64 changes: 64 additions & 0 deletions .github/workflows/check-react-native-nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Check React Native nightly build
on:
pull_request:
paths:
- .github/workflows/check-react-native-nightly.yml
schedule:
- cron: '37 19 * * *'
workflow_dispatch:

jobs:
build_ios:
runs-on: macos-12
strategy:
matrix:
react-native-architecture: ['Paper', 'Fabric']
fail-fast: false
concurrency:
group: ios-react-native-nightly-${{ matrix.react-native-architecture }}-${{ github.ref }}
cancel-in-progress: true
steps:
- name: Create app
run: npx react-native init app --skip-install --version nightly
- name: Install Reanimated
working-directory: app
run: yarn add github:software-mansion/react-native-reanimated
- name: Install Paper Pods
if: ${{ matrix.react-native-architecture == 'Paper' }}
working-directory: app/ios
run: pod install
- name: Install Fabric Pods
if: ${{ matrix.react-native-architecture == 'Fabric' }}
working-directory: app/ios
run: export RCT_NEW_ARCH_ENABLED=1 && pod install
- name: Build app
working-directory: app
run: yarn react-native run-ios --simulator='iPhone 14'

build_android:
runs-on: ubuntu-latest
strategy:
matrix:
react-native-architecture: ['Paper', 'Fabric']
fail-fast: false
concurrency:
group: android-react-native-nightly-${{ matrix.react-native-architecture }}-${{ github.ref }}
cancel-in-progress: true
steps:
- name: Set up JDK 18
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '18'
- name: Create app
run: npx react-native init app --skip-install --version nightly
- name: Install Reanimated
working-directory: app
run: yarn add github:software-mansion/react-native-reanimated
- name: Setup Fabric
if: ${{ matrix.react-native-architecture == 'Fabric' }}
working-directory: app/android
run: sed -i 's/newArchEnabled=false/newArchEnabled=true/' gradle.properties
- name: Build app
working-directory: app/android
run: ./gradlew assembleDebug --console=plain
39 changes: 39 additions & 0 deletions .github/workflows/helper/configureDevClient.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
fs = require('fs');

function patchFile(path, find, replace) {
let data = fs.readFileSync(path, 'utf8');
data = data.replace(find, replace);
fs.writeFileSync(path, data);
}

const command = process.argv[2];

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

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

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

if (command === 'setupFabricAndroid') {
patchFile(
'app/android/gradle.properties',
'newArchEnabled=false',
'newArchEnabled=true'
);
}
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

yarn lint-staged
yarn type:check
yarn find-unused-code:js

# This automatically builds Reanimated Babel plugin JavaScript files if their
# TypeScript counterparts were changed. It also adds those files to the commit
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ comes to gesture based interactions.

### Nightly CI state

[![Build nightly npm package](https://github.com/software-mansion/react-native-reanimated/actions/workflows/build-nightly-npm-package.yml/badge.svg)](https://github.com/software-mansion/react-native-reanimated/actions/workflows/build-nightly-npm-package.yml) [![Run nightly monorepo test](https://github.com/software-mansion/react-native-reanimated/actions/workflows/build-monorepo-nightly.yml/badge.svg)](https://github.com/software-mansion/react-native-reanimated/actions/workflows/build-monorepo-nightly.yml) [![Check static framework nightly build](https://github.com/software-mansion/react-native-reanimated/actions/workflows/check-static-framework-nightly.yml/badge.svg)](https://github.com/software-mansion/react-native-reanimated/actions/workflows/check-static-framework-nightly.yml)
[![Build nightly npm package](https://github.com/software-mansion/react-native-reanimated/actions/workflows/build-nightly-npm-package.yml/badge.svg)](https://github.com/software-mansion/react-native-reanimated/actions/workflows/build-nightly-npm-package.yml)
[![Run nightly monorepo test](https://github.com/software-mansion/react-native-reanimated/actions/workflows/build-monorepo-nightly.yml/badge.svg)](https://github.com/software-mansion/react-native-reanimated/actions/workflows/build-monorepo-nightly.yml)
[![Check static framework nightly build](https://github.com/software-mansion/react-native-reanimated/actions/workflows/check-static-framework-nightly.yml/badge.svg)](https://github.com/software-mansion/react-native-reanimated/actions/workflows/check-static-framework-nightly.yml)
[![Check React Native nightly build](https://github.com/software-mansion/react-native-reanimated/actions/workflows/check-react-native-nightly.yml/badge.svg)](https://github.com/software-mansion/react-native-reanimated/actions/workflows/check-react-native-nightly.yml)
[![Check Expo dev-client nightly build](https://github.com/software-mansion/react-native-reanimated/actions/workflows/check-expo-dev-client-nightly.yml/badge.svg)](https://github.com/software-mansion/react-native-reanimated/actions/workflows/check-expo-dev-client-nightly.yml)

## Installation

Expand Down
16 changes: 16 additions & 0 deletions ios/LayoutReanimation/REAAnimationsManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,22 @@ - (instancetype)initWithUIManager:(RCTUIManager *)uiManager
}
_sharedTransitionManager = [[REASharedTransitionManager alloc] initWithAnimationsManager:self];
_reaSwizzledUIManager = [[REASwizzledUIManager alloc] initWithUIManager:uiManager withAnimationManager:self];

_startAnimationForTag = ^(NSNumber *tag, LayoutAnimationType type, NSDictionary *yogaValues) {
// default implementation, this block will be replaced by a setter
};
_hasAnimationForTag = ^(NSNumber *tag, LayoutAnimationType type) {
// default implementation, this block will be replaced by a setter
return NO;
};
_clearAnimationConfigForTag = ^(NSNumber *tag) {
// default implementation, this block will be replaced by a setter
};
#ifdef DEBUG
_checkDuplicateSharedTag = ^(UIView *view, NSNumber *viewTag) {
// default implementation, this block will be replaced by a setter
};
#endif
}
return self;
}
Expand Down
4 changes: 4 additions & 0 deletions ios/native/REAInitializer.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ NS_ASSUME_NONNULL_BEGIN

namespace reanimated {

[[deprecated(
"REAInitializer method is no longer required, you can just remove invocation.")]] void
REAInitializer(RCTBridge *bridge);

#if REACT_NATIVE_MINOR_VERSION <= 71
[[deprecated(
"REAJSIExecutorRuntimeInstaller method is no longer required, you can just remove invocation.")]] JSIExecutor::
Expand Down
5 changes: 5 additions & 0 deletions ios/native/REAInitializer.mm
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@

namespace reanimated {

void REAInitializer(RCTBridge *bridge)
{
// do nothing, just for backward compatibility
}

#if REACT_NATIVE_MINOR_VERSION <= 71

JSIExecutor::RuntimeInstaller REAJSIExecutorRuntimeInstaller(
Expand Down
86 changes: 80 additions & 6 deletions src/Animated.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,87 @@
export { default as createAnimatedComponent } from './createAnimatedComponent';
export {
addWhitelistedNativeProps,
addWhitelistedUIProps,
import type { Extrapolate as _Extrapolate } from './reanimated2/interpolateColor';
import type { SharedValue as _SharedValue } from './reanimated2/commonTypes';
import type { DerivedValue as _DerivedValue } from './reanimated2/hook/useDerivedValue';
import type {
TransformStyleTypes as _TransformStyleTypes,
Adaptable as _Adaptable,
AdaptTransforms as _AdaptTransforms,
AnimatedTransform as _AnimatedTransform,
AnimateStyle as _AnimateStyle,
StylesOrDefault as _StylesOrDefault,
AnimateProps as _AnimateProps,
} from './reanimated2/helperTypes';
import type { EasingFunction as _EasingFunction } from './reanimated2/Easing';
import {
addWhitelistedNativeProps as _addWhitelistedNativeProps,
addWhitelistedUIProps as _addWhitelistedUIProps,
} from './ConfigHelper';
import type { AnimatedScrollViewProps as _AnimatedScrollViewProps } from './reanimated2/component/ScrollView';
import type { FlatListPropsWithLayout as _FlatListPropsWithLayout } from './reanimated2/component/FlatList';
export { default as createAnimatedComponent } from './createAnimatedComponent';

export { AnimatedText as Text } from './reanimated2/component/Text';
export { AnimatedView as View } from './reanimated2/component/View';
export { AnimatedScrollView as ScrollView } from './reanimated2/component/ScrollView';
export { AnimatedImage as Image } from './reanimated2/component/Image';
export { ReanimatedFlatList as FlatList } from './reanimated2/component/FlatList';
export type { SharedValue } from './reanimated2/commonTypes';
export type { AnimateStyle } from './reanimated2/helperTypes';
/**
* @deprecated Please import `Extrapolate` directly from `react-native-reanimated` instead of `Animated` namespace.
*/
export type Extrapolate = typeof _Extrapolate;
/**
* @deprecated Please import `SharedValue` directly from `react-native-reanimated` instead of `Animated` namespace.
*/

export type SharedValue<T> = _SharedValue<T>;
/**
* @deprecated Please import `DerivedValue` directly from `react-native-reanimated` instead of `Animated` namespace.
*/
export type DerivedValue<T> = _DerivedValue<T>;
/**
* @deprecated Please import `Adaptable` directly from `react-native-reanimated` instead of `Animated` namespace.
*/
export type Adaptable<T> = _Adaptable<T>;
/**
* @deprecated Please import `TransformStyleTypes` directly from `react-native-reanimated` instead of `Animated` namespace.
* */
export type TransformStyleTypes = _TransformStyleTypes;
/**
* @deprecated Please import `AdaptTransforms` directly from `react-native-reanimated` instead of `Animated` namespace.
* */
export type AdaptTransforms<T> = _AdaptTransforms<T>;
/**
* @deprecated Please import `AnimatedTransform` directly from `react-native-reanimated` instead of `Animated` namespace.
*/
export type AnimatedTransform = _AnimatedTransform;
/**
* @deprecated Please import `AnimateStyle` directly from `react-native-reanimated` instead of `Animated` namespace.
* */
export type AnimateStyle<S> = _AnimateStyle<S>;
/**
* @deprecated Please import `StylesOrDefault` directly from `react-native-reanimated` instead of `Animated` namespace.
* */
export type StylesOrDefault<S> = _StylesOrDefault<S>;
/**
* @deprecated Please import `AnimateProps` directly from `react-native-reanimated` instead of `Animated` namespace.
* */
export type AnimateProps<P extends object> = _AnimateProps<P>;
/**
* @deprecated Please import `EasingFunction` directly from `react-native-reanimated` instead of `Animated` namespace.
* */
export type EasingFunction = _EasingFunction;
/**
* @deprecated Please import `addWhitelistedNativeProps` directly from `react-native-reanimated` instead of `Animated` namespace.
* */
export const addWhitelistedNativeProps = _addWhitelistedNativeProps;
/**
* @deprecated Please import `addWhitelistedUIProps` directly from `react-native-reanimated` instead of `Animated` namespace.
* */
export const addWhitelistedUIProps = _addWhitelistedUIProps;
/**
* @deprecated Please import `AnimatedScrollViewProps` directly from `react-native-reanimated` instead of `Animated` namespace.
* */
export type AnimatedScrollViewProps = _AnimatedScrollViewProps;
/**
* @deprecated Please import `FlatListPropsWithLayout` directly from `react-native-reanimated` instead of `Animated` namespace.
* */
export type FlatListPropsWithLayout<T> = _FlatListPropsWithLayout<T>;
Loading

0 comments on commit 458eb37

Please sign in to comment.