-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
External component lifecycle events (#4872)
* Add external component e2e * Emit appear and disappear events for external components
- Loading branch information
Showing
9 changed files
with
186 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
const Utils = require('./Utils'); | ||
const TestIDs = require('../playground/src/testIDs'); | ||
const Android = require('./AndroidUtils'); | ||
|
||
const { elementByLabel, elementById } = Utils; | ||
|
||
describe('External Component', () => { | ||
beforeEach(async () => { | ||
await device.relaunchApp(); | ||
await elementById(TestIDs.NAVIGATION_TAB).tap(); | ||
await elementById(TestIDs.EXTERNAL_COMP_BTN).tap(); | ||
}); | ||
|
||
test('Push external component', async () => { | ||
await elementById(TestIDs.PUSH_BTN).tap(); | ||
await expect(elementByLabel('This is an external component')).toBeVisible(); | ||
}); | ||
|
||
test('Show external component in deep stack in modal', async () => { | ||
await elementById(TestIDs.MODAL_BTN).tap(); | ||
await expect(elementByLabel('External component in deep stack')).toBeVisible(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
const React = require('react'); | ||
const Root = require('../components/Root'); | ||
const Button = require('../components/Button'); | ||
const Screens = require('./Screens'); | ||
const Navigation = require('../services/Navigation'); | ||
const { stack } = require('../commons/Layouts'); | ||
const { | ||
PUSH_BTN, | ||
MODAL_BTN | ||
} = require('../testIDs'); | ||
|
||
class ExternalComponentScreen extends React.Component { | ||
static options() { | ||
return { | ||
topBar: { | ||
title: { | ||
text: 'External Component' | ||
} | ||
} | ||
} | ||
} | ||
|
||
render() { | ||
return ( | ||
<Root componentId={this.props.componentId}> | ||
<Button label='Push' testID={PUSH_BTN} onPress={this.push} /> | ||
<Button label='Show Modal' testID={MODAL_BTN} onPress={this.modal} /> | ||
</Root> | ||
); | ||
} | ||
|
||
push = () => Navigation.push(this, { | ||
externalComponent: { | ||
name: Screens.NativeScreen, | ||
passProps: { | ||
text: 'This is an external component' | ||
} | ||
} | ||
}); | ||
modal = () => Navigation.showModal( | ||
stack([ | ||
Screens.Pushed, | ||
{ | ||
externalComponent: { | ||
name: Screens.NativeScreen, | ||
passProps: { | ||
text: 'External component in deep stack' | ||
} | ||
} | ||
} | ||
]) | ||
); | ||
} | ||
|
||
module.exports = ExternalComponentScreen; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters