Skip to content
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.

Commit

Permalink
chore: lib rename & rc1
Browse files Browse the repository at this point in the history
  • Loading branch information
alantoa committed Feb 19, 2022
1 parent db44ddb commit 05c66fa
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 33 deletions.
18 changes: 16 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "react-native-video-player",
"name": "react-native-reanimated-player",
"version": "0.0.1",
"description": "react-native-video-player",
"description": "A react-native video player that interacts like Youtube player, built upon Reanimted v2 & react-native-gesture-handle",
"main": "lib/commonjs/index",
"module": "lib/module/index",
"types": "lib/typescript/index.d.ts",
Expand Down Expand Up @@ -118,5 +118,19 @@
"preset": "angular"
}
}
},
"react-native-builder-bob": {
"source": "src",
"output": "lib",
"targets": [
"commonjs",
"module",
[
"typescript",
{
"project": "tsconfig.build.json"
}
]
]
}
}
14 changes: 2 additions & 12 deletions src/components/ripple.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,12 @@
import React, { useImperativeHandle, useState } from 'react';
import type { StyleProp } from 'react-native';
import type { ViewStyle } from 'react-native';
import { Dimensions } from 'react-native';
import { StyleSheet, View } from 'react-native';
import type { TapGestureHandlerEventPayload } from 'react-native-gesture-handler';
import type { GestureEvent } from 'react-native-gesture-handler';
import { State, TapGestureHandler } from 'react-native-gesture-handler';
import type { StyleProp, ViewStyle } from 'react-native';
import { View } from 'react-native';
import Animated, {
Easing,
measure,
runOnJS,
useAnimatedGestureHandler,
useAnimatedRef,
useAnimatedStyle,
useSharedValue,
withTiming,
} from 'react-native-reanimated';
import { width } from 'react-native-video-player';
export type RippleTargetEvent = { x: number; y: number };

type RippleBtnProps = {
Expand Down
33 changes: 19 additions & 14 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
import LottieView from 'lottie-react-native';
import React, { useEffect, useRef, useState } from 'react';
import { StatusBar, StyleSheet, View, useWindowDimensions } from 'react-native';
import {
Dimensions,
Image,
StatusBar,
StyleSheet,
useWindowDimensions,
View,
} from 'react-native';
import { Slider } from 'react-native-awesome-slider/src/index';
import { clamp } from 'react-native-awesome-slider/src/utils';
import type { TapGestureHandlerEventPayload } from 'react-native-gesture-handler';
import {
GestureEvent,
TapGestureHandler,
PanGestureHandler,
PanGestureHandlerEventPayload,
TapGestureHandler,
} from 'react-native-gesture-handler';
import Orientation, { OrientationType } from 'react-native-orientation-locker';
import Animated, {
Expand All @@ -20,24 +29,20 @@ import Animated, {
withTiming,
} from 'react-native-reanimated';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
import RootViewBackgroundColor from 'react-native-set-rootview-bgcolor';
import Video, {
OnLoadData,
OnProgressData,
OnSeekData,
VideoProperties,
} from 'react-native-video';
import { VideoLoader } from './video-loading';
import { secondToTime, formatTimeToMins, formatTime } from './video-utils';
import { bin, isIos, useRefs, useVector } from './utils';
import { Dimensions } from 'react-native';
import { palette } from './theme/palette';
import { Text } from './components';
import { Image } from 'react-native';
import { TapControler } from './tap-controler';
import type { TapGestureHandlerEventPayload } from 'react-native-gesture-handler';
import { Ripple } from './components/ripple';
import { clamp } from 'react-native-awesome-slider/src/utils';
import RootViewBackgroundColor from 'react-native-set-rootview-bgcolor';
import { TapControler } from './tap-controler';
import { palette } from './theme/palette';
import { bin, isIos, useRefs, useVector } from './utils';
import { VideoLoader } from './video-loading';
import { formatTime, formatTimeToMins, secondToTime } from './video-utils';
export const { width, height, scale, fontScale } = Dimensions.get('window');

const VIDEO_DEFAULT_HEIGHT = width * (9 / 16);
Expand Down Expand Up @@ -404,15 +409,15 @@ const VideoPlayer: React.FC<IProps> = ({
isVertical: boolean;
}
>({
onStart: ({ velocityY, velocityX, ...rest }, ctx) => {
onStart: ({ velocityY, velocityX, ...rest }) => {
if (onPanStartEvent) {
runOnJS(onPanStartEvent)({ velocityX, velocityY, ...rest });
}

// ctx.isVertical = Math.abs(velocityY) > Math.abs(velocityX);
controlViewOpacity.value = withTiming(0, { duration: 100 });
},
onActive: ({ translationY, ...rest }, ctx) => {
onActive: ({ translationY, ...rest }) => {
if (onPanEvent) {
runOnJS(onPanEvent)({ translationY, ...rest });
}
Expand Down
5 changes: 2 additions & 3 deletions src/tap-controler.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import React from 'react';
import type { StyleProp, ViewStyle } from 'react-native';
import {
TapGestureHandler,
TapGestureHandlerProps,
} from 'react-native-gesture-handler';
import React from 'react';
import type { StyleProp } from 'react-native';
import type { ViewStyle } from 'react-native';
import Animated from 'react-native-reanimated';

const hitSlop = { left: 8, bottom: 4, right: 8, top: 4 };
Expand Down
2 changes: 1 addition & 1 deletion src/video-error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const VideoError = React.memo<Props>(function VideoError({ isError }) {
if (!isError) return null;
return (
<View style={errorStyle.container}>
<Text h5 color={palette.Danger(1)} tx="加载错误" />
<Text h5 color={palette.Danger(1)} tx="error" />
</View>
);
});
Expand Down
2 changes: 1 addition & 1 deletion src/video-replay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const VideoReplayed = React.memo<Props>(function VideoReplayed({
if (!isPlayed) return null;
return (
<View style={STYLE}>
<Button onPress={onPress} title={`重新播放`} />
<Button onPress={onPress} title={`replay`} />
</View>
);
});

0 comments on commit 05c66fa

Please sign in to comment.