react-native-ui-lib 7.42.0-snapshot.7019 → 7.43.0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-ui-lib",
3
- "version": "7.42.0-snapshot.7019",
3
+ "version": "7.43.0",
4
4
  "main": "src/index.js",
5
5
  "types": "src/index.d.ts",
6
6
  "author": "Ethan Sharabi <ethan.shar@gmail.com>",
@@ -1,5 +1,5 @@
1
- import React, { useCallback, useContext, useState, useMemo, useRef, useEffect } from 'react';
2
- import { StyleSheet, findNodeHandle, AccessibilityInfo } from 'react-native';
1
+ import React, { useCallback, useContext, useState, useMemo } from 'react';
2
+ import { StyleSheet } from 'react-native';
3
3
  import Reanimated, { useAnimatedStyle, useAnimatedReaction, runOnJS } from 'react-native-reanimated';
4
4
  // import {Freeze} from 'react-freeze';
5
5
  import TabBarContext from "./TabBarContext";
@@ -23,8 +23,6 @@ export default function TabPage({
23
23
  containerWidth
24
24
  } = useContext(TabBarContext);
25
25
  const [shouldLoad, setLoaded] = useState(!lazy);
26
- const [isActive, setIsActive] = useState(false);
27
- const pageRef = useRef(null);
28
26
  // const [focused, setFocused] = useState(false);
29
27
 
30
28
  const lazyLoad = useCallback(() => {
@@ -37,11 +35,13 @@ export default function TabPage({
37
35
  useAnimatedReaction(() => {
38
36
  return currentPage.value;
39
37
  }, (currentPage /* , previousPage */) => {
40
- const newIsActive = currentPage === index;
41
- if (newIsActive !== isActive) {
42
- runOnJS(setIsActive)(newIsActive);
43
- }
44
- if (newIsActive) {
38
+ const isActive = currentPage === index;
39
+ // const wasActive = previousPage === index;
40
+ // const nearActive = asCarousel && (currentPage - 1 === index || currentPage + 1 === index);
41
+ // const wasNearActive =
42
+ // asCarousel && previousPage !== null && (previousPage - 1 === index || previousPage + 1 === index);
43
+
44
+ if (isActive) {
45
45
  runOnJS(lazyLoad)();
46
46
  }
47
47
 
@@ -50,23 +50,7 @@ export default function TabPage({
50
50
  // } else if (wasActive || wasNearActive) {
51
51
  // runOnJS(setFocused)(false);
52
52
  // }
53
- }, [currentPage, lazyLoad, isActive]);
54
- useEffect(() => {
55
- let timeoutId;
56
- if (isActive && pageRef.current && shouldLoad) {
57
- timeoutId = setTimeout(() => {
58
- const node = findNodeHandle(pageRef.current);
59
- if (node) {
60
- AccessibilityInfo.setAccessibilityFocus(node);
61
- }
62
- }, 100);
63
- }
64
- return () => {
65
- if (timeoutId) {
66
- clearTimeout(timeoutId);
67
- }
68
- };
69
- }, [isActive, shouldLoad]);
53
+ }, [currentPage, lazyLoad]);
70
54
  const animatedPageStyle = useAnimatedStyle(() => {
71
55
  const isActive = Math.round(currentPage.value) === index;
72
56
 
@@ -85,7 +69,7 @@ export default function TabPage({
85
69
  width: asCarousel ? containerWidth : undefined
86
70
  }, style];
87
71
  }, [asCarousel, animatedPageStyle, containerWidth, style]);
88
- return <Reanimated.View ref={pageRef} style={_style} testID={testID} accessible={false}>
72
+ return <Reanimated.View style={_style} testID={testID}>
89
73
  {!shouldLoad && renderLoading?.()}
90
74
  {shouldLoad && props.children}
91
75
  {/* <Freeze freeze={!shouldLoad || !focused}>{props.children}</Freeze> */}