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: remove system animations on Android #1213

Merged
merged 23 commits into from
Jan 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
b702c00
feat: add new animations and remove system ones
WoLewicki Nov 17, 2021
0c5e11f
feat: remove code regarding system animation events
WoLewicki Nov 17, 2021
5eadbd4
chore: merge current master
kacperkapusciak Dec 1, 2021
397f8f0
fix: transition events on 'none' animation
kacperkapusciak Dec 1, 2021
434f3b5
feat: add events example
kacperkapusciak Dec 1, 2021
db47333
feat: add stack animation change in example
kacperkapusciak Dec 1, 2021
423af4b
feat: add events e2e tests
kacperkapusciak Dec 1, 2021
eabca18
chore: add repro
kacperkapusciak Dec 6, 2021
edd0f77
feat: add logic for not dispatching same events twice
WoLewicki Dec 15, 2021
4a38929
feat: working version with nested fragments
WoLewicki Jan 5, 2022
251229e
fix: make android hardware button tests pass
kacperkapusciak Jan 10, 2022
34c5315
fix: test suite description
kacperkapusciak Jan 10, 2022
44b5c2b
chore: commit yarn.lock
kacperkapusciak Jan 10, 2022
f358ae4
fix: newline character issues in xmls
kacperkapusciak Jan 10, 2022
a433a3d
chore: merge current main
kacperkapusciak Jan 10, 2022
2fd280d
fix: make fields private
kacperkapusciak Jan 10, 2022
edb8ba0
fix: scroll down in Events test suite
kacperkapusciak Jan 11, 2022
7ef2436
chore: rename jest setup file
kacperkapusciak Jan 11, 2022
930e49c
feat: make toasts smol ʕ•ᴥ•ʔ
kacperkapusciak Jan 11, 2022
b7c09b1
fix: make Example app small screen friendly
kacperkapusciak Jan 11, 2022
d8b0dbf
fix: change backticks to double quotes in tests
kacperkapusciak Jan 11, 2022
c4202c9
fix: remove faulty tests
kacperkapusciak Jan 26, 2022
c9df361
fix: remove faulty test, bring back correct test
kacperkapusciak Jan 26, 2022
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
9 changes: 8 additions & 1 deletion Example/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import StackReactNavigation4 from './src/screens/StackReactNavigation4';
import Modals from './src/screens/Modals';
import Orientation from './src/screens/Orientation';
import SearchBar from './src/screens/SearchBar';
import Events from './src/screens/Events';

import { enableFreeze } from 'react-native-screens';

Expand Down Expand Up @@ -93,6 +94,11 @@ const SCREENS: Record<
component: SearchBar,
type: 'playground',
},
Events: {
title: 'Events',
component: Events,
type: 'playground',
},
};

