问题描述
使用“react-native-floating-label-input”时遇到什么问题:“^1.3.9” 如果您有任何使用“react-native-floating-label-input”的方法,请给我(附上源代码)。 图像 My problem image
我的代码
import React,{useState} from 'react';
import { StyleSheet,TouchableOpacity,View,Image} from 'react-native';
import { useTranslation,} from 'react-i18next'
import { useNavigation } from '@react-navigation/native';
import styles from './style'
import images from '../../theme/images';
import { colors } from 'react-native-elements';
import { FloatingLabelInput } from 'react-native-floating-label-input';
interface SignInScreenProps {
}
const SignInScreen: React.FC<SignInScreenProps> = () => {
const { t } = useTranslation()
const navigation = useNavigation()
const [phone,setPhone] = useState('')
return (
<View style={styles.container}>
<View>
<Image source={images.logo}
style={styles.logoStyle}>
</Image>
</View>
<View style={{ flex: 1,backgroundColor: colors.white,borderTopLefTradius: 20,borderTopRighTradius: 20}}>
<FloatingLabelInput
label={'label'}
value={phone}
rightComponent={(
<TouchableOpacity style={{ alignContent:'center',justifyContent:'center'}} onPress={()=>{console.log('X clicked')}}></TouchableOpacity>
)}
onChangeText={(val) => setPhone(val)}
/>
</View>
</View>
)
}
export default SignInScreen;
解决方法
1.3.5 或更高版本 - react-native-reanimated v2
-
所有动画现在都使用 react-native-reanimated v2,因为它是 近日正式发布。请关注软件大厦 react-native-reanimated v2 的安装指南: https://docs.swmansion.com/react-native-reanimated/docs/installation
-
OBS.: 如果在 Software Mansion 安装期间指导您的项目 不会构建或构建但在启动时崩溃,请尝试删除 node_modules 文件夹。
-
OBS。 2:如果你不想使用新的 react-native-reanimated v2, 不要升级到这个版本,安装版本 1.3.4 和 react-native-reanimated@1.13.2