Skip to content

Commit b57bb68

Browse files
committed
fix: Fix element measure function not returning sometimes
1 parent 01d5f33 commit b57bb68

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

.changeset/dirty-drinks-bathe.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@plextv/react-native-lightning": patch
3+
---
4+
5+
fix: Fix measure function not returning in some cases

packages/react-native-lightning/src/plugins/reactNativePolyfillsPlugin.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,9 @@ export const reactNativePolyfillsPlugin = (): Plugin => {
150150
onCreateInstance(instance) {
151151
const nativeInstance = instance as LightningNativeViewElement;
152152

153-
// Initialize the load promise to resolve when the instance is laid out
153+
// Initialize the load promise to resolve when the instance is available
154154
nativeInstance.__loadPromise = new Promise<void>((resolve) => {
155-
nativeInstance.once('layout', () => {
155+
nativeInstance.once('inViewport', () => {
156156
nativeInstance.__loaded = true;
157157
resolve();
158158
});

0 commit comments

Comments
 (0)