@@ -88,7 +88,7 @@ class GifSearch extends PureComponent {
88
88
if ( props . numColumns != null ) {
89
89
this . numColumns = props . numColumns ;
90
90
this . horizontal = false ;
91
- this . gifSize = Dimensions . get ( 'window' ) . width / this . numColumns - 20 ;
91
+ this . gifSize = Dimensions . get ( 'window' ) . width / this . numColumns - 15 ;
92
92
}
93
93
this . provider = providers . ALL ;
94
94
if ( props . provider != null ) {
@@ -352,7 +352,7 @@ class GifSearch extends PureComponent {
352
352
}
353
353
if ( this . numColumns > 1 ) {
354
354
Dimensions . addEventListener ( 'change' , ( ) => {
355
- this . setState ( { gifSize : Dimensions . get ( 'window' ) . width / this . numColumns - 20 } )
355
+ this . setState ( { gifSize : Dimensions . get ( 'window' ) . width / this . numColumns - 15 } )
356
356
} )
357
357
}
358
358
}
@@ -369,12 +369,13 @@ class GifSearch extends PureComponent {
369
369
(
370
370
< View style = { [ this . styles . view , this . props . style ] } >
371
371
372
- < View style = { { flexDirection : 'row' , alignSelf : 'stretch' , alignItems : 'center' , justifyContent : 'center' } } >
372
+ { /** EDIT: input box should fill whole space */ }
373
+ < View style = { { flexDirection : 'row' , alignSelf : 'stretch' , alignItems : 'center' , justifyContent : 'space-between' } } >
373
374
< TextInput
374
375
placeholder = { this . state . currentGifType == gif_types . GIF ? ( this . placeholderText ) : ( this . stickersPlaceholderText ) }
375
376
placeholderTextColor = { this . placeholderTextColor }
376
377
autoCapitalize = 'none'
377
- style = { [ this . styles . textInput , { width : this . providerLogo == null ? '100%' : '60%' } , this . props . textInputStyle ] }
378
+ style = { [ this . styles . textInput , this . props . textInputStyle ] }
378
379
onChangeText = { this . onSearchTermChanged }
379
380
value = { this . state . search_term }
380
381
{ ...this . props . textInputProps }
@@ -383,17 +384,20 @@ class GifSearch extends PureComponent {
383
384
(
384
385
< Image
385
386
source = { this . providerLogo }
386
- style = { { width : '40 %' , height : 50 , resizeMode : 'contain' } }
387
+ style = { { width : '25 %' , height : 50 , resizeMode : 'contain' } }
387
388
/>
388
389
)
389
390
:
390
391
( null )
391
392
}
392
393
</ View >
393
- { this . gifType == gif_types . ALL ?
394
+ {
395
+ /** EDIT: flex: 1 results in height-stretched buttons */
396
+ this . gifType == gif_types . ALL ?
394
397
(
395
- < View style = { { flex : 1 , flexDirection :'row' , justifyContent :'center' , paddingBottom : 5 } } >
398
+ < View style = { { flexDirection :'row' , alignItems :'center' , marginVertical : 5 } } >
396
399
400
+ { /** EDIT: margin between buttons only, not on their end-sides */ }
397
401
< TouchableOpacity
398
402
style = { this . state . currentGifType != gif_types . GIF ? ( [ this . styles . gifTypeButton , this . props . showGifsButtonStyle ] )
399
403
: ( [ this . styles . gifTypeButton , this . props . showGifsButtonStyle , this . styles . gifTypeButtonSelected , this . props . showGifsButtonSelectedStyle ] ) }
@@ -405,9 +409,10 @@ class GifSearch extends PureComponent {
405
409
{ this . showGifsButtonText }
406
410
</ Text >
407
411
</ TouchableOpacity >
412
+
408
413
< TouchableOpacity
409
- style = { this . state . currentGifType != gif_types . STICKER ? ( [ this . styles . gifTypeButton , this . props . showStickersButtonStyle ] )
410
- : ( [ this . styles . gifTypeButton , this . props . showStickersButtonStyle , this . styles . gifTypeButtonSelected , this . props . showStickersButtonSelectedStyle ] ) }
414
+ style = { this . state . currentGifType != gif_types . STICKER ? ( [ this . styles . gifTypeButton , this . styles . stickerTypeButton , this . props . showStickersButtonStyle ] )
415
+ : ( [ this . styles . gifTypeButton , this . styles . stickerTypeButton , this . props . showStickersButtonStyle , this . styles . gifTypeButtonSelected , this . props . showStickersButtonSelectedStyle ] ) }
411
416
onPress = { this . showStickersButtonPressed }
412
417
>
413
418
< Text style = { this . state . currentGifType != gif_types . STICKER ? ( [ this . styles . gifTypeButtonText , this . props . showStickersButtonTextStyle ] )
@@ -424,7 +429,7 @@ class GifSearch extends PureComponent {
424
429
}
425
430
< FlatList
426
431
onEndReached = { this . loadMoreGifs }
427
- onEndReachedThreshold = { 0.98 }
432
+ onEndReachedThreshold = { 0.8 /** EDIT */ }
428
433
onScroll = { this . handleScroll }
429
434
keyboardShouldPersistTaps = { "handled" }
430
435
style = { [ this . styles . gifList , this . props . gifListStyle ] }
@@ -435,8 +440,8 @@ class GifSearch extends PureComponent {
435
440
showsHorizontalScrollIndicator = { this . showScrollBar }
436
441
showsVerticalScrollIndicator = { this . showScrollBar }
437
442
{ ...this . props . gifListProps }
438
- renderItem = { ( { item} ) => {
439
-
443
+ renderItem = { ( { item, index } ) => {
444
+ // EDIT: no right margin for last image column
440
445
var aspect_ratio = null ;
441
446
var gif_preview = null ;
442
447
var gif_better_quality = null ;
@@ -464,7 +469,7 @@ class GifSearch extends PureComponent {
464
469
465
470
< Image
466
471
resizeMode = { 'cover' }
467
- style = { [ this . styles . image , this . numColumns > 1 ? { width :this . state . gifSize , minHeight : this . state . gifSize , maxHeight :this . state . gifSize } : { aspectRatio : aspect_ratio ? aspect_ratio : 4 / 3 , height : 150 } , this . props . gifStyle ] }
472
+ style = { [ this . styles . image , ( index + 1 ) % this . numColumns === 0 ? this . styles . lastColumnImage : { } , this . numColumns > 1 ? { width :this . state . gifSize , minHeight : this . state . gifSize , maxHeight :this . state . gifSize } : { aspectRatio : aspect_ratio ? aspect_ratio : 4 / 3 , height : 150 } , this . props . gifStyle ] }
468
473
source = { { uri : gif_preview } }
469
474
/>
470
475
</ TouchableOpacity >
@@ -505,6 +510,7 @@ class GifSearch extends PureComponent {
505
510
padding : 10 ,
506
511
} ,
507
512
textInput : {
513
+ flex : 1 ,
508
514
height : 50 ,
509
515
fontSize : 20 ,
510
516
paddingLeft : 10 ,
@@ -515,9 +521,11 @@ class GifSearch extends PureComponent {
515
521
marginRight : 10 ,
516
522
marginBottom : 10
517
523
} ,
524
+ lastColumnImage : {
525
+ marginRight : 0 ,
526
+ } ,
518
527
gifList : {
519
528
height : 160 ,
520
- margin : 5 ,
521
529
marginBottom : 10 ,
522
530
} ,
523
531
gifTypeButton : {
@@ -526,10 +534,14 @@ class GifSearch extends PureComponent {
526
534
backgroundColor : "black" ,
527
535
borderRadius : 15 ,
528
536
padding : 6 ,
529
- marginHorizontal : 4 ,
537
+ marginRight : 2 ,
530
538
borderColor : "black" ,
531
539
borderWidth : 2
532
540
} ,
541
+ stickerTypeButton : {
542
+ marginRight : 0 ,
543
+ marginLeft : 2
544
+ } ,
533
545
gifTypeButtonSelected : {
534
546
borderColor : "white" ,
535
547
borderWidth : 2
@@ -546,4 +558,3 @@ class GifSearch extends PureComponent {
546
558
}
547
559
548
560
export default GifSearch ;
549
-
0 commit comments