我已经围绕 ScrollView 编写了一个简单的包装组件,它根据给定的可用高度启用/禁用滚动:
import React, {useCallback, useEffect, useRef, useState} from 'react';
import {Keyboard, ScrollView} from 'react-native';
import {deviceHeight} from '../../../platform';
export default function ScrollingForm({
availableHeight = deviceHeight,
children,
}) {
const [scrollEnabled, setScrollEnabled] = useState(true);
const [formHeight, setFormHeight] = useState(0);
const scrollingForm = useRef(null);
const checkScrollViewEnabled = useCallback(() => {
setScrollEnabled(formHeight > availableHeight);
}, [availableHeight, formHeight]);
const onFormLayout = async event => {
await setFormHeight(event.nativeEvent.layout.height);
checkScrollViewEnabled();
};
useEffect(() => {
Keyboard.addListener('keyboardDidHide', checkScrollViewEnabled);
// cleanup function
return () => {
Keyboard.removeListener('keyboardDidHide', …
Run Code Online (Sandbox Code Playgroud) 我有一个用Java构建的Web API,它将数据库信息返回给SPA.我需要在发送响应之前使用AAD Graph API检查用户的组信息.现在,Web API接受请求并读取用户的令牌(eyJ ...).
应用程序准备好代表用户向Graph API发送请求的后续步骤是什么?
我尝试使用Authorization:Bearer ey ...使用用户令牌发送请求,但收到Authentication_MissingOrMalformed错误.我还尝试了对应用程序清单和委派权限的各种编辑,没有运气.