描述 / 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
描述 / 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};
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