@@ -19,6 +19,7 @@ import {
19
19
ImageStyle ,
20
20
TouchableWithoutFeedback ,
21
21
LayoutChangeEvent ,
22
+ StyleSheet ,
22
23
} from 'react-native' ;
23
24
import Animated , {
24
25
EasingNode ,
@@ -218,14 +219,16 @@ const FloatingLabelInput: React.ForwardRefRenderFunction<InputRef, Props> = (
218
219
const [ secureText , setSecureText ] = useState ( true ) ;
219
220
const inputRef = useRef < any > ( null ) ;
220
221
221
- customLabelStyles = {
222
- fontSizeFocused : 10 ,
223
- fontSizeBlurred : 14 ,
224
- colorFocused : '#49658c' ,
225
- colorBlurred : '#49658c' ,
226
- ...setGlobalStyles ?. customLabelStyles ,
227
- ...customLabelStyles ,
228
- } ;
222
+ customLabelStyles = StyleSheet . flatten ( [
223
+ {
224
+ fontSizeFocused : 10 ,
225
+ fontSizeBlurred : 14 ,
226
+ colorFocused : '#49658c' ,
227
+ colorBlurred : '#49658c' ,
228
+ } ,
229
+ setGlobalStyles ?. customLabelStyles ,
230
+ customLabelStyles ,
231
+ ] ) ;
229
232
230
233
const [ fontColorAnimated ] = useState ( new Animated . Value ( 0 ) ) ;
231
234
@@ -499,32 +502,34 @@ const FloatingLabelInput: React.ForwardRefRenderFunction<InputRef, Props> = (
499
502
? customShowPasswordImage || makeVisibleWhite
500
503
: customHidePasswordImage || makeInvisibleWhite ;
501
504
502
- const style : TextStyle = {
503
- ...setGlobalStyles ?. labelStyles ,
504
- ...labelStyles ,
505
- left : labelStyles ?. left !== undefined ? labelStyles ?. left : 5 ,
506
- fontSize : staticLabel
507
- ? customLabelStyles ?. fontSizeFocused !== undefined
508
- ? customLabelStyles . fontSizeFocused
509
- : 10
510
- : ! isFocusedState
511
- ? customLabelStyles . fontSizeBlurred
512
- : customLabelStyles . fontSizeFocused ,
513
- // @ts -ignore
514
- color : interpolateColors ( fontColorAnimated , {
515
- inputRange : [ 0 , 1 ] ,
516
- outputColorRange : [
517
- // @ts -ignore
518
- customLabelStyles . colorBlurred ,
519
- // @ts -ignore
520
- customLabelStyles . colorFocused ,
521
- ] ,
522
- } ) ,
523
- alignSelf : 'center' ,
524
- position : 'absolute' ,
525
- flex : 1 ,
526
- zIndex : 999 ,
527
- } ;
505
+ const style : TextStyle = StyleSheet . flatten ( [
506
+ setGlobalStyles ?. labelStyles ,
507
+ labelStyles ,
508
+ {
509
+ left : labelStyles ?. left !== undefined ? labelStyles ?. left : 5 ,
510
+ fontSize : staticLabel
511
+ ? customLabelStyles ?. fontSizeFocused !== undefined
512
+ ? customLabelStyles . fontSizeFocused
513
+ : 10
514
+ : ! isFocusedState
515
+ ? customLabelStyles . fontSizeBlurred
516
+ : customLabelStyles . fontSizeFocused ,
517
+ // @ts -ignore
518
+ color : interpolateColors ( fontColorAnimated , {
519
+ inputRange : [ 0 , 1 ] ,
520
+ outputColorRange : [
521
+ // @ts -ignore
522
+ customLabelStyles . colorBlurred ,
523
+ // @ts -ignore
524
+ customLabelStyles . colorFocused ,
525
+ ] ,
526
+ } ) ,
527
+ alignSelf : 'center' ,
528
+ position : 'absolute' ,
529
+ flex : 1 ,
530
+ zIndex : 999 ,
531
+ } ,
532
+ ] ) ;
528
533
529
534
let input : TextStyle =
530
535
inputStyles !== undefined
@@ -533,13 +538,15 @@ const FloatingLabelInput: React.ForwardRefRenderFunction<InputRef, Props> = (
533
538
? setGlobalStyles . inputStyles
534
539
: styles . input ;
535
540
536
- input = {
537
- ...input ,
538
- flex : 1 ,
539
- color :
540
- input . color !== undefined ? input . color : customLabelStyles . colorFocused ,
541
- zIndex : style ?. zIndex !== undefined ? style . zIndex - 2 : 0 ,
542
- } ;
541
+ input = StyleSheet . flatten ( [
542
+ input ,
543
+ {
544
+ flex : 1 ,
545
+ color :
546
+ input . color !== undefined ? input . color : customLabelStyles . colorFocused ,
547
+ zIndex : style ?. zIndex !== undefined ? style . zIndex - 2 : 0 ,
548
+ }
549
+ ] ) ;
543
550
544
551
containerStyles =
545
552
containerStyles !== undefined
@@ -548,13 +555,15 @@ const FloatingLabelInput: React.ForwardRefRenderFunction<InputRef, Props> = (
548
555
? setGlobalStyles ?. containerStyles
549
556
: styles . container ;
550
557
551
- containerStyles = {
552
- ...containerStyles ,
553
- alignItems : 'center' ,
554
- flexDirection : 'row' ,
555
- flex : 1 ,
556
- zIndex : style ?. zIndex !== undefined ? style . zIndex - 6 : 0 ,
557
- } ;
558
+ containerStyles = StyleSheet . flatten ( [
559
+ containerStyles ,
560
+ {
561
+ alignItems : 'center' ,
562
+ flexDirection : 'row' ,
563
+ flex : 1 ,
564
+ zIndex : style ?. zIndex !== undefined ? style . zIndex - 6 : 0 ,
565
+ }
566
+ ] ) ;
558
567
559
568
let toggleButton =
560
569
showPasswordContainerStyles !== undefined
@@ -563,10 +572,12 @@ const FloatingLabelInput: React.ForwardRefRenderFunction<InputRef, Props> = (
563
572
? setGlobalStyles . showPasswordContainerStyles
564
573
: styles . toggleButton ;
565
574
566
- toggleButton = {
567
- ...toggleButton ,
568
- alignSelf : 'center' ,
569
- } ;
575
+ toggleButton = StyleSheet . flatten ( [
576
+ toggleButton ,
577
+ {
578
+ alignSelf : 'center' ,
579
+ } ,
580
+ ] ) ;
570
581
571
582
let img =
572
583
showPasswordImageStyles !== undefined
@@ -575,17 +586,19 @@ const FloatingLabelInput: React.ForwardRefRenderFunction<InputRef, Props> = (
575
586
? setGlobalStyles . showPasswordImageStyles
576
587
: styles . img ;
577
588
578
- img = {
579
- height : 25 ,
580
- width : 25 ,
581
- ...img ,
582
- } ;
583
-
584
- const countdown = {
585
- ...styles . countdown ,
586
- ...setGlobalStyles ?. showCountdownStyles ,
587
- ...showCountdownStyles ,
588
- } ;
589
+ img = StyleSheet . flatten ( [
590
+ {
591
+ height : 25 ,
592
+ width : 25 ,
593
+ } ,
594
+ img ,
595
+ ] ) ;
596
+
597
+ const countdown = StyleSheet . flatten ( [
598
+ styles . countdown ,
599
+ setGlobalStyles ?. showCountdownStyles ,
600
+ showCountdownStyles ,
601
+ ] ) ;
589
602
590
603
function onChangeTextCallback ( val : string ) : void | undefined {
591
604
if ( onChangeText === undefined ) return undefined ;
0 commit comments