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: expose transition progress #890

Merged
merged 58 commits into from Aug 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
7552134
feat: add version with normal transitions working
WoLewicki Apr 14, 2021
c20d693
feat: working version on iOS
WoLewicki Apr 15, 2021
998d021
feat: add working android version
WoLewicki Apr 15, 2021
f7f641d
feat: update READMEs, remove comments, add v4 impl
WoLewicki Apr 16, 2021
795b760
feat: change ios event to dispatcher
WoLewicki Apr 22, 2021
cd10306
feat: expose isClosing
WoLewicki Apr 22, 2021
16a9f05
feat: merge current master with rea2
WoLewicki Apr 22, 2021
4cd89e5
feat: merge current master
WoLewicki May 11, 2021
d916e90
feat: remove event dispatcher and add start and end progress
WoLewicki May 12, 2021
f9e65a2
feat: clean code
WoLewicki May 12, 2021
7bc1471
fix: event coalescing on Android
WoLewicki May 12, 2021
53e626c
fix: changes from other PR
WoLewicki May 17, 2021
5e6638b
feat: add rea2 configuration
WoLewicki May 17, 2021
57f2b7d
feat: merge current master
WoLewicki May 25, 2021
084b36b
feat: wip
WoLewicki May 26, 2021
7b7e7d0
feat: add implementation with context
WoLewicki Jun 1, 2021
9e1d50f
chore: merge current master
WoLewicki Jun 1, 2021
c24cede
feat: add v4 context consumer
WoLewicki Jun 1, 2021
1226509
fix: apply some changes from comments
WoLewicki Jun 7, 2021
978e0a0
fix: better comment
WoLewicki Jun 8, 2021
c0e2e9c
feat: version with context
WoLewicki Jun 24, 2021
30ca8d4
feat: version with context and transparent modal not working on Android
WoLewicki Jun 25, 2021
2e84bf2
chore: merge current master
WoLewicki Jun 25, 2021
3fce365
feat: add context to v4
WoLewicki Jun 25, 2021
8b2f90b
feat: rewrite v4 to functions for easier usage
WoLewicki Jun 25, 2021
604a6b7
feat: add more documentation
WoLewicki Jun 28, 2021
08f30c0
feat: use context for reanimated
WoLewicki Jul 1, 2021
a6da1de
fix: move onTranistionProgress to Screen component
WoLewicki Jul 1, 2021
22fd9c4
feat: add goingForward flag
WoLewicki Jul 1, 2021
3fb3429
fix: easier logic on Android and comments on iOS
WoLewicki Jul 2, 2021
efeb811
fix: update READMEs
WoLewicki Jul 2, 2021
1145b0d
feat: format native code before merging current master
WoLewicki Jul 2, 2021
3fe65cd
chore: merge current master
WoLewicki Jul 2, 2021
3f5d8fd
feat: add changes to Android
WoLewicki Jul 9, 2021
d0e3226
fix: alloc fakeView once
WoLewicki Jul 12, 2021
7cfe825
chore: merge current master
WoLewicki Jul 12, 2021
f36f261
fix: changes from comments
WoLewicki Jul 12, 2021
0cf45e7
chore: merge current master
WoLewicki Jul 12, 2021
d84f181
feat: ReanimatedScreen to functional
WoLewicki Jul 13, 2021
dc90b3e
fix: indent
WoLewicki Jul 13, 2021
3c7d38c
feat: comments and multiple component check
WoLewicki Jul 13, 2021
ae03fb4
feat: remove modal integration
WoLewicki Jul 13, 2021
b1eb074
feat: move sending progress to fake animation
WoLewicki Jul 13, 2021
8871ef0
feat: add isNativeStack prop and some fixes
WoLewicki Jul 14, 2021
25b142b
fix: remove unnecessary prop
WoLewicki Jul 14, 2021
e17f098
feat: add class wrapper to pass setNativeProps
WoLewicki Jul 14, 2021
33c135f
feat: add nested normal stack in example
WoLewicki Jul 14, 2021
d400ef6
fix: remove unused prop on iOS
WoLewicki Jul 14, 2021
3fe3f6a
fix: move java code to original place
WoLewicki Jul 14, 2021
7e2dad7
fix: mistake
WoLewicki Jul 14, 2021
e9ac748
fix: small change
WoLewicki Jul 14, 2021
82259d5
chore: merge current master
WoLewicki Jul 15, 2021
f5e31d4
fix: merge unnecessary method
WoLewicki Jul 15, 2021
112dc25
fix: goingForward per documentation
WoLewicki Jul 27, 2021
b2551ab
chore: merge current master
WoLewicki Aug 23, 2021
ddfbfdf
fix: format android
WoLewicki Aug 23, 2021
f0ba599
fix: run pod install to fix CI
WoLewicki Aug 24, 2021
3639fdd
fix: restore proper version
WoLewicki Aug 24, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc.js
Expand Up @@ -16,7 +16,7 @@ module.exports = {
},

