Giter VIP home page Giter VIP logo

Comments (4)

gre avatar gre commented on May 17, 2024 10

you can "render off-screen" by rendering it in a View that is not displayed or absolute "out of the screen".
It's a bit hacky but i've been using it in prod.

just a quick example:

class Stuff extends Component {
  snapIt() { return RNViewShot.takeSnapshot(this.refs.root, {...}) }
  render () {
    return <View ref="root">...</View>;
  }
}
class MyApp extends Component {
  doIt = () => { this.refs.stuff.snapIt().then(...) }
  render () {
    return <View>
      <View style={{ position: "absolute", left: 1000 /* basically should be screenSize.width */ }}>
        <Stuff ref="stuff" />
      </View>
      .. your app content..
      <Button onPress={this.doIt} label="RENDER IT!" />
    </View>
  }
}

from react-native-view-shot.

timLoewel avatar timLoewel commented on May 17, 2024

Cool, This Works. Thanks a lot.

from react-native-view-shot.

tza17313 avatar tza17313 commented on May 17, 2024

@gre Have you ever encountered a view outside the Image will have a certain probability can not be captured; I am sure this picture has been loaded . if I set the left to 0, the Image ca be captured.

Platform : android (6.0.1 and 7.0) ;
react-native : 0.43.1
react-native-view-shot : 1.9.1

from react-native-view-shot.

hugoh59 avatar hugoh59 commented on May 17, 2024

Do you have an exemple for a functional component?

from react-native-view-shot.

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.