@iternio/react-native-auto-play 0.4.6 → 0.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -2,7 +2,6 @@ import React from 'react';
|
|
|
2
2
|
import { AppRegistry, Platform } from 'react-native';
|
|
3
3
|
import { NitroModules } from 'react-native-nitro-modules';
|
|
4
4
|
import { MapTemplateProvider } from '../components/MapTemplateContext';
|
|
5
|
-
import OnAppearedChildRenderer from '../components/OnAppearedChildRenderer';
|
|
6
5
|
import { SafeAreaInsetsProvider } from '../components/SafeAreaInsetsContext';
|
|
7
6
|
import { HybridAutoPlay } from '../hybrid/HybridAutoPlay';
|
|
8
7
|
import { NitroActionUtil } from '../utils/NitroAction';
|
|
@@ -24,11 +23,7 @@ export class MapTemplate extends Template {
|
|
|
24
23
|
children: React.createElement(SafeAreaInsetsProvider, {
|
|
25
24
|
moduleName: this.id,
|
|
26
25
|
// biome-ignore lint/correctness/noChildrenProp: there is no other way in a ts file
|
|
27
|
-
children: React.createElement(
|
|
28
|
-
// biome-ignore lint/correctness/noChildrenProp: there is no other way in a ts file
|
|
29
|
-
children: React.createElement(component, props),
|
|
30
|
-
moduleName: this.id,
|
|
31
|
-
}),
|
|
26
|
+
children: React.createElement(component, props),
|
|
32
27
|
}),
|
|
33
28
|
}));
|
|
34
29
|
const nitroConfig = {
|
package/package.json
CHANGED
|
@@ -3,7 +3,6 @@ import { AppRegistry, Platform } from 'react-native';
|
|
|
3
3
|
import { NitroModules } from 'react-native-nitro-modules';
|
|
4
4
|
import type { AutoText } from '..';
|
|
5
5
|
import { MapTemplateProvider } from '../components/MapTemplateContext';
|
|
6
|
-
import OnAppearedChildRenderer from '../components/OnAppearedChildRenderer';
|
|
7
6
|
import { SafeAreaInsetsProvider } from '../components/SafeAreaInsetsContext';
|
|
8
7
|
import { HybridAutoPlay } from '../hybrid/HybridAutoPlay';
|
|
9
8
|
import type { MapTemplate as NitroMapTemplate } from '../specs/MapTemplate.nitro';
|
|
@@ -197,11 +196,7 @@ export class MapTemplate extends Template<MapTemplateConfig, MapTemplateConfig['
|
|
|
197
196
|
children: React.createElement(SafeAreaInsetsProvider, {
|
|
198
197
|
moduleName: this.id,
|
|
199
198
|
// biome-ignore lint/correctness/noChildrenProp: there is no other way in a ts file
|
|
200
|
-
children: React.createElement(
|
|
201
|
-
// biome-ignore lint/correctness/noChildrenProp: there is no other way in a ts file
|
|
202
|
-
children: React.createElement(component, props),
|
|
203
|
-
moduleName: this.id,
|
|
204
|
-
}),
|
|
199
|
+
children: React.createElement(component, props),
|
|
205
200
|
}),
|
|
206
201
|
})
|
|
207
202
|
);
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
type Props = {
|
|
2
|
-
children: React.ReactNode;
|
|
3
|
-
moduleName: string;
|
|
4
|
-
};
|
|
5
|
-
/**
|
|
6
|
-
* renders the passed children when the specified scene/screen appeared
|
|
7
|
-
* this makes sure child hooks are executed only when the map template is ready
|
|
8
|
-
*/
|
|
9
|
-
export default function OnAppearedChildRenderer({ children, moduleName }: Props): import("react").ReactNode;
|
|
10
|
-
export {};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from 'react';
|
|
2
|
-
import { HybridAutoPlay } from '../hybrid/HybridAutoPlay';
|
|
3
|
-
/**
|
|
4
|
-
* renders the passed children when the specified scene/screen appeared
|
|
5
|
-
* this makes sure child hooks are executed only when the map template is ready
|
|
6
|
-
*/
|
|
7
|
-
export default function OnAppearedChildRenderer({ children, moduleName }) {
|
|
8
|
-
const [didAppear, setDidAppear] = useState(false);
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
let remove = HybridAutoPlay.addListenerRenderState(moduleName, (renderState) => {
|
|
11
|
-
if (renderState === 'didAppear') {
|
|
12
|
-
remove?.();
|
|
13
|
-
remove = null;
|
|
14
|
-
setDidAppear(true);
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
return () => {
|
|
18
|
-
remove?.();
|
|
19
|
-
remove = null;
|
|
20
|
-
};
|
|
21
|
-
}, [moduleName]);
|
|
22
|
-
if (didAppear) {
|
|
23
|
-
return children;
|
|
24
|
-
}
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from 'react';
|
|
2
|
-
import { HybridAutoPlay } from '../hybrid/HybridAutoPlay';
|
|
3
|
-
import type { CleanupCallback } from '../types/Event';
|
|
4
|
-
|
|
5
|
-
type Props = { children: React.ReactNode; moduleName: string };
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* renders the passed children when the specified scene/screen appeared
|
|
9
|
-
* this makes sure child hooks are executed only when the map template is ready
|
|
10
|
-
*/
|
|
11
|
-
export default function OnAppearedChildRenderer({ children, moduleName }: Props) {
|
|
12
|
-
const [didAppear, setDidAppear] = useState(false);
|
|
13
|
-
|
|
14
|
-
useEffect(() => {
|
|
15
|
-
let remove: CleanupCallback | null = HybridAutoPlay.addListenerRenderState(
|
|
16
|
-
moduleName,
|
|
17
|
-
(renderState) => {
|
|
18
|
-
if (renderState === 'didAppear') {
|
|
19
|
-
remove?.();
|
|
20
|
-
remove = null;
|
|
21
|
-
setDidAppear(true);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
return () => {
|
|
27
|
-
remove?.();
|
|
28
|
-
remove = null;
|
|
29
|
-
};
|
|
30
|
-
}, [moduleName]);
|
|
31
|
-
|
|
32
|
-
if (didAppear) {
|
|
33
|
-
return children;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return null;
|
|
37
|
-
}
|