@@ -633,44 +633,6 @@ export interface SearchBarProps {
633
633
* Indicates whether to obscure the underlying content
634
634
*/
635
635
obscureBackground ?: boolean ;
636
- /**
637
- * A callback that gets called when search bar has lost focus
638
- */
639
- onBlur ?: ( e : NativeSyntheticEvent < TargetedEvent > ) => void ;
640
- /**
641
- * A callback that gets called when the cancel button is pressed
642
- *
643
- * @platform ios
644
- */
645
- onCancelButtonPress ?: ( e : NativeSyntheticEvent < TargetedEvent > ) => void ;
646
-
647
- /**
648
- * A callback that gets called when the text changes. It receives the current text value of the search bar.
649
- */
650
- onChangeText ?: ( e : NativeSyntheticEvent < TextInputFocusEventData > ) => void ;
651
-
652
- /**
653
- * A callback that gets called when search bar is closed
654
- *
655
- * @platform android
656
- */
657
- onClose ?: ( ) => void ;
658
- /**
659
- * A callback that gets called when search bar has received focus
660
- */
661
- onFocus ?: ( e : NativeSyntheticEvent < TargetedEvent > ) => void ;
662
- /**
663
- * A callback that gets called when search bar is opened
664
- *
665
- * @platform android
666
- */
667
- onOpen ?: ( ) => void ;
668
- /**
669
- * A callback that gets called when the search button is pressed. It receives the current text value of the search bar.
670
- */
671
- onSearchButtonPress ?: (
672
- e : NativeSyntheticEvent < TextInputFocusEventData >
673
- ) => void ;
674
636
/**
675
637
* Text displayed when search field is empty
676
638
*/
@@ -714,23 +676,42 @@ export interface SearchBarProps {
714
676
shouldShowHintSearchIcon ?: boolean ;
715
677
}
716
678
717
- /**
718
- * Since the search bar is a component that is extended from View on iOS,
719
- * we can't use onFocus and onBlur events directly there (as of the event naming conflicts).
720
- * To omit any breaking changes, we're handling this type to rename onFocus and onBlur events
721
- * to onSearchFocus and onSearchBlur inside the native component of the search bar.
722
- */
723
- export type RenamedSearchBarProps = Rename <
724
- SearchBarProps ,
725
- { onFocus : 'onSearchFocus' ; onBlur : 'onSearchBlur' }
726
- > ;
679
+ export interface SearchBarEvents {
680
+ /**
681
+ * A callback that gets called when search bar has received focus
682
+ */
683
+ onFocus ?: ( e : NativeSyntheticEvent < TargetedEvent > ) => void ;
684
+ /**
685
+ * A callback that gets called when search bar has lost focus
686
+ */
687
+ onBlur ?: ( e : NativeSyntheticEvent < TargetedEvent > ) => void ;
688
+ /**
689
+ * A callback that gets called when the search button is pressed. It receives the current text value of the search bar.
690
+ */
691
+ onSearchButtonPress ?: (
692
+ e : NativeSyntheticEvent < TextInputFocusEventData >
693
+ ) => void ;
694
+ /**
695
+ * A callback that gets called when the cancel button is pressed
696
+ *
697
+ * @platform ios
698
+ */
699
+ onCancelButtonPress ?: ( e : NativeSyntheticEvent < TargetedEvent > ) => void ;
727
700
728
- /**
729
- * Helper type, used to rename certain keys in the interface, given from object.
730
- */
731
- type Rename <
732
- T ,
733
- R extends {
734
- [ K in keyof R ] : K extends keyof T ? PropertyKey : 'Error: key not in T' ;
735
- }
736
- > = { [ P in keyof T as P extends keyof R ? R [ P ] : P ] : T [ P ] } ;
701
+ /**
702
+ * A callback that gets called when the text changes. It receives the current text value of the search bar.
703
+ */
704
+ onChangeText ?: ( e : NativeSyntheticEvent < TextInputFocusEventData > ) => void ;
705
+ /**
706
+ * A callback that gets called when search bar is opened
707
+ *
708
+ * @platform android
709
+ */
710
+ onOpen ?: ( ) => void ;
711
+ /**
712
+ * A callback that gets called when search bar is closed
713
+ *
714
+ * @platform android
715
+ */
716
+ onClose ?: ( ) => void ;
717
+ }
0 commit comments