kyo504 / react-native-marquee

React Native Marquee Text Component
MIT License
196 stars 29 forks source link

Fix for bug with custom opacity #27

Open vishalkrishnads opened 3 years ago

vishalkrishnads commented 3 years ago

There is an issue with the current release which causes an issue with the text if the default opacity style prop is changed when calling the component. For instance, if someone were to call the <MarqueeText> component as follows,

    <MarqueeText
          style={{ opacity: 0.5 }} // changing the default opacity
          duration={3000}
          marqueeOnStart
          loop
          marqueeDelay={1000}
          marqueeResetDelay={1000}
        >
          Lorem Ipsum is simply dummy text of the printing and typesetting industry and typesetting industry.
        </MarqueeText>

then, a bug would cause the specified opacity: 0.5 to take effect only once the text starts to move. Moreover, if the length of the string is short enough that there is no need for the marquee animation, then the whole text would stay at the default opacity.

This pull request fixes the same.