@fruits-chain/react-native-xiaoshu
Version:
🌈 React Native UI library
28 lines (27 loc) • 619 B
JavaScript
;
import React, { useRef, memo } from 'react';
import { View } from 'react-native';
import { jsx as _jsx } from "react/jsx-runtime";
const activeStyle = {
flex: 1
};
const inactiveStyle = {
flex: 1,
display: 'none'
};
const TabView = ({
children,
active,
lazyRender = true
}) => {
const Activated = useRef(!lazyRender);
if (active) {
Activated.current = true;
}
return /*#__PURE__*/_jsx(View, {
style: active ? activeStyle : inactiveStyle,
children: Activated.current ? children : null
});
};
export default /*#__PURE__*/memo(TabView);
//# sourceMappingURL=tab-view.js.map