-
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.
Allow to update props for a specific component (#5612)
This commit adds support to update props of screen or custom button/title via the mergeOptions api. ```js Navigation.mergeOptions('myComponentId', { passProps: { text: 'new value' } }); ```
- Loading branch information
Showing
18 changed files
with
268 additions
and
111 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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
dist | ||
.vscode/ | ||
package-lock.json | ||
.history/ | ||
|
||
############ | ||
# Node | ||
|
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,48 @@ | ||
const Utils = require('./Utils'); | ||
const TestIDs = require('../playground/src/testIDs'); | ||
|
||
const { elementById, elementByLabel } = Utils; | ||
|
||
describe('Buttons', () => { | ||
beforeEach(async () => { | ||
await device.relaunchApp(); | ||
await elementById(TestIDs.OPTIONS_TAB).tap(); | ||
await elementById(TestIDs.GOTO_BUTTONS_SCREEN).tap(); | ||
}); | ||
|
||
it('sets right buttons', async () => { | ||
await expect(elementById(TestIDs.BUTTON_ONE)).toBeVisible(); | ||
await expect(elementById(TestIDs.ROUND_BUTTON)).toBeVisible(); | ||
}); | ||
|
||
it('set left buttons', async () => { | ||
await expect(elementById(TestIDs.LEFT_BUTTON)).toBeVisible(); | ||
}); | ||
|
||
it('pass props to custom button component', async () => { | ||
await expect(elementByLabel('Two')).toExist(); | ||
}); | ||
|
||
it('pass props to custom button component should exist after push pop', async () => { | ||
await expect(elementByLabel('Two')).toExist(); | ||
await elementById(TestIDs.PUSH_BTN).tap(); | ||
await elementById(TestIDs.POP_BTN).tap(); | ||
await expect(elementByLabel('Two')).toExist(); | ||
}); | ||
|
||
it('custom button is clickable', async () => { | ||
await elementByLabel('Two').tap(); | ||
await expect(elementByLabel('Thanks for that :)')).toExist(); | ||
}); | ||
|
||
it(':ios: Reseting buttons should unmount button react view', async () => { | ||
await elementById(TestIDs.SHOW_LIFECYCLE_BTN).tap(); | ||
await elementById(TestIDs.RESET_BUTTONS).tap(); | ||
await expect(elementByLabel('Button component unmounted')).toBeVisible(); | ||
}); | ||
|
||
it('change button props without rendering all buttons', async () => { | ||
await elementById(TestIDs.CHANGE_BUTTON_PROPS).tap(); | ||
await expect(elementByLabel('Three')).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
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
Oops, something went wrong.