LonelyCpp / react-native-youtube-iframe

A wrapper of the Youtube-iframe API built for react native.
https://lonelycpp.github.io/react-native-youtube-iframe/
MIT License
603 stars 153 forks source link

Getting scrollable issue on youtube player #210

Open saikiruba-mj opened 2 years ago

saikiruba-mj commented 2 years ago

Bug Description

We have tried the basic code snippet from here and got an scroll issue via horizontal and vertical view while passing height and width value to the example code.

const { width, height } = Dimensions.get('screen');

And the same issue was replicated on emulator and real devices.

Screenshots

image

image

Kindly let us know if there is any solution to fix this issue.

Thank you!

LonelyCpp commented 2 years ago

this is due to the player always following a set aspect ratio by default. Use this snippet to disable it : https://github.com/LonelyCpp/react-native-youtube-iframe/issues/13#issuecomment-611753123 (you have to reload the component for this prop to take effect, hot reload will not work)

also, please check if the height and width accounts for the status bar up top and the notch, if not - it would make sense to reduce it by a little.

leticiabytes commented 1 year ago

this is due to the player always following a set aspect ratio by default. Use this snippet to disable it : #13 (comment) (you have to reload the component for this prop to take effect, hot reload will not work)

also, please check if the height and width accounts for the status bar up top and the notch, if not - it would make sense to reduce it by a little.

I achieved the solution using this recommendation and adding zero margin

webViewProps={{
          // 
          injectedJavaScript: `
            var element = document.getElementsByClassName('container')[0];
            element.style.position = 'unset';
            element.style.padding = 0;
            element.style.margin = 0;
            true;
          `,
        }}