react-native-ui-custom
v0.0.3
Published
标签(空格分隔): 未分类
Downloads
4
Readme
react-naitve ui组件
标签(空格分隔): 未分类
TreeView 属性
data 数据源
onExpend 展开时获取查询下级数据的事件 需要数据格式:
{ name:'',//名称 children:[],//子节点 isOpen:false,//是否展开 isLeave:'是否叶子节点' }
样例
import { TreeView } from 'react-native-ui-custom';
export default function Default() {
const [expanded, setExpanded] = useState(true);
const [dataSource, setDataSource] = useState([]);
useEffect(() => {
SplashScreen.hide();
getScript();
}, []);
async function getInitData() {
//查询首次加载的数据
}
async function GetDeptChild(name) {
const dataChild = ...;//查询下级数据
return dataChild;
}
function goTo(address, parm) {
const { navigation } = props;
navigation.navigate(address, parm);
}
function _handlePress() {
setExpanded(!expanded);
}
return (
<View style={{
padding: 10,
flex: 1
}}>
<TreeView data={dataSource} onExpend={GetDeptChild} />
</View>
);
}