Skip to content

Commit

Permalink
fix: potential crash fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
KestasVenslauskas committed Oct 11, 2024
1 parent d33a699 commit 319a0f8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
12 changes: 5 additions & 7 deletions app/components/videoComponent/TheoMediaPlayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,12 @@ interface Props {
onEnded?: () => void;
}

const license = Platform.select({
android:
'sZP7IYe6T6Pe3uPKTuX136ztIuhtFSacIQC-ClhoTOziTuR_3D4e3uetIS06FOPlUY3zWokgbgjNIOf9fKCi0L0cTSRtFDCkIlR-3Q363ZzrTuarFS0L0SA1ISerIl3K0mfVfK4_bQgZCYxNWoryIQXzImf90SbiTSf_3Lfi0u5i0Oi6Io4pIYP1UQgqWgjeCYxgflEc3lbk0SCk3SbcTS5tFOPeWok1dDrLYtA1Ioh6TgV6v6fVfKcqCoXVdQjLUOfVfGxEIDjiWQXrIYfpCoj-fgzVfKxqWDXNWG3ybojkbK3gflNWf6E6FOPVWo31WQ1qbta6FOPzdQ4qbQc1sD4ZFK3qWmPUFOPLIQ-LflNWfK1zWDikf6i6CDrebKjNIOfVfKXpIwPqdDxzU6fVfKINbK4zU6fVfKgqbZfVfGxNsK4pf6i6UwIqbZfVfGUgCKjLfgzVfG3gWKxydDkibK4LbogqW6f9UwPkImi6IK41Uw4ZIY06Tg-Uya',
ios: 'sZP7IYe6T6Pe3uPKTuX136ztIuhtFSacIQC-ClhoTOziTuR_3D4e3uetIS06FOPlUY3zWokgbgjNIOf9fKCi0L0cTSRtFDCkIlR-3Q363ZzrTuarFS0L0SA1ISerIl3K0mfVfK4_bQgZCYxNWoryIQXzImf90SbiTSf_3Lfi0u5i0Oi6Io4pIYP1UQgqWgjeCYxgflEc3lbk0SCk3SbcTS5tFOPeWok1dDrLYtA1Ioh6TgV6v6fVfKcqCoXVdQjLUOfVfGxEIDjiWQXrIYfpCoj-fgzVfKxqWDXNWG3yboj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gflNWf6E6FOPVWo31WQ1qbta6FOPzdQ4qbQc1sD4ZFK3qWmPUFOPLIQ-LflNWfK1zWDikf6i6CDrebKjNIOfVfKXpIwPqdDxzU6fVfKINbK4zU6fVfKgqbZfVfGxNsK4pf6i6UwIqbZfVfGUgCKjLfgzVfG3gWKxydDkibK4LbogqW6f9UwPkImi6IK41Uw4ZIY06Tg-Uya',
}),
chromeless: true,
};

Expand Down
10 changes: 8 additions & 2 deletions app/screens/verticalVideos/VerticalVideosScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {MainStackParamList} from '../../navigation/MainStack';
import InfinitePager from 'react-native-infinite-pager';
import {pageInterpolatorTurnIn} from './pageInterpolator';
import VerticalVideoWrapper from './VerticalVideoWrapper';
import {ScreenError} from '../../components';

type ScreenRouteProp = RouteProp<MainStackParamList, 'VideoList'>;
type ScreenNavigationProp = StackNavigationProp<MainStackParamList, 'VideoList'>;
Expand All @@ -21,7 +22,7 @@ type Props = {
const HEADER_BACKGROUND_COLOR = '#000000';

const VerticalVideoScreen: React.FC<React.PropsWithChildren<Props>> = ({navigation, route}) => {
const {colors} = useTheme();
const {colors, strings} = useTheme();
const {articles, initialIndex, title} = route.params;

useEffect(() => {
Expand Down Expand Up @@ -51,7 +52,12 @@ const VerticalVideoScreen: React.FC<React.PropsWithChildren<Props>> = ({navigati
initialIndex={initialIndex}
renderPage={(props) => {
let validIndex = ((props.index % articles.length) + articles.length) % articles.length;
return <VerticalVideoWrapper id={articles[validIndex].id} isActive={props.isActive} />;
if (!articles[validIndex]) {
console.error('Invalid index', validIndex);
return <ScreenError text={strings.articleError} />;
} else {
return <VerticalVideoWrapper id={articles[validIndex].id} isActive={props.isActive} />;
}
}}
/>
</SafeAreaView>
Expand Down
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Setup RN Gesture handler
import 'react-native-gesture-handler';
//Might help with crash https://github.com/jpudysz/react-native-unistyles/issues/151
import 'react-native-unistyles';

import {setupGemius} from './app/util/useGemiusSetup';
setupGemius();
Expand Down

0 comments on commit 319a0f8

Please sign in to comment.