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: disallow rtl behaviour #222

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions VideoPlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
Image,
View,
Text,
I18nManager
} from 'react-native';
import padStart from 'lodash/padStart';

Expand Down Expand Up @@ -795,7 +796,7 @@ export default class VideoPlayer extends Component {
onPanResponderGrant: (evt, gestureState) => {
let state = this.state;
this.clearControlTimeout();
const position = evt.nativeEvent.locationX;
const position = evt.nativeEvent[I18nManager.isRTL ? 'pageX' : 'locationX'];
this.setSeekerPosition(position);
state.seeking = true;
state.originallyPaused = state.paused;
Expand Down Expand Up @@ -1247,6 +1248,7 @@ export default class VideoPlayer extends Component {
* specific styles and control specific ones.
* And then there's volume/seeker styles.
*/
const calcRtlRow =I18nManager.isRTL ? 'row-reverse' : 'row'
const styles = {
player: StyleSheet.create({
container: {
Expand Down Expand Up @@ -1297,7 +1299,7 @@ const styles = {
}),
controls: StyleSheet.create({
row: {
flexDirection: 'row',
flexDirection: calcRtlRow,
alignItems: 'center',
justifyContent: 'space-between',
height: null,
Expand All @@ -1323,7 +1325,7 @@ const styles = {
textAlign: 'center',
},
pullRight: {
flexDirection: 'row',
flexDirection: calcRtlRow,
alignItems: 'center',
justifyContent: 'center',
},
Expand All @@ -1341,7 +1343,7 @@ const styles = {
alignSelf: 'stretch',
alignItems: 'center',
justifyContent: 'space-between',
flexDirection: 'row',
flexDirection: calcRtlRow,
width: null,
margin: 12,
marginBottom: 18,
Expand All @@ -1355,10 +1357,10 @@ const styles = {
marginBottom: 0,
},
volume: {
flexDirection: 'row',
flexDirection: calcRtlRow,
},
fullscreen: {
flexDirection: 'row',
flexDirection: calcRtlRow,
},
playPause: {
position: 'relative',
Expand Down Expand Up @@ -1388,7 +1390,7 @@ const styles = {
container: {
alignItems: 'center',
justifyContent: 'flex-start',
flexDirection: 'row',
flexDirection: calcRtlRow,
height: 1,
marginLeft: 20,
marginRight: 20,
Expand Down Expand Up @@ -1419,6 +1421,7 @@ const styles = {
height: 28,
marginLeft: 20,
marginRight: 20,
...(I18nManager.isRTL ? { transform: [{ rotateY: '180deg' }] } : {})
},
track: {
backgroundColor: '#333',
Expand Down