Git Product home page Git Product logo

Comments (10)

diaazzawi avatar diaazzawi commented on June 13, 2024 2

@dev-yakuza

Wonderful. Million thanks to you!

from react-native-image-modal.

dev-yakuza avatar dev-yakuza commented on June 13, 2024

Hi @diaazzawi

Thanks for using this library.

Could you share the video about the bug? I can't imagine it 😭

Thanks

from react-native-image-modal.

diaazzawi avatar diaazzawi commented on June 13, 2024

Thank you so much @dev-yakuza for your prompt response. Here is what I'm experiencing when my simulator's language is Arabic or any other RTL-language:

image_modal_rtl mp4

Thanks

from react-native-image-modal.

dev-yakuza avatar dev-yakuza commented on June 13, 2024

@diaazzawi

Thanks for sharing the video.
If you configure the other language(like English), is it working well? 🤔

from react-native-image-modal.

diaazzawi avatar diaazzawi commented on June 13, 2024

@dev-yakuza

Yes it works perfectly in other LTR-languages.

Just throwing an idea: It would be AWESOME if you add one more prop (say rtl as boolean) that I can pass to the component and based on its value you'll need to flip the x-coordinate of the last image position.

In the meanwhile, it will be great if you have any temporary workaround.

Thanks!

from react-native-image-modal.

dev-yakuza avatar dev-yakuza commented on June 13, 2024

@diaazzawi

Thanks for your investigation and idea.
I will fix it when I have time!

from react-native-image-modal.

diaazzawi avatar diaazzawi commented on June 13, 2024

@dev-yakuza

Just found where you need to make the necessary changes: Assuming you add a new boolean prop (isRTL) to your component, the _setOrigin function (lines 69-91) in src\index.tsx file should change to:

  private _setOrigin = (): void => {
    if (this._root) {
      this._root.measureInWindow((x: number, y: number, width: number, height: number) => {
        const { isTranslucent, onOpen, isRTL } = this.props;
        let newY: number = y;
        if (typeof onOpen === 'function') {
          onOpen();
        }
        if (isTranslucent) {
          newY += StatusBar.currentHeight ? StatusBar.currentHeight : 0;
          StatusBar.setHidden(true);
        }
        let newX: number = x;
        if (isRTL) {
            newX = Dimensions.get('window').width - width - x;
        }
        this.setState({
          origin: {
            width,
            height,
            x: newX,
            y: newY,
          },
        });
      });
    }
  };

🎉 🎉 🎉 🥳 🥳 🥳 I tested the app with the above change in both LTR- and RTL-languages and it PERFECTLY works as expected 🥳 🥳 🥳 🎉 🎉 🎉

Please update your library with this change ASAP so I can get it in my project.

Thank you again for this AWESOME lib.

from react-native-image-modal.

dev-yakuza avatar dev-yakuza commented on June 13, 2024

@diaazzawi

Thanks so much to implement it.
Could you make a PR? 🙏 If you make it, I will merge it and release it asap!

Thanks

from react-native-image-modal.

diaazzawi avatar diaazzawi commented on June 13, 2024

FYI, I just created the above PR.

from react-native-image-modal.

dev-yakuza avatar dev-yakuza commented on June 13, 2024

@diaazzawi

Thanks for your contribution 🙇‍♂️
I just update the version of the npm package(v2.0.2)
And update the document.

from react-native-image-modal.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.