Skip to content
This repository was archived by the owner on Jan 14, 2026. It is now read-only.
This repository was archived by the owner on Jan 14, 2026. It is now read-only.

react-native-reanimated中useAnimatedStyle 不支持高度height、paddingBottom的样式动画属性 #13

@ganghongli

Description

@ganghongli

描述 / Description

react-native-reanimated中useAnimatedStyle 不支持 { paddingBottom: }、{height:}的动画属性,但支持 { bottom: ***}、 { top: ***}动画属性,请查看下方代码可以复现

复现步骤 / Steps to reproduce

import React, { forwardRef, useCallback, useMemo } from "react";
import { View ,TextInput,StyleSheet} from "react-native";
import Reanimated, {
useAnimatedStyle
} from "react-native-reanimated";
const TestAvoidingView = ( {
behavior,
})=>{
const animatedStyle = useAnimatedStyle(() => {
switch (behavior) {
case "height":
return {height:800};

    case "position":
      return { bottom: 200 };

    case "padding":
      return { paddingBottom: 200 };
    default:
      return {};
  }
}, [behavior]);

return (
<Reanimated.View
style={animatedStyle}
>
<TextInput
style={styles.textInput}
key='test001'
keyboardType="default"
placeholder={请点击弹起键盘}
/>
<TextInput
style={styles.textInput}
key='test03'
keyboardType="default"
placeholder={请点击弹起键盘}
/>
<TextInput
style={styles.textInput}
key='test0233'
keyboardType="default"
placeholder={请点击弹起键盘}
/>
</Reanimated.View>
);
}
const styles = StyleSheet.create({
textInput: {
height: 45,
borderColor: "#000000",
borderWidth: 1,
borderRadius: 10,
marginBottom: 10,
paddingLeft: 10,
backgroundColor:'yellow'
}
});
export default TestAvoidingView;

库版本 / Library version

3.6.3

React Native OpenHarmony version

0.72.33

构建类型 / Build type

Debug app & dev bundle

设备 / Device

Real device

设备版本 / Device model

HUAWEI mate 60 NEXT.0.0.71

已悉知 / Acknowledgements

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions