【发布时间】:2021-09-03 16:22:46
【问题描述】:
当我使用“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;
【问题讨论】:
标签: javascript react-native floating-labels