Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Hiroaki KARASAWA
committed
Aug 10, 2019
1 parent
30cbaa5
commit c0649a4
Showing
6 changed files
with
72 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,7 +35,6 @@ src | |
|
||
## TODO | ||
|
||
- [ ] コメント入力 | ||
- [ ] 体組成値のグラフ | ||
- [ ] デザインを整える | ||
- [ ] 未読バッチ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// TODO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import React from "react"; | ||
import { KeyboardAvoidingView } from "react-native"; | ||
import { useStatusBarHeight } from "../hooks/device"; | ||
|
||
export const KeyboardAvoidingContainer: React.FC<{}> = ({ children }) => { | ||
const statusBarHeight = useStatusBarHeight(); | ||
|
||
return ( | ||
<KeyboardAvoidingView | ||
style={{ flex: 1 }} | ||
behavior="padding" | ||
keyboardVerticalOffset={44 + statusBarHeight}> | ||
{children} | ||
</KeyboardAvoidingView> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { NativeModules, Platform, StatusBarIOS } from "react-native"; | ||
import { useState, useEffect } from "react"; | ||
|
||
const { StatusBarManager } = NativeModules; | ||
|
||
export const useStatusBarHeight = () => { | ||
const [statusBarHeight, setStatusBarHeight] = useState(0); | ||
|
||
useEffect(() => { | ||
if (Platform.OS === "ios") { | ||
StatusBarManager.getHeight(statusBarFrameData => { | ||
setStatusBarHeight(statusBarFrameData.height); | ||
}); | ||
|
||
const statusBarListener = StatusBarIOS.addListener( | ||
"statusBarFrameWillChange", | ||
statusBarData => { | ||
setStatusBarHeight(statusBarData.frame.height); | ||
} | ||
); | ||
|
||
return () => { | ||
statusBarListener.remove(); | ||
}; | ||
} | ||
}); | ||
|
||
return statusBarHeight; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters