@@ -19,15 +19,19 @@ import {
1919 TouchableWithoutFeedback ,
2020 LayoutChangeEvent ,
2121} from 'react-native' ;
22- import Animated , { EasingNode , timing , interpolateColors } from 'react-native-reanimated' ;
22+ import Animated , {
23+ EasingNode ,
24+ timing ,
25+ interpolateColors ,
26+ } from 'react-native-reanimated' ;
2327import { styles } from './styles' ;
2428
2529import makeVisibleWhite from './assets/make_visible_white.png' ;
2630import makeInvisibleWhite from './assets/make_invisible_white.png' ;
2731import makeVisibleBlack from './assets/make_visible_black.png' ;
2832import makeInvisibleBlack from './assets/make_invisible_black.png' ;
2933
30- export interface Props extends TextInputProps {
34+ export interface Props extends Omit < TextInputProps , 'secureTextEntry' > {
3135 /** Style to the container of whole component */
3236 containerStyles ?: ViewStyle ;
3337 /** Changes the color for hide/show password image */
@@ -170,7 +174,6 @@ const FloatingLabelInput: React.ForwardRefRenderFunction<InputRef, Props> = (
170174 currencyDivider,
171175 maskType,
172176 onChangeText,
173- secureTextEntry,
174177 customHidePasswordComponent,
175178 customShowPasswordComponent,
176179 isFocused,
@@ -255,23 +258,23 @@ const FloatingLabelInput: React.ForwardRefRenderFunction<InputRef, Props> = (
255258 ) ;
256259
257260 useEffect ( ( ) => {
258- if ( isFocused === undefined ) {
259- if ( value !== '' || isFocusedState ) {
260- setIsFocused ( true ) ;
261- } else if ( value === '' || value === null ) {
262- setIsFocused ( false ) ;
263- }
261+ if ( isFocused === undefined ) {
262+ if ( value !== '' || isFocusedState ) {
263+ setIsFocused ( true ) ;
264+ } else if ( value === '' || value === null ) {
265+ setIsFocused ( false ) ;
264266 }
267+ }
265268 } , [ value ] ) ;
266269
267270 useEffect ( ( ) => {
268- if ( isFocused !== undefined ) {
269- if ( value !== '' || isFocused ) {
270- setIsFocused ( true ) ;
271- } else {
272- setIsFocused ( false ) ;
273- }
271+ if ( isFocused !== undefined ) {
272+ if ( value !== '' || isFocused ) {
273+ setIsFocused ( true ) ;
274+ } else {
275+ setIsFocused ( false ) ;
274276 }
277+ }
275278 } , [ isFocused , value ] ) ;
276279
277280 useEffect ( ( ) => {
@@ -287,7 +290,7 @@ const FloatingLabelInput: React.ForwardRefRenderFunction<InputRef, Props> = (
287290 }
288291 } else {
289292 animateBlur ( ) ;
290- }
293+ }
291294 } , [ isFocusedState ] ) ;
292295
293296 useImperativeHandle ( ref , ( ) => ( {
@@ -298,7 +301,7 @@ const FloatingLabelInput: React.ForwardRefRenderFunction<InputRef, Props> = (
298301 inputRef . current . blur ( ) ;
299302 } ,
300303 } ) ) ;
301-
304+
302305 useEffect ( ( ) => {
303306 if (
304307 ! staticLabel &&
@@ -343,13 +346,12 @@ const FloatingLabelInput: React.ForwardRefRenderFunction<InputRef, Props> = (
343346 easing : EasingNode . linear ,
344347 } ) ,
345348 ] ) . start ( ) ;
346- } else if ( staticLabel &&
347- isFocusedState ) {
348- Animated . timing ( fontColorAnimated , {
349- toValue : 1 ,
350- duration : animationDuration ? animationDuration : 300 ,
351- easing : EasingNode . linear ,
352- } ) . start ( ) ;
349+ } else if ( staticLabel && isFocusedState ) {
350+ Animated . timing ( fontColorAnimated , {
351+ toValue : 1 ,
352+ duration : animationDuration ? animationDuration : 300 ,
353+ easing : EasingNode . linear ,
354+ } ) . start ( ) ;
353355 }
354356 } , [ halfTop ] ) ;
355357
@@ -393,7 +395,7 @@ const FloatingLabelInput: React.ForwardRefRenderFunction<InputRef, Props> = (
393395 easing : EasingNode . linear ,
394396 } ) ,
395397 ] ) . start ( ) ;
396- } else {
398+ } else {
397399 Animated . timing ( fontColorAnimated , {
398400 toValue : 1 ,
399401 duration : animationDuration ? animationDuration : 300 ,
@@ -435,7 +437,7 @@ const FloatingLabelInput: React.ForwardRefRenderFunction<InputRef, Props> = (
435437 easing : EasingNode . linear ,
436438 } ) ,
437439 ] ) . start ( ) ;
438- } else {
440+ } else {
439441 Animated . timing ( fontColorAnimated , {
440442 toValue : 0 ,
441443 duration : animationDuration ? animationDuration : 300 ,
@@ -494,7 +496,6 @@ const FloatingLabelInput: React.ForwardRefRenderFunction<InputRef, Props> = (
494496 ? customShowPasswordImage || makeVisibleWhite
495497 : customHidePasswordImage || makeInvisibleWhite ;
496498
497-
498499 const style : TextStyle = {
499500 ...setGlobalStyles ?. labelStyles ,
500501 ...labelStyles ,
@@ -508,7 +509,10 @@ const FloatingLabelInput: React.ForwardRefRenderFunction<InputRef, Props> = (
508509 : customLabelStyles . fontSizeFocused ,
509510 color : interpolateColors ( fontColorAnimated , {
510511 inputRange : [ 0 , 1 ] ,
511- outputColorRange : [ customLabelStyles . colorBlurred , customLabelStyles . colorFocused ]
512+ outputColorRange : [
513+ customLabelStyles . colorBlurred ,
514+ customLabelStyles . colorFocused ,
515+ ] ,
512516 } ) ,
513517 alignSelf : 'center' ,
514518 position : 'absolute' ,
0 commit comments