diff --git a/front/components/Play/PartitionMagic.tsx b/front/components/Play/PartitionMagic.tsx
index f59bef2..00974a9 100644
--- a/front/components/Play/PartitionMagic.tsx
+++ b/front/components/Play/PartitionMagic.tsx
@@ -18,8 +18,6 @@ export type ParitionMagicProps = {
};
const getSVGURL = (songID: number) => {
- // return 'https://www.svgrepo.com/show/148626/test.svg';
- // return 'https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/3.3.0/flags/1x1/ad.svg';
return API.getPartitionSvgUrl(songID);
};
@@ -59,12 +57,6 @@ const PartitionMagic = ({ songID, onEndReached, onError, onReady }: ParitionMagi
const cursorLeft = (data?.cursors[0]?.x ?? 0) - cursorPaddingHorizontal;
React.useEffect(() => {
- if (Platform.OS === 'web') {
- Image.getSize(getSVGURL(songID), (w, h) => {
- setPartitionDims([w, h]);
- });
- return;
- }
GetSvgDims(getSVGURL(songID), (w, h) => {
setPartitionDims([w, h]);
});
@@ -131,65 +123,62 @@ const PartitionMagic = ({ songID, onEndReached, onError, onReady }: ParitionMagi
);
return (
- <>
+
-
-
- {!isLoading && !isError && (
- {
- console.log('ready');
- console.log(partitionDims);
- onReady();
- }}
- style={{
- // check to avoid NaN
- // aspectRatio: partitionDims[1]
- // ? partitionDims[0] / partitionDims[1]
- // : undefined,
- height: '100%',
- }}
- />
- )}
-
-
-
+ {!isLoading && !isError && (
+ {
+ console.log('ready');
+ console.log(partitionDims);
+ onReady();
+ }}
+ style={{
+ aspectRatio: partitionDims[0] / partitionDims[1],
+ }}
+ />
+ )}
+
+
- >
+
);
};
diff --git a/front/components/Play/SvgContainer.tsx b/front/components/Play/SvgContainer.tsx
index a00b0fc..2737ad1 100644
--- a/front/components/Play/SvgContainer.tsx
+++ b/front/components/Play/SvgContainer.tsx
@@ -1,7 +1,6 @@
import React from 'react';
import { ViewStyle, ImageBackground, Platform, Image } from 'react-native';
import { SvgCssUri } from 'react-native-svg/css';
-import Svg, { Path, Text, G } from 'react-native-svg';
type SvgContainerProps = {
url: string;
@@ -18,39 +17,21 @@ export const GetSvgDims = (url: string, success: (w: number, h: number) => void)
}, [url]);
return;
}
- success(470.1052279999999, 275);
+ // success(470.1052279999999, 275);
+ success(6146.845969199998, 408.00000000000006);
};
export const SvgContainer = ({ url, onReady, style }: SvgContainerProps) => {
-
if (Platform.OS === 'web') {
- return (
-
- );
+ return ;
}
return (
{
- // const { width, height } = e.nativeEvent.layout;
- // getDims(width, height);
- // }}
+ style={style}
+ // force to not look at the width and height of the actual file
+ height={undefined}
+ width={undefined}
onLoad={onReady}
/>
);
diff --git a/front/views/PlayView.tsx b/front/views/PlayView.tsx
index c920e35..b994460 100644
--- a/front/views/PlayView.tsx
+++ b/front/views/PlayView.tsx
@@ -79,7 +79,7 @@ export const PianoCC = createContext({
});
const PlayView = ({ songId, route }: RouteProps) => {
- songId = 13;
+ songId = 4;
const [type, setType] = useState<'practice' | 'normal'>();
const accessToken = useSelector((state: RootState) => state.user.accessToken);
const navigation = useNavigation();