react-native-aws-cognito

React Native module for authentication with #AWS Cognito.

  • Motivation to work on this module (and so, best use case) was having a secure, simple and cheap user management system that can access AWS IoT devices.
  • It supports Enhanced (Simplified) Authflow as described on are some limitations in this module:

    Sample code for retrieving signed url and using it to connect with AWS IoT using MQTT over Websocket:

React Native module for authenticating with AWS Cognito.
Continue reading “react-native-aws-cognito”

Pixel perfect cloud images in React Native – uncommon

Pixel perfect cloud images in React Native:  #ReactJS #JavaScript

  • It could simply define itself with a flex, like belowImage style={{flex: 1, backgroundColor: ‘red’}} resizeMode={‘cover’} source={{uri: /You could use Image component’s resize mode techniques to achieve the desired effect.Issue here is that you have not optimized image for exact screen resolution of the device.To do that, you need to generate a cloud url that includes dimensions of the image, which, is known only at runtime when Image layout is measured.
  • So you end up providing onLayout function to Image component, get those dimensions, generate a url and then finally re-render Image component with probably a state change in the parent component.You need to go through the same chore every time you would like to fetch an image from cloud service.
  • I will be using Cloudinary as image service provider, but the concept can be extended to any other cloud image service.CLImage component needs to track image width, image height.
  • Here is the snippet for renderImagerenderImage() { let opts = {} Object.assign(opts, this.props.options,{ width: this.state.imageWidth, height: this.state.imageHeight })return ( Image style={{ width: this.state.imageWidth, height: this.state.imageHeight }} source={{ uri: opts) }}/ )}And finally the placeholderrenderFreeForm() { return ( View style={[this.props.style, styles.background]} onLayout= {(event) = / )}Since React Native deals with device independent pixels, it is important to use PixelRatio to determine actual pixel size of the image.
  • This is how imageUrl function is going to look likeimageUrl(cloudId, options={}) { let opts = {} Object.assign(opts, {crop: “fill”, gravity: “face”, format: “jpg”, quality: 75, secure: true}, options) opts.width = opts.height = let url = cloudinary.url(cloudId, opts) console.log(“Image url is:” + url) return url}with CLImage component built, now I can use it to render cloud images with out explicitly specifying width/height, see belowView style={styles.mainContainer} CLImage cloudId={“sample_1”} / View CLImage cloudId={“sample_3”} / CLImage cloudId={“sample_4”} / CLImage cloudId={“sample_2”} / View CLImage cloudId={“sample_6”} / CLImage cloudId={“sample_5”} //ViewStyles for the sameconst styles = StyleSheet.create({ mainContainer: { flex: 5 }, flexOneContainer: { flex: 1 }, portraitContainer: { flex: 2, flexDirection: ‘row’}})You would have noticed that we have not given any information on width and height of the image.

Mobile devices come in multiple screen resolutions. When we display images it is important to ensure that the images displayed are optimized for screen resolution. This will ensure that images will…
Continue reading “Pixel perfect cloud images in React Native – uncommon”

Top 6 Reasons Why We Love React – Syncano – Medium

  • The approach gives you enormous flexibility and amazing gains in performance because React calculates what changes need to be made in the DOM beforehand and updates the DOM tree .
  • Bonus: Mobile Apps using React Native
  • Once you get comfortable with building web application with React, you can easily switch to building mobile application using React Native .
  • When you start your adventure with React, don’t forget to install the official React Chrome extension .
  • Tutorials: Go build awesome stuff with React!

Our front-end team at Syncano loves trying new things. New frameworks, new build tools… anything that makes our work more efficient…
Continue reading “Top 6 Reasons Why We Love React – Syncano – Medium”

Exponent is Free (as in 🍺 and as in 💬)

Exponent is free (as in 🍺 and as in 💬):  #ReactJS

  • We think the best way to achieve all those goals is to make Exponent totally free and open source, so that’s what we did.
  • Exponent is Free (as in 🍺 and as in 💬)
  • We want Exponent to be really popular and feel like a standard thing to use and to have a big community of users.
  • We have a small team of developers who think its way too hard and complicated to make great software for mobile devices, and we think we’ll end up somewhere good if we can make a dent in solving that.
  • We want lots of questions on Stack Overflow about how to do things in Exponent, etc.

One question we get a lot about Exponent is: How much does it cost? The short answer is that it is free. We don’t charge developers…
Continue reading “Exponent is Free (as in 🍺 and as in 💬)”