Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: [#175535051] fixes offset scroller for messages (iphone 7) #2791

Merged
merged 12 commits into from
Mar 31, 2021
3 changes: 2 additions & 1 deletion ts/__mocks__/react-native-device-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ getDeviceIdMock.mockReturnValue("");

const DeviceInfo = {
getReadableVersion,
getDeviceId: getDeviceIdMock
getDeviceId: getDeviceIdMock,
hasNotch: () => true
};

export default DeviceInfo;
6 changes: 4 additions & 2 deletions ts/components/messages/MessageDetailCTABar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import * as pot from "italia-ts-commons/lib/pot";
import { fromNullable, fromPredicate } from "fp-ts/lib/Option";
import { View } from "native-base";
import React from "react";
import { StyleSheet } from "react-native";
import { Platform, StyleSheet } from "react-native";
import { connect } from "react-redux";
import DeviceInfo from "react-native-device-info";
import { CreatedMessageWithContent } from "../../../definitions/backend/CreatedMessageWithContent";
import { ServicePublic } from "../../../definitions/backend/ServicePublic";
import { loadServiceMetadata } from "../../store/actions/content";
Expand Down Expand Up @@ -33,7 +34,8 @@ type Props = OwnProps &

const styles = StyleSheet.create({
row: {
flexDirection: "row"
flexDirection: "row",
paddingBottom: Platform.OS === 'ios' && DeviceInfo.hasNotch() ? 28 : 15,
}
});

Expand Down
8 changes: 6 additions & 2 deletions ts/components/messages/MessageDetailComponent.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { fromNullable } from "fp-ts/lib/Option";
import * as pot from "italia-ts-commons/lib/pot";
import { Content, H3, Text, View } from "native-base";
import DeviceInfo from "react-native-device-info";
import * as React from "react";
import { StyleSheet } from "react-native";
import { CreatedMessageWithContentAndAttachments } from "../../../definitions/backend/CreatedMessageWithContentAndAttachments";
Expand Down Expand Up @@ -212,8 +213,11 @@ export default class MessageDetailComponent extends React.PureComponent<
</React.Fragment>
)}
</Content>
<View spacer={true} large={true} />
<View spacer={true} small={true} />
qesya marked this conversation as resolved.
Show resolved Hide resolved
{DeviceInfo.hasNotch() &&
<React.Fragment>
<View spacer={true} large={true} />
<View spacer={true} small={true} />
</React.Fragment>}
{this.maybeMedicalData.fold(
<MessageDetailCTABar
message={message}
Expand Down