aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael <michael.foiani@gmail.com>2021-07-16 13:06:02 -0400
committerMichael <michael.foiani@gmail.com>2021-07-16 13:06:02 -0400
commitfd2478916a96cb3b75dc2d385d402b4f90b02ce8 (patch)
treeb38509b7d586fee83775849dab639ed5ac74f1aa
parent5d57346e80cbab3d5e0106b3c9edf25670852d71 (diff)
parent17ac3b21f6db0107d3c5eeb8885884fa8cfa5a72 (diff)
Merge branch 'master' into tma954-video-trimming-component
Merging with master that fixes vid quality bugs
-rw-r--r--.github/pull_request_template.md17
-rw-r--r--src/components/common/TaggTypeahead.tsx7
-rw-r--r--src/components/moments/MomentPost.tsx20
-rw-r--r--src/components/notifications/NotificationPill.tsx2
-rw-r--r--src/screens/profile/CaptionScreen.tsx9
-rw-r--r--src/services/MomentService.ts5
6 files changed, 38 insertions, 22 deletions
diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md
index 6d068539..13b198af 100644
--- a/.github/pull_request_template.md
+++ b/.github/pull_request_template.md
@@ -13,6 +13,23 @@
<!--- see how your change affects other areas of the code, etc. -->
- [ ] Requires testing on different screen sizes (iPhone 8, iPhone 11) (optional)
- [ ] Requires testing on different screen sizes (iPhone 12 mini, iPhone 12 Pro Max) (optional)
+- [ ] There is an associated PR [here](URL_HERE)
+
+<!-- Please include steps and expected behavior for "Happy Path" and "Error Handling" when necessary -->
+<!-- E.g. "Tap on Category to select a category (selected category should be displayed)" -->
+* Happy Path
+ * Path 1 description
+ 1. action... (observation...)
+ 2. action... (observation...)
+ * Path 2 description
+ 1. action... (observation...)
+ 2. action... (observation...)
+* Error Handling
+ * ...
+* Existing functionality still works
+ * ...
+* Performance
+ * ...
## Screenshots (if appropriate)
diff --git a/src/components/common/TaggTypeahead.tsx b/src/components/common/TaggTypeahead.tsx
index 672cff69..d5668a38 100644
--- a/src/components/common/TaggTypeahead.tsx
+++ b/src/components/common/TaggTypeahead.tsx
@@ -40,8 +40,7 @@ const TaggTypeahead: React.FC<TaggTypeaheadProps> = ({
}
}, [keyword]);
- const onLayout = (e: LayoutChangeEvent) => {
- setHeight(e.nativeEvent.layout.height);
+ const onLayout = (_e: LayoutChangeEvent) => {
viewRef.current?.measure(
(
_fx: number,
@@ -74,7 +73,6 @@ const TaggTypeahead: React.FC<TaggTypeaheadProps> = ({
return (
<View ref={viewRef} onLayout={onLayout}>
- {/* <View ref={viewRef} onLayout={onLayout}> */}
{!isShowBelowStyle && <View style={styles.overlay} />}
<ScrollView
style={[
@@ -84,6 +82,9 @@ const TaggTypeahead: React.FC<TaggTypeaheadProps> = ({
: {top: -height, margin: margin},
]}
showsVerticalScrollIndicator={false}
+ onLayout={(event) => {
+ setHeight(event.nativeEvent.layout.height);
+ }}
keyboardShouldPersistTaps={'always'}>
{results.map((user) => (
<TaggUserRowCell
diff --git a/src/components/moments/MomentPost.tsx b/src/components/moments/MomentPost.tsx
index 07295369..e789a9bf 100644
--- a/src/components/moments/MomentPost.tsx
+++ b/src/components/moments/MomentPost.tsx
@@ -83,6 +83,7 @@ const MomentPost: React.FC<MomentPostProps> = ({
moment.moment_url.endsWith('GIF') ||
moment.moment_url.endsWith('gif')
);
+ const mediaHeight = SCREEN_WIDTH / aspectRatio;
/*
* Load tags on initial render to pass tags data to moment header and content
@@ -201,14 +202,7 @@ const MomentPost: React.FC<MomentPostProps> = ({
<View style={styles.mainContainer}>
<View style={styles.imageContainer}>
{isVideo ? (
- <View
- ref={imageRef}
- style={[
- styles.media,
- {
- height: SCREEN_WIDTH / aspectRatio,
- },
- ]}>
+ <View ref={imageRef}>
<Video
ref={videoRef}
source={{
@@ -218,7 +212,7 @@ const MomentPost: React.FC<MomentPostProps> = ({
style={[
styles.media,
{
- height: SCREEN_WIDTH / aspectRatio,
+ height: mediaHeight,
},
]}
repeat={true}
@@ -233,7 +227,12 @@ const MomentPost: React.FC<MomentPostProps> = ({
) : (
<Image
source={{uri: moment.moment_url}}
- style={styles.media}
+ style={[
+ styles.media,
+ {
+ height: mediaHeight,
+ },
+ ]}
resizeMode={'contain'}
ref={imageRef}
/>
@@ -337,7 +336,6 @@ const MomentPost: React.FC<MomentPostProps> = ({
const styles = StyleSheet.create({
media: {
zIndex: 0,
- flex: 1,
},
imageContainer: {
height: SCREEN_HEIGHT,
diff --git a/src/components/notifications/NotificationPill.tsx b/src/components/notifications/NotificationPill.tsx
index 525cd7fa..3b42aadf 100644
--- a/src/components/notifications/NotificationPill.tsx
+++ b/src/components/notifications/NotificationPill.tsx
@@ -58,7 +58,7 @@ export const NotificationPill: React.FC<NotificationPillProps> = ({
__px: number,
__py: number,
) => {
- const x = SCREEN_WIDTH / 2 - width / 2;
+ const x = SCREEN_WIDTH * 0.7 - width / 2;
const y = isIPhoneX()
? CHIN_HEIGHT + NAV_BAR_HEIGHT + navBarPos
: NAV_BAR_HEIGHT + navBarPos;
diff --git a/src/screens/profile/CaptionScreen.tsx b/src/screens/profile/CaptionScreen.tsx
index d3aadf76..eba3e4bf 100644
--- a/src/screens/profile/CaptionScreen.tsx
+++ b/src/screens/profile/CaptionScreen.tsx
@@ -114,9 +114,6 @@ const CaptionScreen: React.FC<CaptionScreenProps> = ({route, navigation}) => {
const handleFailed = (noCategory = false) => {
setLoading(false);
- navigation.dangerouslyGetParent()?.setOptions({
- tabBarVisible: true,
- });
setTimeout(() => {
if (noCategory) {
Alert.alert(ERROR_NO_MOMENT_CATEGORY);
@@ -155,9 +152,9 @@ const CaptionScreen: React.FC<CaptionScreenProps> = ({route, navigation}) => {
const formattedTags = () => {
return tags.map((tag) => ({
- x: Math.floor(tag.x),
- y: Math.floor(tag.y),
- z: Math.floor(tag.z),
+ x: tag.x,
+ y: tag.y,
+ z: tag.z,
user_id: tag.user.id,
}));
};
diff --git a/src/services/MomentService.ts b/src/services/MomentService.ts
index 50cedef9..25d44041 100644
--- a/src/services/MomentService.ts
+++ b/src/services/MomentService.ts
@@ -24,9 +24,12 @@ export const postMoment = async (
try {
const request = new FormData();
+ const fileExtension = uri.split('.').pop();
+ const extension = fileExtension ? `.${fileExtension}` : '.jpg';
+
request.append('image', {
uri: uri,
- name: 'moment.jpg',
+ name: Math.random().toString(36).substring(7) + extension,
type: 'image/jpg',
});
request.append('moment', category);