<commit_before>import React from 'react';
import { SearchBarIOS, SearchBarIosProps } from './SearchBar-ios';
import { SearchBarAndroid, SearchBarAndroidProps } from './SearchBar-android';
import { SearchBarDefault, SearchBarDefaultProps } from './SearchBar-default';
import {
  ActivityIndicatorProps,
  StyleProp,
  TextStyle,
  ViewStyle,
  TextInput,
} from 'react-native';
import { IconNode } from '../Icon';
import { ThemeProps } from '../config';

const SEARCHBAR_COMPONENTS = {
  ios: SearchBarIOS,
  android: SearchBarAndroid,
  default: SearchBarDefault,
};

export type SearchBarBaseProps = React.ComponentPropsWithRef<
  typeof TextInput
> & {
  platform: 'default' | 'ios' | 'android';
  containerStyle?: StyleProp<ViewStyle>;
  inputContainerStyle?: StyleProp<ViewStyle>;
  clearIcon?: IconNode;
  searchIcon?: IconNode;
  inputStyle?: StyleProp<TextStyle>;
  loadingProps?: ActivityIndicatorProps;
  showLoading?: boolean;
  leftIconContainerStyle?: StyleProp<ViewStyle>;
  rightIconContainerStyle?: StyleProp<ViewStyle>;
  onClear?(): void;
  onFocus?(): void;
  onBlur?(): void;
  onChangeText?(text: string): void;
  onCancel?(): void;
};

export type SearchBarProps = SearchBarBaseProps &
  SearchBarDefaultProps &
  SearchBarAndroidProps &
  SearchBarIosProps;

export class SearchBar extends React.Component<
  SearchBarProps & Partial<ThemeProps<SearchBarProps>>
> {
  searchbar!: SearchBarIOS;
  static defaultProps = {
    platform: 'default' as const,
  };

  focus = () => {
    this.searchbar.focus();
  };

  blur = () => {
    this.searchbar.blur();
  };

  clear = () => {
    this.searchbar.clear();
  };

  cancel = () => {
    this.searchbar.cancel && this.searchbar.cancel();
  };

  render() {
    const Component: typeof React.Component =<commit_msg>[SearchBar] Fixes broken types #3089 (#3099)<commit_after>import React from 'react';
import { SearchBarIOS, SearchBarIosProps } from './SearchBar-ios';
import { SearchBarAndroid, SearchBarAndroidProps } from './SearchBar-android';
import { SearchBarDefault, SearchBarDefaultProps } from './SearchBar-default';
import {
  ActivityIndicatorProps,
  StyleProp,
  TextStyle,
  ViewStyle,
  TextInput,
} from 'react-native';
import { IconNode } from '../Icon';
import { ThemeProps } from '../config';

const SEARCHBAR_COMPONENTS = {
  ios: SearchBarIOS,
  android: SearchBarAndroid,
  default: SearchBarDefault,
};

export type SearchBarBaseProps = React.ComponentPropsWithRef<
  typeof TextInput
> & {
  platform?: 'default' | 'ios' | 'android';
  containerStyle?: StyleProp<ViewStyle>;
  inputContainerStyle?: StyleProp<ViewStyle>;
  clearIcon?: IconNode;
  searchIcon?: IconNode;
  inputStyle?: StyleProp<TextStyle>;
  loadingProps?: ActivityIndicatorProps;
  showLoading?: boolean;
  leftIconContainerStyle?: StyleProp<ViewStyle>;
  rightIconContainerStyle?: StyleProp<ViewStyle>;
  onClear?(): void;
  onFocus?(): void;
  onBlur?(): void;
  onChangeText?(text: string): void;
  onCancel?(): void;
};

export type SearchBarProps =
  | SearchBarBaseProps
  | SearchBarDefaultProps
  | SearchBarAndroidProps
  | SearchBarIosProps;

export class SearchBar extends React.Component<
  SearchBarProps & Partial<ThemeProps<SearchBarProps>>
> {
  searchbar!: SearchBarIOS;
  static defaultProps = {
    platform: 'default' as const,
  };

  focus = () => {
    this.searchbar.focus();
  };

  blur = () => {
    this.searchbar.blur();
  };

  clear = () => {
    this.searchbar.clear();
  };

  cancel = () => {
    this.searchbar.cancel && this.searchbar.cancel();
  };

  render() {
    const Component: typeof React.Component =
{'fraction_non_alphanumeric': 0.13422074320576816, 'fraction_numerical': 0.0022185246810870773, 'mean_word_length': 4.662480376766091, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3683539', 'n_tokens_mistral': 1121, 'n_tokens_neox': 1103, 'n_words': 241}