Eva*_*nss 5 typescript react-native
如何在 TypeScript 中为 React Native 的 onLayout 事件指定类型?
const handleOnLayout = (e: SomeTypeHere) => {
// stuff
};
<View onLayout={handleOnLayout}>
<Text>Hi</Text>
</View>
Run Code Online (Sandbox Code Playgroud)
小智 13
此方法返回LayoutChangeEvent
具有这些属性的{nativeEvent: { layout: {x, y, width, height}}}
导入:
import { LayoutChangeEvent } from "react-native";
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
1808 次 |
最近记录: |