settings: {
'import/core-modules': ['react-native-screens', 'react-native-screens/native-stack', 'react-native-screens/createNativeStackNavigator'],
'import/core-modules': ['react-native-screens', 'react-native-screens/native-stack', 'react-native-screens/createNativeStackNavigator', 'react-native-screens/reanimated'],
'import/ignore': ['node_modules/react-native/index\\.js$'],
'import/resolver': {
node: {
Expand Down
12 changes: 8 additions & 4 deletions TestsExample/App.js
@@ -1,6 +1,8 @@
/* eslint-disable no-unused-vars */
import React from 'react';

import {ReanimatedScreenProvider} from 'react-native-screens/reanimated';

import Test42 from './src/Test42';
import Test111 from './src/Test111';
import Test263 from './src/Test263';
Expand Down Expand Up @@ -45,12 +47,14 @@ import Test860 from './src/Test860';
import Test861 from './src/Test861';
import Test865 from './src/Test865';
import Test881 from './src/Test881';
import Test887 from './src/Test887';
import Test898 from './src/Test898';
import Test913 from './src/Test913';
import Test999 from './src/Test999';
import Test1031 from './src/Test1031';
import Test1032 from './src/Test1032';

export default function App() {
return <Test42 />;
return (
<ReanimatedScreenProvider>
<Test42 />
</ReanimatedScreenProvider>
);
}
8 changes: 4 additions & 4 deletions TestsExample/ios/Podfile.lock
Expand Up @@ -271,9 +271,9 @@ PODS:
- React-jsinspector (0.65.1)
- react-native-appearance (0.3.4):
- React
- react-native-safe-area-context (3.1.9):
- react-native-safe-area-context (3.2.0):
- React-Core
- react-native-webview (11.0.0):
- react-native-webview (11.4.4):
- React-Core
- React-perflogger (0.65.1)
- React-RCTActionSheet (0.65.1):
Expand Down Expand Up @@ -565,8 +565,8 @@ SPEC CHECKSUMS:
React-jsiexecutor: 43f2542aed3c26e42175b339f8d37fe3dd683765
React-jsinspector: 41e58e5b8e3e0bf061fdf725b03f2144014a8fb0
react-native-appearance: 0f0e5fc2fcef70e03d48c8fe6b00b9158c2ba8aa
react-native-safe-area-context: b6e0e284002381d2ff29fa4fff42b4d8282e3c94
react-native-webview: 6b7950628616679d81bdd75747e50cf6de9b5a5f
react-native-safe-area-context: f0906bf8bc9835ac9a9d3f97e8bde2a997d8da79
react-native-webview: cc2a1fd8149a2654d1408793daa62baadfc0bd96
React-perflogger: fd28ee1f2b5b150b00043f0301d96bd417fdc339
React-RCTActionSheet: 7f3fa0855c346aa5d7c60f9ced16e067db6d29fa
React-RCTAnimation: 2119a18ee26159004b001bc56404ca5dbaae6077
Expand Down
1 change: 1 addition & 0 deletions TestsExample/metro.config.js
Expand Up @@ -11,6 +11,7 @@ const modules = [
'@react-navigation/native',
'react-navigation',
'react-navigation-stack',
'react-native-reanimated',
'react-native-safe-area-context',
...Object.keys(pack.peerDependencies),
];
Expand Down
34 changes: 26 additions & 8 deletions TestsExample/src/Test765.tsx
Expand Up @@ -2,28 +2,31 @@ import * as React from 'react';
import {
Button,
View,
Animated as RNAnimated,
} from 'react-native';
import {
createAppContainer,
} from 'react-navigation';

import createNativeStackNavigator, {NativeStackNavigationOptions, NativeStackNavigationProp} from 'react-native-screens/createNativeStackNavigator';
import {useTransitionProgress} from 'react-native-screens';
import {useReanimatedTransitionProgress} from 'react-native-screens/reanimated';
import Animated, {useAnimatedStyle, useDerivedValue} from 'react-native-reanimated';

const DEFAULT_STACK_OPTIONS : NativeStackNavigationOptions
= {
headerBackTitleVisible: false,
headerTintColor: 'black',
headerTitleStyle: {
fontFamily: 'arial',
},
headerStyle: {
backgroundColor: 'white',
backgroundColor: 'powderblue',
},
cardStyle: {
backgroundColor: 'white',
},
headerTitle: 'Home',
hideShadow: true,
backButtonImage: undefined,
headerTopInsetEnabled: false,
};

Expand Down Expand Up @@ -52,7 +55,6 @@ function makeStacks() {
screen: Home,
navigationOptions: {
cardTransparent: true,
gestureEnabled: false,
stackAnimation: 'fade',
cardStyle: {
backgroundColor: 'blue',
Expand All @@ -62,7 +64,6 @@ function makeStacks() {
},
{
headerMode: 'none',
mode: 'containedModal',
},
);
const MainStack = createNativeStackNavigator(
Expand All @@ -71,14 +72,12 @@ function makeStacks() {
Home5: {
screen: Home,
navigationOptions: {
gestureEnabled: false,
stackAnimation: 'fade',
stackAnimation: 'slide_from_right',
},
},
},
{
headerMode: 'none',
mode: 'containedModal',
},
);
return MainStack;
Expand All @@ -87,8 +86,27 @@ function makeStacks() {
export default createAppContainer(makeStacks());

function Home({navigation}: {navigation: NativeStackNavigationProp}) {
const reaProgress = useReanimatedTransitionProgress();
const sv = useDerivedValue(() => (reaProgress.progress.value < 0.5 ? (reaProgress.progress.value * 50) : ((1 - reaProgress.progress.value) * 50)) + 50);
const reaStyle = useAnimatedStyle(() => {
return {
width: sv.value,
height: sv.value,
backgroundColor: 'blue',
};
});

const {progress} = useTransitionProgress();
const opacity = progress.interpolate({
inputRange: [0, 0.5, 1],
outputRange: [1.0, 0.0 ,1.0],
extrapolate: 'clamp',
});

return (
<View style={{ flex: 1, backgroundColor: 'red' }}>
<RNAnimated.View style={{opacity, height: 50, backgroundColor: 'green'}} />
<Animated.View style={reaStyle} />
<Button title="Go forward" onPress={() => navigation.navigate("Home5")} />
<Button title="Go back" onPress={() => navigation.goBack()} />
</View>
Expand Down