54 lines
2.2 KiB
React
54 lines
2.2 KiB
React
// Metro module 4556 (f4557).
|
|
import _objectWithoutProperties from "./_objectWithoutProperties";
|
|
import Module19 from "react";
|
|
import { View } from "react-native";
|
|
import Module4557, { Commands } from "./Module4557";
|
|
import { isSearchBarAvailableForCurrentPlatform, parseBooleanToOptionalBooleanNativeProp } from "./Module4548";
|
|
const _excluded = ["obscureBackground", "hideNavigationBar", "onFocus", "onBlur", "onSearchButtonPress", "onCancelButtonPress", "onChangeText"];
|
|
export default Module19.forwardRef(function SearchBar(props, a1) {
|
|
let callback;
|
|
const ref = Module19.useRef(null);
|
|
Module19.useImperativeHandle(a1, () => ({
|
|
blur: () => {
|
|
callback((a0) => Commands.blur(a0));
|
|
},
|
|
focus: () => {
|
|
callback((a0) => Commands.focus(a0));
|
|
},
|
|
toggleCancelButton: (c29411_0) => {
|
|
callback((a0) => Commands.toggleCancelButton(a0, c29411_0));
|
|
},
|
|
clearText: () => {
|
|
callback((a0) => Commands.clearText(a0));
|
|
},
|
|
setText: (c29412_0) => {
|
|
callback((a0) => Commands.setText(a0, c29412_0));
|
|
},
|
|
cancelSearch: () => {
|
|
callback((a0) => Commands.cancelSearch(a0));
|
|
}
|
|
}));
|
|
callback = Module19.useCallback((a0) => {
|
|
const current = ref.current;
|
|
if (current) {
|
|
a0(current);
|
|
} else {
|
|
console.warn("Reference to native search bar component has not been updated yet");
|
|
}
|
|
}, [ref]);
|
|
if (isSearchBarAvailableForCurrentPlatform) {
|
|
let autoCapitalize = props.autoCapitalize;
|
|
if (autoCapitalize == null) {
|
|
autoCapitalize = "systemDefault";
|
|
}
|
|
const r13 = {
|
|
...props,
|
|
autoCapitalize
|
|
};
|
|
const { obscureBackground, hideNavigationBar, onFocus, onBlur, onSearchButtonPress, onCancelButtonPress, onChangeText } = r13;
|
|
return <Module4557 ref={ref} {..._objectWithoutProperties(r13, _excluded)} obscureBackground={parseBooleanToOptionalBooleanNativeProp(obscureBackground)} hideNavigationBar={parseBooleanToOptionalBooleanNativeProp(hideNavigationBar)} onSearchFocus={onFocus} onSearchBlur={onBlur} onSearchButtonPress={onSearchButtonPress} onCancelButtonPress={onCancelButtonPress} onChangeText={onChangeText} />;
|
|
}
|
|
console.warn("Importing SearchBar is only valid on iOS and Android devices.");
|
|
return View;
|
|
});
|