Skip to content

Commit 40889ef

Browse files
committed
refactor: renamed show argument to showing
1 parent 478ba61 commit 40889ef

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class ListScreen extends React.Component {
7575
```jsx
7676
// DetailScreen.js
7777
class DetailScreen extends React.Component {
78-
static sharedElements = (navigation, prevNavigation, show) => {
78+
static sharedElements = (navigation, prevNavigation, showing) => {
7979
const item = navigation.getParam('item');
8080
return [`item.${item.id}.photo`];
8181
};
@@ -136,7 +136,7 @@ The `sharedElements` function receives 3 arguments
136136
| ---------------- | ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
137137
| `navigation` | `NavigationProp` | Navigation prop of the current screen. You can use this to get the params of the screen using `getParam`, or the route-name using `state.routeName` |
138138
| `prevNavigation` | `NavigationProp` | The navigation-prop of the previous screen. You can use this to get the params of that screen using `getParam`, or the route-name using `state.routeName` |
139-
| `show` | `boolean` | `true` when this screen is being shown, and `false` when this screen is being hidden. | |
139+
| `showing` | `boolean` | `true` when this screen is being shown, and `false` when this screen is being hidden. | |
140140

141141
The return value should be either `undefined` or an array of shared-element configs or identifiers. Specifying a string-identifier is shorthand for `{id: 'myid'}`.
142142

@@ -145,7 +145,7 @@ The return value should be either `undefined` or an array of shared-element conf
145145

146146
```js
147147
class DetailScreen extends Component {
148-
static sharedElements = (navigation, prevNavigation, show) => {
148+
static sharedElements = (navigation, prevNavigation, showing) => {
149149
// Transition element `item.${item.id}.photo` when either
150150
// showing or hiding this screen
151151
const item = navigation.getParam('item');
@@ -162,7 +162,7 @@ If you only want to show a transition when transitioning from a particular scree
162162

163163
```js
164164
class DetailScreen extends Component {
165-
static sharedElements = (navigation, prevNavigation, show) => {
165+
static sharedElements = (navigation, prevNavigation, showing) => {
166166
if (prevNavigation.state.routeName === 'List') {
167167
const item = navigation.getParam('item');
168168
return [`item.${item.id}.photo`];
@@ -178,7 +178,7 @@ If the source- and target elements are visually distinct, the consider using a c
178178

179179
```js
180180
class DetailScreen extends Component {
181-
static sharedElements = (navigation, prevNavigation, show) => {
181+
static sharedElements = (navigation, prevNavigation, showing) => {
182182
const item = navigation.getParam('item');
183183
return [{
184184
id: `item.${item.id}.photo`,

src/SharedElementRendererData.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ export interface ISharedElementRendererData {
1919
function getSharedElements(
2020
sceneData: SharedElementSceneData,
2121
otherSceneData: SharedElementSceneData,
22-
show: boolean
22+
showing: boolean
2323
): SharedElementsConfig | null {
2424
const { sharedElements } = sceneData.Component;
2525
if (!sharedElements) return null;
2626
// TODO push/pop distinction?
2727
return normalizeSharedElementsConfig(
28-
sharedElements(sceneData.navigation, otherSceneData.navigation, show)
28+
sharedElements(sceneData.navigation, otherSceneData.navigation, showing)
2929
);
3030
}
3131

src/types.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export type SharedElementAnimatedValue = any;
7676
export type SharedElementsComponentConfig = (
7777
navigation: NavigationProp,
7878
otherNavigation: NavigationProp,
79-
show: boolean
79+
showing: boolean
8080
) => SharedElementsConfig | null;
8181

8282
export type SharedElementSceneComponent = React.ComponentType<any> & {

0 commit comments

Comments
 (0)