type RootStackParamList = {
Expand All @@ -108,7 +114,7 @@ interface MainScreenProps {
}

const MainScreen = ({ navigation }: MainScreenProps): JSX.Element => (
<ScrollView>
<ScrollView testID="root-screen-examples-scrollview">
<SafeAreaView>
<SettingsSwitch
style={styles.switch}
Expand Down Expand Up @@ -138,6 +144,7 @@ const MainScreen = ({ navigation }: MainScreenProps): JSX.Element => (
.map((name) => (
<ListItem
key={name}
testID={`root-screen-playground-${name}`}
title={SCREENS[name].title}
onPress={() => navigation.navigate(name)}
/>
Expand Down
2 changes: 1 addition & 1 deletion Example/e2e/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"reporters": ["detox/runners/jest/streamlineReporter"],
"verbose": true,
"preset": "ts-jest",
"setupTestFrameworkScriptFile": "./init.ts"
"setupFilesAfterEnv": ["./jest.setup.ts"]
}
220 changes: 220 additions & 0 deletions Example/e2e/examplesTests/events.e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,220 @@
import { device, expect, element, by } from 'detox';

describe('Events', () => {
beforeEach(async () => {
await device.reloadReactNative();

await waitFor(element(by.id('root-screen-playground-Events')))
.toBeVisible()
.whileElement(by.id('root-screen-examples-scrollview'))
.scroll(200, 'down');
});

it('should Events playground exist', async () => {
await expect(element(by.id('root-screen-playground-Events'))).toBeVisible();
element(by.id('root-screen-playground-Events')).tap();
});

it('should run transitionStart & transitionEnd opening events', async () => {
await element(by.id('root-screen-playground-Events')).tap();

await expect(
element(by.text('1. Main | transitionStart | opening'))
).toExist();
await expect(
element(by.text('2. Main | transitionEnd | opening'))
).toExist();
});

it('should go back from Chats using header button and run opening & closing events in correct order ', async () => {
await element(by.id('root-screen-playground-Events')).tap();

await element(by.id('events-go-to-chats')).tap();
if (device.getPlatform() === 'ios') {
await element(by.type('_UIButtonBarButton')).tap();
} else {
await element(
by.type('androidx.appcompat.widget.AppCompatImageButton')
).tap();
}

await expect(
element(by.text('9. Chats | transitionStart | closing'))
).toExist();
await expect(
element(by.text('10. Privacy | transitionStart | closing'))
).toExist();
await expect(
element(by.text('11. Main | transitionStart | opening'))
).toExist();
await expect(
element(by.text('12. Chats | transitionEnd | closing'))
).toExist();
await expect(
element(by.text('13. Privacy | transitionEnd | closing'))
).toExist();
await expect(
element(by.text('14. Main | transitionEnd | opening'))
).toExist();
});

it('should use "none" animation, go back from Chats using header button and run opening & closing events in correct order ', async () => {
await element(by.id('root-screen-playground-Events')).tap();

await element(by.id('events-stack-animation-picker')).tap();
await element(by.id('stack-animation-none')).tap();

await element(by.id('events-go-to-chats')).tap();

if (device.getPlatform() === 'ios') {
await element(by.type('_UIButtonBarButton')).tap();
} else {
await element(
by.type('androidx.appcompat.widget.AppCompatImageButton')
).tap();
}

await expect(
element(by.text('9. Chats | transitionStart | closing'))
).toExist();
await expect(
element(by.text('10. Privacy | transitionStart | closing'))
).toExist();
await expect(
element(by.text('11. Main | transitionStart | opening'))
).toExist();
await expect(
element(by.text('12. Chats | transitionEnd | closing'))
).toExist();
await expect(
element(by.text('13. Privacy | transitionEnd | closing'))
).toExist();
await expect(
element(by.text('14. Main | transitionEnd | opening'))
).toExist();
});

it('should use "slide_from_bottom" animation, go to Chats and run opening & closing events in correct order ', async () => {
await element(by.id('root-screen-playground-Events')).tap();

await element(by.id('events-stack-animation-picker')).tap();
await element(by.id('stack-animation-slide_from_bottom')).tap();

await element(by.id('events-go-to-chats')).tap();

await expect(
element(by.text('3. Main | transitionStart | closing'))
).toExist();
await expect(
element(by.text('4. Chats | transitionStart | opening'))
).toExist();
await expect(
element(by.text('5. Privacy | transitionStart | opening'))
).toExist();
await expect(
element(by.text('6. Main | transitionEnd | closing'))
).toExist();
await expect(
element(by.text('7. Chats | transitionEnd | opening'))
).toExist();
await expect(
element(by.text('8. Privacy | transitionEnd | opening'))
).toExist();
});

it('should use "slide_from_bottom" animation, go back from Chats using header button and run opening & closing events in correct order ', async () => {
await element(by.id('root-screen-playground-Events')).tap();

await element(by.id('events-stack-animation-picker')).tap();
await element(by.id('stack-animation-slide_from_bottom')).tap();

await element(by.id('events-go-to-chats')).tap();

if (device.getPlatform() === 'ios') {
await element(by.type('_UIButtonBarButton')).tap();
} else {
await element(
by.type('androidx.appcompat.widget.AppCompatImageButton')
).tap();
}

await expect(
element(by.text('9. Chats | transitionStart | closing'))
).toExist();
await expect(
element(by.text('10. Privacy | transitionStart | closing'))
).toExist();
await expect(
element(by.text('11. Main | transitionStart | opening'))
).toExist();
await expect(
element(by.text('12. Chats | transitionEnd | closing'))
).toExist();
await expect(
element(by.text('13. Privacy | transitionEnd | closing'))
).toExist();
await expect(
element(by.text('14. Main | transitionEnd | opening'))
).toExist();
});

it('[Android] should go back from Chats using native way and run opening & closing events in correct order ', async () => {
// swipe to go back doesn't seem to work on iOS
if (device.getPlatform() !== 'android') return;

await element(by.id('root-screen-playground-Events')).tap();

await element(by.id('events-go-to-chats')).tap();

await device.pressBack();

await expect(
element(by.text('9. Main | transitionStart | opening'))
).toExist();
await expect(
element(by.text('10. Main | transitionEnd | opening'))
).toExist();
});

it('[Android] should use "none" animation, go back from Chats using native way and run opening & closing events in correct order ', async () => {
// swipe to go back doesn't seem to work on iOS
if (device.getPlatform() !== 'android') return;

await element(by.id('root-screen-playground-Events')).tap();

await element(by.id('events-stack-animation-picker')).tap();
await element(by.id('stack-animation-none')).tap();

await element(by.id('events-go-to-chats')).tap();

await device.pressBack();

await expect(
element(by.text('9. Main | transitionStart | opening'))
).toExist();
await expect(
element(by.text('10. Main | transitionEnd | opening'))
).toExist();
});

it('[Android] should use "slide_from_bottom" animation, go back from Chats using native way and run opening & closing events in correct order ', async () => {
// swipe to go back doesn't seem to work on iOS
if (device.getPlatform() !== 'android') return;

await element(by.id('root-screen-playground-Events')).tap();

await element(by.id('events-stack-animation-picker')).tap();
await element(by.id('stack-animation-slide_from_bottom')).tap();

await element(by.id('events-go-to-chats')).tap();

await device.pressBack();

await expect(
element(by.text('9. Main | transitionStart | opening'))
).toExist();
await expect(
element(by.text('10. Main | transitionEnd | opening'))
).toExist();
});
});
2 changes: 1 addition & 1 deletion Example/e2e/examplesTests/stackPresentation.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { device, expect, element, by } from 'detox';

describe('Simple Native Stack', () => {
describe('Simple Stack Presentation', () => {
beforeAll(async () => {
await device.reloadReactNative();
});
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion Example/src/screens/Animations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ const App = (): JSX.Element => {
const styles = StyleSheet.create({
container: {
flex: 1,
paddingTop: 100,
paddingTop: 10,
},
});

Expand Down
2 changes: 1 addition & 1 deletion Example/src/screens/BottomTabsAndStack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ const NavigationTabsAndStack = (): JSX.Element => (
const styles = StyleSheet.create({
container: {
flex: 1,
paddingTop: 100,
paddingTop: 10,
},
});

Expand Down
Loading