Skip to content

Commit

Permalink
Android tested and worked with new SafeAreaView dependency. Now even …
Browse files Browse the repository at this point in the history
…on the Android, its design is perfect :)
  • Loading branch information
WrathChaos committed Dec 11, 2019
1 parent 8cc581b commit f66de72
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 13 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ npm i react-native-header-search-bar
"react-native": ">= 0.55.x",
"react-native-androw": ">= 0.0.33",
"react-native-vector-icons": ">= 6.6.0",
"react-native-safe-area-context": ">= 0.6.1",
"react-native-dynamic-vector-icons": ">= 0.2.1",
"@freakycoder/react-native-helpers": ">= 0.0.21"
```
Expand Down
1 change: 1 addition & 0 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"react-native-dynamic-vector-icons": "^0.2.1",
"react-native-header-search-bar": "0.1.3",
"react-native-material-ripple": "^0.9.1",
"react-native-safe-area-context": "^0.6.1",
"react-native-vector-icons": "^6.6.0"
},
"devDependencies": {
Expand Down
9 changes: 6 additions & 3 deletions lib/src/HeaderClassicSearchBar/HeaderClassicSearchBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,22 @@ import PropTypes from "prop-types";
import { View } from "react-native";
import styles, {
shadowStyle,
container
container,
searchboxContainer
} from "../HeaderClassicSearchBar/HeaderClassicSearchBar.style";
import Androw from "react-native-androw";
import SearchBox from "../components/SearchBox/SearchBox";
import Icon from "react-native-dynamic-vector-icons";
import Ripple from "react-native-material-ripple";
import { useSafeArea } from "react-native-safe-area-context";

const HeaderClassicSearchBar = props => {
const { shadowColor, backgroundColor, onPress } = props;
const insets = useSafeArea();
return (
<Androw style={shadowStyle(shadowColor)}>
<View style={container(backgroundColor)}>
<View style={styles.searchboxContainer}>
<View style={container(backgroundColor, insets)}>
<View style={searchboxContainer(insets)}>
<SearchBox searchBoxWidth="80%" {...props} />
<Ripple
rippleColor="gray"
Expand Down
23 changes: 14 additions & 9 deletions lib/src/HeaderClassicSearchBar/HeaderClassicSearchBar.style.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,28 @@ export const shadowStyle = shadowColor => {
};
};

export const container = backgroundColor => {
export const container = (backgroundColor, insets) => {
return {
height: isAndroid ? 70 : 115,
width: "100%",
backgroundColor,
borderBottomEndRadius: 24,
borderBottomStartRadius: 24
borderBottomStartRadius: 24,
height: isAndroid ? insets.top + 70 : 115
};
};

export const searchboxContainer = insets => ({
flexDirection: "row",
alignItems: "center",
justifyContent: "space-around",
marginTop: hasNotch()
? getStatusBarHeight() + 16
: isAndroid
? insets.top + 16
: 0
});

export default {
searchboxContainer: {
flexDirection: "row",
alignItems: "center",
justifyContent: "space-around",
marginTop: hasNotch() ? getStatusBarHeight() + 16 : isAndroid? 16 : 0
},
rippleContainer: {
bottom: 2,
width: 35,
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-header-search-bar",
"version": "0.1.3",
"version": "0.1.4",
"description": "Fully customizable header search bar for React Native",
"keywords": [
"header",
Expand Down Expand Up @@ -30,6 +30,7 @@
"react-native": ">= 0.55.x",
"react-native-androw": ">= 0.0.33",
"react-native-vector-icons": ">= 6.6.0",
"react-native-safe-area-context": ">= 0.6.1",
"react-native-dynamic-vector-icons": ">= 0.2.1",
"@freakycoder/react-native-helpers": ">= 0.0.21"
}
Expand Down

0 comments on commit f66de72

Please sign in to comment.